import{b as h,j as _}from"./entry.b54e9fef.js";import{I as p,a as w,e as F,c as u,t as r,g as A}from"./helper.7f3868cf.js";/* empty css             */import{m as c,n as t,G as n,y as d,p as l,x as S,D as k,q as b,F as y,S as v}from"./vue.24564602.js";import"./i18n.40531e16.js";import"./libs.8dc969cc.js";const P={name:"I8AuthFormCommon",components:{I8AuthForm:p,I8PasswordResetForm:w},provide:()=>({env:F}),props:{waitUntilAuthConfigured:{type:Boolean,default:!1},isRegisterTab:{type:Boolean,required:!1,default:!0},userProcessingEmail:{type:String,required:!1,default:""}},emits:["success","forgot-password"],setup(){const e=A("landings");return{authStore:_(),project:e}},data:()=>({isForgotPassword:!1,isAuthConfigured:!1}),async created(){this.waitUntilAuthConfigured&&(await u(this.$i18n.locale),await this.$nextTick(),this.isAuthConfigured=!0)},mounted(){this.waitUntilAuthConfigured||u(this.$i18n.locale)},methods:{onLogin(e){this.onSuccess(e),r("login")},onRegister(e){this.onSuccess(e),r("registration",e)},onSubscribeNewsletter(){r("newsletter")},onSuccess(e){e.token?(this.authStore.fillUserInfo(e.token),this.$emit("success")):console.warn("No token provided")},onForgotPassword(){this.isForgotPassword=!0,this.$emit("forgot-password")}}},C={key:1};function I(e,i,o,m,R,s){const g=c("i8-auth-form",!0),f=c("i8-password-reset-form");return t(),n(v,{name:"fade-scale",mode:"out-in",appear:""},{default:d(()=>[!o.waitUntilAuthConfigured||e.isAuthConfigured?(t(),l(y,{key:0},[e.isForgotPassword?(t(),n(f,{key:1,class:"i8-auth-form__reset-pass"})):(t(),n(g,{key:0,"show-register-tab":o.isRegisterTab,"user-processing-email":o.userProcessingEmail,project:m.project,onLogin:s.onLogin,onRegister:s.onRegister,onSubscribeNewsletter:s.onSubscribeNewsletter,onForgotPassword:s.onForgotPassword},S({_:2},[k(e.$slots,(j,a)=>({name:a,fn:d(()=>[b(e.$slots,a,{},void 0,!0)])}))]),1032,["show-register-tab","user-processing-email","project","onLogin","onRegister","onSubscribeNewsletter","onForgotPassword"]))],64)):(t(),l("div",C))]),_:3})}const E=h(P,[["render",I],["__scopeId","data-v-03a4363e"]]);export{E as default};
