Spaces:
Sleeping
Sleeping
| import{d as F,l as U,h as y,i as f,q as Z,s as S,c as l,a as e,x as m,y as G,b as d,n as u,F as V,r as $,z as K,t as p,A as w,u as a,R as k,B as O,T as q,p as E,f as A,e as s}from"./index-Bld7Uski.js";import{u as J}from"./settings-H-RYxUda.js";import{_ as Q}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-QhDFiT60.js";import{u as W}from"./useConfirmDialog-XZs7petQ.js";const X={class:"min-h-screen"},Y={class:"flex min-h-screen flex-col lg:flex-row"},ee={key:0,class:"text-base font-semibold text-foreground"},te={key:0,class:"px-3 pb-2 text-xs uppercase tracking-[0.28em] text-muted-foreground"},re={class:"space-y-1"},oe={"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},se=["d"],ne={key:0,class:"flex-1 min-w-0 truncate"},le={key:1,class:"ml-auto text-xs opacity-0 transition-opacity group-hover:opacity-100"},ae={class:"mt-auto border-t border-border px-6 py-3 lg:py-4"},ie={key:0,class:"rounded-2xl bg-secondary/60 p-3"},de=["title"],ue={class:"min-w-0 flex-1 overflow-hidden lg:ml-0"},pe={class:"min-w-0 flex flex-col gap-4 border-b border-border bg-card/70 px-6 py-5 backdrop-blur lg:flex-row lg:items-center lg:justify-between lg:px-10"},ce={class:"flex items-center gap-3"},xe={class:"text-xl font-semibold text-foreground lg:text-2xl"},fe={class:"flex flex-wrap items-center gap-3"},me={class:"h-full overflow-y-auto overflow-x-hidden bg-card/70 px-4 pb-10 pt-6 backdrop-blur lg:px-10 lg:pt-10"},be={key:0,class:"fixed inset-0 z-[100] flex items-center justify-center bg-black/30 px-4"},ge={class:"w-full max-w-lg rounded-3xl border border-border bg-card p-6 shadow-xl"},ve={class:"flex items-center justify-between"},he={class:"mt-4 space-y-3 text-sm"},ye={class:"mt-1 flex items-start gap-2"},we={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ke={class:"mt-1 flex items-start gap-2"},_e={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},ze={class:"mt-1 flex items-start gap-2"},Ce={class:"min-w-0 flex-1 break-all rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},He={class:"mt-1 rounded-2xl border border-border bg-background px-3 py-2 text-xs text-muted-foreground"},Me={class:"flex flex-wrap gap-2 text-foreground"},Se={class:"mt-1 flex items-start gap-2"},Ve={class:"min-w-0 flex-1 rounded-2xl border border-border bg-background px-3 py-2 font-mono text-xs"},$e={class:"mt-6 flex items-center justify-end"},Ie=F({__name:"AppShell",setup(Ae){const L=E(),b=Z(),j=U(),c=J(),x=y(!1),o=y(!1),i=W(),g=y(!1),_=[{path:"/",label:"概览",icon:"M4 4h7v7H4V4zm9 0h7v4h-7V4zm0 6h7v10h-7V10zM4 13h7v7H4v-7z"},{path:"/accounts",label:"账号管理",icon:"M12 12a3.5 3.5 0 1 0-3.5-3.5A3.5 3.5 0 0 0 12 12zm0 2c-4.1 0-7.5 2.2-7.5 5v1h15v-1c0-2.8-3.4-5-7.5-5z"},{path:"/settings",label:"系统设置",icon:"M4 6h10v2H4V6zm12 0h4v2h-4V6zM4 11h6v2H4v-2zm8 0h8v2h-8v-2zM4 16h10v2H4v-2zm12 0h4v2h-4v-2z"},{path:"/monitor",label:"监控状态",icon:"M3 12h4l2-4 4 8 3-6h5v2h-4l-4 8-4-8-2 4H3v-2z"},{path:"/logs",label:"运行日志",icon:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h10v2H4v-2z"},{path:"/docs",label:"文档中心",icon:"M6 3h9l4 4v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm8 1.5V8h3.5L14 4.5zM8 11h8v2H8v-2zm0 4h8v2H8v-2z"}],B=f(()=>_.find(t=>t.path===b.path)?.label||"概览"),D=n=>{const r=`transition-colors ${o.value?"px-2 justify-center gap-0":"px-3 gap-3"}`;return b.path===n?`${r} bg-primary text-primary-foreground`:`${r} text-muted-foreground hover:bg-accent hover:text-accent-foreground`},I=n=>b.path===n?"bg-primary-foreground/15 text-primary-foreground border-primary-foreground/40":"bg-secondary text-muted-foreground group-hover:text-accent-foreground",v=f(()=>(c.settings?.basic?.base_url||""||window.location.origin).replace(/\/$/,"")),z=f(()=>`${v.value}/v1`),C=f(()=>`${v.value}/v1/chat/completions`),H=f(()=>c.settings?.basic?.api_key||"未设置"),T=["gemini-auto","gemini-2.5-flash","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview"];S(()=>b.path,()=>{x.value=!1});const M=localStorage.getItem("sidebar-collapsed");M&&(o.value=M==="true"),S(o,n=>{localStorage.setItem("sidebar-collapsed",n?"true":"false")});async function N(){await i.ask({title:"退出登录",message:"确定退出管理控制台吗?"})&&(await j.logout(),L.push({name:"login"}))}function P(){window.location.reload()}async function R(){g.value=!0,!c.settings&&!c.isLoading&&await c.loadSettings()}async function h(n){if(n)try{await navigator.clipboard.writeText(n)}catch(t){console.error("Copy failed",t)}}return(n,t)=>(s(),l("div",X,[e("div",Y,[x.value?(s(),l("div",{key:0,class:"fixed inset-0 z-30 bg-black/20 backdrop-blur-sm lg:hidden",onClick:t[0]||(t[0]=r=>x.value=!1)})):d("",!0),e("aside",{class:u(["fixed inset-y-0 left-0 z-40 w-72 -translate-x-full bg-card/90 backdrop-blur-sm lg:backdrop-blur-none border-r border-border transition-transform duration-200 ease-out will-change-[transform] transform-gpu flex flex-col lg:static lg:translate-x-0 lg:bg-card/80 lg:border-b-0 lg:border-r lg:sticky lg:top-0 lg:h-screen",[{"translate-x-0":x.value,"w-20 lg:w-20":o.value}]])},[e("div",{class:u(["flex h-16 items-center justify-between px-6 pt-4 lg:h-20 lg:pt-5",o.value?"justify-center px-0":""])},[e("div",{class:u(["flex items-center gap-2",o.value?"gap-0 justify-center w-full":""])},[t[9]||(t[9]=e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"text-foreground transition-colors hover:text-primary","aria-label":"GitHub"},[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-6 w-6",fill:"currentColor"},[e("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.166 6.839 9.489.5.09.682-.217.682-.483 0-.237-.009-.868-.014-1.703-2.782.604-3.369-1.341-3.369-1.341-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.004.071 1.532 1.031 1.532 1.031.892 1.529 2.341 1.087 2.91.832.091-.647.349-1.087.636-1.337-2.22-.253-4.555-1.11-4.555-4.944 0-1.092.39-1.987 1.029-2.687-.103-.253-.446-1.272.098-2.65 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.295 2.748-1.026 2.748-1.026.546 1.378.202 2.397.1 2.65.64.7 1.028 1.595 1.028 2.687 0 3.842-2.338 4.687-4.566 4.936.359.309.678.919.678 1.852 0 1.337-.012 2.418-.012 2.747 0 .268.18.577.688.479A10.002 10.002 0 0 0 22 12c0-5.523-4.477-10-10-10z"})])],-1)),o.value?d("",!0):(s(),l("span",ee,"Gemini Business2API"))],2)],2),e("nav",{class:u(["pb-4 pt-4 lg:pt-6 flex-1 overflow-y-auto",o.value?"px-2":"px-3"])},[o.value?d("",!0):(s(),l("p",te," 导航 ")),e("div",re,[(s(),l(V,null,$(_,r=>m(a(k),{key:r.path,to:r.path,class:u(["group flex items-center rounded-2xl py-2 text-sm font-medium transition-colors overflow-hidden",D(r.path)]),title:o.value?r.label:void 0},{default:w(()=>[e("span",{class:u(["inline-flex h-9 w-9 items-center justify-center rounded-2xl border border-border",I(r.path)])},[(s(),l("svg",oe,[e("path",{d:r.icon},null,8,se)]))],2),o.value?d("",!0):(s(),l("span",ne,p(r.label),1)),o.value?d("",!0):(s(),l("span",le," 进入 "))]),_:2},1032,["to","class","title"])),64))])],2),e("div",ae,[o.value?d("",!0):(s(),l("div",ie,[...t[10]||(t[10]=[e("p",{class:"text-xs tracking-[0.12em] text-muted-foreground"},[e("a",{href:"https://github.com/Dreamy-rain/gemini-business2api",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 transition-colors hover:text-foreground"}," gemini-business2api "),e("span",null," · 声明")],-1),e("p",{class:"mt-2 text-xs text-muted-foreground"}," 本项目仅限学习与研究用途,禁止用于商业用途。请保留本声明、原作者信息与开源来源。 ",-1)])])),e("div",{class:u(["mt-4 flex items-center gap-3",o.value?"justify-center":""])},[o.value?d("",!0):(s(),l("button",{key:0,onClick:N,class:"flex-1 rounded-2xl border border-border bg-background px-4 py-3 text-sm font-medium text-muted-foreground transition-colors hover:border-destructive/40 hover:text-destructive"}," 退出登录 ")),e("button",{class:"h-10 w-10 shrink-0 items-center justify-center rounded-2xl border border-border text-muted-foreground transition-all hover:border-primary hover:text-primary flex",onClick:t[1]||(t[1]=r=>o.value=!o.value),title:o.value?"展开侧边栏":"收起侧边栏"},[...t[11]||(t[11]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-4 w-4 shrink-0",fill:"currentColor"},[e("path",{d:"M6 4h2v16H6V4zm4 4h8v2h-8V8zm0 6h8v2h-8v-2z"})],-1)])],8,de)],2)])],2),e("main",ue,[e("header",pe,[e("div",ce,[e("button",{class:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-border text-foreground transition-colors hover:border-primary hover:text-primary lg:hidden",onClick:t[2]||(t[2]=r=>x.value=!0),"aria-label":"打开导航"},[...t[12]||(t[12]=[e("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",class:"h-5 w-5",fill:"currentColor"},[e("path",{d:"M4 6h16v2H4V6zm0 5h16v2H4v-2zm0 5h16v2H4v-2z"})],-1)])]),t[13]||(t[13]=K('<svg aria-hidden="true" viewBox="0 0 130 150" class="logo-mark h-9 w-9 shrink-0 text-foreground"><defs><filter id="head-shadow" x="-50%" y="-50%" width="200%" height="200%"><feDropShadow dx="0" dy="10" stdDeviation="12" flood-color="rgba(0, 188, 212, 0.2)"></feDropShadow></filter></defs><g class="logo-cat-wrapper" transform="translate(0, 12)"><g transform="translate(16, 20) rotate(-10, 9, 12)"><path d="M14 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g transform="translate(96, 20) rotate(10, 9, 12)"><path d="M4 0 L18 24 L0 24 Z" fill="#2c3e50"></path></g><g filter="url(#head-shadow)"><path d="M 32 40 L 98 40 A 12 12 0 0 1 110 52 L 110 90 A 30 30 0 0 1 80 120 L 50 120 A 30 30 0 0 1 20 90 L 20 52 A 12 12 0 0 1 32 40 Z" fill="rgba(255, 255, 255, 0.9)" stroke="#2c3e50" stroke-width="3"></path></g><rect class="logo-eye" x="35" y="68" width="14" height="4" rx="1"></rect><rect class="logo-eye" x="81" y="68" width="14" height="4" rx="1"></rect></g></svg>',1)),e("h2",xe,p(B.value),1)]),e("div",fe,[e("button",{onClick:P,class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary",title:"刷新"}," 刷新 "),e("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:R}," 接口信息 "),m(a(k),{to:"/public/uptime",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[14]||(t[14]=[A(" 状态监控 ",-1)])]),_:1}),m(a(k),{to:"/public/logs",target:"_blank",class:"rounded-full border border-border px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-primary hover:text-primary"},{default:w(()=>[...t[15]||(t[15]=[A(" 公开日志 ",-1)])]),_:1})])]),e("div",me,[m(a(O))])])]),m(Q,{open:a(i).open.value,title:a(i).title.value,message:a(i).message.value,"confirm-text":a(i).confirmText.value,"cancel-text":a(i).cancelText.value,onConfirm:a(i).confirm,onCancel:a(i).cancel},null,8,["open","title","message","confirm-text","cancel-text","onConfirm","onCancel"]),(s(),G(q,{to:"body"},[g.value?(s(),l("div",be,[e("div",ge,[e("div",ve,[t[16]||(t[16]=e("p",{class:"text-sm font-medium text-foreground"},"API 接口",-1)),e("button",{class:"text-xs text-muted-foreground transition-colors hover:text-foreground",onClick:t[3]||(t[3]=r=>g.value=!1)}," 关闭 ")]),t[22]||(t[22]=e("p",{class:"mt-2 text-xs text-muted-foreground"},"根据客户端选择对应接口",-1)),e("div",he,[e("div",null,[t[17]||(t[17]=e("p",{class:"text-xs text-muted-foreground"},"基础端点",-1)),e("div",ye,[e("p",we,p(v.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[4]||(t[4]=r=>h(v.value))}," 复制 ")])]),e("div",null,[t[18]||(t[18]=e("p",{class:"text-xs text-muted-foreground"},"SDK 接口",-1)),e("div",ke,[e("p",_e,p(z.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[5]||(t[5]=r=>h(z.value))}," 复制 ")])]),e("div",null,[t[19]||(t[19]=e("p",{class:"text-xs text-muted-foreground"},"完整接口",-1)),e("div",ze,[e("p",Ce,p(C.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[6]||(t[6]=r=>h(C.value))}," 复制 ")])]),e("div",null,[t[20]||(t[20]=e("p",{class:"text-xs text-muted-foreground"},"支持模型",-1)),e("div",He,[e("div",Me,[(s(),l(V,null,$(T,r=>e("span",{key:r,class:"rounded-full border border-border px-2 py-0.5 text-[11px]"},p(r),1)),64))])])]),e("div",null,[t[21]||(t[21]=e("p",{class:"text-xs text-muted-foreground"},"API 密钥",-1)),e("div",Se,[e("p",Ve,p(H.value),1),e("button",{class:"shrink-0 rounded-full border border-border px-3 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary hover:text-primary",onClick:t[7]||(t[7]=r=>h(H.value))}," 复制 ")])])]),e("div",$e,[e("button",{class:"rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90",onClick:t[8]||(t[8]=r=>g.value=!1)}," 知道了 ")])])])):d("",!0)]))]))}});export{Ie as default}; | |