import{Bt as e,Ct as t,F as n,G as r,H as i,L as a,N as o,Nt as s,Pt as c,T as l,Vt as u,X as d,bt as f,ft as p,mt as m,ot as h,tt as g,ut as _,vt as v,z as y}from"../chunks/BT3KAag_.js";import{r as b}from"../chunks/DqZmeWn2.js";import"../chunks/t62M88qj.js";import"../chunks/wcGRWqFZ.js";import{i as x}from"../chunks/Brnt5OaR.js";import{t as S}from"../chunks/ikKa4mia.js";import{t as C}from"../chunks/DPNVpxC52.js";import"../chunks/De4vjwu82.js";import{t as w}from"../chunks/B6jmww-W.js";import"../chunks/DGpZN1Lp2.js";var T=y(`<p class="error-msg svelte-1x05zx6"> </p>`),E=y(`<div class="login-page svelte-1x05zx6"><div class="login-card svelte-1x05zx6"><div class="logo svelte-1x05zx6"><img class="logo-mark svelte-1x05zx6" src="/studiograph-logomark.svg" alt="" width="64" height="64"/> <span class="logo-text svelte-1x05zx6"> </span></div> <form class="svelte-1x05zx6"><label class="field svelte-1x05zx6"><span class="field-label svelte-1x05zx6">Email</span> <!></label> <label class="field svelte-1x05zx6"><span class="field-label svelte-1x05zx6">Password</span> <!></label> <!> <!></form></div></div>`);function D(y,D){c(D,!0);let O=t(()=>S.workspaceName||`Studiograph`),k=f(``),A=f(``),j=f(``),M=f(!1);async function N(e){e.preventDefault();let t=e.currentTarget,n=t.querySelector(`input[type="email"]`).value,r=t.querySelector(`input[type="password"]`).value;v(j,``),v(M,!0);try{await S.login(n,r),await x.load(),b(`/`)}catch(e){v(j,e.message||`Invalid credentials`,!0)}finally{v(M,!1)}}var P=E();l(`1x05zx6`,e=>{g(()=>{_.title=`Sign in — ${d(O)??``}`})});var F=p(P),I=p(F),L=m(p(I),2),R=p(L,!0);u(L),u(I);var z=m(I,2),B=p(z);w(m(p(B),2),{type:`email`,required:!0,autocomplete:`email`,autofocus:!0,class:`field-input`,get value(){return d(k)},set value(e){v(k,e,!0)}}),u(B);var V=m(B,2);w(m(p(V),2),{type:`password`,required:!0,autocomplete:`current-password`,class:`field-input`,get value(){return d(A)},set value(e){v(A,e,!0)}}),u(V);var H=m(V,2),U=e=>{var t=T(),r=p(t,!0);u(t),h(()=>n(r,d(j))),a(e,t)};o(H,e=>{d(j)&&e(U)}),C(m(H,2),{variant:`accent`,type:`submit`,class:`submit-btn`,get disabled(){return d(M)},children:(t,n)=>{e(),a(t,i(`Sign in`))},$$slots:{default:!0}}),u(z),u(F),u(P),h(()=>n(R,d(O))),r(`submit`,z,N),a(y,P),s()}export{D as component};