import{U as L,L as I,C as P,F as U,a as F,I as S,M as R}from"./icons-CbZw_MCi.js";import{d as E,c as i,p as y,a,b as s,q as g,t as k,e as p,k as $,E as M,o,h as W,s as h,F as O,v as T,x as j,y as D,P as N,z as q,w as G,R as H,g as J,A as C,r as K}from"./index-p1BAR2Hc.js";import{l as Q}from"./logo-DX2NYOdf.js";import{u as A}from"./auth-BqcbSIN_.js";import{_ as x}from"./_plugin-vue_export-helper-DlAUqK2U.js";const X={class:"web-user-entry__avatar"},Y=["src"],Z={class:"web-user-entry__copy"},ee=["disabled"],te=E({__name:"WebUserEntry",props:{active:{type:Boolean}},emits:["navigate"],setup(n,{emit:r}){const c=r,l=A(),d=W(),e=$(!1);async function t(){if(!e.value){try{await M.confirm("退出后需要重新登录,确定退出当前账号吗?","退出登录",{type:"warning",confirmButtonText:"退出登录",cancelButtonText:"取消"})}catch(u){if(u==="cancel"||u==="close")return;throw u}e.value=!0;try{await l.logout(),await d.replace("/login")}finally{e.value=!1}}}return(u,v)=>{var b,_,m,f;return o(),i("div",{class:y(["web-user-entry",{active:n.active}])},[a("button",{type:"button",class:"web-user-entry__profile",onClick:v[0]||(v[0]=w=>c("navigate"))},[a("span",X,[(b=s(l).profile)!=null&&b.avatar_url?(o(),i("img",{key:0,src:s(l).profile.avatar_url,alt:""},null,8,Y)):(o(),g(s(L),{key:1,size:19}))]),a("span",Z,[a("strong",null,k(((_=s(l).profile)==null?void 0:_.username)||((m=s(l).profile)==null?void 0:m.account)||"用户中心"),1),a("small",null,k(Number(((f=s(l).account)==null?void 0:f.point_balance)||0).toFixed(2))+" 积分",1)])]),a("button",{type:"button",class:"web-user-entry__logout",title:"退出登录",disabled:e.value,onClick:t},[p(s(I),{size:18})],8,ee)],2)}}}),ae=x(te,[["__scopeId","data-v-8716efd4"]]),se=["src"],oe={key:0},ne={class:"web-sidebar__nav"},le=["disabled","title","onClick"],ie={key:0},re={class:"web-sidebar__footer"},ce=E({__name:"WebSidebar",props:{activePath:{},collapsed:{type:Boolean}},emits:["navigate"],setup(n,{emit:r}){const c=r,l=[{path:"/drama-projects",label:"短剧创作",icon:P,disabled:!1},{path:"/redraw-projects",label:"剧本反推",icon:U,disabled:!1},{path:"/script-analysis",label:"剧本分析",icon:F,disabled:!1},{path:"/product-images",label:"图片生成",icon:S,disabled:!1}];return(d,e)=>(o(),i("div",{class:y(["web-sidebar",{"is-collapsed":n.collapsed}])},[a("button",{class:"web-sidebar__brand",type:"button",title:"短剧创作",onClick:e[0]||(e[0]=t=>c("navigate","/drama-projects"))},[a("span",null,[a("img",{src:s(Q),alt:""},null,8,se)]),n.collapsed?h("",!0):(o(),i("strong",oe,"剧游AI"))]),a("nav",ne,[(o(),i(O,null,T(l,t=>a("button",{key:t.path,type:"button",disabled:t.disabled,class:y({active:n.activePath.startsWith(t.path)}),title:n.collapsed?t.label:void 0,onClick:u=>c("navigate",t.path)},[(o(),g(j(t.icon),{size:20})),n.collapsed?h("",!0):(o(),i("span",ie,k(t.label),1))],10,le)),64))]),a("div",re,[n.collapsed?(o(),i("button",{key:0,type:"button",class:y(["web-sidebar__account",{active:n.activePath==="/account"}]),title:"用户中心",onClick:e[1]||(e[1]=t=>c("navigate","/account"))},[p(s(L),{size:20})],2)):(o(),g(ae,{key:1,active:n.activePath==="/account",onNavigate:e[2]||(e[2]=t=>c("navigate","/account"))},null,8,["active"]))])],2))}}),z=x(ce,[["__scopeId","data-v-c624bd8f"]]),ue={key:0,class:"web-layout__sidebar"},de={class:"web-layout__main"},ve={key:0,class:"web-layout__mobile-bar"},pe=E({__name:"WebLayout",setup(n){const r=J(),c=W(),l=A(),d=$(window.innerWidth),e=$(!1),t=C(()=>d.value<768),u=C(()=>d.value>=768&&d.value<1200),v=C(()=>r.meta.fullscreen===!0);function b(){d.value=window.innerWidth,t.value||(e.value=!1)}function _(f){e.value=!1,c.push(f)}function m(){l.loadAccount()}return D(()=>{window.addEventListener("resize",b,{passive:!0}),window.addEventListener(N,m),l.loadAccount()}),q(()=>{window.removeEventListener("resize",b),window.removeEventListener(N,m)}),(f,w)=>{const V=K("el-drawer");return o(),i("div",{class:y(["web-layout",{"is-collapsed":u.value,"is-fullscreen":v.value}])},[!t.value&&!v.value?(o(),i("aside",ue,[p(z,{"active-path":s(r).path,collapsed:u.value,onNavigate:_},null,8,["active-path","collapsed"])])):h("",!0),v.value?h("",!0):(o(),g(V,{key:1,modelValue:e.value,"onUpdate:modelValue":w[0]||(w[0]=B=>e.value=B),direction:"ltr",size:"min(280px, 88vw)","with-header":!1,class:"web-drawer"},{default:G(()=>[p(z,{"active-path":s(r).path,onNavigate:_},null,8,["active-path"])]),_:1},8,["modelValue"])),a("main",de,[t.value&&!v.value?(o(),i("header",ve,[a("button",{type:"button",class:"web-layout__menu",title:"打开菜单",onClick:w[1]||(w[1]=B=>e.value=!0)},[p(s(R),{size:21})]),a("strong",null,k(String(s(r).meta.title||"剧游AI")),1)])):h("",!0),p(s(H))])],2)}}}),ye=x(pe,[["__scopeId","data-v-09e56ee6"]]);export{ye as default};