import{L as O}from"./LogoMain-BraKYMck.js";import{I,k as r,l as F,Q as _,R as P,aG as H,o as x,A as T,a as t,w as a,$ as V,b as i,d as y,N as C,e as v,bJ as U,t as W,s as $,M as G,F as q,W as h,c as z,a9 as j,V as S,f,ae as M,af as J}from"./index-DX6YuaFW.js";import{c as Q}from"./comment-BQy6qCgn.js";import{R as K}from"./ReCaptcha-CUzxhO31.js";import{F as X}from"./vee-validate.esm-DYGBJxK0.js";import{_ as Y}from"./_plugin-vue_export-helper-DlAUqK2U.js";/* empty css                                                   */import{L as Z}from"./LoginImage-BS95rrDw.js";import"./customizer-BDglo6NG.js";const ee={key:0,class:"mt-2"},te={class:"mt-5 text-right"},ae=I({__name:"AuthLogin",setup(w){const g=r(!1);let l=r(!1);const N=r(!1),d=r(!1),u=r(""),c=r(""),m=r("");F(()=>{const e=_();e.isRememberPwd&&(g.value=e.isRememberPwd,c.value=e.loginMsgmutations.username,u.value=e.loginMsgmutations.password,console.log("usersStore....",e.loginMsgmutations),console.log("username....",e.loginMsgmutations.username),console.log("password....",e.loginMsgmutations.password))}),P(()=>_().shouldDashboardNotice);const b=H(),s=_(),R=Q();function A(e,{setErrors:o}){return l.value=!0,console.log(s),m.value||(l.value=!1,o({apiError:"Please verify reCaptcha"})),console.log("authStore.login....",c.value,u.value,m.value),b.login(c.value,u.value,m.value).then(n=>{n.code==200?(E(),L()):(o({apiError:n.msg}),l.value=!1)}).catch(function(n){o({apiError:n}),l.value=!1})}function E(){console.log("getCurrentMerchant"),b.currentMerchant().then(async e=>{console.log("getCurrentMerchant....",E),await s.SET_MERCHANT_INFO_MUTATIONS().then(()=>{if(console.log("res.data.login...",e.data.login),e.data.login)if(l.value=!1,s.SET_lOGIN_MSG_MUTATIONS({username:c.value,password:u.value}),g.value==!0?s.SET_IS_REMEMBER_PWD(!0):s.SET_IS_REMEMBER_PWD(!1),console.log("res.data.login2...",e.data.login),sessionStorage.getItem("lastRoute")){let o=k(sessionStorage.getItem("lastRoute"));h.push(o)}else h.push("/affiliate")})})}function L(){R.noticeList({type:3}).then(e=>{e.code==200&&(s.SET_SHOULD_DASHBOARD_NOTICE_Mutations(!0),s.SET_DASHBOARDNOTICE_INTERVAL(e.data.dashboardNoticeInterval),s.SET_NOTICE_LIST(e.data.itemList),notices.value&&notices.value.length>0&&showNotice())})}function k(e){return e.startsWith("/app")?e.slice(4):e}function B(){h.push("/auth/forgot-password")}const D=e=>(console.log("val....",e),m.value=e,e);return(e,o)=>(x(),T(q,null,[t(C(X),{onSubmit:A,class:"mt-7 loginForm"},{default:a(({errors:n})=>[t(V,{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=p=>c.value=p),label:"Email Address",class:"mt-4 mb-8",required:"",density:"comfortable","hide-details":"auto",variant:"outlined",color:"primary"},null,8,["modelValue"]),t(V,{modelValue:u.value,"onUpdate:modelValue":o[1]||(o[1]=p=>u.value=p),label:"Password",required:"",density:"comfortable",variant:"outlined",color:"primary","hide-details":"auto","append-icon":d.value?"mdi-eye":"mdi-eye-off",type:d.value?"text":"password","onClick:append":o[2]||(o[2]=p=>d.value=!d.value),class:"pwdInput"},null,8,["modelValue","append-icon","type"]),i("div",{class:"d-sm-flex align-center mt-4 mb-4 mb-sm-0"},[i("div",{class:"ml-auto mb-4"},[i("a",{onClick:B,class:"text-secondary text-decoration-none cursor-pointer"},"Forgot password?")])]),t(K,{onGetChildren:D}),t(y,{color:"secondary",loading:C(l),block:"",class:"mt-2",variant:"flat",size:"large",disabled:N.value,type:"submit"},{default:a(()=>[v(" Sign In")]),_:1},8,["loading","disabled"]),n.apiError?(x(),T("div",ee,[t(U,{color:"error"},{default:a(()=>[v(W(n.apiError),1)]),_:2},1024)])):$("",!0)]),_:1}),i("div",te,[t(G),t(y,{variant:"plain",to:"/register",class:"mt-2 text-capitalize mr-n2"},{default:a(()=>[v("Don't Have an account?")]),_:1})])],64))}}),oe=Y(ae,[["__scopeId","data-v-4bfa31ad"]]),se={class:"pa-0 pa-sm-12"},le=i("h2",{class:"text-secondary text-h2"},"Hi, Welcome Back",-1),ne=i("h4",{class:"text-h4"},"Login in to your account",-1),_e=I({__name:"LoginPage",setup(w){return(g,l)=>(x(),z(S,{class:"h-100vh","no-gutters":""},{default:a(()=>[t(f,{cols:"12",lg:"7",xl:"7",class:"d-flex align-center bg-lightprimary"},{default:a(()=>[t(j,null,{default:a(()=>[i("div",se,[t(S,{justify:"center"},{default:a(()=>[t(f,{cols:"12",lg:"10",xl:"6",md:"7"},{default:a(()=>[t(M,{elevation:"0",class:"loginBox"},{default:a(()=>[t(M,{variant:"outlined"},{default:a(()=>[t(J,{class:"pa-9"},{default:a(()=>[t(S,null,{default:a(()=>[t(f,{cols:"12",md:"7",sm:"7","order-sm":"first",order:"last",class:"text-sm-start text-center"},{default:a(()=>[le,ne]),_:1}),t(f,{class:"text-sm-end text-center",sm:"5",cols:"12"},{default:a(()=>[t(O)]),_:1})]),_:1}),t(oe)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})])]),_:1})]),_:1}),t(Z)]),_:1}))}});export{_e as default};