1import{r as e,j as t}from"./react-vendor-hAxFZxNQ.js";import{a as r,ae as s,L as a,c as o}from"./main-C-ofR5-x.js";import{P as n}from"./PageWrapper-CoTxZ1Il.js";import{t as l}from"./twoFactor-CYUUH2jY.js";import"./ui-DlHKYJvh.js";const i=()=>{const i=r(),{redirect:d}=s.useSearch(),[c,m]=e.useState("enter-phone"),[u,x]=e.useState(""),[h,p]=e.useState(""),[f,g]=e.useState(""),[b,y]=e.useState(!1),j=d||"/social";return t.jsx(n,{className:"flex items-center justify-center",children:t.jsx("section",{className:"w-full min-h-[calc(100vh-4rem)] flex items-center justify-center py-12",children:t.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-y-6 rounded-2xl border border-border bg-card px-8 py-10 shadow-lg",children:[t.jsx("div",{className:"flex items-center gap-1 lg:justify-start",children:t.jsxs(a,{to:"/",className:"transition-all duration-300 hover:drop-shadow-[0_0_12px_rgba(147,51,234,0.6)]",children:[t.jsx("img",{src:"/static/images/logos/logo-light.svg",alt:"SocialNex",className:"h-10 w-auto dark:hidden"}),t.jsx("img",{src:"/static/images/logos/logo-dark.svg",alt:"SocialNex",className:"h-10 w-auto hidden dark:block"})]})}),t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-2xl font-bold text-foreground mb-1",children:"Secure Your Account"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"enter-phone"===c?"Add two-factor authentication for extra security":"Enter the 6-digit code sent to your phone"})]}),f&&t.jsxs("div",{className:"w-full flex items-center gap-3 rounded-xl bg-destructive/10 border border-destructive/20 px-4 py-3 text-sm text-destructive",children:[t.jsx(o,{name:"material-symbols:error-outline",className:"w-5 h-5 flex-shrink-0"}),f]}),"enter-phone"===c?t.jsxs("form",{onSubmit:async e=>{if(e.preventDefault(),g(""),!u.trim())return void g("Enter your phone number");y(!0);const t=await l.setupSend(u.trim());y(!1),t.success?m("enter-code"):g(t.error||"Failed to send code. Check the number and try again.")},className:"w-full flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("label",{htmlFor:"phone",className:"text-sm font-medium text-foreground",children:"Mobile Number"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter in international format (e.g. +12025551234)"}),t.jsxs("div",{className:"relative",children:[t.jsx(o,{name:"material-symbols:smartphone",className:"absolute left-3.5 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground/60"}),t.jsx("input",{id:"phone",type:"tel",value:u,onChange:e=>x(e.target.value),autoFocus:!0,placeholder:"+12025551234",className:"h-12 w-full rounded-xl border border-input bg-background pl-11 pr-4 text-sm text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-all"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"By providing your number, you agree that SocialNex may use it to contact you. SMS charges may apply."})]}),t.jsx("button",{type:"submit",disabled:b,className:"h-12 w-full rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-all hover:shadow-lg hover:shadow-primary/25 hover:-translate-y-0.5 active:translate-y-0 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:hover:shadow-none mt-1",children:b?t.jsxs("span",{className:"inline-flex items-center gap-2",children:[t.jsx(o,{name:"material-symbols:sync",className:"w-4 h-4 animate-spin"}),"Sending code..."]}):"Send Verification Code"}),t.jsx("button",{type:"button",onClick:()=>i({to:j}),className:"text-sm text-muted-foreground hover:text-foreground transition-colors text-center",children:"Skip for now"})]}):t.jsxs("form",{onSubmit:async e=>{e.preventDefault(),g(""),y(!0);const t=await l.setupVerify(u.trim(),h.trim());y(!1),t.success?i({to:j}):g(t.error||"Invalid code. Please try again.")},className:"w-full flex flex-col gap-4",children:[t.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:["Code sent to ",t.jsx("span",{className:"font-medium text-foreground",children:u})]}),t.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",maxLength:6,value:h,onChange:e=>p(e.target.value.replace(/\D/g,"")),placeholder:"000000",autoFocus:!0,className:"w-full text-center text-3xl tracking-[0.5em] font-mono border border-input rounded-xl py-4 bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-all"}),t.jsx("button",{type:"submit",disabled:b||h.length<6,className:"h-12 w-full rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:bg-primary/90 transition-all hover:shadow-lg hover:shadow-
1primary/25 hover:-translate-y-0.5 active:translate-y-0 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:hover:shadow-none",children:b?t.jsxs("span",{className:"inline-flex items-center gap-2",children:[t.jsx(o,{name:"material-symbols:sync",className:"w-4 h-4 animate-spin"}),"Verifying..."]}):"Verify & Enable 2FA"}),t.jsxs("div",{className:"flex items-center justify-between text-sm",children:[t.jsxs("button",{type:"button",onClick:()=>{m("enter-phone"),p(""),g("")},className:"text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(o,{name:"material-symbols:arrow-back",className:"inline mr-1 text-base"}),"Change number"]}),t.jsx("button",{type:"button",onClick:()=>i({to:j}),className:"text-muted-foreground hover:text-foreground transition-colors",children:"Skip for now"})]})]})]})})})};export{i as component};
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.