import{d as A,c as a,n as g,F as M,l as $,b as r,m as E,o as s,e as o,t as L,p as d,q as N,s as R,a as t,w as S,R as U,h as W,k as f,v as C,r as F,E as O,g as P}from"./index-CcdGGfCj.js";import{_ as h}from"./http-CGjljVXL.js";import{_ as V}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{l as x}from"./logo-DSdTLzUt.js";import{u as T}from"./auth-EXu5ynQ_.js";const q=["title","onClick"],D={key:0},j=A({__name:"AdminMenu",props:{activePath:{},collapsed:{type:Boolean}},emits:["navigate"],setup(c,{emit:m}){const p=m;return(b,v)=>(s(),a("nav",{class:g(["menu admin-menu",{"admin-menu--collapsed":c.collapsed}])},[(s(!0),a(M,null,$(r(E),e=>(s(),a("button",{key:e.path,class:g(["menu-item",{active:c.activePath===e.path}]),type:"button",title:c.collapsed?e.label:void 0,onClick:l=>p("navigate",e.path)},[o(h,{name:e.icon,size:20},null,8,["name"]),c.collapsed?d("",!0):(s(),a("span",D,L(e.label),1))],10,q))),128))],2))}}),z=V(j,[["__scopeId","data-v-74e38916"]]),G={key:0,class:"sidebar"},H=["title"],J={class:"brand-mark"},K=["src"],Q={key:0},X=["title","disabled"],Y={key:0},Z={class:"brand"},ee={class:"brand-mark"},te=["src"],ae=["disabled"],se={class:"shell-main"},ne={class:"page-content"},oe=A({__name:"AdminLayout",setup(c){const m=W(),p=P(),b=T(),v=f(window.innerWidth),e=f(!1),l=f(!1),i=C(()=>v.value<1200),_=C(()=>v.value<768),w=()=>{v.value=window.innerWidth,_.value||(e.value=!1)};N(()=>window.addEventListener("resize",w,{passive:!0})),R(()=>window.removeEventListener("resize",w));async function y(){if(!l.value){try{await O.confirm("退出后需要重新登录，确定退出管理后台吗？","退出登录",{type:"warning",confirmButtonText:"退出登录",cancelButtonText:"取消"})}catch(u){if(u==="cancel"||u==="close")return;throw u}l.value=!0;try{await b.logout(),await p.replace("/login")}finally{l.value=!1}}}function k(u){p.push(u),e.value=!1}return(u,n)=>{const I=F("el-drawer");return s(),a("div",{class:g(["admin-shell",{"is-collapsed":i.value&&!_.value}])},[_.value?d("",!0):(s(),a("aside",G,[t("div",{class:"brand",title:i.value?"剧游AI":void 0},[t("span",J,[t("img",{src:r(x),alt:""},null,8,K)]),i.value?d("",!0):(s(),a("strong",Q,"剧游AI"))],8,H),o(z,{"active-path":r(m).path,collapsed:i.value,onNavigate:k},null,8,["active-path","collapsed"]),t("button",{class:"menu-item logout",type:"button",title:i.value?"退出登录":void 0,disabled:l.value,onClick:y},[o(h,{name:"SwitchButton",size:20}),i.value?d("",!0):(s(),a("span",Y,"退出登录"))],8,X)])),o(I,{modelValue:e.value,"onUpdate:modelValue":n[0]||(n[0]=B=>e.value=B),direction:"ltr",size:"240px","with-header":!1,class:"mobile-drawer"},{default:S(()=>[t("div",Z,[t("span",ee,[t("img",{src:r(x),alt:""},null,8,te)]),n[2]||(n[2]=t("strong",null,"剧游AI",-1))]),o(z,{"active-path":r(m).path,onNavigate:k},null,8,["active-path"]),t("button",{class:"menu-item logout",type:"button",disabled:l.value,onClick:y},[o(h,{name:"SwitchButton",size:20}),n[3]||(n[3]=t("span",null,"退出登录",-1))],8,ae)]),_:1},8,["modelValue"]),t("div",se,[t("main",ne,[_.value?(s(),a("button",{key:0,class:"icon-button mobile-menu-trigger",type:"button",title:"打开菜单",onClick:n[1]||(n[1]=B=>e.value=!0)},[o(h,{name:"Menu",size:22})])):d("",!0),o(r(U))])])],2)}}}),de=V(oe,[["__scopeId","data-v-209f12ce"]]);export{de as default};
