const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WebSystemOutageMessaging-BNMMaNiF.mjs","./iHN4ezdB.js","./entry.C9NmUZ0o.css","./WebSystemOutageMessaging.Cd-9fIgR.css"])))=>i.map(i=>d[i]); import{_ as B}from"./ViewPageEventTrigger.vue-Dvnz2z9y.mjs";import{_ as I,b as k,c as a,o as n,K as q,d,v,a as t,p as m,l as c,t as E,bP as A,O,bQ as W,Q as V,q as g,ab as F,b5 as z,N as J,z as K,bg as u,i as p,al as x,bJ as $,u as H,f as R,bW as N,M as Q,m as C,F as Y}from"./iHN4ezdB.js";const G=q(()=>Q(()=>import("./WebSystemOutageMessaging-BNMMaNiF.mjs"),__vite__mapDeps([0,1,2,3]),import.meta.url).then(e=>e.default||e)),X={props:{},async setup(){const{$gql:e}=H(),{trackRegistration:s}=R(),i=await e.query("getReCAPTCHAPublicKey");return{tenantRecaptchaPublicKey:i==null?void 0:i.data,trackRegistration:s,RegistrationActions:N}},data(){return{mode:"login",siteUser:null,loginValues:{username:"",password:""},resetPasswordValues:{email:""},error:null,showErrors:!1,loginErrors:{},resetPasswordErrors:{},processing:!1,qualifyingMembership:!1,message:null,recaptcha:null}},computed:{returnedFromSSO(){var e,s;return(s=(e=p())==null?void 0:e.query)==null?void 0:s.siteUserToken},submitDisabled(){var e,s;return this.mode==="login"&&(!((e=this.loginValues)!=null&&e.username)||!((s=this.loginValues)!=null&&s.password))||this.mode==="reset-password"&&!this.resetPasswordValues.email},loginFieldInfo(){return{rows:[{fields:{username:{type:"email_input",label:"Email",placeholder:"Enter Email",required:!0,disabled:this.processing,showErrors:this.showErrors,icon:!0},password:{type:"password",label:"Password",placeholder:"Enter Password",required:!0,disabled:this.processing,showErrors:this.showErrors,icon:!0}}}]}},resetPasswordFieldInfo(){return{rows:[{fields:{email:{type:"email_input",label:"Email",placeholder:"Enter Email",required:!0,disabled:this.processing,showErrors:this.showErrors,icon:!0}}}]}}},async mounted(){const{query:e,hash:s}=p();this.siteUser=u.getUserInfo(),u.isLoggedIn()&&(window.location=(e==null?void 0:e.redirectTo)===""||(e==null?void 0:e.redirectTo)===void 0?"/account":`${e==null?void 0:e.redirectTo}${s}`),this.recaptcha=$(this.tenantRecaptchaPublicKey),e.email&&(this.loginValues.username=e.email),e.mode==="resetPassword"&&this.setMode("reset-password")},methods:{async register(){await trackRegistration(this.RegistrationActions.ClickLoginFormJoinLink),await u.goToJoinPage()},setMode(e){this.mode=e,e==="reset-password"?this.resetPasswordValues.email=this.loginValues.username:e==="login"&&(this.loginValues.username=this.resetPasswordValues.email)},update(e,s,i){this.mode==="login"?(this.loginValues[e]=s,this.loginErrors[e]={errorObj:i}):(this.resetPasswordValues[e]=s,this.resetPasswordErrors[e]={errorObj:i})},submitForm(){this.showErrors=x(this.mode==="login"?this.loginErrors:this.resetPasswordErrors??{})>0},async handleSubmit(){try{this.error="",this.processing=!0;let e=null;if(this.mode==="login"){const s=await this.recaptcha("siteUserLogin");if(e=await u.login(this.loginValues.username,this.loginValues.password,s),e!=null&&e.error)throw this.processing=!1,new Error(e.message)}if(this.mode==="reset-password"){const s=await this.recaptcha("siteUserResetPassword");e=await u.requestPasswordReset(this.resetPasswordValues.email,p().path,s),this.processing=!1,this.message=`You will receive an email momentarily if the account exists. Check your spam folder if you don’t see the email. Contact customerservice@${this.$ss.general.rootDomain} for further assistance.`}}catch(e){this.error=e,this.processing=!1}}}},Z={key:0},j={key:1},ee={key:0,class:"preface"},se={class:"submit"},re={class:"links"};function oe(e,s,i,S,r,o){var h,f;const D=G,L=W,T=z,U=A,M=J;return(h=e.$ss.systemOutage)!=null&&h.disableOmeda?(n(),k(D,{key:0})):(n(),a("div",{key:1,ref:"loginForm",class:K(["login-form",e.$ss.useNewDesign?"new-design":""]),style:m({fontFamily:e.$ss.primaryFontFamily,backgroundColor:(f=e.$ss)!=null&&f.useNewDesign?"":"#ffffff"})},[d(M,null,{default:v(()=>{var w,_,b;return[t("h1",{class:"title",style:m({fontFamily:e.$ss.primaryFontFamily,color:(w=e.$ss)!=null&&w.useNewDesign?"var(--color-black)":e.$ss.baseStyles.primaryColor,marginBottom:(_=e.$ss)!=null&&_.useNewDesign?"0":"15px"})},[r.mode==="login"?(n(),a("span",Z,"Login to "+E(e.$ss.general.siteName),1)):c("",!0),r.mode==="reset-password"?(n(),a("span",j,"Reset Password")):c("",!0)],4),t("div",{class:"form-content",style:m({backgroundColor:(b=e.$ss)!=null&&b.useNewDesign?"var(--color-secondary-container)":"#ffffff"})},[d(U,{error:r.error,processing:r.processing,padding:"0",message:r.message,"qualifying-membership":r.qualifyingMembership},{default:v(()=>{var y,P;return[t("form",{class:"form",onSubmit:s[3]||(s[3]=O((...l)=>o.handleSubmit&&o.handleSubmit(...l),["prevent"]))},[r.mode==="login"&&e.$ss.memberships.siteLoginPageText?(n(),a("div",ee,[t("p",null,E(e.$ss.memberships.siteLoginPageText),1)])):c("",!0),r.mode==="reset-password"?(n(),a("div",{key:1,class:"preface",style:m({backgroundColor:(y=e.$ss)!=null&&y.useNewDesign?"":"#f0f0f0"})}," Please enter your email address below to reset your password. ",4)):c("",!0),(n(),k(L,{key:r.mode,"field-info":r.mode==="login"?o.loginFieldInfo:o.resetPasswordFieldInfo,"field-values":r.mode==="login"?r.loginValues:r.resetPasswordValues,onUpdate:o.update},null,8,["field-info","field-values","onUpdate"])),t("div",se,[t("div",re,[V(t("a",{onClick:s[0]||(s[0]=l=>o.setMode("reset-password"))},"Reset Password",512),[[F,r.mode==="login"]]),V(t("a",{onClick:s[1]||(s[1]=l=>o.setMode("login"))},"Return to Login",512),[[F,r.mode==="reset-password"]]),s[4]||(s[4]=g(" | ")),t("a",{class:"register",onClick:s[2]||(s[2]=(...l)=>o.register&&o.register(...l))},"Join")]),d(T,{label:r.mode==="login"?"Login":"Reset",disabled:o.submitDisabled,type:"submit",onOnClick:o.submitForm},null,8,["label","disabled","onOnClick"])])],32),t("div",{class:"consent",style:m({backgroundColor:(P=e.$ss)!=null&&P.useNewDesign?"":"#f0f0f0"})},s[5]||(s[5]=[g(" By creating an account, you are agreeing to Endeavor Business Media's "),t("a",{href:"https://www.endeavorbusinessmedia.com/endeavor-terms",target:"_blank",rel:"noopener"},"Terms of Service",-1),g(" and "),t("a",{href:"https://www.endeavorbusinessmedia.com/privacy-policy",target:"_blank",rel:"noopener"},"Privacy Policy",-1)]),4)]}),_:1},8,["error","processing","message","qualifying-membership"])],4)]}),_:1})],6))}const te=I(X,[["render",oe],["__scopeId","data-v-3b98fd2e"]]),ae={__name:"SiteUserLoginBlock",setup(e){const{trackRegistration:s}=R();return(i,S)=>{const r=B,o=te;return n(),a(Y,null,[d(r,{event:()=>C(s)(C(N).ViewLoginPage)},null,8,["event"]),d(o)],64)}}};export{ae as default};