import{p as c,e as re,i as R,b as ae}from"./i18n-Dnhn5Rxr.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-DWyDLubb.js";import{h as ne}from"./html-Ih_5QVTo.js";import{B as pe}from"./BaseForm-B7Gu_hvH.js";import{T as A}from"./Textbox-BuFR2fNz.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{B as E}from"./Block-J4oodUWp.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";/* empty css                                              */import{B as me}from"./Button-D-_s2ksk.js";import{B as ue}from"./Index.svelte_svelte_type_style_lang-BKODC18H.js";import"./actions-CLThs9VH.js";import"./input-DrerMDOL.js";import"./BlockTitle-BMm9LakX.js";import"./Info-Dzjhnd64.js";import"./Check-DUAHzS2-.js";import"./Copy-ChCbTvli.js";import"./Send-B_rl9Hxa.js";import"./Square-CcB54dqq.js";import"./IconButtonWrapper-D0s9l4wW.js";import"./snippet-BWgYNF9D.js";import"./index-B_pwUImq.js";import"./Image-CeW7PJs4.js";import"./misc-vsnLZ-Y1.js";/* empty css                                            *//* empty css                                                   */import"./index-CglBvmLb.js";import"./Clear-BF6j078A.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};
