import{_ as O}from"./LogoMain-BCV8KvJE.js";import{U as I,aW as r,aH as F,bU as _,z as H,dm as P,H as T,o as b,a as t,b as i,w as o,G as U,c3 as V,e as y,bm as C,d as v,cC as W,bd as $,c2 as G,F as z,c7 as h,c as q,V as p,d2 as j,f as S,bW as M,bY as Y}from"./index-CxvxTWuH.js";import{c as J}from"./comment-CSye7JKO.js";import{_ as K}from"./ReCaptcha-g5PzMc6U.js";import{F as Q}from"./vee-validate.esm-B8FsPYbv.js";import{_ as X}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{L as Z}from"./LoginImage-BCBKa5WW.js";import"./customizer-CIgRPOmM.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 s=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))}),H(()=>_().shouldDashboardNotice);const x=P(),l=_(),A=J();function R(e,{setErrors:a}){return s.value=!0,console.log(l),m.value||(s.value=!1,a({apiError:"Please verify reCaptcha"})),console.log("authStore.login....",c.value,u.value,m.value),x.login(c.value,u.value,m.value).then(n=>{n.code==200?(E(),L()):(a({apiError:n.msg}),s.value=!1)}).catch(function(n){a({apiError:n}),s.value=!1})}function E(){console.log("getCurrentMerchant"),x.currentMerchant().then(async e=>{console.log("getCurrentMerchant....",E),await l.SET_MERCHANT_INFO_MUTATIONS().then(()=>{if(console.log("res.data.login...",e.data.login),e.data.login)if(s.value=!1,l.SET_lOGIN_MSG_MUTATIONS({username:c.value,password:u.value}),g.value==!0?l.SET_IS_REMEMBER_PWD(!0):l.SET_IS_REMEMBER_PWD(!1),console.log("res.data.login2...",e.data.login),sessionStorage.getItem("lastRoute")){let a=B(sessionStorage.getItem("lastRoute"));h.push(a)}else h.push("/affiliate")})})}function L(){A.noticeList({type:3}).then(e=>{e.code==200&&(l.SET_SHOULD_DASHBOARD_NOTICE_Mutations(!0),l.SET_DASHBOARDNOTICE_INTERVAL(e.data.dashboardNoticeInterval),l.SET_NOTICE_LIST(e.data.itemList))})}function B(e){return e.startsWith("/app")?e.slice(4):e}function D(){h.push("/auth/forgot-password")}const k=e=>(console.log("val....",e),m.value=e,e);return(e,a)=>(b(),T(z,null,[t(C(Q),{onSubmit:R,class:"mt-7 loginForm"},{default:o(({errors:n})=>[t(V,{modelValue:c.value,"onUpdate:modelValue":a[0]||(a[0]=f=>c.value=f),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":a[1]||(a[1]=f=>u.value=f),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":a[2]||(a[2]=f=>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:D,class:"text-secondary text-decoration-none cursor-pointer"},"Forgot password?")])]),t(K,{onGetChildren:k}),t(y,{color:"secondary",loading:C(s),block:"",class:"mt-2",variant:"flat",size:"large",disabled:N.value,type:"submit"},{default:o(()=>a[3]||(a[3]=[v(" Sign In")])),_:1},8,["loading","disabled"]),n.apiError?(b(),T("div",ee,[t(W,{color:"error"},{default:o(()=>[v($(n.apiError),1)]),_:2},1024)])):U("",!0)]),_:1}),i("div",te,[t(G),t(y,{variant:"plain",to:"/register",class:"mt-2 text-capitalize mr-n2"},{default:o(()=>a[4]||(a[4]=[v("Don't Have an account?")])),_:1})])],64))}}),oe=X(ae,[["__scopeId","data-v-bc58199a"]]),se={class:"pa-0 pa-sm-12"},fe=I({__name:"LoginPage",setup(w){return(g,s)=>(b(),q(S,{class:"h-100vh","no-gutters":""},{default:o(()=>[t(p,{cols:"12",lg:"7",xl:"7",class:"d-flex align-center bg-lightprimary"},{default:o(()=>[t(j,null,{default:o(()=>[i("div",se,[t(S,{justify:"center"},{default:o(()=>[t(p,{cols:"12",lg:"10",xl:"6",md:"7"},{default:o(()=>[t(M,{elevation:"0",class:"loginBox"},{default:o(()=>[t(M,{variant:"outlined"},{default:o(()=>[t(Y,{class:"pa-9"},{default:o(()=>[t(S,null,{default:o(()=>[t(p,{cols:"12",md:"7",sm:"7","order-sm":"first",order:"last",class:"text-sm-start text-center"},{default:o(()=>s[0]||(s[0]=[i("h2",{class:"text-secondary text-h2"},"Hi, Welcome Back",-1),i("h4",{class:"text-h4"},"Login in to your account",-1)])),_:1}),t(p,{class:"text-sm-end text-center",sm:"5",cols:"12"},{default:o(()=>[t(O)]),_:1})]),_:1}),t(oe)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})])]),_:1})]),_:1}),t(Z)]),_:1}))}});export{fe as default};