gemini-2api / static /assets /Accounts-YFw0nAMh.js
xiaoyukkkk's picture
Upload 541 files
b71597d verified
import{g as b,C as Ke,h as d,d as We,D as Xe,i as H,o as Ye,j as Ze,c as l,a as s,x as R,y as Se,m as C,v as V,b as v,A as et,t as n,n as h,u as $,F as Q,r as ee,f as Te,T as Le,w as A,e as r}from"./index-Bh_hLcqi.js";import{_ as tt}from"./SelectMenu.vue_vue_type_script_setup_true_lang-8KWxq5-G.js";import{_ as te}from"./Checkbox.vue_vue_type_script_setup_true_lang-DsgZPRUK.js";import{_ as st}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-B-fGXmXJ.js";import{u as ot}from"./useConfirmDialog-CSNT_h0m.js";import{_ as rt}from"./HelpTip.vue_vue_type_script_setup_true_lang-Be-NxYdK.js";const x={list:()=>b.get("/admin/accounts"),getConfig:()=>b.get("/admin/accounts-config"),updateConfig:u=>b.put("/admin/accounts-config",u),delete:u=>b.delete(`/admin/accounts/${u}`),disable:u=>b.put(`/admin/accounts/${u}/disable`),enable:u=>b.put(`/admin/accounts/${u}/enable`),startRegister:(u,m)=>b.post("/admin/register/start",{count:u,domain:m}),getRegisterTask:u=>b.get(`/admin/register/task/${u}`),getRegisterCurrent:()=>b.get("/admin/register/current"),startLogin:u=>b.post("/admin/login/start",u),getLoginTask:u=>b.get(`/admin/login/task/${u}`),getLoginCurrent:()=>b.get("/admin/login/current"),checkLogin:()=>b.post("/admin/login/check")},nt=Ke("accounts",()=>{const u=d([]),m=d(!1);async function w(){m.value=!0;try{const i=await x.list();u.value=Array.isArray(i)?i:i.accounts||[]}finally{m.value=!1}}async function I(i){await x.delete(i),await w()}async function g(i){await x.disable(i),await w()}async function M(i){await x.enable(i),await w()}async function j(i){await Promise.all(i.map(S=>x.enable(S))),await w()}async function c(i){await Promise.all(i.map(S=>x.disable(S))),await w()}async function E(i){await Promise.all(i.map(S=>x.delete(S))),await w()}async function O(i){await x.updateConfig(i),await w()}return{accounts:u,isLoading:m,loadAccounts:w,deleteAccount:I,disableAccount:g,enableAccount:M,bulkEnable:j,bulkDisable:c,bulkDelete:E,updateConfig:O}}),lt={class:"space-y-8"},at={class:"rounded-3xl border border-border bg-card p-6"},it={class:"flex flex-wrap items-center justify-between gap-4"},dt={class:"grid w-full grid-cols-2 gap-3 sm:flex sm:w-auto sm:items-center"},ut={class:"flex w-full flex-wrap items-center gap-3 text-xs text-muted-foreground sm:w-auto sm:flex-nowrap"},ct={key:0},pt={class:"ml-auto flex items-center gap-2 sm:ml-0"},xt={class:"mt-4 flex flex-wrap items-center gap-3"},mt=["disabled"],vt=["disabled"],ft=["disabled"],gt=["disabled"],bt={class:"mt-4 rounded-2xl border border-border bg-background p-4"},yt={class:"flex flex-wrap items-center gap-3"},_t={class:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground"},ht=["disabled"],wt=["disabled"],kt=["disabled"],Ct={key:0,class:"mt-3 rounded-2xl bg-destructive/10 px-3 py-2 text-xs text-destructive"},Vt={key:1,class:"mt-3 grid gap-2 text-xs text-muted-foreground"},$t={key:0},At={class:"ml-2"},St={class:"ml-2"},Tt={class:"ml-2"},Lt={class:"ml-2"},Dt={key:1},Et={class:"ml-2"},Ut={class:"ml-2"},Rt={class:"ml-2"},jt={class:"ml-2"},zt={key:2,class:"mt-3 grid gap-2"},Nt={key:0,class:"rounded-2xl border border-border bg-muted/30 p-3"},Bt={class:"mt-2 space-y-1 text-[11px] text-muted-foreground"},It={key:1,class:"rounded-2xl border border-border bg-muted/30 p-3"},Mt={class:"mt-2 space-y-1 text-[11px] text-muted-foreground"},Ot={key:0,class:"mt-6 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3"},Pt=["onClick"],Ft={class:"flex items-start justify-between gap-3"},Jt={class:"mt-1 font-mono text-xs text-foreground"},Ht={class:"flex items-center gap-2"},Qt={class:"mt-4 grid grid-cols-2 gap-3 text-xs text-muted-foreground"},qt={key:0,class:"mt-1 text-[11px]"},Gt={key:0},Kt={key:1},Wt={class:"mt-1 text-sm font-semibold text-foreground"},Xt={class:"mt-1 text-sm font-semibold text-foreground"},Yt={class:"mt-4 flex flex-wrap items-center gap-2"},Zt=["onClick"],es=["onClick"],ts=["onClick"],ss=["onClick"],os={key:0,class:"rounded-2xl border border-border bg-background p-4 text-center text-xs text-muted-foreground"},rs={key:1,class:"relative mt-6 overflow-x-auto overflow-y-visible"},ns={class:"min-w-full text-left text-sm"},ls={class:"text-xs uppercase tracking-[0.2em] text-muted-foreground"},as={class:"py-3 pr-4"},is={class:"py-3 pr-6"},ds={class:"inline-flex items-center gap-2"},us={class:"text-sm text-foreground"},cs={key:0},ps=["onClick"],xs={class:"py-4 pr-6 font-mono text-xs text-foreground"},ms={class:"py-4 pr-6"},vs={class:"py-4 pr-6"},fs={key:0,class:"block text-[11px] text-muted-foreground"},gs={class:"py-4 pr-6 text-xs"},bs={class:"py-4 pr-6 text-xs text-muted-foreground"},ys={class:"py-4 pr-6 text-xs text-muted-foreground"},_s={class:"py-4 text-right"},hs={class:"flex flex-wrap justify-end gap-2"},ws=["onClick"],ks=["onClick"],Cs=["onClick"],Vs=["onClick"],$s={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},As={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},Ss={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},Ts={class:"mt-4 space-y-3 text-sm"},Ls={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},Ds={class:"w-full max-w-3xl rounded-3xl border border-border bg-card p-6 shadow-xl"},Es={class:"flex items-center justify-between"},Us={class:"flex items-center gap-2"},Rs={key:0,class:"mt-4 rounded-2xl bg-destructive/10 px-4 py-3 text-sm text-destructive"},js={class:"mt-4"},zs=["readonly"],Ns={class:"mt-6 flex items-center justify-end gap-2"},Bs=["disabled"],Hs=We({__name:"Accounts",setup(u){const m=nt(),{accounts:w,isLoading:I}=Xe(m),g=ot(),M=d(""),j=d("all"),c=d(new Set),E=d("table"),O=d(!1),i=d(""),S=d(!1),T=d(""),z=d(""),L=d(!1),P=d([]),F=d(1),se=d(""),y=d(null),f=d(null),N=d(!1),k=d(!1),_=d(""),p=d({id:"",secure_c_ses:"",csesidx:"",config_id:"",host_c_oses:"",expires_at:""}),q=d(null),ue=d([]),De=[{label:"全部状态",value:"all"},{label:"正常",value:"正常"},{label:"即将过期",value:"即将过期"},{label:"已过期",value:"已过期"},{label:"手动禁用",value:"手动禁用"},{label:"错误禁用",value:"错误禁用"},{label:"429限流",value:"429限流"}],D=H(()=>{const t=M.value.trim().toLowerCase();return w.value.filter(e=>{const o=!t||e.id.toLowerCase().includes(t),a=j.value==="all"||J(e)===j.value;return o&&a})}),B=H(()=>c.value.size),oe=H(()=>D.value.length>0&&D.value.every(t=>c.value.has(t.id))),G=async()=>{await m.loadAccounts(),c.value=new Set};Ye(async()=>{await G(),await He()});const re=H(()=>y.value?.logs?.slice(-8)||[]),ne=H(()=>f.value?.logs?.slice(-8)||[]);Ze(()=>{Y(),Z()});const J=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?"429限流":t.cooldown_reason==="错误禁用"?"错误禁用":t.disabled?"手动禁用":t.status==="已过期"?"已过期":t.status==="即将过期"?"即将过期":"正常",ce=t=>{const e=J(t);return e==="429限流"||e==="即将过期"?"bg-amber-200 text-amber-900":e==="错误禁用"||e==="已过期"?"bg-destructive/10 text-destructive":e==="手动禁用"?"bg-muted text-muted-foreground":"bg-emerald-500 text-white"},pe=t=>t.cooldown_reason?.includes("429")&&t.cooldown_seconds>0?!0:t.disabled||t.cooldown_reason==="错误禁用",xe=t=>t==="已过期"?"过期":t==="未设置"?"未设置":t,me=t=>t.status==="已过期"?"text-rose-600":t.status==="即将过期"?"text-amber-700":t.status==="未设置"?"text-muted-foreground":"text-emerald-600",ve=t=>t<60?`${t} 秒`:t<3600?`${Math.ceil(t/60)} 分钟`:`${(t/3600).toFixed(1)} 小时`,le=t=>t.cooldown_seconds>0?"text-amber-700":t.cooldown_reason==="错误禁用"?"text-rose-600":"text-muted-foreground",fe=t=>{const e=J(t);return e==="手动禁用"||e==="已过期"?"bg-muted/70":""},K=t=>{const e=new Set(c.value);e.has(t)?e.delete(t):e.add(t),c.value=e},ge=()=>{if(oe.value){c.value=new Set;return}c.value=new Set(D.value.map(t=>t.id))},Ee=(t,e)=>t.id||`account_${e+1}`,Ue=async()=>(await x.getConfig()).accounts.map((e,o)=>({...e,id:Ee(e,o)})),be=t=>`${t.time} [${t.level}] ${t.message}`,Re=(t,e)=>{let o=-1;for(let U=0;U<t.length;U+=1)if(t[U].id===e){o=U;break}if(o===-1)return i.value="未找到对应账号配置。",!1;const a=t[o];return p.value={id:a.id,secure_c_ses:a.secure_c_ses,csesidx:a.csesidx,config_id:a.config_id,host_c_oses:a.host_c_oses,expires_at:a.expires_at},ue.value=t,q.value=o,O.value=!0,!0},ye=async t=>{i.value="";try{const e=await Ue();Re(e,t)}catch(e){i.value=e.message||"加载账号配置失败"}},je=async()=>{T.value="";try{const t=await x.getConfig();P.value=Array.isArray(t.accounts)?t.accounts:[],z.value=JSON.stringify(he(P.value),null,2),L.value=!0,S.value=!0}catch(t){T.value=t.message||"加载账号配置失败"}},ae=()=>{S.value=!1,T.value="",L.value=!1},_e=()=>{const t=JSON.parse(z.value);if(!Array.isArray(t))throw new Error("配置格式必须是数组。");return t},ze=t=>typeof t!="string"||!t?t:t.length<=6?`${t.slice(0,2)}****`:`${t.slice(0,3)}****`,he=t=>{const e=new Set(["secure_c_ses","csesidx","config_id","host_c_oses","mail_password"]);return t.map(o=>{const a={...o};return e.forEach(U=>{const Ae=a[U];Ae&&(a[U]=ze(Ae))}),a})},Ne=()=>{if(T.value="",!L.value){try{P.value=_e()}catch(t){T.value=t.message||"JSON 格式错误";return}z.value=JSON.stringify(he(P.value),null,2),L.value=!0;return}z.value=JSON.stringify(P.value,null,2),L.value=!1},Be=async()=>{T.value="";try{const t=_e();await m.updateConfig(t),ae()}catch(t){T.value=t.message||"保存失败"}},ie=()=>{O.value=!1,i.value=""},Ie=async()=>{if(q.value===null)return;const t=[...ue.value];t[q.value]={...t[q.value],id:p.value.id,secure_c_ses:p.value.secure_c_ses,csesidx:p.value.csesidx,config_id:p.value.config_id,host_c_oses:p.value.host_c_oses||void 0,expires_at:p.value.expires_at||void 0};try{await m.updateConfig(t),ie()}catch(e){i.value=e.message||"保存失败"}},Me=async()=>{await m.bulkEnable(Array.from(c.value)),c.value=new Set},Oe=async()=>{await g.ask({title:"批量禁用",message:"确定要批量禁用选中的账号吗?"})&&(await m.bulkDisable(Array.from(c.value)),c.value=new Set)},Pe=async()=>{await g.ask({title:"批量删除",message:"确定要批量删除选中的账号吗?",confirmText:"删除"})&&(await m.bulkDelete(Array.from(c.value)),c.value=new Set)},we=async t=>{await m.enableAccount(t)},ke=async t=>{await g.ask({title:"禁用账号",message:"确定要禁用该账号吗?"})&&await m.disableAccount(t)},Ce=async t=>{await g.ask({title:"删除账号",message:"确定要删除该账号吗?",confirmText:"删除"})&&await m.deleteAccount(t)};let W=null,X=null;const Y=()=>{W!==null&&(window.clearInterval(W),W=null)},Z=()=>{X!==null&&(window.clearInterval(X),X=null)},Ve=t=>t==="pending"?"等待中":t==="running"?"执行中":t==="success"?"成功":t==="failed"?"失败":t,Fe=async t=>{const e=await x.getRegisterTask(t);y.value=e,e.status!=="running"&&e.status!=="pending"&&(N.value=!1,Y(),await G())},Je=async t=>{const e=await x.getLoginTask(t);f.value=e,e.status!=="running"&&e.status!=="pending"&&(k.value=!1,Z(),await G())},$e=t=>{Y(),W=window.setInterval(()=>{Fe(t).catch(e=>{_.value=e?.message||"注册任务更新失败",Y(),N.value=!1})},3e3)},de=t=>{Z(),X=window.setInterval(()=>{Je(t).catch(e=>{_.value=e?.message||"刷新任务更新失败",Z(),k.value=!1})},3e3)},He=async()=>{try{const t=await x.getRegisterCurrent();t&&"id"in t?(y.value=t,(t.status==="running"||t.status==="pending")&&(N.value=!0,$e(t.id))):y.value=null}catch(t){_.value=t.message||"加载注册任务失败"}try{const t=await x.getLoginCurrent();t&&"id"in t?(f.value=t,(t.status==="running"||t.status==="pending")&&(k.value=!0,de(t.id))):f.value=null}catch(t){_.value=t.message||"加载刷新任务失败"}},Qe=async()=>{_.value="",N.value=!0;const t=se.value.trim();try{const e=Number.isFinite(F.value)&&F.value>0?F.value:void 0,o=await x.startRegister(e,t||void 0);y.value=o,$e(o.id)}catch(e){_.value=e.message||"启动注册失败",N.value=!1}},qe=async()=>{if(c.value.size){_.value="",k.value=!0;try{const t=await x.startLogin(Array.from(c.value));f.value=t,de(t.id)}catch(t){_.value=t.message||"启动刷新失败",k.value=!1}}},Ge=async()=>{_.value="",k.value=!0;try{await x.checkLogin();const t=await x.getLoginCurrent();if(t&&"id"in t){f.value=t,de(t.id);return}f.value=null,k.value=!1}catch(t){_.value=t.message||"触发刷新失败",k.value=!1}};return(t,e)=>(r(),l(Q,null,[s("div",lt,[s("section",at,[s("div",it,[s("div",dt,[C(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>M.value=o),type:"text",placeholder:"搜索账号 ID",class:"w-full rounded-full border border-input bg-background px-4 py-2 text-sm sm:w-48"},null,512),[[V,M.value]]),R(tt,{modelValue:j.value,"onUpdate:modelValue":e[1]||(e[1]=o=>j.value=o),options:De},null,8,["modelValue"])]),s("div",ut,[R(te,{modelValue:oe.value,"onUpdate:modelValue":ge},{default:et(()=>[...e[18]||(e[18]=[Te(" 全选 ",-1)])]),_:1},8,["modelValue"]),s("span",null,"共 "+n(D.value.length)+" 个账号",1),B.value?(r(),l("span",ct,"已选 "+n(B.value)+" 个",1)):v("",!0),s("div",pt,[s("button",{type:"button",class:h(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",E.value==="table"?"bg-accent text-accent-foreground":""]),onClick:e[2]||(e[2]=o=>E.value="table"),"aria-label":"列表视图"},[...e[19]||(e[19]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])],2),s("button",{type:"button",class:h(["inline-flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:border-primary hover:text-primary",E.value==="card"?"bg-accent text-accent-foreground":""]),onClick:e[3]||(e[3]=o=>E.value="card"),"aria-label":"卡片视图"},[...e[20]||(e[20]=[s("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4",fill:"currentColor"},[s("path",{d:"M4 6h7v6H4V6zm9 0h7v6h-7V6zM4 14h7v4H4v-4zm9 0h7v4h-7v-4z"})],-1)])],2)])])]),s("div",xt,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",onClick:je}," 账户配置 "),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:$(I),onClick:G}," 刷新列表 ",8,mt),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value,onClick:Me}," 批量启用 ",8,vt),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value,onClick:Oe}," 批量禁用 ",8,ft),s("button",{class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-destructive transition-colors hover:border-destructive hover:text-destructive",disabled:!B.value,onClick:Pe}," 批量删除 ",8,gt)]),s("div",bt,[s("div",yt,[s("div",_t,[e[21]||(e[21]=s("span",{class:"text-foreground"},"自动注册",-1)),C(s("input",{"onUpdate:modelValue":e[4]||(e[4]=o=>F.value=o),type:"number",min:"1",class:"w-20 rounded-full border border-input bg-background px-3 py-1 text-xs"},null,512),[[V,F.value,void 0,{number:!0}]]),C(s("input",{"onUpdate:modelValue":e[5]||(e[5]=o=>se.value=o),type:"text",class:"w-40 rounded-full border border-input bg-background px-3 py-1 text-xs",placeholder:"指定域名(可选)"},null,512),[[V,se.value]])]),s("button",{class:"rounded-full border border-border px-4 py-2 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:N.value,onClick:Qe}," 开始注册 ",8,ht),s("button",{class:"rounded-full border border-border px-4 py-2 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:k.value,onClick:Ge}," 刷新过期 ",8,wt),s("button",{class:"rounded-full border border-border px-4 py-2 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary",disabled:!B.value||k.value,onClick:qe}," 刷新选中 ",8,kt)]),_.value?(r(),l("div",Ct,n(_.value),1)):v("",!0),y.value||f.value?(r(),l("div",Vt,[y.value?(r(),l("div",$t,[e[22]||(e[22]=s("span",{class:"font-medium text-foreground"},"注册任务",-1)),s("span",At,"状态:"+n(Ve(y.value.status)),1),s("span",St,"进度:"+n(y.value.progress)+"/"+n(y.value.count),1),s("span",Tt,"成功:"+n(y.value.success_count),1),s("span",Lt,"失败:"+n(y.value.fail_count),1)])):v("",!0),f.value?(r(),l("div",Dt,[e[23]||(e[23]=s("span",{class:"font-medium text-foreground"},"刷新任务",-1)),s("span",Et,"状态:"+n(Ve(f.value.status)),1),s("span",Ut,"进度:"+n(f.value.progress)+"/"+n(f.value.account_ids.length),1),s("span",Rt,"成功:"+n(f.value.success_count),1),s("span",jt,"失败:"+n(f.value.fail_count),1)])):v("",!0)])):v("",!0),re.value.length||ne.value.length?(r(),l("div",zt,[re.value.length?(r(),l("div",Nt,[e[24]||(e[24]=s("p",{class:"text-xs font-semibold text-foreground"},"注册日志",-1)),s("div",Bt,[(r(!0),l(Q,null,ee(re.value,(o,a)=>(r(),l("div",{key:`reg-${a}`,class:"font-mono"},n(be(o)),1))),128))])])):v("",!0),ne.value.length?(r(),l("div",It,[e[25]||(e[25]=s("p",{class:"text-xs font-semibold text-foreground"},"刷新日志",-1)),s("div",Mt,[(r(!0),l(Q,null,ee(ne.value,(o,a)=>(r(),l("div",{key:`login-${a}`,class:"font-mono"},n(be(o)),1))),128))])])):v("",!0)])):v("",!0)]),E.value==="card"?(r(),l("div",Ot,[(r(!0),l(Q,null,ee(D.value,o=>(r(),l("div",{key:o.id,class:h(["rounded-2xl border border-border bg-card p-4",fe(o)]),onClick:a=>K(o.id)},[s("div",Ft,[s("div",null,[e[26]||(e[26]=s("p",{class:"text-xs text-muted-foreground"},"账号 ID",-1)),s("p",Jt,n(o.id),1)]),s("div",Ht,[R(te,{modelValue:c.value.has(o.id),"onUpdate:modelValue":a=>K(o.id),onClick:e[6]||(e[6]=A(()=>{},["stop"]))},null,8,["modelValue","onUpdate:modelValue"]),s("span",{class:h(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ce(o)])},n(J(o)),3)])]),s("div",Qt,[s("div",null,[e[27]||(e[27]=s("p",null,"剩余时间",-1)),s("p",{class:h(["mt-1 text-sm font-semibold",me(o)])},n(xe(o.remaining_display)),3),o.expires_at?(r(),l("p",qt,n(o.expires_at),1)):v("",!0)]),s("div",null,[e[28]||(e[28]=s("p",null,"冷却",-1)),s("p",{class:h(["mt-1",le(o)])},[o.cooldown_seconds>0?(r(),l("span",Gt,n(ve(o.cooldown_seconds))+" · "+n(o.cooldown_reason),1)):(r(),l("span",Kt,n(o.cooldown_reason||"无冷却"),1))],2)]),s("div",null,[e[29]||(e[29]=s("p",null,"失败数",-1)),s("p",Wt,n(o.error_count),1)]),s("div",null,[e[30]||(e[30]=s("p",null,"会话数",-1)),s("p",Xt,n(o.conversation_count),1)])]),s("div",Yt,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(a=>ye(o.id),["stop"])}," 编辑 ",8,Zt),pe(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[7]||(e[7]=A(()=>{},["stop"])),a=>we(o.id)]}," 启用 ",8,es)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:[e[8]||(e[8]=A(()=>{},["stop"])),a=>ke(o.id)]}," 禁用 ",8,ts)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:[e[9]||(e[9]=A(()=>{},["stop"])),a=>Ce(o.id)]}," 删除 ",8,ss)])],10,Pt))),128)),!D.value.length&&!$(I)?(r(),l("div",os," 暂无账号数据,请检查后台配置。 ")):v("",!0)])):(r(),l("div",rs,[s("table",ns,[s("thead",ls,[s("tr",null,[s("th",as,[R(te,{modelValue:oe.value,"onUpdate:modelValue":ge},null,8,["modelValue"])]),e[32]||(e[32]=s("th",{class:"py-3 pr-6"},"账号 ID",-1)),e[33]||(e[33]=s("th",{class:"py-3 pr-6"},"状态",-1)),s("th",is,[s("span",ds,[e[31]||(e[31]=Te(" 剩余/过期 ",-1)),R(rt,{text:"过期时间为 12 小时,账户过期以北京时间为准。"})])]),e[34]||(e[34]=s("th",{class:"py-3 pr-6"},"冷却",-1)),e[35]||(e[35]=s("th",{class:"py-3 pr-6"},"失败数",-1)),e[36]||(e[36]=s("th",{class:"py-3 pr-6"},"会话数",-1)),e[37]||(e[37]=s("th",{class:"py-3 text-right"},"操作",-1))])]),s("tbody",us,[!D.value.length&&!$(I)?(r(),l("tr",cs,[...e[38]||(e[38]=[s("td",{colspan:"8",class:"py-8 text-center text-muted-foreground"}," 暂无账号数据,请检查后台配置。 ",-1)])])):v("",!0),(r(!0),l(Q,null,ee(D.value,o=>(r(),l("tr",{key:o.id,class:h(["border-t border-border",fe(o)]),onClick:a=>K(o.id)},[s("td",{class:"py-4 pr-4",onClick:e[10]||(e[10]=A(()=>{},["stop"]))},[R(te,{modelValue:c.value.has(o.id),"onUpdate:modelValue":a=>K(o.id)},null,8,["modelValue","onUpdate:modelValue"])]),s("td",xs,n(o.id),1),s("td",ms,[s("span",{class:h(["inline-flex items-center rounded-full border border-border px-3 py-1 text-xs",ce(o)])},n(J(o)),3)]),s("td",vs,[s("div",{class:h(["text-sm font-semibold",me(o)])},n(xe(o.remaining_display)),3),o.expires_at?(r(),l("span",fs,n(o.expires_at),1)):v("",!0)]),s("td",gs,[o.cooldown_seconds>0?(r(),l("span",{key:0,class:h(le(o))},n(ve(o.cooldown_seconds))+" · "+n(o.cooldown_reason),3)):(r(),l("span",{key:1,class:h(le(o))},n(o.cooldown_reason||"无冷却"),3))]),s("td",bs,n(o.error_count),1),s("td",ys,n(o.conversation_count),1),s("td",_s,[s("div",hs,[s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(a=>ye(o.id),["stop"])}," 编辑 ",8,ws),pe(o)?(r(),l("button",{key:0,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(a=>we(o.id),["stop"])}," 启用 ",8,ks)):(r(),l("button",{key:1,class:"rounded-full border border-border px-3 py-1 text-xs text-foreground transition-colors hover:border-primary hover:text-primary",onClick:A(a=>ke(o.id),["stop"])}," 禁用 ",8,Cs)),s("button",{class:"rounded-full border border-border px-3 py-1 text-xs text-destructive transition-colors hover:border-destructive hover:text-destructive",onClick:A(a=>Ce(o.id),["stop"])}," 删除 ",8,Vs)])])],10,ps))),128))])])]))])]),R(st,{open:$(g).open.value,title:$(g).title.value,message:$(g).message.value,"confirm-text":$(g).confirmText.value,"cancel-text":$(g).cancelText.value,onConfirm:$(g).confirm,onCancel:$(g).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(r(),Se(Le,{to:"body"},[O.value?(r(),l("div",$s,[s("div",As,[s("div",{class:"flex items-center justify-between"},[e[39]||(e[39]=s("p",{class:"text-sm font-medium text-foreground"},"编辑账号",-1)),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ie}," 关闭 ")]),i.value?(r(),l("div",Ss,n(i.value),1)):v("",!0),s("div",Ts,[e[40]||(e[40]=s("label",{class:"block text-xs text-muted-foreground"},"账号 ID",-1)),C(s("input",{"onUpdate:modelValue":e[11]||(e[11]=o=>p.value.id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",disabled:""},null,512),[[V,p.value.id]]),e[41]||(e[41]=s("label",{class:"block text-xs text-muted-foreground"},"secure_c_ses",-1)),C(s("textarea",{"onUpdate:modelValue":e[12]||(e[12]=o=>p.value.secure_c_ses=o),class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",rows:"3"},null,512),[[V,p.value.secure_c_ses]]),e[42]||(e[42]=s("label",{class:"block text-xs text-muted-foreground"},"csesidx",-1)),C(s("input",{"onUpdate:modelValue":e[13]||(e[13]=o=>p.value.csesidx=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,p.value.csesidx]]),e[43]||(e[43]=s("label",{class:"block text-xs text-muted-foreground"},"config_id",-1)),C(s("input",{"onUpdate:modelValue":e[14]||(e[14]=o=>p.value.config_id=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,p.value.config_id]]),e[44]||(e[44]=s("label",{class:"block text-xs text-muted-foreground"},"host_c_oses",-1)),C(s("input",{"onUpdate:modelValue":e[15]||(e[15]=o=>p.value.host_c_oses=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm"},null,512),[[V,p.value.host_c_oses]]),e[45]||(e[45]=s("label",{class:"block text-xs text-muted-foreground"},"expires_at",-1)),C(s("input",{"onUpdate:modelValue":e[16]||(e[16]=o=>p.value.expires_at=o),type:"text",class:"w-full rounded-2xl border border-input bg-background px-3 py-2 text-sm",placeholder:"2025-12-23 10:59:21"},null,512),[[V,p.value.expires_at]])]),s("div",{class:"mt-6 flex items-center justify-end gap-2"},[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ie}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Ie}," 保存 ")])])])):v("",!0)])),(r(),Se(Le,{to:"body"},[S.value?(r(),l("div",Ls,[s("div",Ds,[s("div",Es,[e[46]||(e[46]=s("p",{class:"text-sm font-medium text-foreground"},"账户配置(JSON)",-1)),s("div",Us,[s("button",{class:"rounded-full bg-foreground px-3 py-1 text-xs text-background transition-opacity hover:opacity-90",onClick:Ne},n(L.value?"显示原文":"脱敏显示"),1),s("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:ae}," 关闭 ")])]),T.value?(r(),l("div",Rs,n(T.value),1)):v("",!0),s("div",js,[C(s("textarea",{"onUpdate:modelValue":e[17]||(e[17]=o=>z.value=o),class:"h-96 w-full rounded-2xl border border-input bg-background px-4 py-3 font-mono text-xs text-foreground",spellcheck:"false",readonly:L.value},null,8,zs),[[V,z.value]])]),s("div",Ns,[s("button",{class:"rounded-full border border-border px-4 py-2 text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:ae}," 取消 "),s("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:Be,disabled:L.value}," 保存 ",8,Bs)])])])):v("",!0)]))],64))}});export{Hs as default};