import{p as c,e as re,i as R,b as ae}from"./i18n-eTakDDhg.js";import{R as se,S as Y,X as p,w as l,x as f,ad as j,G as m,z as u,a as i,a7 as oe,t as g,a0 as P,V as h,T as le,a3 as U,U as x,W as d,Y as $,a8 as ie}from"./index-BkylzejB.js";import{h as ne}from"./html-DvOIMrhY.js";import{B as pe}from"./BaseForm-BD1FbzA7.js";import{T as A}from"./Textbox-BKaV3ERZ.js";import"./StreamingBar.svelte_svelte_type_style_lang-CFNH9sqm.js";import{B as E}from"./Block-Bl_3z_UU.js";import"./ScrollFade.svelte_svelte_type_style_lang-De9nUaYy.js";/* empty css                                              */import{B as me}from"./Button-CIsBas6L.js";import{B as ue}from"./Index.svelte_svelte_type_style_lang-Cn03ZAkL.js";import"./actions-CWv1ghz2.js";import"./input-l8ysRorr.js";import"./BlockTitle-BP9HXeKy.js";import"./Info-ElNnmNxB.js";import"./Check-8VzamX5F.js";import"./Copy-Dnm0QzA5.js";import"./Send-ChW5puPB.js";import"./Square-oaGskVQb.js";import"./IconButtonWrapper-33oacT7w.js";import"./snippet-CC9u6I34.js";import"./index-B_pwUImq.js";import"./Image-BfEz-0y2.js";import"./misc-Q1bfX-rj.js";/* empty css                                            *//* empty css                                                   */import"./index-C-r_2iGV.js";import"./Clear-Daql2pLY.js";var de=d('<p class="auth svelte-14xt79u"><!></p>'),_e=d('<p class="auth svelte-14xt79u"> </p>'),ve=d('<p class="creds svelte-14xt79u"> </p>'),ce=d("<!> <!>",1),fe=d('<h2 class="svelte-14xt79u"> </h2> <!> <!> <!> <!> <!>',1),ge=d("<div><!></div>");function He(H,n){se(n,!1);let _=c(n,"root",12),b=c(n,"auth_message",12),k=c(n,"app_mode",12),T=c(n,"space_id",12),r=c(n,"i18n",12),w=U(""),B=U(""),W=U(!1);const S=async()=>{const t=new FormData;t.append("username",l(w)),t.append("password",l(B));const C=new URL("login",_().endsWith("/")?_():_()+"/").href;let v=await fetch(C,{method:"POST",body:t});v.status===400?(f(W,!0),f(w,""),f(B,"")):v.status==200&&location.reload()};var I={get root(){return _()},set root(t){_(t),x()},get auth_message(){return b()},set auth_message(t){b(t),x()},get app_mode(){return k()},set app_mode(t){k(t),x()},get space_id(){return T()},set space_id(t){T(t),x()},get i18n(){return r()},set i18n(t){r(t),x()}};re();var y=ge();let q;var J=h(y);return ue(J,{variant:"panel",min_width:480,children:(t,C)=>{var v=fe(),z=Y(v),K=h(z,!0);$(z);var G=p(z,2);{var M=e=>{var a=de(),s=h(a);ne(s,b),$(a),i(e,a)};R(G,e=>{b()&&e(M)})}var O=p(G,2);{var N=e=>{var a=_e(),s=h(a,!0);$(a),g(o=>P(s,o),[()=>(m(r()),u(()=>r()("login.enable_cookies")))]),i(e,a)};R(O,e=>{T()&&e(N)})}var V=p(O,2);{var Q=e=>{var a=ve(),s=h(a,!0);$(a),g(o=>P(s,o),[()=>(m(r()),u(()=>r()("login.incorrect_credentials")))]),i(e,a)};R(V,e=>{l(W)&&e(Q)})}var X=p(V,2);pe(X,{children:(e,a)=>{var s=ce(),o=Y(s);E(o,{children:(D,te)=>{{let F=j(()=>(m(r()),u(()=>r()("login.username"))));A(D,{get label(){return l(F)},lines:1,show_label:!0,max_lines:1,onsubmit:S,get value(){return l(w)},set value(L){f(w,L)},$$legacy:!0})}},$$slots:{default:!0}});var ee=p(o,2);E(ee,{children:(D,te)=>{{let F=j(()=>(m(r()),u(()=>r()("login.password"))));A(D,{get label(){return l(F)},lines:1,show_label:!0,max_lines:1,type:"password",onsubmit:S,get value(){return l(B)},set value(L){f(B,L)},$$legacy:!0})}},$$slots:{default:!0}}),i(e,s)},$$slots:{default:!0}});var Z=p(X,2);me(Z,{size:"lg",variant:"primary",onclick:S,children:(e,a)=>{ie();var s=oe();g(o=>P(s,o),[()=>(m(r()),u(()=>r()("login.login")))]),i(e,s)},$$slots:{default:!0}}),g(e=>P(K,e),[()=>(m(r()),u(()=>r()("login.login")))]),i(t,v)},$$slots:{default:!0}}),$(y),g(()=>q=ae(y,1,"wrap svelte-14xt79u",null,q,{"min-h-screen":k()})),i(H,y),le(I)}export{He as default};
