1import{j as e}from"./ui-749bda0b.js";import{r as t}from"./vendor-4a6eca19.js";import{a7 as r,a8 as s,a9 as a}from"./index-b7973960.js";import{L as o,O as n,C as i}from"./phoneNumber-795d3818.js";import"./redux-b8f2f78f.js";import"./router-2a1143ef.js";import"./icons-05e2bda1.js";import"./utils-2f253737.js";const l=()=>{const[l,c]=t.useState(!0),[u,d]=t.useState(!1),[g,m]=t.useState(!1),[h,p]=t.useState(!1),[f,x]=t.useState(""),[j,y]=t.useState(""),[b,w]=t.useState(""),[S,v]=t.useState(""),[P,A]=t.useState(localStorage.getItem("session-id")),C=t.useRef([]);return t.useEffect(()=>{A(localStorage.getItem("session-id"))},[]),t.useEffect(()=>{P&&(c(!1),d(!1),m(!0))},[P]),e.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:[l&&e.jsx(o,{phoneNumber:f,errorMessage:b,onPhoneNumberChange(e){e.target.value.length>10||(x(e.target.value),w(""))},async onPhoneSubmit(){if(10===f.trim().length)try{const e=await r(f);if(e.isError)return void w(e.data.message||"An error occurred. Please try again.");c(!1),d(!0)}catch(e){w("An error occurred. Please try again.")}else w("Please enter a valid 10-digit phone number.")}}),u&&e.jsx(n,{phoneNumber:f,otpErrorMessage:S,onOtpChange(e,t){const r=e.target.value;if(!/[0-9]/.test(r))return;const s=j.split("");s[t]=r,y(s.join("")),r&&t<C.current.length-1&&C.current[t+1]?.focus()},async onOtpSubmit(){if(6===j.trim().length)try{const e=await s(f,j);if(e.isError)return void v(e.data.message||"An error occurred. Please try again.");const t=e.data.sessionId;localStorage.setItem("session-id",t),d(!1),m(!0)}catch(e){v("An error occurred. Please try again.")}else v("Please enter a valid 6-digit OTP.")},onBack(){d(!1),c(!0)}}),g&&e.jsxs("div",{className:"p-8 rounded-xl shadow-xl w-[90%] max-w-lg text-center",children:[e.jsx("h2",{className:"text-2xl font-bold text-center mb-4 text-purple-700",children:"Logged In "}),e.jsx("button",{className:"bg-purple-700 text-white py-3 px-6 rounded-lg w-full hover:bg-purple-500 transition-all mb-4",onClick:()=>window.location.href="/",children:"Go to Home"}),e.jsx("button",{className:"bg-red-700 text-white py-3 px-6 rounded-lg w-full hover:bg-red-500 transition-all",onClick(){p(!0)},children:"Delete User Account"})]}),h&&e.jsx(i,{message:"Are you sure? All your data will be lost.",onConfirm(){p(!1),(async()=>{try{const e=await a();if(e.isError)return void alert(e.data.message||"An error occurred. Please try again.");localStorage.setItem("session-id",""),window.location.href="/"}catch(e){alert("An error occurred. Please try again.")}})()},onCancel(){p(!1)}})]})};export{l 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.