import{r as o,h as r,H as a}from"./p-9576a29b.js";import{c as t}from"./p-d8e783d1.js";import"./p-0bc4f624.js";import{s}from"./p-17b7253a.js";import"./p-b423423b.js";import{r as m}from"./p-a6974d5a.js";import{a as e}from"./p-539e53cb.js";import{c as i}from"./p-c7f96882.js";const l=class{constructor(r){o(this,r),this.formId="login"}componentWillLoad(){e.identity&&m.router.push("/")}async formEventHandler({detail:o}){if(o.formId!=this.formId)return;const r=await t.client.mutate({mutation:s(i),variables:{email:o.email.value,password:o.password.value}});r.data.userAuthenticate?(e.identity=r.data.userAuthenticate,this.onSuccess?this.onSuccess():m.router.push("/")):this.onFail&&this.onFail()}render(){return r(a,null,r("corejam-box",{p:8,max:"md",mx:"auto",px:4,lgPx:0,flex:!0,direction:"col",justify:"between",mb:24},r("corejam-flash",null),r("corejam-box",{w:5,mx:"auto"},r("corejam-form-container",{name:this.formId},r("corejam-box",null,r("corejam-form-input",{name:"email",type:"text",formId:this.formId,label:"Email"}),r("corejam-box",null,r("corejam-form-input",{name:"password",type:"password",formId:this.formId,label:"Password"})),r("corejam-box",{flex:!0,direction:"col"},r("corejam-box",null,r("corejam-form-submit",{formId:this.formId},r("button",{type:"submit"},"Login"))),r("corejam-box",null,r("corejam-base-link",{href:"/login/reset"},"Reset Password"))))))))}};export{l as auth_form_login}