import{n as i,a_ as L,c as B,f,d as _,aC as g,T as s,Z as x,a1 as E,a6 as m,a$ as D,b0 as C,o as N,j as A,a2 as F,a9 as U,b1 as $,ax as z,b2 as j,a7 as a,ay as l,a0 as H,b3 as W,az as q}from"./index-0cfc8c89.js";import"./dayjs-919e6097.js";import{D as Q}from"./DarkModeToggle-cdd0dfa0.js";var Z={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"};const Y=Z;function I(t){for(var e=1;e(t[t.LOGIN=0]="LOGIN",t[t.REGISTER=1]="REGISTER",t[t.RESET_PASSWORD=2]="RESET_PASSWORD",t))(p||{});const w=B(0);function P(){function t(n){w.value=n}const e=f(()=>w.value);function o(){t(0)}return{setLoginState:t,getLoginState:e,handleBackLogin:o}}const re={class:"mb-3 text-2xl font-bold text-center xl:text-3xl enter-x xl:text-left color-text"},ae=_({__name:"login-form-title",setup(t){const{t:e}=g(),{getLoginState:o}=P(),n=f(()=>({[p.RESET_PASSWORD]:e("sys.login.forgetFormTitle"),[p.LOGIN]:e("sys.login.signInFormTitle"),[p.REGISTER]:e("sys.login.signUpFormTitle")})[s(o)]);return(r,c)=>(x(),E("h2",re,m(n.value),1))}}),ie=_({__name:"login-form",setup(t){const{t:e}=g(),{setLoginState:o,getLoginState:n}=P(),r=f(()=>s(n)===p.LOGIN),c={type:"object",properties:{username:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{size:"large",allowClear:!0,placeholder:e("sys.login.usernamePlaceholder")},"x-content":{prefix:oe},"x-validator":{required:!0},default:"admin"},password:{type:"string","x-decorator":"FormItem","x-component":"Password","x-component-props":{size:"large",allowClear:!0,placeholder:e("sys.login.passwordPlaceholder")},"x-content":{prefix:X},required:!0,default:"admin"},submit:{type:"void","x-component":"Button","x-component-props":{size:"large",block:!0,type:"primary","@click":()=>y()},"x-reactions":{fulfill:{schema:{"x-component-props.loading":"{{ $form.submitting }}"}}},"x-content":e("sys.login.loginButton")}}},{FormilyForm:R,submit:V,form:v}=D({schema:c}),{notification:M}=$(),G=C(),y=async()=>{const u=await V();if(u)try{v.submitting=!0;const d=u,k={username:d.username,password:d.password},b=await G.login(k);b&&M.success({message:e("sys.login.loginSuccessTitle"),description:`${e("sys.login.loginSuccessDesc")}: ${b.username}`,duration:3})}catch(d){console.error(`login-error: ${d}`)}finally{v.submitting=!1}},h=u=>{u.keyCode===13&&r.value&&y()};return N(()=>{window.addEventListener("keydown",h)}),A(()=>{window.removeEventListener("keydown",h)}),(u,d)=>r.value?(x(),E(F,{key:0},[i(ae,{class:"enter-x"}),i(s(R))],64)):U("",!0)}}),le=["title","alt"],ce={class:"my-auto"},ue=["alt"],de={class:"mt-10 font-medium text-white -enter-x"},pe={class:"inline-block mt-4 text-2xl"},me={class:"mt-4 font-normal text-white text-md -enter-x"},_e={class:"absolute mt-4 right-4"},fe={class:"sm:w-4/6 xl:w-4/5 w-full mx-auto my-auto p-4 rounded-md shadow-md xl:shadow-none"},ge=_({name:"Login"}),Oe=_({...ge,setup(t){const{bem:e}=q("login"),{title:o}=z({VITE_PORT:"3000",VITE_GLOB_APP_TITLE:"SagooMedia",VITE_GLOB_APP_SHORT_NAME:"SagooMedia",VITE_NEED_LOGIN:"false",VITE_USE_MOCK:"true",VITE_PUBLIC_PATH:"/plugin/media",VITE_DROP_CONSOLE:"true",VITE_BUILD_COMPRESS:"none",VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE:"false",VITE_GLOB_HTTP_REFRESH_TIME:"5000",VITE_GLOB_GB_HTTP_REFRESH_TIME:"60000",VITE_USE_IMAGEMIN:"true",VITE_LEGACY:"false",VITE_M7S_SERVER:"/media",VITE_M7S_WS_SERVER:"/media",BASE_URL:"/plugin/media",MODE:"production",DEV:!1,PROD:!0,SSR:!1}),{t:n}=g();return(r,c)=>(x(),E("div",{class:l(s(e)())},[c[0]||(c[0]=j('',1)),a("div",{class:l([s(e)("slogan"),"hidden xl:flex"])},[a("div",{class:l(s(e)("logo"))},[a("img",{title:s(o),alt:s(o),src:ne},null,8,le),a("div",{class:l([s(e)("logo-title"),"truncate"])},m(s(o)),3)],2),a("div",ce,[a("img",{alt:s(o),src:se,class:"w-2/3 -enter-x"},null,8,ue),a("div",de,[a("span",pe,m(s(n)("sys.login.signInTitle")),1)]),a("div",me,m(s(n)("sys.login.signInDesc")),1)])],2),a("div",{class:l([s(e)("form"),"enter-x"])},[a("div",_e,[i(s(Q))]),a("div",fe,[i(s(W),{class:l(s(e)("card")),bodyStyle:{background:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"}},{default:H(()=>[i(ie)]),_:1},8,["class"])])],2)],2))}});export{Oe as default}; //# sourceMappingURL=login-1220728f.js.map