import"./svelte/svelte_internal_flags_legacy.js";import"./svelte/svelte_internal_flags_async.js";import*as e from"./svelte/svelte_internal_client.js";import"./i18n-BldJSFLV.js";import"./svelte/svelte_svelte.js";import{B as H}from"./BaseForm-C8gZwaiu.js";import{BaseTextbox as q}from"./Index-DVLnugaJ.js";import{B as I}from"./Button-D-Ky-vOi.js";import{B as J}from"./Index.svelte_svelte_type_style_lang-Bv_DpXXD.js";import{B as D}from"./IconButtonWrapper-Cljb5D-5.js";import"./svelte/svelte_store.js";import"./index-Ds2meNS5.js";import"./svelte/svelte_animate.js";import"./svelte/svelte_attachments.js";import"./svelte/svelte_easing.js";import"./svelte/svelte_internal_flags_tracing.js";import"./svelte/svelte_internal_server.js";import"./svelte/svelte_legacy.js";import"./svelte/svelte_motion.js";import"./svelte/svelte_reactivity.js";import"./svelte/svelte_reactivity_window.js";import"./svelte/svelte_server.js";import"./svelte/svelte_transition.js";import"./svelte/svelte_events.js";import"./StreamingBar-b2qVLPYU.js";import"./MarkdownCode-C2b9iIxl.js";import"./prism-python-CpYAgONt.js";import"./utils.svelte-Ceck75cM.js";import"./Example-gF45j9DF.js";import"./Image-Bdf4wQSw.js";import"./ImagePreview-Cx854cRW.js";import"./ShareButton-DCJS4lh5.js";import"./FullscreenButton-Cqzqqtq6.js";var K=e.from_html('<p class="auth svelte-14xt79u"><!></p>'),M=e.from_html('<p class="auth svelte-14xt79u"> </p>'),N=e.from_html('<p class="creds svelte-14xt79u"> </p>'),Q=e.from_html("<!> <!>",1),R=e.from_html('<h2 class="svelte-14xt79u"> </h2> <!> <!> <!> <!> <!>',1),U=e.from_html("<div><!></div>");function Te(F,i){e.push(i,!1);let d=e.prop(i,"root",12),p=e.prop(i,"auth_message",12),u=e.prop(i,"app_mode",12),c=e.prop(i,"space_id",12),a=e.prop(i,"i18n",12),n=e.mutable_source(""),m=e.mutable_source(""),b=e.mutable_source(!1);const f=async()=>{const r=new FormData;r.append("username",e.get(n)),r.append("password",e.get(m));let v=await fetch(d()+"/login",{method:"POST",body:r});v.status===400?(e.set(b,!0),e.set(n,""),e.set(m,"")):v.status==200&&location.reload()};var z={get root(){return d()},set root(r){d(r),e.flush()},get auth_message(){return p()},set auth_message(r){p(r),e.flush()},get app_mode(){return u()},set app_mode(r){u(r),e.flush()},get space_id(){return c()},set space_id(r){c(r),e.flush()},get i18n(){return a()},set i18n(r){a(r),e.flush()}};e.init();var _=U();let w;var C=e.child(_);return J(C,{variant:"panel",min_width:480,children:(r,v)=>{var k=R(),g=e.first_child(k),L=e.child(g,!0);e.reset(g);var B=e.sibling(g,2);{var O=t=>{var s=K(),o=e.child(s);e.html(o,p),e.reset(s),e.append(t,s)};e.if(B,t=>{p()&&t(O)})}var y=e.sibling(B,2);{var S=t=>{var s=M(),o=e.child(s,!0);e.reset(s),e.template_effect(l=>e.set_text(o,l),[()=>(e.deep_read_state(a()),e.untrack(()=>a()("login.enable_cookies")))]),e.append(t,s)};e.if(y,t=>{c()&&t(S)})}var P=e.sibling(y,2);{var j=t=>{var s=N(),o=e.child(s,!0);e.reset(s),e.template_effect(l=>e.set_text(o,l),[()=>(e.deep_read_state(a()),e.untrack(()=>a()("login.incorrect_credentials")))]),e.append(t,s)};e.if(P,t=>{e.get(b)&&t(j)})}var T=e.sibling(P,2);H(T,{children:(t,s)=>{var o=Q(),l=e.first_child(o);D(l,{children:(h,G)=>{{let x=e.derived_safe_equal(()=>(e.deep_read_state(a()),e.untrack(()=>a()("login.username"))));q(h,{get label(){return e.get(x)},lines:1,show_label:!0,max_lines:1,get value(){return e.get(n)},set value($){e.set(n,$)},$$events:{submit:f},$$legacy:!0})}},$$slots:{default:!0}});var E=e.sibling(l,2);D(E,{children:(h,G)=>{{let x=e.derived_safe_equal(()=>(e.deep_read_state(a()),e.untrack(()=>a()("login.password"))));q(h,{get label(){return e.get(x)},lines:1,show_label:!0,max_lines:1,type:"password",get value(){return e.get(m)},set value($){e.set(m,$)},$$events:{submit:f},$$legacy:!0})}},$$slots:{default:!0}}),e.append(t,o)},$$slots:{default:!0}});var A=e.sibling(T,2);I(A,{size:"lg",variant:"primary",onclick:f,children:(t,s)=>{e.next();var o=e.text();e.template_effect(l=>e.set_text(o,l),[()=>(e.deep_read_state(a()),e.untrack(()=>a()("login.login")))]),e.append(t,o)},$$slots:{default:!0}}),e.template_effect(t=>e.set_text(L,t),[()=>(e.deep_read_state(a()),e.untrack(()=>a()("login.login")))]),e.append(r,k)},$$slots:{default:!0}}),e.reset(_),e.template_effect(()=>w=e.set_class(_,1,"wrap svelte-14xt79u",null,w,{"min-h-screen":u()})),e.append(F,_),e.pop(z)}export{Te as default};
