1import{_ as T}from"./Knuu0yqI.js";import{_ as B}from"./CUxQuSEP.js";import{e as E,C as R,D as y,E as q,r as a,c as p,a as t,i as w,l as k,b as s,w as b,g as r,d as f,h as z,t as _,j as V,v as C,k as g,o as x}from"./Bptaa8rK.js";import{Z as D}from"./MYvVcLv4.js";import{G}from"./C8TOBZzF.js";import{M as H}from"./E3DtZ1QA.js";import{L}from"./BgdJqKiM.js";import"./CRPvtfJY.js";import"./CUJNYxGK.js";import"./Biyx9X2C.js";const U={class:"min-h-screen flex items-center justify-center bg-surface-50 dark:bg-surface-950 px-4"},A={class:"w-full max-w-sm"},F={class:"text-center mb-8"},P={class:"flex items-center justify-center w-12 h-12 rounded-xl bg-gradient-to-br from-primary-500 to-accent-500 shadow-lg shadow-primary-500/25"},W={key:0,class:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-950 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-300 text-sm"},I={class:"space-y-3 mb-6"},Z={href:"/auth/github",class:"flex items-center justify-center gap-2 w-full px-4 py-2.5 rounded-lg border border-surface-300 dark:border-surface-700 bg-white dark:bg-surface-800 hover:bg-surface-50 dark:hover:bg-surface-700 transition-colors text-sm font-medium"},$={key:0,class:"p-3 rounded-lg bg-red-50 dark:bg-red-950 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-300 text-sm"},J={class:"relative"},O={class:"flex items-center justify-between mb-1.5"},K={class:"relative"},Q=["disabled"],X={class:"text-center text-sm text-surface-500 dark:text-surface-400 mt-6"},ue=E({__name:"login",setup(Y){const{loggedIn:M}=R();M.value&&y("/dashboard");const v=q(),S=a(v.query.error),d=a(""),n=a(""),u=a(!1),c=a(""),l=a(""),h=a();async function j(){u.value=!0,c.value="";try{await $fetch("/api/auth/login",{method:"POST",body:{email:d.value,password:n.value,turnstileToken:l.value}});const o=v.query.redirect||"/dashboard",e=o.startsWith("/")&&!o.startsWith("//")?o:"/dashboard";await y(e)}catch(o){c.value=o.data?.message||"Invalid email or password",h.value?.reset()}finally{u.value=!1}}return(o,e)=>{const m=T,N=B;return x(),p("div",U,[t("div",A,[t("div",F,[s(m,{to:"/",class:"inline-flex items-center gap-2"},{default:b(()=>[t("div",P,[s(r(D),{class:"w-6 h-6 text-white"})])]),_:1}),e[3]||(e[3]=t("h1",{class:"text-2xl font-bold mt-4"},"Sign in to MailJunky",-1)),e[4]||(e[4]=t("p",{class:"text-surface-500 dark:text-surface-400 mt-1"},"Welcome back",-1))]),r(S)?(x(),p("div",W," Authentication failed. Please try again. ")):w("",!0),t("div",I,[e[6]||(e[6]=k('<a href="/auth/google" class="flex items-center justify-center gap-2 w-full px-4 py-2.5 rounded-lg border border-surface-300 dark:border-surface-700 bg-white dark:bg-surface-800 hover:bg-surface-50 dark:hover:bg-surface-700 transition-colors text-sm font-medium"><svg class="w-5 h-5" viewBox="0 0 24 24"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"></path><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"></path><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"></path><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"></path></svg> Continue with Google </a>',1)),t("a",Z,[s(r(G),{class:"w-5 h-5"}),e[5]||(e[5]=f(" Continue with GitHub ",-1))])]),e[12]||(e[12]=k('<div class="relative mb-6"><div class="absolute inset-0 flex items-center"><div class="w-full border-t border-surface-200 dark:border-surface-700"></div></div><div class="relative flex justify-center text-xs uppercase"><span class="bg-surface-50 dark:bg-surface-950 px-2 text-surface-500">or</span></div></div>',1)),t("form",{onSubmit:z(j,["prevent"]),class:"space-y-4"},[r(c)?(x(),p("div",$,_(r(c)),1)):w("",!0),t("div",null,[e[7]||(e[7]=t("label",{for:"email",class:"block text-sm font-medium mb-1.5"},"Email",-1)),t("div",J,[s(r(H),{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-surface-400"}),V(t("input",{id:"email","onUpdate:modelValue":e[0]||(e[0]=i=>g(d)?d.value=i:null),type:"email",required:"",placeholder:"[email protected]",class:"w-full pl-10 pr-4 py-2.5 rounded-lg border border-surface-300 dark:border-surface-700 bg-white dark:bg-surface-800 text-sm focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none"},null,512),[[C,r(d)]])])]),t("div",null,[t("div",O,[e[9]||(e[9]=t("label",{for:"password",class:"block text-sm font-medium"},"Password",-1)),s(m,{to:"/forgot-password",class:"text-xs text-primary-600 hover:text-primary-500"},{default:b(()=>[...e[8]||(e[8]=[f(" Forgot password? ",-1)])]),_:1})]),t("div",K,[s(r(L),{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-surface-400"}),V(t("input",{id:"password","onUpdate:modelValue":e[1]||(e[1]=i=>g(n)?n.value=i:null),type:"password",required:"",placeholder:"Enter your password",class:"w-full pl-10 pr-4 py-2.5 rounded-lg border border-surface-300 dark:border-surface-700 bg-white dark:bg-surface-800 text-sm focus:ring-2 focus:ring-primary-500 focus:border-primary-500 outline-none"},null,512),[[C,r(n)]])])]),s(N,{ref_key:"turnstileRef",ref:h,modelValue:r(l),"onUpdate:modelValue":e[2]||(e[2]=i=>
1g(l)?l.value=i:null)},null,8,["modelValue"]),t("button",{type:"submit",disabled:r(u)||!r(l),class:"btn-primary w-full py-2.5 text-sm"},_(r(u)?"Signing in...":"Sign in"),9,Q)],32),t("p",X,[e[11]||(e[11]=f(" Don't have an account? ",-1)),s(m,{to:"/register",class:"text-primary-600 hover:text-primary-500 font-medium"},{default:b(()=>[...e[10]||(e[10]=[f(" Sign up ",-1)])]),_:1})])])])}}});export{ue 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.