1import{u as y,c as O,r as g,j as e,d as S,b as r,t as C}from"./index-C3Qps0S4.js";import{A as L}from"./arrow-left-AxGNO8ZF.js";import{K as E}from"./key-round-wjdacBW6.js";import{P as w}from"./phone-C7ssNq9Y.js";import{L as $}from"./lock-BImxJe9g.js";import{E as q}from"./external-link-BaKbLCyP.js";import{H as A}from"./headphones-D6SC7HuD.js";import{S as R}from"./send-CbRcUDpe.js";import{M as I}from"./message-circle-BkrB8C2p.js";function U(){const[,l]=y(),{lang:t}=O(),[c,x]=g.useState("request"),[o,s]=g.useState(""),[n,P]=g.useState(""),[j,v]=g.useState(""),[m,N]=g.useState(""),[u,F]=g.useState(""),[d,h]=g.useState(!1),f=async a=>{if(a.preventDefault(),!o.trim()){r.error(t==="th"?"à¸à¸£à¸¸à¸à¸²à¸à¸£à¸à¸à¹à¸à¸à¸£à¹à¹à¸à¸£à¸¨à¸±à¸à¸à¹à¸«à¸£à¸·à¸à¸à¸µà¹à¸¡à¸¥":"Please enter phone number or email");return}h(!0);try{const i=await fetch("/api/auth/forgot-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identifier:o.trim()})}),p=await i.json();if(!i.ok){r.error(p.error||"à¹à¸à¸´à¸à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸");return}r.success(t==="th"?"สà¹à¸à¸£à¸«à¸±à¸ª OTP à¹à¸£à¸µà¸¢à¸à¸£à¹à¸à¸¢":"OTP sent successfully"),x("verify")}catch{r.error(t==="th"?"à¹à¸à¸´à¸à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸ à¸à¸£à¸¸à¸à¸²à¸¥à¸à¸à¹à¸«à¸¡à¹":"An error occurred")}finally{h(!1)}},T=async a=>{if(a.preventDefault(),!n.trim()){r.error(t==="th"?"à¸à¸£à¸¸à¸à¸²à¸à¸£à¸à¸à¸£à¸«à¸±à¸ª OTP":"Please enter OTP");return}h(!0);try{const i=await fetch("/api/auth/verify-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identifier:o.trim(),otp:n.trim()})}),p=await i.json();if(!i.ok){r.error(p.error||"รหัส OTP à¹à¸¡à¹à¸à¸¹à¸à¸à¹à¸à¸");return}v(p.resetToken),r.success(t==="th"?"ยืà¸à¸¢à¸±à¸ OTP สำà¹à¸£à¹à¸":"OTP verified"),x("reset")}catch{r.error(t==="th"?"à¹à¸à¸´à¸à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸ à¸à¸£à¸¸à¸à¸²à¸¥à¸à¸à¹à¸«à¸¡à¹":"An error occurred")}finally{h(!1)}},k=async a=>{if(a.preventDefault(),!m||!u){r.error(t==="th"?"à¸à¸£à¸¸à¸à¸²à¸à¸£à¸à¸à¸£à¸«à¸±à¸ªà¸à¹à¸²à¸à¹à¸«à¸¡à¹":"Please enter new password");return}if(m.length<6){r.error(t==="th"?"รหัสà¸à¹à¸²à¸à¸à¹à¸à¸à¸¡à¸µà¸à¸¢à¹à¸²à¸à¸à¹à¸à¸¢ 6 à¸à¸±à¸§à¸à¸±à¸à¸©à¸£":"Password must be at least 6 characters");return}if(m!==u){r.error(t==="th"?"รหัสà¸à¹à¸²à¸à¹à¸¡à¹à¸à¸£à¸à¸à¸±à¸":"Passwords don't match");return}h(!0);try{const i=await fetch("/api/auth/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resetToken:j,newPassword:m,confirmPassword:u})}),p=await i.json();if(!i.ok){r.error(p.error||"à¹à¸à¸´à¸à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸");return}r.success(t==="th"?"à¹à¸à¸¥à¸µà¹à¸¢à¸à¸£à¸«à¸±à¸ªà¸à¹à¸²à¸à¸ªà¸³à¹à¸£à¹à¸!":"Password changed successfully!"),setTimeout(()=>l("/login"),1500)}catch{r.error(t==="th"?"à¹à¸à¸´à¸à¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸ à¸à¸£à¸¸à¸à¸²à¸¥à¸à¸à¹à¸«à¸¡à¹":"An error occurred")}finally{h(!1)}};return e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:115",className:"min-h-screen bg-[#0a0e1a] flex items-center justify-center p-4",children:e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:116",className:"w-full max-w-sm",children:[e.jsxs("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:118",onClick:()=>c==="request"?l("/login"):x(c==="verify"?"request":"verify"),className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors mb-6",children:[e.jsx(L,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:122",className:"w-4 h-4"}),e.jsx("span",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:123",className:"text-sm",children:t==="th"?"ยà¹à¸à¸à¸à¸¥à¸±à¸":"Back"})]}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:127",className:"bg-white/5 backdrop-blur-xl border border-white/10 rounded-2xl p-6",children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:129",className:"flex items-center justify-center gap-2 mb-6",children:[1,2,3].map(a=>e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:131",className:`w-8 h-1 rounded-full transition-all ${a<=(c==="request"?1:c==="verify"?2:3)?"bg-orange-500":"bg-white/10"}`},a))}),c==="request"&&e.jsxs("form",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:144",onSubmit:f,className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:145",className:"text-center mb-4",children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:146",className:"w-14 h-14 roun
1ded-2xl bg-orange-500/10 flex items-center justify-center mx-auto mb-3",children:e.jsx(E,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:147",className:"w-7 h-7 text-orange-400"})}),e.jsx("h1",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:149",className:"text-lg font-bold text-white",children:t==="th"?"ลืมรหัสà¸à¹à¸²à¸":"Forgot Password"}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:152",className:"text-xs text-gray-400 mt-1",children:t==="th"?"à¸à¸£à¸à¸à¹à¸à¸à¸£à¹à¹à¸à¸£à¸¨à¸±à¸à¸à¹à¸«à¸£à¸·à¸à¸à¸µà¹à¸¡à¸¥à¸à¸µà¹à¹à¸à¹à¸ªà¸¡à¸±à¸à¸£":"Enter your registered phone or email"})]}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:159",children:[e.jsx("label",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:160",className:"text-xs font-medium text-gray-300 mb-1.5 block",children:t==="th"?"à¹à¸à¸à¸£à¹à¹à¸à¸£à¸¨à¸±à¸à¸à¹ หรืภà¸à¸µà¹à¸¡à¸¥":"Phone or Email"}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:163",className:"relative",children:[e.jsx("input",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:164",type:"text",value:o,onChange:a=>s(a.target.value),className:"w-full bg-black/40 border border-white/10 rounded-xl px-4 py-3 pl-10 text-sm text-white placeholder:text-gray-600 focus:border-orange-500/50 focus:ring-1 focus:ring-orange-500/20 focus:outline-none transition-all",placeholder:t==="th"?"0812345678 หรืภ[email protected]":"0812345678 or [email protected]"}),e.jsx(w,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:171",className:"w-4 h-4 text-gray-500 absolute left-3 top-1/2 -translate-y-1/2"})]})]}),e.jsx("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:175",type:"submit",disabled:d,className:"w-full py-3.5 rounded-xl bg-gradient-to-r from-orange-500 via-red-500 to-pink-500 text-white font-bold text-sm disabled:opacity-50 transition-all duration-200 active:scale-[0.97] shadow-lg shadow-orange-500/25",children:d?t==="th"?"à¸à¸³à¸¥à¸±à¸à¸ªà¹à¸...":"Sending...":t==="th"?"สà¹à¸à¸£à¸«à¸±à¸ª OTP":"Send OTP"})]}),c==="verify"&&e.jsxs("form",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:189",onSubmit:T,className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:190",className:"text-center mb-4",children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:191",className:"w-14 h-14 rounded-2xl bg-blue-500/10 flex items-center justify-center mx-auto mb-3",children:e.jsx(S,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:192",className:"w-7 h-7 text-blue-400"})}),e.jsx("h1",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:194",className:"text-lg font-bold text-white",children:t==="th"?"ยืà¸à¸¢à¸±à¸à¸£à¸«à¸±à¸ª OTP":"Verify OTP"}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:197",className:"text-xs text-gray-400 mt-1",children:t==="th"?"à¸à¸£à¸à¸à¸£à¸«à¸±à¸ª 6 หลัà¸à¸à¸µà¹à¹à¸à¹à¸£à¸±à¸":"Enter the 6-digit code you received"}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:202",className:"text-xs text-orange-400/80 mt-2",children:t==="th"?`สà¹à¸à¹à¸à¸à¸µà¹: ${o.substring(0,3)}***${o.substring(o.length-2)}`:`Sent to: ${o.substring(0,3)}***${o.substring(o.length-2)}`})]}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:209",children:[e.jsx("label",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:210",className:"text-xs font-medium text-gray-300 mb-1.5 block",children:t==="th"?"รหัส OTP (6 หลัà¸)":"OTP Code (6 digits)"}),e.jsx("input",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:213",type:"text",value:n,onChange:a=>P(a.target.value.replace(/\D/g,"").slice(0,6)),className:"w-full bg-black/40 border border-white/10 rounded-xl px-4 py-3 text-sm text-white text-center tracking-[0.5em] font-mono placeholder:text-gray-600 focus:border-orange-500/50 focus:ring-1 focus:ring-orange-500/20 focus:outline-none transition-all",placeholder:"000000",maxLength:6,autoFocus:!0})]}),e.jsx("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:224",type:"submit",disabled:d||n.length!==6,className:"w-full py-3.5 rounded-xl bg-gradient-to-r from-blue-500 to-purple-500 text-white font-bold text-sm disabled:opacity-50 transition-all duration-200 active:scale-[0.97] shadow-lg shadow-blue-500/25",children:d?t==="th"?"à¸à¸³à¸¥à¸±à¸à¸à¸£à¸§à¸à¸ªà¸à¸...":"
1Verifying...":t==="th"?"ยืà¸à¸¢à¸±à¸ OTP":"Verify OTP"}),e.jsx("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:234",type:"button",onClick:f,disabled:d,className:"w-full text-xs text-gray-400 hover:text-orange-400 transition-colors py-2",children:t==="th"?"สà¹à¸à¸£à¸«à¸±à¸ª OTP à¸à¸µà¸à¸à¸£à¸±à¹à¸":"Resend OTP"})]}),c==="reset"&&e.jsxs("form",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:247",onSubmit:k,className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:248",className:"text-center mb-4",children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:249",className:"w-14 h-14 rounded-2xl bg-green-500/10 flex items-center justify-center mx-auto mb-3",children:e.jsx($,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:250",className:"w-7 h-7 text-green-400"})}),e.jsx("h1",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:252",className:"text-lg font-bold text-white",children:t==="th"?"à¸à¸±à¹à¸à¸£à¸«à¸±à¸ªà¸à¹à¸²à¸à¹à¸«à¸¡à¹":"Set New Password"}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:255",className:"text-xs text-gray-400 mt-1",children:t==="th"?"à¸à¸£à¸à¸à¸£à¸«à¸±à¸ªà¸à¹à¸²à¸à¹à¸«à¸¡à¹à¸à¸µà¹à¸à¹à¸à¸à¸à¸²à¸£ (à¸à¸¢à¹à¸²à¸à¸à¹à¸à¸¢ 6 à¸à¸±à¸§à¸à¸±à¸à¸©à¸£)":"Enter your new password (min 6 characters)"})]}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:262",children:[e.jsx("label",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:263",className:"text-xs font-medium text-gray-300 mb-1.5 block",children:t==="th"?"รหัสà¸à¹à¸²à¸à¹à¸«à¸¡à¹":"New Password"}),e.jsx("input",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:266",type:"password",value:m,onChange:a=>N(a.target.value),className:"w-full bg-black/40 border border-white/10 rounded-xl px-4 py-3 text-sm text-white placeholder:text-gray-600 focus:border-orange-500/50 focus:ring-1 focus:ring-orange-500/20 focus:outline-none transition-all",placeholder:t==="th"?"รหัสà¸à¹à¸²à¸à¹à¸«à¸¡à¹ (à¸à¸¢à¹à¸²à¸à¸à¹à¸à¸¢ 6 à¸à¸±à¸§)":"New password (min 6 chars)"})]}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:275",children:[e.jsx("label",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:276",className:"text-xs font-medium text-gray-300 mb-1.5 block",children:t==="th"?"ยืà¸à¸¢à¸±à¸à¸£à¸«à¸±à¸ªà¸à¹à¸²à¸à¹à¸«à¸¡à¹":"Confirm New Password"}),e.jsx("input",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:279",type:"password",value:u,onChange:a=>F(a.target.value),className:"w-full bg-black/40 border border-white/10 rounded-xl px-4 py-3 text-sm text-white placeholder:text-gray-600 focus:border-orange-500/50 focus:ring-1 focus:ring-orange-500/20 focus:outline-none transition-all",placeholder:t==="th"?"à¸à¸£à¸à¸à¸£à¸«à¸±à¸ªà¸à¹à¸²à¸à¸à¸µà¸à¸à¸£à¸±à¹à¸":"Confirm password"})]}),e.jsx("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:288",type:"submit",disabled:d,className:"w-full py-3.5 rounded-xl bg-gradient-to-r from-green-500 to-emerald-500 text-white font-bold text-sm disabled:opacity-50 transition-all duration-200 active:scale-[0.97] shadow-lg shadow-green-500/25",children:d?t==="th"?"à¸à¸³à¸¥à¸±à¸à¹à¸à¸¥à¸µà¹à¸¢à¸...":"Changing...":t==="th"?"à¹à¸à¸¥à¸µà¹à¸¢à¸à¸£à¸«à¸±à¸ªà¸à¹à¸²à¸":"Change Password"})]})]}),e.jsx(V,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:302",lang:t})]})})}const D={line:e.jsx(I,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:310",className:"w-5 h-5"}),telegram:e.jsx(R,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:311",className:"w-5 h-5"}),livechat:e.jsx(A,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:312",className:"w-5 h-5"}),phone:e.jsx(w,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:313",className:"w-5 h-5"})},b={line:{bg:"bg-green-500/10",border:"border-green-500/30 hover:border-green-500/60",text:"text-green-400"},telegram:{bg:"bg-sky-400/10",border:"border-sky-400/30 hover:border-sky-400/60",text:"text-sky-400"},livechat:{bg:"bg-orange-500/10",border:"border-orange-500/30 hover:border-orange-500/60",text:"text-orange-400"},phone:{bg:"bg-emerald-500/10",border:"border-emerald-500/30 hover:border-emerald-500/60",text:"text-emerald-400"}};function V({lang:l}){const[,t]=y(),{data:c}=C.contact.list.useQuery(),x=c?.filter(s=>["line","telegram","livechat","phone"].includes(s.channelType))||[];if(x.length===0)return null;const o=s=>{s.channelType==="livechat"?t("/live-chat"):s.channelType==="phone"&&s.value?window.open(`tel:${s.value}`,"_blank"):s.url&&window.open(s.url,"_blank")};return e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:345",className:"mt-5",children:[e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:347",className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:348",className:"flex-1 h-px bg-white/10"}),e.jsx("span",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:349",className:"text-[11px] text-gray-500 whitespace-nowrap",children:l==="th"?"หรืภà¸à¸´à¸à¸à¹à¸à¹à¸à¸à¸¡à¸´à¸à¹à¸à¸·à¹à¸à¸à¸à¹à¸à¸¥à¸µà¹à¸¢à¸à¸£à¸«à¸±à¸ªà¸à¹à¸²à¸":"Or contact admin to reset password"}),e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:352",className:"flex-1 h-px bg-white/10"})]}),e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:356",className:"space-y-2.5",children:x.map(s=>{const n=b[s.channelType]||b.phone,P=D[s.channelType]||e.jsx(w,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:359",className:"w-5 h-5"});return e.jsxs("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:361",onClick:()=>o(s),className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl border ${n.border} ${n.bg} transition-all duration-200 active:scale-[0.97] group`,children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:366",className:`${n.text}`,children:P}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:369",className:"flex-1 text-left",children:[e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:370",className:"text-sm font-medium text-white",children:s.label||s.channelType}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:373",className:"text-[11px] text-gray-500",children:s.channelType==="livechat"?l==="th"?"à¹à¸à¸à¸ªà¸à¸à¸±à¸à¹à¸à¸à¸¡à¸´à¸à¹à¸à¸¢à¸à¸£à¸":"Chat directly with admin":s.channelType==="line"?l==="th"?"à¹à¸à¹à¸à¹à¸à¸à¸¡à¸´à¸à¸à¹à¸²à¸ LINE":"Contact admin via LINE":s.channelType==="telegram"?l==="th"?"à¹à¸à¹à¸à¹à¸à¸à¸¡à¸´à¸à¸à¹à¸²à¸ Telegram":"Contact admin via Telegram":s.value||""})]}),e.jsx(q,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:383",className:"w-4 h-4 text-gray-600 group-hover:text-gray-400 transition-colors"})]},s.channelType)})}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:390",className:"text-[10px] text-gray-600 text-center mt-3",children:l==="th"?"à¹à¸à¹à¸ username หรืà¸à¹à¸à¸à¸£à¹à¹à¸à¸£à¸à¸µà¹à¸ªà¸¡à¸±à¸à¸£ à¹à¸à¸·à¹à¸à¸¢à¸·à¸à¸¢à¸±à¸à¸à¸±à¸§à¸à¸à¸à¸±à¸à¹à¸à¸à¸¡à¸´à¸":"Provide your username or registered phone to verify your identity"})]})}
1export{U as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.