1import{d as F,p as h,e as b,f as d,g as s,i as u,h as l,w as p,j as v,u as e,s as _,J as C,k,F as U,B as M,r as G,n as q,a0 as I,o as n,K as D,l as J,_ as E,a3 as K,a5 as Q,R as W,G as X}from"#entry";import{A as z,a as P,_ as Y}from"./BPcR48y6.js";import{_ as Z}from"./kHUp8lMP.js";import{_ as ee}from"./BbZ_xfnd.js";import{_ as te}from"./CWXG8wMV.js";import{_ as se}from"./CLalQf_w.js";import{_ as A}from"./bdTI0xvv.js";import{u as oe}from"./DTax1JMZ.js";import"./DlAUqK2U.js";import"./yO6oVPbK.js";import"./BKbuWlto.js";const ae={class:"flex flex-col gap-6"},le={class:"flex flex-col items-center gap-4"},ne={class:"text-center text-sm text-foreground"},re={class:"flex flex-col gap-6"},ie={class:"space-y-2"},de={key:0,class:"text-xs text-red-400"},ue={class:"space-y-2"},me={class:"space-y-1"},ce={class:"flex items-center gap-2"},fe={class:"h-1.5 flex-1 max-w-[120px] rounded-full bg-white/10 overflow-hidden"},pe={class:"text-xs text-muted-foreground capitalize shrink-0"},xe={class:"mt-1.5 space-y-1 text-xs","aria-live":"polite"},ge={key:0},ve={key:1},_e={key:1,class:"text-red-400/90 text-xs"},he={class:"space-y-2"},we={key:0,class:"text-xs text-red-400"},ye={class:"flex items-start gap-3 rounded-lg border border-white/10 bg-white/5 p-3"},be={key:1},ke={class:"flex flex-col gap-4"},Ve=F({__name:"RegisterForm",props:{class:{},loading:{type:Boolean}},emits:["submit","oauth"],setup(w,{emit:R}){const y=w,{validateEmail:B,validatePassword:S}=oe(),r=h(""),o=h(""),m=h(""),x=h(!1),i=h({email:!1,password:!1,confirm:!1}),g=R,V=b(()=>B(r.value)),c=b(()=>S(o.value)),$=b(()=>{const f=o.value??"",t=m.value??"";return t.length===0?{valid:!1,message:""}:{valid:f===t,message:f===t?"":"Passwords do not match"}}),T=b(()=>V.value.valid&&c.value.valid&&$.value.valid&&x.value===!0),L=b(()=>{const f=c.value.strength;return f==="weak"?"bg-red-400/80":f==="fair"?"bg-amber-400/80":f==="good"?"bg-blue-400/80":"bg-emerald-500/80"});function O(){i.value={email:!0,password:!0,confirm:!0},T.value&&g("submit",{email:r.value.trim(),password:o.value})}return(f,t)=>{const j=I,N=Z,H=ee;return n(),d("div",{class:_([e(K)("flex flex-col gap-6",y.class),"dark"])},[s("form",{onSubmit:q(O,["prevent"])},[s("div",ae,[s("div",le,[t[10]||(t[10]=s("div",{class:"flex items-center gap-2 font-medium"},[s("img",{src:te,class:"h-16"})],-1)),s("div",ne,[t[9]||(t[9]=u(" Already have an account? ",-1)),l(j,{to:"/login",class:"underline underline-offset-2 hover:underline-offset-4 transition-all text-white font-medium"},{default:p(()=>[...t[8]||(t[8]=[u(" Sign in ",-1)])]),_:1})])]),s("div",re,[s("div",ie,[l(e(A),{for:"email",class:"text-sm font-medium text-foreground"},{default:p(()=>[...t[11]||(t[11]=[u("Email",-1)])]),_:1}),l(e(D),{modelValue:e(r),"onUpdate:modelValue":t[0]||(t[0]=a=>C(r)?r.value=a:null),id:"email",type:"email",placeholder:"[email protected]",required:"",autocomplete:"email",class:_([e(z),e(i).email&&!e(V).valid?e(P):""]),onBlur:t[1]||(t[1]=a=>e(i).email=!0)},null,8,["modelValue","class"]),e(i).email&&!e(V).valid&&e(r)?(n(),d("p",de,k(e(V).message),1)):v("",!0)]),s("div",ue,[l(e(A),{for:"password",class:"text-sm font-medium text-foreground"},{default:p(()=>[...t[12]||(t[12]=[u("Password",-1)])]),_:1}),s("div",me,[l(N,{id:"password",modelValue:e(o),"onUpdate:modelValue":t[2]||(t[2]=a=>C(o)?o.value=a:null),required:"",autocomplete:"new-password",class:_([e(z),e(i).password&&!e(c).valid&&e(o)?e(P):""]),onBlur:t[3]||(t[3]=a=>e(i).password=!0)},null,8,["modelValue","class"]),e(o).length>=1?(n(),d(U,{key:0},[s("div",ce,[s("div",fe,[s("div",{class:_(["h-1.5 rounded-full transition-all",e(L)]),style:M({width:e(c).percent+"%"})},null,6)]),s("span",pe,k(e(c).strength),1)]),s("ul",xe,[(n(!0),d(U,null,G(e(c).requirements,a=>(n(),d("li",{key:a.id,class:_(a.met?"text-emerald-400":"text-muted-foreground")},[a.met?(n(),d("span",ge,"â")):(n(),d("span",ve,"·")),u(" "+k(a.label),1)],2))),128))])],64)):v("",!0),e(c).message?(n(),d("p",_e,k(e(c).message),1)):v("",!0)])]),s("div",he,[l(e(A),{for:"confirm-password",class:"text-sm font-medium text-foreground"},{default:p(()=>[...t[13]||(t[13]=[u("Confirm password",-1)])]),_:1}),l(N,{id:"confirm-password",modelValue:e(m),"onUpdate:modelValue":t[4]||(t[4]=a=>C(m)?m.value=a:null),required:"",autocomplete:"new-password",class:_([e(z),e(i).confirm&&!e($).valid&&e(m)?e(P):""]),onBlur:t[5]||(t[5]=a=>e(i).confirm=!0)},null,8,["modelValue","class"]),e(i).confirm&&!e($).valid&&e(m)?(n(),d("p",we,k(e($).message),1)):v("",!0)]),s("div",ye,[l(e(se),{id:"terms",modelValue:e(x),"onUpdate:modelValue":t[6]||(t[6]=a=>C(x)?x.value=a:null),class:"mt-0.5 border-zinc-500 data-[state=checked]:border-violet-400 data-[state=checked]:bg-violet-500"},null,8,["modelValue"]),t[14]||(t[14]=s("label",{for:"terms",class:"cursor-pointer text-sm text-muted-foreground"},[u(" I agree to the "),s("a",{href:"https://litlyx.com/terms-of-service",target:"_blank",rel:"noopener",class:"underline underline-offset-2 hover:text-white"},"Terms of Service"),u(" and "),s("a",{href:"https://litlyx.com/privacy-policy",target:"_blank",rel:"noopener",class:"underline underline-offset-2 hover:text-white"},"Privacy Policy"),u(". ")],-1))]),l(e(E),{disabled:!e(T)||w.loading,type:"submit",class:"w-full cursor-pointer h-12"},{default:p(()=>[w.loading?(n(),J(H,{key:0,class:"!size-6"})):v("",!0),w.loading?v("",!0):(n(),d("span",be," Register "))]),_:1},8,["disabled"]),t[16]||(t[16]=s("fieldset",{class:"border-t border-gray-200 text-center"},[s("legend",{class:"px-2 text-sm text-white"},"Or")],-1)),s("div",ke,[l(e(E),{onClick:t[7]||(t[7]=a=>g("oauth","google")),variant:"outline",type:"button",class:"w-full text-white !border-0 cursor-pointer"},{default:p(()=>[...t[15]||(t[15]=[s("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[s("path",{d:"M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4
1-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z",fill:"currentColor"})],-1),u(" Continue with Google ",-1)])]),_:1})])])])],32)],2)}}}),$e={class:"auth-page relative flex min-h-svh flex-col overflow-hidden"},Ce={class:"relative z-10 flex flex-1 flex-col items-center justify-center px-4 pt-20 pb-10 md:px-6 md:py-20"},Re={class:"auth-card w-full max-w-[400px] rounded-2xl border border-zinc-700/50 bg-zinc-900/80 px-6 py-8 shadow-2xl backdrop-blur-xl"},Le=F({__name:"register",setup(w){const R=Q(),y=h(!1);async function B(r){y.value=!0,await W({toast:!0,toastTitle:"Error during login",async action(){await X("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:r})},onSuccess(o,m){m("Registration completed",{description:"Registration completed, check your inbox to confirm your account"}),R.push("/")}}),y.value=!1}async function S(r){location.href=`/api/auth/${r}/authenticate`}return(r,o)=>{const m=I,x=Y,i=Ve;return n(),d("div",$e,[l(m,{to:"/login",class:"auth-back-link absolute left-4 top-[max(1rem,env(safe-area-inset-top))] z-20 text-sm text-muted-foreground transition-colors hover:text-foreground"},{default:p(()=>[...o[2]||(o[2]=[u(" â Sign in ",-1)])]),_:1}),l(x),s("div",Ce,[s("div",Re,[l(i,{loading:e(y),onSubmit:o[0]||(o[0]=g=>B(g)),onOauth:o[1]||(o[1]=g=>S(g))},null,8,["loading"])])])])}}});export{Le 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.