import{t as e}from"./module.esm-BwdFUNDF.js";import{n as t,t as n}from"./submit-loader-BtPqcIBw.js";import{o as r}from"./http-CdJ4ujKK.js";function i({mode:e=`status`}={}){return{submitting:!1,errorMsg:``,statusMsg:``,async submit(t){if(!this.submitting){this.submitting=!0,this.errorMsg=``,this.statusMsg=``;try{let{data:n}=await this.$http.post(t.target.action,new FormData(t.target));if(e===`redirect`){window.location.href=n.redirect||`/login`;return}this.statusMsg=n.status||``,this.submitting=!1}catch(e){this.errorMsg=e.errors&&Object.values(e.errors).flat()[0]||e.message||``,e.errors&&this.$http.applyValidationErrors(t.target,e.errors),this.submitting=!1}}}}}document.addEventListener(`alpine:init`,()=>{t(e),r(e),e.data(`authForm`,i)}),window.Alpine=e,e.start(),n();