1import{j as e}from"./query-Cof1y_xS.js";import{r as o}from"./react-DTthrbVy.js";import{i as E,j as M,k as R,Q as P,C as T,d as U,h as W,e as B,ac as D,a as I,I as d,B as c,U as z,V as h,W as b,X as y,Y as v,Z as j,L as w,M as V,a0 as O,af as Y,O as N}from"./index-PlFUvtKE.js";import{u as q}from"./use-page-title-BG1KOdtD.js";import{S as Z,a3 as _,U as $,c as H,Z as K,a1 as m}from"./icons-DA5H4eNx.js";import"./radix-LzHLEu2X.js";const Q=Y({email:N().email("Invalid email address"),password:N().min(6,"Password must be at least 6 characters")}),X=[{icon:_,title:"Never miss a call",description:"Track every incoming call with detailed notes",gradient:"from-[#C68A5C]/20 to-[#DDB18A]/20"},{icon:$,title:"Team collaboration",description:"Coordinate responses across your team",gradient:"from-[#7F90B0]/20 to-[#B5705B]/20"},{icon:H,title:"Enterprise-ready",description:"Role-based access and security",gradient:"from-[#7E9A82]/20 to-[#97B09A]/20"},{icon:K,title:"Stay on top of SLAs",description:"Automated notifications and tracking",gradient:"from-[#C68A5C]/20 to-[#DDB18A]/20"}];function ie(){q({title:"Sign In",description:"Sign in to your WYWO account to manage call notes, track follow-ups, and collaborate with your team.",path:"/login"});const{login:S,completeMfaLogin:k}=E(),[,p]=M(),{toast:s}=R(),[C,u]=o.useState(!1),[n,l]=o.useState(""),[i,L]=o.useState(!1),[x,g]=o.useState(!1),f=async()=>{g(!0);try{await k(n.trim(),i),p("/")}catch(t){s({title:"Verification failed",description:t.message||"Invalid code",variant:"destructive"})}finally{g(!1)}};o.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("error");a&&(s({title:"Sign-in error",description:{login_failed:"Sign-in failed. Please try again."}[a]||"An error occurred during sign-in.",variant:"destructive"}),window.history.replaceState({},"","/login"))},[]);const F=typeof window<"u"&&new URLSearchParams(window.location.search).get("email")||"",r=P({resolver:O(Q),defaultValues:{email:F,password:""}});o.useEffect(()=>{const t=new URLSearchParams(window.location.search).get("verify");t==="invalid"?s({title:"Link expired",description:"That verification link is invalid or expired. Sign in and we'll send a new one.",variant:"destructive"}):t==="error"&&s({title:"Verification error",description:"Something went wrong verifying your email. Please try signing in.",variant:"destructive"})},[]);const A=async t=>{try{const a=await S(t.email,t.password);if(a!=null&&a.mfaRequired){u(!0);return}if(a!=null&&a.verificationRequired){s({title:"Verify your email",description:a.message||"We've sent you a verification link. Click it to finish signing in."});return}p("/")}catch(a){s({title:"Login failed",description:a.message||"Invalid email or password",variant:"destructive"})}};return e.jsxs("div",{className:"h-screen flex overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 bg-gradient-to-br from-background via-background to-background",children:[e.jsx("div",{className:"absolute top-0 right-1/4 w-96 h-96 bg-primary/10 rounded-full blur-3xl animate-float"}),e.jsx("div",{className:"absolute bottom-1/4 left-1/3 w-80 h-80 bg-accent/15 rounded-full blur-3xl animate-float-delay"}),e.jsx("div",{className:"absolute top-1/3 right-1/3 w-72 h-72 bg-primary/5 rounded-full blur-3xl animate-float-slow"})]}),e.jsx("div",{className:"hidden lg:flex lg:w-1/2 p-8 flex-col justify-center relative z-10",children:e.jsxs("div",{className:"space-y-6 max-w-xl",children:[e.jsxs("div",{className:"space-y-4 animate-in fade-in slide-in-from-left duration-700",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full bg-primary/10 backdrop-blur-sm border border-primary/20",children:[e.jsx(Z,{className:"w-3.5 h-3.5 text-primary"}),e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Professional Call Management"})]}),e.jsxs("h1",{className:"text-4xl font-bold text-foreground leading-tight","data-testid":"text-page-title",children:["The modern way to manage"," ",e.jsx("span",{className:"bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent",children:"incoming calls"})]}),e.jsx("p",{className:"text-base text-muted-foreground","data-testid":"text-page-description",children:"Stay organized, respond faster, and never miss an important follow-up."})]}),e.jsx("div",{className:"grid gap-3",children:X.map((t,a)=>e.jsxs("div",{className:"group relative overflow-hidden rounded-lg bg-card/50 backdrop-blur-sm border border-border/50 p-4 hover:border-primary/30 transition-all duration-300 hover:shadow-lg hover:shadow-
1primary/5 animate-in fade-in slide-in-from-left",style:{animationDelay:`${a*100}ms`},"data-testid":`card-feature-${a}`,children:[e.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${t.gradient} opacity-0 group-hover:opacity-100 transition-opacity duration-300`}),e.jsxs("div",{className:"relative flex gap-3 items-center",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center group-hover:bg-primary/20 group-hover:scale-110 transition-all duration-300",children:e.jsx(t.icon,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm text-foreground group-hover:text-primary transition-colors",children:t.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description})]}),e.jsx(m,{className:"w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100 group-hover:translate-x-1 transition-all duration-300 flex-shrink-0"})]})]},t.title))}),e.jsx("div",{className:"animate-in fade-in slide-in-from-bottom duration-1000",children:e.jsxs("div",{className:"flex gap-3 p-3 rounded-lg bg-card/30 backdrop-blur-sm border border-border/30","data-testid":"card-testimonial",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-gradient-to-br from-primary/20 to-accent/20 flex items-center justify-center font-bold text-sm text-primary",children:"SC"}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-xs text-muted-foreground italic","data-testid":"text-testimonial-quote",children:'"WYWO has transformed how we handle incoming calls. Response times are down 60%."'}),e.jsxs("p",{className:"text-xs font-semibold text-foreground","data-testid":"text-testimonial-author",children:["Sarah Chen",e.jsx("span",{className:"text-muted-foreground font-normal",children:" · Operations Director"})]})]})]})})]})}),e.jsx("div",{className:"flex-1 flex items-center justify-center py-3 px-4 lg:p-6 relative z-10",children:e.jsx("div",{className:"w-full max-w-lg animate-in fade-in zoom-in-95 duration-700",children:e.jsxs(T,{className:"border-border/50 shadow-2xl backdrop-blur-xl bg-card/80 relative overflow-hidden group","data-testid":"login-card",children:[e.jsx("div",{className:"absolute inset-0 rounded-lg bg-gradient-to-r from-primary/0 via-primary/20 to-primary/0 opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-xl"}),e.jsxs("div",{className:"relative",children:[e.jsxs(U,{className:"space-y-2 pb-2 pt-4 lg:space-y-4 lg:pb-6 lg:pt-8",children:[e.jsx("div",{className:"flex justify-center text-foreground",children:e.jsx(W,{size:56,withWordmark:!0})}),e.jsxs("div",{className:"space-y-0.5 lg:space-y-2 text-center",children:[e.jsx(B,{className:"text-xl lg:text-3xl font-bold tracking-tight bg-gradient-to-br from-foreground to-foreground/70 bg-clip-text","data-testid":"text-card-title",children:"Welcome back"}),e.jsx(D,{className:"text-xs lg:text-base","data-testid":"text-card-description",children:"Sign in to your account to continue"})]})]}),e.jsx(I,{className:"space-y-3 lg:space-y-5 px-5 lg:px-8",children:C?e.jsxs("div",{className:"space-y-4","data-testid":"mfa-step",children:[e.jsxs("div",{className:"text-center space-y-1",children:[e.jsx("h3",{className:"font-semibold",children:"Two-factor authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i?"Enter one of your recovery codes.":"Enter the 6-digit code from your authenticator app."})]}),e.jsx(d,{autoFocus:!0,value:n,onChange:t=>l(t.target.value),onKeyDown:t=>t.key==="Enter"&&n.trim()&&f(),placeholder:i?"xxxxx-xxxxx":"123456",inputMode:i?"text":"numeric",autoComplete:"one-time-code",className:"h-11 text-center tracking-widest","data-testid":"input-mfa-code"}),e.jsx(c,{onClick:f,disabled:x||!n.trim(),className:"w-full h-11","data-testid":"button-verify-mfa",children:x?"Verifyingâ¦":"Verify"}),e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:()=>{L(!i),l("")},"data-testid":"button-toggle-recovery",children:i?"Use authenticator code":"Use a recovery code"}),e.jsx("button",{type:"button",className:"text-muted-foreground hover:underline",onClick:()=>{u(!1),l("")},children:"Back"})]}),e.jsx("p",{className:"text-xs text-muted-foreground text-center","data-testid":"text-mfa-lost-device",children:"Lost your device? Use a recovery code above. If you've also lost those, ask an organization owner or contact support to reset two-factor authentication."})]}):e.jsx(z,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(A),className:"space-y-3 lg:space-y-5",children:[e.jsx(h,{control:r.control,name:"email",render:({field:t})=>e.jsxs(b,{children:[e.jsx(y,{className:"text-xs lg:text-sm font-medium",children:"Email address"}),e.jsx(v,{children:e.jsxs("div",{className:"relative group/input",children:[e.jsx(d,{...t,type:"email",placeholder:"[email protected]",autoComplete:"email",className:"h-10 lg:h-11 bg-background/50 backdrop-blur-sm border-border/50 focus:border-primary/50 focus:ring-2 focus:ring-primary/20 transition-all duration-200","data-testid":"input-email"}),e.jsx("div",{className:"absolute inset-0 rounded-md bg-gradient-to-r from-primary/0 via-primary/5 to-primary/0 opacity-0 group-focus-within/input:opacity-100 transition-opacity duration-300 pointer-events-none"})]})}),e.jsx(j,{})]})}),e.jsx(h,{control:r.control,name:"password",render:({field:t})=>e.jsxs(b,{children:[e.jsx(y,{className:"text-xs lg:text-sm font-medium",children:"Password"}),e.jsx(v,{children:e.jsxs("div",{className:"relative group/input",children:[e.jsx(d,{...t,type:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢",autoComplete:"current-password",className:"h-10 lg:h-11 bg-background/50 backdrop-blur-sm border-border/50 focus:border-primary/50 focus:ring-2 focus:ring-primary/20 transition-all duration-200","data-testid":"input-password"}),e.jsx("div",{className:"absolute inset-0 rounded-md bg-gradient-to-r from-primary/0 via-primary/5 to-primary/0 opacity-0 group-focus-within/input:opacity-100 transition-opacity duration-300 pointer-events-none"})]})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(w,{href:"/forgot-password",className:"text-xs text-primary hover:text-primary/80 transition-colors","data-testid":"link-forgot-password",children:"Forgot password?"})}),e.jsx(j,{})]})}),e.jsxs(c,{type:"submit",className:"w-full h-10 lg:h-11 text-sm lg:text-base font-semibold relative overflow-hidden group/button shadow-lg shadow-primary/25 hover:shadow-xl hover:shadow-
1primary/30 transition-all duration-300",disabled:r.formState.isSubmitting,"data-testid":"button-login",children:[e.jsxs("span",{className:"relative z-10 flex items-center justify-center gap-2",children:[r.formState.isSubmitting?"Signing in...":"Sign in",!r.formState.isSubmitting&&e.jsx(m,{className:"w-4 h-4 group-hover/button:translate-x-1 transition-transform"})]}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary via-primary to-primary bg-[length:200%_100%] group-hover/button:bg-[position:100%_0] transition-all duration-500"})]})]})})}),e.jsxs(V,{className:"flex flex-col gap-2 lg:gap-4 pt-1 pb-5 lg:pb-8 px-5 lg:px-8",children:[e.jsxs("div",{className:"relative w-full",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-border/50"})}),e.jsx("div",{className:"relative flex justify-center text-[10px] lg:text-xs uppercase",children:e.jsx("span",{className:"bg-card px-2 lg:px-3 py-0.5 lg:py-1 text-muted-foreground rounded-full backdrop-blur-sm",children:"New to WYWO?"})})]}),e.jsx(w,{href:"/register",className:"w-full","data-testid":"link-register",children:e.jsx(c,{variant:"outline",className:"w-full h-10 lg:h-11 text-sm lg:text-base font-semibold border-border/50 hover:border-primary/50 hover:bg-primary/5 transition-all duration-300 group/create",type:"button",children:e.jsxs("span",{className:"flex items-center gap-2",children:["Create an account",e.jsx(m,{className:"w-4 h-4 group-hover/create:translate-x-1 transition-transform"})]})})})]})]})]})})})]})}export{ie 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.