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