import{_ as R}from"./CDB8L8go.js";import{u as L}from"./xsgK-Nup.js";import{g as C,o,c as l,F as m,r as k,n as G,a as t,t as i,m as c,I as M,w as N,l as v,T as H,_ as q,j as W,k as J,E as K,C as Q,d as X,M as Y,N as Z,q as w,v as y,b as B,S as tt,y as E,z as et,A as h}from"./6O01ZZML.js";import{a as st,u as ot}from"./BgasD__e.js";const nt={class:"toast toast-bottom toast-end z-50"},lt=C({__name:"AppToast",setup(A){const{toasts:n}=L();function p(r){switch(r){case"success":return"alert-success";case"error":return"alert-error";case"warning":return"alert-warning";default:return"alert-info"}}return(r,z)=>(o(),l("div",nt,[(o(!0),l(m,null,k(c(n),u=>(o(),l("div",{key:u.id,class:G(["alert",p(u.type)])},[t("span",null,i(u.msg),1)],2))),128))]))}}),at=Object.assign(lt,{__name:"AppToast"}),it={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 backdrop-blur-[1px]","aria-busy":"true",role:"alert"},rt=C({__name:"AppLoading",setup(A){const{loading:n}=st();return(p,r)=>(o(),M(H,{name:"fade"},{default:N(()=>[c(n)?(o(),l("div",it,[...r[0]||(r[0]=[t("div",{class:"flex flex-col items-center gap-3 rounded-2xl bg-white px-10 py-7 shadow-xl"},[t("span",{class:"loading loading-spinner loading-lg text-primary"}),t("span",{class:"text-sm text-slate-600"},"处理中,请稍候…")],-1)])])):v("",!0)]),_:1}))}}),dt=Object.assign(q(rt,[["__scopeId","data-v-c1ace0c2"]]),{__name:"AppLoading"}),ct={class:"flex min-h-screen"},pt={class:"fixed top-0 left-0 bottom-0 z-30 overflow-y-auto flex flex-col",style:{width:"256px",background:"#1E293B"}},ut={style:{padding:"20px 20px 16px","border-bottom":"1px solid rgba(255,255,255,0.06)"}},xt={style:{display:"flex","align-items":"center",gap:"12px"}},mt={style:{width:"40px",height:"40px",background:"linear-gradient(135deg,#4F46E5,#7C3AED)","border-radius":"12px",display:"flex","align-items":"center","justify-content":"center","box-shadow":"0 6px 20px rgba(79,70,229,0.35)","flex-shrink":"0"}},ft={style:{width:"22px",height:"22px",color:"#fff"},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},_t={style:{color:"#fff","font-weight":"700","font-size":"15px","letter-spacing":"-0.02em"}},ht={style:{padding:"12px 0",flex:"1"}},vt={class:"icon",width:"18",height:"18",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},gt=["d"],bt={style:{"margin-top":"auto",padding:"14px 18px","border-top":"1px solid rgba(255,255,255,0.06)"}},wt={style:{display:"flex","align-items":"center",gap:"10px"}},yt={style:{width:"32px",height:"32px","border-radius":"9px",background:"linear-gradient(135deg,#4F46E5,#7C3AED)",color:"#fff",display:"flex","align-items":"center","justify-content":"center","font-weight":"700","flex-shrink":"0"}},kt={style:{"min-width":"0"}},Ct={style:{color:"#E2E8F0","font-size":"13px","font-weight":"600","line-height":"1.2",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},At={style:{color:"#64748B","font-size":"11px","margin-top":"2px"}},zt={class:"flex-1",style:{"margin-left":"256px"}},Vt={class:"bg-white shadow-sm sticky top-0 z-20 h-16 flex items-center justify-between px-6"},jt={class:"flex items-center gap-2 text-sm"},Tt={class:"text-slate-700 font-medium"},Bt={class:"flex items-center gap-2"},Et={class:"dropdown dropdown-end"},Lt={tabindex:"0",class:"flex items-center gap-2 cursor-pointer hover:bg-slate-50 rounded-lg px-3 py-1.5"},Mt={class:"avatar placeholder"},Nt={class:"bg-indigo-600 text-white rounded-full w-8"},St={class:"text-sm"},Ut={class:"text-sm text-slate-700 leading-tight"},$t={class:"text-[10px] text-slate-400"},Ft={key:0,class:"modal modal-open"},Dt={class:"modal-box max-w-sm"},Ot={class:"space-y-3"},It={class:"modal-action"},Pt=["disabled"],Rt={class:"p-6"},Jt=C({__name:"default",setup(A){const n=W(),p=J(),r=K(),{consoleApi:z}=ot(),{success:u,error:f}=L();function V(){n.logout(),p.push("/")}const _=E(!1),g=E(!1),s=et({old:"",next:"",confirm:""});function S(){s.old="",s.next="",s.confirm="",_.value=!0}async function U(){if(!s.old||!s.next){f("原密码和新密码必填");return}if(s.next.length<6){f("新密码至少 6 位");return}if(s.next!==s.confirm){f("两次输入的新密码不一致");return}g.value=!0;try{await z("accounts/changepwd",{old_password:s.old,new_password:s.next}),_.value=!1,u("密码已修改,请重新登录"),setTimeout(V,800)}catch(d){f(d?.message??"修改失败")}finally{g.value=!1}}const $=h(()=>({1:"超级管理员",2:"管理员",3:"代理",4:"运营"})[n.identity]??""),F=h(()=>({1:"超管",2:"管理员",3:"代理",4:"运营"})[n.identity]??""),j=h(()=>(n.account||"A").charAt(0).toUpperCase()),T=Y;function D(d){return d.items.some(e=>n.hasAccess(e.id))}const O=h(()=>{if(r.meta?.title)return r.meta.title;for(const d of T){const e=d.items.find(b=>r.path.startsWith(b.to));if(e)return e.label}return"Console"});return Q(()=>{n.token||p.push("/")}),(d,e)=>{const b=R,I=at,P=dt;return o(),l("div",ct,[t("aside",pt,[t("div",ut,[t("div",xt,[t("div",mt,[(o(),l("svg",ft,[...e[4]||(e[4]=[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},null,-1)])]))]),t("div",null,[t("div",_t,i(c(n).siteTitle||"Admin"),1),e[5]||(e[5]=t("div",{style:{color:"#64748B","font-size":"11px","font-weight":"500"}},"Admin Console · v1.0.1",-1))])])]),t("nav",ht,[(o(!0),l(m,null,k(c(T),a=>(o(),l(m,null,[D(a)?(o(),l("div",{key:a.label,class:"group-title"},i(a.label),1)):v("",!0),(o(!0),l(m,null,k(a.items,x=>(o(),l(m,null,[c(n).hasAccess(x.id)?(o(),M(b,{key:x.id,to:x.to,class:"sidebar-link","active-class":"active"},{default:N(()=>[(o(),l("svg",vt,[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:x.icon},null,8,gt)])),X(" "+i(x.label),1)]),_:2},1032,["to"])):v("",!0)],64))),256))],64))),256))]),t("div",bt,[t("div",wt,[t("div",yt,i(j.value),1),t("div",kt,[t("div",Ct,i(c(n).account||"-"),1),t("div",At,i($.value),1)])])])]),t("main",zt,[t("header",Vt,[t("div",jt,[e[6]||(e[6]=t("span",{class:"text-slate-400"},"首页",-1)),e[7]||(e[7]=t("span",{class:"text-slate-300"},"/",-1)),t("span",Tt,i(O.value),1)]),t("div",Bt,[e[8]||(e[8]=Z('