import{_ as A}from"./DxB0DKYp.js";import{u as N,E as V,c as _,a as e,t as a,e as s,f as k,g as f,h as g,y as b,i as L,d as m,b as E,w as P,l as p,o as v,G as R}from"./BKiFavna.js";import{u as T}from"./BZ7f31ti.js";import{u as q}from"./DKzHUNYh.js";import{u as B}from"./BOqT4ZDK.js";import{_ as S}from"./DlAUqK2U.js";const C={class:"admin-login-wrap"},D={class:"admin-login-box"},I={class:"logo-section"},M={class:"form-group"},U={class:"form-group"},W=["placeholder"],$=["disabled"],z={key:0,class:"fas fa-spinner fa-spin"},F={class:"note"},G={__name:"login",setup(H){const{lang:o}=N(),{login:h,logout:w}=T(),c=q(),y=V(),u=p(""),d=p(""),i=p(!1),x=async()=>{i.value=!0;try{const n=await h(u.value,d.value);if(!["admin","editor"].includes(n.role)){w(),c.error(o.value==="bn"?"আপনি এডমিন প্যানেলে প্রবেশ করার অনুমতি নেই":"You are not authorized to access admin panel");return}c.success(o.value==="bn"?`স্বাগতম, ${n.name}!`:`Welcome, ${n.name}!`);const l=R().query.redirect||"/admin",r=typeof l=="string"&&l.startsWith("/admin")?l:"/admin";y.push(r)}catch(n){c.error(n.message||(o.value==="bn"?"লগইন ব্যর্থ":"Login failed"))}finally{i.value=!1}};return B({title:"Admin Login"}),(n,t)=>{const l=A;return v(),_("div",C,[e("div",D,[e("div",I,[t[2]||(t[2]=e("i",{class:"fas fa-shield-alt"},null,-1)),t[3]||(t[3]=e("h1",null,"Admin Panel",-1)),e("p",null,a(s(o)==="bn"?"অ্যাডমিন / এডিটর লগইন":"Admin / Editor Login"),1)]),e("form",{onSubmit:k(x,["prevent"]),class:"auth-form"},[e("div",M,[e("label",null,a(s(o)==="bn"?"ইমেইল":"Email"),1),f(e("input",{"onUpdate:modelValue":t[0]||(t[0]=r=>b(u)?u.value=r:null),type:"email",required:"",placeholder:"admin@newsverse.com",autocomplete:"email"},null,512),[[g,s(u)]])]),e("div",U,[e("label",null,a(s(o)==="bn"?"পাসওয়ার্ড":"Password"),1),f(e("input",{"onUpdate:modelValue":t[1]||(t[1]=r=>b(d)?d.value=r:null),type:"password",required:"",placeholder:s(o)==="bn"?"পাসওয়ার্ড":"Password",autocomplete:"current-password"},null,8,W),[[g,s(d)]])]),e("button",{type:"submit",disabled:s(i),class:"auth-btn"},[s(i)?(v(),_("i",z)):L("",!0),m(" "+a(s(i)?s(o)==="bn"?"লগইন হচ্ছে...":"Signing in...":s(o)==="bn"?"অ্যাডমিন প্যানেলে প্রবেশ করুন":"Access Admin Panel"),1)],8,$),e("div",F,[m(a(s(o)==="bn"?"সাধারণ ইউজার লগইনের জন্য":"For regular user login")+" ",1),E(l,{to:"/login"},{default:P(()=>[m(a(s(o)==="bn"?"এখানে ক্লিক করুন":"click here"),1)]),_:1})])],32)])])}}},X=S(G,[["__scopeId","data-v-4b5e8ce8"]]);export{X as default};
