import{_ as R,r as m,E as z,u as O,K as H,g as K,i as L,c as p,o as v,a as e,D as g,b as a,t as n,B as P,C as S,l as C,j as Y,w as q,d as V,v as G,M as J,H as Q,f as y,S as h,e as W}from"./app-L4cdeQDO.js";import{i as X,j as Z,F as ee}from"./index-C-hHfgK1.js";/* empty css            */const se={class:"login-section"},te={class:"container"},oe={class:"row"},ae={class:"col-12 col-lg-5 py-5 my-auto mx-md-auto"},ne={class:"card shadow-sm border-0 rounded-4"},le={key:0,class:"version-badge"},re={key:1,class:"powerBy"},ie={class:"text-start logo-img mb-2"},de=["src"],ce={class:"d-flex p-2 p-md-4"},ue={class:"my-auto w-100"},me={class:"fw-bold mb-3"},pe={class:"text-muted"},ve={class:"mb-4"},fe=["placeholder"],_e={key:0,class:"text-danger fw-bold mt-2"},ge={class:"mb-3 position-relative"},ye=["type","placeholder"],he={key:0,class:"text-danger fw-bold mt-2"},we={type:"submit",class:"btn btn-primary w-100 rounded-2"},be={key:0,class:"border p-3 d-flex flex-wrap gap-3 align-items-center justify-content-between rounded-4 my-3"},Se={__name:"Login",setup(De){let u=m("");const D=m(!1),$=W(),A=z(),l=O(),w=m(""),b=m(""),k=m("Sign in"),{t:F}=H();let d=m(!1);const N=async()=>{var s,t,c,r,f,_;try{D.value=!0,k.value="Signing in...";const o=await L.post("/login",{email:w.value,password:b.value});A.setAuthData(o.data.data.token,o.data.data.user),h.fire({icon:"success",title:"Success",text:"Login successful",showConfirmButton:!1,timer:1500}),localStorage.getItem("handle_course_id")?($.push("/checkout/"+localStorage.getItem("handle_course_id")),localStorage.removeItem("handle_course_id")):$.push("/dashboard")}catch(o){D.value=!1,(s=o==null?void 0:o.response)!=null&&s.data.errors?u.value=(t=o==null?void 0:o.response)==null?void 0:t.data.errors:u.value=(c=o==null?void 0:o.response)==null?void 0:c.data.message,k.value="Sign in",((r=o==null?void 0:o.response)==null?void 0:r.status)===403&&h.fire({icon:"error",title:"Oops...",text:((_=(f=o.response)==null?void 0:f.data)==null?void 0:_.message)||"Login failed. Please try again."})}},U=(s,t)=>{w.value=s,b.value=t,h.mixin({toast:!0,position:"top-end",showConfirmButton:!1,timer:3e3,timerProgressBar:!0,didOpen:r=>{r.onmouseenter=h.stopTimer,r.onmouseleave=h.resumeTimer}}).fire({icon:"success",title:F("Demo credentials copied Successfully!!")})};return K(async()=>{l.data||L.get("/master",{headers:{"Content-Type":"application/json",Accept:"application/json"}}).then(s=>{l.setMasterData(s.data.data.master)}).catch(s=>{console.error("Error fetching data:",s)})}),(s,t)=>{var r,f,_,o,x,B,T,E,M,j;const c=Y("router-link");return v(),p("section",se,[e("div",te,[e("div",oe,[e("div",ae,[e("div",ne,[((f=(r=a(l))==null?void 0:r.masterData)==null?void 0:f.mode)=="local"?(v(),p("div",le,"v"+n((o=(_=a(l))==null?void 0:_.masterData)==null?void 0:o.version),1)):g("",!0),((B=(x=a(l))==null?void 0:x.masterData)==null?void 0:B.mode)=="local"?(v(),p("div",re,"Powered by RazinSoft ©"+n(new Date().getFullYear()),1)):g("",!0),e("div",{class:P(["card-body",((E=(T=a(l))==null?void 0:T.masterData)==null?void 0:E.mode)=="local"?"pb-5":"pb-0"])},[e("div",ie,[S(c,{to:"/"},{default:C(()=>{var i,I;return[e("img",{src:(I=(i=a(l))==null?void 0:i.masterData)==null?void 0:I.logo,class:"object-fit-cover",alt:"Login"},null,8,de)]}),_:1})]),e("div",ce,[e("div",ue,[e("h3",me,n(s.$t("Login")),1),e("span",pe,n(s.$t("Boost your skill always and forever"))+".",1),e("form",{class:"my-4",onSubmit:q(N,["prevent"])},[e("div",ve,[V(e("input",{type:"email","onUpdate:modelValue":t[0]||(t[0]=i=>w.value=i),class:"form-control",placeholder:s.$t("Email Address")},null,8,fe),[[G,w.value]]),a(u).email?(v(),p("p",_e,n(a(u).email[0]),1)):g("",!0)]),e("div",ge,[V(e("input",{type:a(d)?"text":"password","onUpdate:modelValue":t[1]||(t[1]=i=>b.value=i),class:"form-control",placeholder:s.$t("Password")},null,8,ye),[[J,b.value]]),a(u).password?(v(),p("p",he,n(a(u).password[0]),1)):g("",!0),e("div",{class:"eye-icon",onClick:t[2]||(t[2]=i=>Q(d)?d.value=!a(d):d=!a(d))},[S(a(ee),{icon:a(d)?a(X):a(Z)},null,8,["icon"])])]),S(c,{to:"/reset_password",class:"small d-block text-decoration-none mb-4"},{default:C(()=>[y(n(s.$t("Forgot your password"))+"?",1)]),_:1}),e("button",we,[e("span",{class:P({loader:D.value})},n(k.value),3)])],32),e("span",null,[y(n(s.$t("Don't have an account"))+"? ",1),S(c,{to:"/register"},{default:C(()=>[y(n(s.$t("Sign Up")),1)]),_:1})]),((j=(M=a(l))==null?void 0:M.masterData)==null?void 0:j.mode)=="local"?(v(),p("div",be,[e("div",null,[e("strong",null,n(s.$t("Email"))+":",1),t[4]||(t[4]=y(" user@readylms.com ",-1)),t[5]||(t[5]=e("br",null,null,-1)),e("strong",null,n(s.$t("Password"))+":",1),t[6]||(t[6]=y(" secret@123 ",-1))]),e("button",{onClick:t[3]||(t[3]=i=>U("user@readylms.com","secret@123")),class:"btn btn-sm btn-outline-primary small float-end"},n(s.$t("Copy")),1)])):g("",!0)])])],2)])])])])])}}},xe=R(Se,[["__scopeId","data-v-389136ff"]]);export{xe as default};
