1import { p as prop, e as init, i as if_block, b as set_class } from './i18n-CMo5lpzy.js'; 2import { R as push, S as first_child, X as sibling, w as get, x as set, ad as derived_safe_equal, G as deep_read_state, z as untrack, a as append, a7 as text, t as template_effect, a0 as set_text, V as child, T as pop, a3 as mutable_source, U as flushSync, W as from_html, Y as reset, a8 as next } from './index-BvBk1Iap.js'; 3import { h as html } from './html-CdUEtR5E.js'; 4import { B as BaseForm } from './BaseForm-0cuxY3Cw.js'; 5import { T as Textbox } from './Textbox-v-cNeNHQ.js'; 6import './StreamingBar.svelte_svelte_type_style_lang-CdFIGsJa.js'; 7import { B as Block } from './Block-Bx3BikCN.js'; 8import './ScrollFade.svelte_svelte_type_style_lang-Xm-PLg9E.js'; 9/* empty css */ 10import { B as Button } from './Button-CH2w4_A4.js'; 11import { B as BaseColumn } from './Index.svelte_svelte_type_style_lang-C97CbKPo.js'; 12import './actions-Cit_UA5S.js'; 13import './input-C317uaXR.js'; 14import './BlockTitle-7XQ-8ENg.js'; 15import './Info-BrkJhX6_.js'; 16import './Check-BlnBgjLT.js'; 17import './Copy-DFFray7x.js'; 18import './Send-Ee555fP_.js'; 19import './Square-B6INQV79.js'; 20import './IconButtonWrapper-Ba0GidgU.js'; 21import './snippet-Bl5YVoCg.js'; 22import './index-C7e-J7CF.js'; 23import './Image-CDw5qb5O.js'; 24import './misc-ByVveAau.js'; 25/* empty css */ 26/* empty css */ 27import './index-Lz7fsHFt.js'; 28import './Clear-Dgs5UhTO.js'; 29 30var root_3 = from_html(`<p class="auth svelte-14xt79u"><!></p>`); 31var root_4 = from_html(`<p class="auth svelte-14xt79u"> </p>`); 32var root_5 = from_html(`<p class="creds svelte-14xt79u"> </p>`); 33var root_6 = from_html(`<!> <!>`, 1); 34var root_2 = from_html(`<h2 class="svelte-14xt79u"> </h2> <!> <!> <!> <!> <!>`, 1); 35var root_1 = from_html(`<div><!></div>`); 36 37function Login($$anchor, $$props) { 38 push($$props, false); 39 40 let root = prop($$props, 'root', 12); 41 let auth_message = prop($$props, 'auth_message', 12); 42 let app_mode = prop($$props, 'app_mode', 12); 43 let space_id = prop($$props, 'space_id', 12); 44 let i18n = prop($$props, 'i18n', 12); 45 let username = mutable_source(""); 46 let password = mutable_source(""); 47 let incorrect_credentials = mutable_source(false); 48 49 const submit = async () => { 50 const formData = new FormData(); 51 52 formData.append("username", get(username)); 53 formData.append("password", get(password)); 54 55 // Use URL constructor to properly join paths and avoid double slashes 56 const login_url = new URL("login", root().endsWith("/") ? root() : root() + "/").href; 57 58 let response = await fetch(login_url, { method: "POST", body: formData }); 59 60 if (response.status === 400) { 61 set(incorrect_credentials, true); 62 set(username, ""); 63 set(password, ""); 64 } else if (response.status == 200) { 65 location.reload(); 66 } 67 }; 68 69 var $$exports = { 70 get root() { 71 return root(); 72 }, 73 74 set root($$value) { 75 root($$value); 76 flushSync(); 77 }, 78 79 get auth_message() { 80 return auth_message(); 81 }, 82 83 set auth_message($$value) { 84 auth_message($$value); 85 flushSync(); 86 }, 87 88 get app_mode() { 89 return app_mode(); 90 }, 91 92 set app_mode($$value) { 93 app_mode($$value); 94 flushSync(); 95 }, 96 97 get space_id() { 98 return space_id(); 99 }, 100 101 set space_id($$value) { 102 space_id($$value); 103 flushSync(); 104 }, 105 106 get i18n() { 107 return i18n(); 108 }, 109 110 set i18n($$value) { 111 i18n($$value); 112 flushSync(); 113 } 114 }; 115 116 init(); 117 118 var div = root_1(); 119 let classes; 120 var node = child(div); 121 122 BaseColumn(node, { 123 variant: 'panel', 124 min_width: 480, 125 children: ($$anchor, $$slotProps) => { 126 var fragment = root_2(); 127 var h2 = first_child(fragment); 128 var text$1 = child(h2, true); 129 130 reset(h2); 131 132 var node_1 = sibling(h2, 2); 133 134 { 135 var consequent = ($$anchor) => { 136 var p = root_3(); 137 var node_2 = child(p); 138 139 html(node_2, auth_message); 140 reset(p); 141 append($$anchor, p); 142 }; 143 144 if_block(node_1, ($$render) => { 145 if (auth_message()) $$render(consequent); 146 }); 147 } 148 149 var node_3 = sibling(node_1, 2); 150 151 { 152 var consequent_1 = ($$anchor) => { 153 var p_1 = root_4(); 154 var text_1 = child(p_1, true); 155 156 reset(p_1); 157 158 template_effect(($0) => set_text(text_1, $0), [ 159 () => (
160 deep_read_state(i18n()), 161 untrack(() => i18n()("login.enable_cookies")) 162 ) 163 ]); 164 165 append($$anchor, p_1); 166 }; 167 168 if_block(node_3, ($$render) => { 169 if (space_id()) $$render(consequent_1); 170 }); 171 } 172 173 var node_4 = sibling(node_3, 2); 174 175 { 176 var consequent_2 = ($$anchor) => { 177 var p_2 = root_5(); 178 var text_2 = child(p_2, true); 179 180 reset(p_2); 181 182 template_effect(($0) => set_text(text_2, $0), [ 183 () => ( 184 deep_read_state(i18n()), 185 untrack(() => i18n()("login.incorrect_credentials")) 186 ) 187 ]); 188 189 append($$anchor, p_2); 190 }; 191 192 if_block(node_4, ($$render) => { 193 if (get(incorrect_credentials)) $$render(consequent_2); 194 }); 195 } 196 197 var node_5 = sibling(node_4, 2); 198 199 BaseForm(node_5, { 200 children: ($$anchor, $$slotProps) => { 201 var fragment_1 = root_6(); 202 var node_6 = first_child(fragment_1); 203 204 Block(node_6, { 205 children: ($$anchor, $$slotProps) => { 206 { 207 let $0 = derived_safe_equal(() => ( 208 deep_read_state(i18n()), 209 untrack(() => i18n()("login.username")) 210 )); 211 212 Textbox($$anchor, { 213 get label() { 214 return get($0); 215 }, 216 lines: 1, 217 show_label: true, 218 max_lines: 1, 219 onsubmit: submit, 220 get value() { 221 return get(username); 222 }, 223 224 set value($$value) { 225 set(username, $$value); 226 }, 227 $$legacy: true 228 }); 229 } 230 }, 231 $$slots: { default: true } 232 }); 233 234 var node_7 = sibling(node_6, 2); 235 236 Block(node_7, { 237 children: ($$anchor, $$slotProps) => { 238 { 239 let $0 = derived_safe_equal(() => ( 240 deep_read_state(i18n()), 241 untrack(() => i18n()("login.password")) 242 )); 243 244 Textbox($$anchor, { 245 get label() { 246 return get($0); 247 }, 248 lines: 1, 249 show_label: true, 250 max_lines: 1, 251 type: 'password', 252 onsubmit: submit, 253 get value() { 254 return get(password); 255 }, 256 257 set value($$value) { 258 set(password, $$value); 259 }, 260 $$legacy: true 261 }); 262 } 263 }, 264 $$slots: { default: true } 265 }); 266 267 append($$anchor, fragment_1); 268 }, 269 $$slots: { default: true } 270 }); 271 272 var node_8 = sibling(node_5, 2); 273 274 Button(node_8, { 275 size: 'lg', 276 variant: 'primary', 277 onclick: submit, 278 children: ($$anchor, $$slotProps) => { 279 next(); 280 281 var text_3 = text(); 282 283 template_effect(($0) => set_text(text_3, $0), [ 284 () => ( 285 deep_read_state(i18n()), 286 untrack(() => i18n()("login.login")) 287 ) 288 ]); 289 290 append($$anchor, text_3); 291 }, 292 $$slots: { default: true } 293 }); 294 295 template_effect(($0) => set_text(text$1, $0), [ 296 () => ( 297 deep_read_state(i18n()), 298 untrack(() => i18n()("login.login")) 299 ) 300 ]); 301 302 append($$anchor, fragment); 303 }, 304 $$slots: { default: true } 305 }); 306 307 reset(div); 308 template_effect(() => classes = set_class(div, 1, 'wrap svelte-14xt79u', null, classes, { 'min-h-screen': app_mode() })); 309 append($$anchor, div); 310 311 return pop($$exports); 312} 313 314export { Login as default }; 315//# sourceMappingURL=Login-DbEEw7Ia.js.map
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.