1import{D as e,E as t,Kt as n,On as r,g as i,k as a,mt as o,qt as s,v as c,vn as l}from"./CoKk4mC0.js";import{r as u}from"./CdFrTMvw.js";import{t as d}from"./FL7TF-bY.js";import{t as f}from"./Dzo5qFXH.js";import{t as p}from"./BkciXpOk.js";import{n as m}from"./A-JmF_gw.js";import{t as h}from"./Cf0_l5aR2.js";import{a as g,i as _,n as v,r as y}from"./CxCUa4Ke2.js";import{t as b}from"./rNCy6biR.js";import{t as x}from"./CNs_Ozdc.js";import{t as S}from"./BlszRc5N2.js";import{t as C}from"./CLIVjNQX2.js";var w=a({__name:`login`,async setup(a){let w,T;x({layout:`auth`,middleware:`supabase`}),u({title:`Sign in`,description:`Sign in to your account to continue sourcing with your team.`});let E=h(),D=d(),O=m(),{confirmUrl:k}=C(),{captureReturnToFromRoute:A,navigateAfterAuth:j,authLinkQuery:M}=S();A(),D.value&&([w,T]=n(()=>j()),await w,T());let N=[{name:`email`,type:`email`,label:`Email`,placeholder:`[email protected]`,required:!0,autocomplete:`email`},{name:`password`,label:`Password`,type:`password`,placeholder:`Enter your password`,required:!0,autocomplete:`current-password`},{name:`remember`,label:`Remember me`,type:`checkbox`}],P=l(!1),F=l(!1),I=i(()=>[{label:`Continue with Google`,icon:`i-simple-icons-google`,color:`neutral`,variant:`subtle`,loading:P.value,disabled:F.value||P.value,onClick:async()=>{if(P.value||F.value)return;P.value=!0;let{error:e}=await E.auth.signInWithOAuth({provider:`google`,options:{redirectTo:k.value}});e&&(P.value=!1,O.add({title:`Google sign-in failed`,description:e.message,color:`error`,icon:`i-simple-icons-google`}))}}]),L=_({email:y(`Enter a valid email`),password:g().min(8,`Must be at least 8 characters`),remember:v().optional()});async function R(e){if(!F.value){F.value=!0;try{let{data:t,error:n}=await E.auth.signInWithPassword({email:e.data.email,password:e.data.password});if(n){O.add({title:`Sign in failed`,description:n.message,color:`error`,icon:`i-lucide-lock`});return}await b(t.session),await j()}finally{F.value=!1}}}return(n,i)=>{let a=p,l=f;return o(),c(l,{fields:N,schema:r(L),providers:r(I),loading:r(F),disabled:r(F),submit:{label:`Sign in`,color:`primary`},title:`Welcome back`,icon:`i-lucide-lock`,separator:`or continue with email`,onSubmit:R},{description:s(()=>[i[1]||=t(` Don't have an account? `,-1),e(a,{to:{path:`/signup`,query:r(M)()},class:`text-primary font-medium`},{default:s(()=>[...i[0]||=[t(` Sign up `,-1)]]),_:1},8,[`to`])]),"password-hint":s(()=>[e(a,{to:`/forgot-password`,class:`text-primary font-medium`,tabindex:`-1`},{default:s(()=>[...i[2]||=[t(` Forgot password? `,-1)]]),_:1})]),footer:s(()=>[i[5]||=t(` By signing in, you agree to our `,-1),e(a,{to:`/terms`,class:`text-primary font-medium`},{default:s(()=>[...i[3]||=[t(` Terms of Service `,-1)]]),_:1}),i[6]||=t(` and `,-1),e(a,{to:`/privacy`,class:`text-primary font-medium`},{default:s(()=>[...i[4]||=[t(` Privacy Policy `,-1)]]),_:1}),i[7]||=t(`. `,-1)]),_:1},8,[`schema`,`providers`,`loading`,`disabled`])}}});export{w 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.