fogact 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +244 -0
  3. package/README.zh-CN.md +244 -0
  4. package/bin/cli.js +9 -0
  5. package/bin/web-server.js +1434 -0
  6. package/config/upstream.example.json +14 -0
  7. package/frontend/activate.html +249 -0
  8. package/frontend/admin/admin-panel-v2.js +1899 -0
  9. package/frontend/admin/index.html +705 -0
  10. package/frontend/assets/market-ui.css +1876 -0
  11. package/frontend/color-test.html +136 -0
  12. package/frontend/index.html +191 -0
  13. package/frontend/user/assets/AnnouncementDetail-Dvxmwz0A.js +12 -0
  14. package/frontend/user/assets/Announcements-CS1tF2mx.js +11 -0
  15. package/frontend/user/assets/CardBind-CsCxihhP.js +21 -0
  16. package/frontend/user/assets/CardContent.vue_vue_type_script_setup_true_lang-D2L-uqSl.js +1 -0
  17. package/frontend/user/assets/CardDescription.vue_vue_type_script_setup_true_lang-D-v5Pl7F.js +1 -0
  18. package/frontend/user/assets/CardTitle.vue_vue_type_script_setup_true_lang-a0CCN6D5.js +1 -0
  19. package/frontend/user/assets/Dashboard-rPsmltm5.js +51 -0
  20. package/frontend/user/assets/DashboardLayout-BUCWGlXC.css +1 -0
  21. package/frontend/user/assets/DashboardLayout-DDkxHYFj.js +80 -0
  22. package/frontend/user/assets/Input.vue_vue_type_script_setup_true_lang-B0SyPmYb.js +6 -0
  23. package/frontend/user/assets/Label.vue_vue_type_script_setup_true_lang-CxYORSgN.js +1 -0
  24. package/frontend/user/assets/Progress.vue_vue_type_script_setup_true_lang-2_QbPsEQ.js +1 -0
  25. package/frontend/user/assets/QuotaPack-B_tJ7Psm.js +6 -0
  26. package/frontend/user/assets/Renewal-BSDhDmwv.js +6 -0
  27. package/frontend/user/assets/ScrollArea.vue_vue_type_script_setup_true_lang-DMYwcfpz.js +1 -0
  28. package/frontend/user/assets/Separator.vue_vue_type_script_setup_true_lang-Ckg8EXj_.js +1 -0
  29. package/frontend/user/assets/Settings-CBdAa3lw.js +11 -0
  30. package/frontend/user/assets/TooltipTrigger.vue_vue_type_script_setup_true_lang-DtSBjzGo.js +16 -0
  31. package/frontend/user/assets/Welcome-7IfzEli4.css +1 -0
  32. package/frontend/user/assets/Welcome-Dtfp6oER.js +1 -0
  33. package/frontend/user/assets/_plugin-vue_export-helper-5cjT4u0R.js +16 -0
  34. package/frontend/user/assets/activity-wYWtyqTJ.js +6 -0
  35. package/frontend/user/assets/announcement-35mOnjRL.js +16 -0
  36. package/frontend/user/assets/calendar-BFNuCata.js +6 -0
  37. package/frontend/user/assets/chart-vendor-CULJE59K.js +37 -0
  38. package/frontend/user/assets/chevron-down-kDbuU1Py.js +6 -0
  39. package/frontend/user/assets/chevron-right-BayASIm0.js +6 -0
  40. package/frontend/user/assets/eye-CY62vip0.js +6 -0
  41. package/frontend/user/assets/gauge-C5NQ-mV8.js +6 -0
  42. package/frontend/user/assets/index-B8QSyYhS.css +1 -0
  43. package/frontend/user/assets/index-Da98HOxL.js +91 -0
  44. package/frontend/user/assets/link-2-DT5R5nGO.js +6 -0
  45. package/frontend/user/assets/package-rUbExUEn.js +6 -0
  46. package/frontend/user/assets/plus-CQc6C8wG.js +11 -0
  47. package/frontend/user/assets/refresh-cw-Y9hCloPL.js +6 -0
  48. package/frontend/user/assets/useUserPageRefresh-BYZvpNR9.js +1 -0
  49. package/frontend/user/assets/zap-l5zbZqrM.js +11 -0
  50. package/frontend/user/index.html +67 -0
  51. package/install.sh +402 -0
  52. package/lib/commands/activate.js +144 -0
  53. package/lib/commands/restore.js +102 -0
  54. package/lib/commands/test.js +40 -0
  55. package/lib/config/claude.js +81 -0
  56. package/lib/config/codex.js +164 -0
  57. package/lib/config/upstream.js +79 -0
  58. package/lib/index.js +164 -0
  59. package/lib/platforms/claude-code.js +35 -0
  60. package/lib/platforms/codex-cli.js +35 -0
  61. package/lib/platforms/editor-codex.js +138 -0
  62. package/lib/platforms/index.js +32 -0
  63. package/lib/platforms/openclaw.js +118 -0
  64. package/lib/platforms/opencode.js +89 -0
  65. package/lib/services/activation-orchestrator.js +666 -0
  66. package/lib/services/backup-service.js +162 -0
  67. package/lib/services/cliproxy-api.js +174 -0
  68. package/lib/services/database.js +461 -0
  69. package/lib/services/newapi.js +97 -0
  70. package/lib/services/node-service.js +49 -0
  71. package/lib/utils/json-file.js +33 -0
  72. package/package.json +53 -0
@@ -0,0 +1,51 @@
1
+ import{c as le,O as st,a6 as at,Q as He,a7 as ot,a8 as lt,a9 as nt,a as rt,aa as ve,L as Te,J as xe,X,ab as Qe,ac as Ie,Z as it,ad as ut,ae as fe,u as dt,af as ct,ag as mt,W as Ce,ah as pt,_ as ft,a2 as Ke,$ as vt,a4 as xt,V as gt,a3 as ht,ai as _t,aj as Se}from"./index-Da98HOxL.js";import{j as ae,D as H,y as c,E as u,G as Le,C as Be,u as t,d as l,aw as ye,ax as ze,ay as Oe,az as We,aA as Ge,aB as Ve,aC as be,aD as Me,aE as Ye,H as o,A as e,P as A,I as Z,Q as i,x as y,z as E,aF as Ze,aG as yt,aH as bt,aI as Xe,r as ne,w as Je,aJ as et,F as re,B as _e,J as F,N as kt,aK as wt,aL as $t}from"./chart-vendor-CULJE59K.js";import{_ as W,a as G}from"./CardContent.vue_vue_type_script_setup_true_lang-D2L-uqSl.js";import{_ as ke,a as we}from"./CardTitle.vue_vue_type_script_setup_true_lang-a0CCN6D5.js";import{_ as Ae,d as Re,e as De,f as Pe,C as je,S as qt,g as Ct}from"./TooltipTrigger.vue_vue_type_script_setup_true_lang-DtSBjzGo.js";import{A as Tt}from"./activity-wYWtyqTJ.js";import{G as Mt}from"./gauge-C5NQ-mV8.js";import{_ as It}from"./Progress.vue_vue_type_script_setup_true_lang-2_QbPsEQ.js";import{P as St}from"./package-rUbExUEn.js";import{S as At,Z as Rt}from"./zap-l5zbZqrM.js";import{a as Dt}from"./useUserPageRefresh-BYZvpNR9.js";import{R as Fe}from"./refresh-cw-Y9hCloPL.js";import{C as Pt}from"./calendar-BFNuCata.js";import{E as jt}from"./eye-CY62vip0.js";/**
2
+ * @license lucide-vue-next v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Ht=le("ArrowRightLeftIcon",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
7
+ * @license lucide-vue-next v0.468.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Lt=le("ChartColumnIcon",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
12
+ * @license lucide-vue-next v0.468.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Bt=le("ChartLineIcon",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/**
17
+ * @license lucide-vue-next v0.468.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const zt=le("DollarSignIcon",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
22
+ * @license lucide-vue-next v0.468.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const Ot=le("HourglassIcon",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/**
27
+ * @license lucide-vue-next v0.468.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const tt=le("InboxIcon",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
32
+ * @license lucide-vue-next v0.468.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const Vt=le("MessageCircleQuestionIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
37
+ * @license lucide-vue-next v0.468.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const Nt=le("MessageSquareIcon",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
42
+ * @license lucide-vue-next v0.468.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const Et=le("TrendingUpIcon",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
47
+ * @license lucide-vue-next v0.468.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const Kt=le("WifiOffIcon",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Ft=ae({__name:"Tabs",props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},asChild:{type:Boolean},as:{},class:{}},emits:["update:modelValue"],setup(d,{emit:a}){const g=d,v=a,C=st(g,"class"),k=at(C,v);return(w,n)=>(c(),H(t(ot),Be(t(k),{class:t(He)("",g.class)}),{default:u(()=>[Le(w.$slots,"default")]),_:3},16,["class"]))}}),Ut=ae({__name:"TabsList",props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(d){const a=d;return(g,v)=>(c(),H(t(lt),Be(a,{class:t(He)("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",a.class)}),{default:u(()=>[Le(g.$slots,"default")]),_:3},16,["class"]))}}),Qt=ae({__name:"TabsTrigger",props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(d){const a=d;return(g,v)=>(c(),H(t(nt),Be(a,{class:t(He)("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",a.class)}),{default:u(()=>[Le(g.$slots,"default")]),_:3},16,["class"]))}}),Wt=["hsl(221, 83%, 53%)","hsl(142, 76%, 36%)","hsl(38, 92%, 50%)","hsl(280, 65%, 60%)","hsl(350, 89%, 60%)","hsl(188, 85%, 45%)","hsl(239, 84%, 67%)","hsl(168, 76%, 42%)"],Gt=["hsl(217, 91%, 60%)","hsl(142, 70%, 45%)","hsl(38, 92%, 55%)","hsl(280, 65%, 65%)","hsl(350, 89%, 60%)","hsl(188, 85%, 50%)","hsl(239, 84%, 67%)","hsl(168, 76%, 42%)"];function $e(){const d=rt(),a=l(()=>{const I=d.isDark;return{tooltipBg:I?"#27272a":"#ffffff",tooltipTitle:I?"#fafafa":"#09090b",tooltipBody:I?"#d4d4d8":"#52525b",tooltipBorder:I?"#3f3f46":"#e4e4e7",grid:I?"#27272a":"#e4e4e7",ticks:I?"#a1a1aa":"#71717a"}}),g=l(()=>({backgroundColor:a.value.tooltipBg,titleColor:a.value.tooltipTitle,bodyColor:a.value.tooltipBody,borderColor:a.value.tooltipBorder,borderWidth:1,padding:12,cornerRadius:8})),v=l(()=>({border:{display:!1},grid:{display:!1},ticks:{color:a.value.ticks,font:{size:11}}})),C=l(()=>({beginAtZero:!0,border:{display:!1},grid:{color:a.value.grid},ticks:{color:a.value.ticks,font:{size:11}}})),k=l(()=>d.isDark),w=l(()=>k.value?Gt:Wt);function n(I){return w.value[I%w.value.length]}function T(I,z=.1){return n(I).replace("hsl(","hsla(").replace(")",`, ${z})`)}return{colors:a,tooltipOptions:g,xScaleOptions:v,yScaleOptions:C,isDark:k,palette:w,getColor:n,getFillColor:T,chartAnimation:{duration:200,easing:"easeOutQuart"}}}function P(d){const a=Number(d);return!Number.isFinite(a)||a<=0?0:a}function Ne(d,a){const g=a==="24h";return d.map(v=>{if(g){const n=v.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2})/);return n?`${Number(n[4])}:00`:v}const C=v.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(C)return`${Number(C[2])}/${Number(C[3])}`;const w=v.split("T")[0].match(/^(\d{4})-(\d{2})-(\d{2})$/);return w?`${Number(w[2])}/${Number(w[3])}`:v})}const Yt={class:"flex flex-wrap justify-between items-center gap-2"},Zt={class:"flex items-center gap-2"},Xt={class:"flex flex-wrap gap-3 text-xs"},Jt={class:"flex items-center gap-1.5"},es={class:"text-muted-foreground"},ts={class:"font-medium text-foreground"},ss={class:"flex items-center gap-1.5"},as={class:"text-muted-foreground"},os={class:"font-medium text-foreground"},ls={class:"flex items-center gap-1.5"},ns={class:"text-muted-foreground"},rs={class:"font-medium text-foreground"},is={class:"flex items-center gap-1.5"},us={class:"text-muted-foreground"},ds={class:"font-medium text-foreground"},cs={class:"h-56"},ms={key:0,class:"flex items-center justify-center h-full"},ps={key:1,class:"flex flex-col items-center justify-center h-full text-muted-foreground"},fs=ae({__name:"TokenTrend",props:{data:{},period:{},loading:{type:Boolean}},setup(d){ye.register(ze,Oe,We,Ge,Ve,be,Me,Ye);const a=d,{tooltipOptions:g,xScaleOptions:v,yScaleOptions:C,getColor:k,getFillColor:w,chartAnimation:n}=$e(),T=l(()=>a.data.some(p=>P(p.input_tokens)>0||P(p.output_tokens)>0||P(p.cache_read_tokens)>0||P(p.cache_create_tokens)>0)),b=l(()=>({labels:Ne(a.data.map(m=>m.date),a.period),datasets:[{label:"输入",data:a.data.map(m=>P(m.input_tokens)),borderColor:k(0),backgroundColor:w(0),fill:!0,tension:.4,borderWidth:2,pointRadius:0,pointHoverRadius:4},{label:"输出",data:a.data.map(m=>P(m.output_tokens)),borderColor:k(1),backgroundColor:w(1),fill:!0,tension:.4,borderWidth:2,pointRadius:0,pointHoverRadius:4},{label:"缓存读取",data:a.data.map(m=>P(m.cache_read_tokens)),borderColor:k(2),backgroundColor:w(2),fill:!0,tension:.4,borderWidth:2,pointRadius:0,pointHoverRadius:4},{label:"缓存创建",data:a.data.map(m=>P(m.cache_create_tokens)),borderColor:k(3),backgroundColor:w(3),fill:!0,tension:.4,borderWidth:2,pointRadius:0,pointHoverRadius:4}]})),I=l(()=>({responsive:!0,maintainAspectRatio:!1,animation:n,interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!1},tooltip:{...g.value,callbacks:{label:p=>{const m=P(p.raw);return`${p.dataset.label}: ${m.toLocaleString()}`}}}},scales:{x:v.value,y:{...C.value,ticks:{...C.value.ticks,callback:p=>p>=1e6?`${(p/1e6).toFixed(1)}M`:p>=1e3?`${(p/1e3).toFixed(1)}K`:p}}}})),z=l(()=>a.data.reduce((p,m)=>p+P(m.input_tokens),0)),$=l(()=>a.data.reduce((p,m)=>p+P(m.output_tokens),0)),S=l(()=>a.data.reduce((p,m)=>p+P(m.cache_read_tokens),0)),x=l(()=>a.data.reduce((p,m)=>p+P(m.cache_create_tokens),0));function _(p){return p>=1e6?`${(p/1e6).toFixed(1)}M`:p>=1e3?`${(p/1e3).toFixed(1)}K`:p.toString()}return(p,m)=>(c(),H(t(G),{class:"h-full"},{default:u(()=>[o(t(we),{class:"pb-2"},{default:u(()=>[e("div",Yt,[e("div",Zt,[o(t(Et),{class:"h-5 w-5 text-muted-foreground"}),o(t(ke),{class:"text-base"},{default:u(()=>[...m[0]||(m[0]=[A("Token 使用趋势",-1)])]),_:1}),o(t(Ae),null,{default:u(()=>[o(t(Re),null,{default:u(()=>[o(t(De),null,{default:u(()=>[o(t(ve),{class:"h-4 w-4 text-muted-foreground"})]),_:1}),o(t(Pe),{side:"right",class:"max-w-xs"},{default:u(()=>[...m[1]||(m[1]=[e("p",{class:"text-xs"},[e("strong",null,"输入:"),A(" 发送给 AI 的 token 数"),e("br"),e("strong",null,"输出:"),A(" AI 生成的 token 数"),e("br"),e("strong",null,"缓存读取:"),A(" 从缓存读取的 token 数(节省成本)"),e("br"),e("strong",null,"缓存创建:"),A(" 创建缓存使用的 token 数 ")],-1)])]),_:1})]),_:1})]),_:1})]),e("div",Xt,[e("div",Jt,[e("span",{class:"w-2.5 h-2.5 rounded-full",style:Z({background:t(k)(0)})},null,4),e("span",es,[m[2]||(m[2]=A("输入: ",-1)),e("span",ts,i(_(z.value)),1)])]),e("div",ss,[e("span",{class:"w-2.5 h-2.5 rounded-full",style:Z({background:t(k)(1)})},null,4),e("span",as,[m[3]||(m[3]=A("输出: ",-1)),e("span",os,i(_($.value)),1)])]),e("div",ls,[e("span",{class:"w-2.5 h-2.5 rounded-full",style:Z({background:t(k)(2)})},null,4),e("span",ns,[m[4]||(m[4]=A("缓存读: ",-1)),e("span",rs,i(_(S.value)),1)])]),e("div",is,[e("span",{class:"w-2.5 h-2.5 rounded-full",style:Z({background:t(k)(3)})},null,4),e("span",us,[m[5]||(m[5]=A("缓存创: ",-1)),e("span",ds,i(_(x.value)),1)])])])])]),_:1}),o(t(W),null,{default:u(()=>[e("div",cs,[d.loading?(c(),y("div",ms,[o(t(Te),{class:"h-8 w-8 animate-spin text-primary"})])):T.value?T.value?(c(),H(t(Ze),{key:2,data:b.value,options:I.value},null,8,["data","options"])):E("",!0):(c(),y("div",ps,[...m[6]||(m[6]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-12 w-12 mb-2 opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})],-1),e("p",{class:"text-sm"},"暂无数据",-1),e("p",{class:"text-xs mt-1"},"该时间段内没有使用记录",-1)])]))])]),_:1})]),_:1}))}}),vs={class:"flex flex-wrap justify-between items-center gap-2"},xs={class:"flex items-center gap-2"},gs={class:"flex flex-col sm:flex-row sm:items-center flex-wrap gap-2 sm:gap-6 text-xs sm:text-sm"},hs={class:"flex items-center gap-2"},_s={class:"text-muted-foreground"},ys={class:"font-medium text-foreground tabular-nums"},bs={class:"text-muted-foreground"},ks={class:"font-medium text-foreground tabular-nums"},ws={class:"h-44"},$s={key:0,class:"flex items-center justify-center h-full"},qs={key:1,class:"flex flex-col items-center justify-center h-full text-muted-foreground"},Cs=ae({__name:"RequestBar",props:{data:{},period:{},loading:{type:Boolean}},setup(d){ye.register(ze,Oe,yt,Ve,be,Me);const a=d,{tooltipOptions:g,xScaleOptions:v,yScaleOptions:C,getColor:k,chartAnimation:w}=$e(),n=l(()=>a.period==="24h"),T=l(()=>({labels:Ne(a.data.map(x=>x.date),a.period),datasets:[{label:"请求次数",data:a.data.map(x=>P(x.requests)),backgroundColor:k(0),borderRadius:6,maxBarThickness:32}]})),b=l(()=>({responsive:!0,maintainAspectRatio:!1,animation:w,plugins:{legend:{display:!1},tooltip:{...g.value,callbacks:{label:S=>`请求次数: ${P(S.raw)}`}}},scales:{x:v.value,y:{...C.value,ticks:{...C.value.ticks,stepSize:1,callback:S=>Number.isInteger(S)?S:null}}}})),I=l(()=>a.data.reduce((S,x)=>S+P(x.requests),0)),z=l(()=>a.data.length===0?0:Math.round(I.value/a.data.length)),$=l(()=>I.value>0);return(S,x)=>(c(),H(t(G),null,{default:u(()=>[o(t(we),{class:"pb-2"},{default:u(()=>[e("div",vs,[e("div",xs,[o(t(Tt),{class:"h-5 w-5 text-muted-foreground"}),o(t(ke),{class:"text-base"},{default:u(()=>[...x[0]||(x[0]=[A("请求次数统计",-1)])]),_:1})]),e("div",gs,[e("div",hs,[e("div",{class:"w-3 h-3 rounded-full",style:Z({background:t(k)(0)})},null,4),e("span",_s,[x[1]||(x[1]=A("总计: ",-1)),e("span",ys,i(I.value),1)])]),e("span",bs,[A(i(n.value?"时均":"日均")+": ",1),e("span",ks,i(z.value),1)])])])]),_:1}),o(t(W),null,{default:u(()=>[e("div",ws,[d.loading?(c(),y("div",$s,[o(t(Te),{class:"h-8 w-8 animate-spin text-primary"})])):$.value?$.value?(c(),H(t(bt),{key:2,data:T.value,options:b.value},null,8,["data","options"])):E("",!0):(c(),y("div",qs,[...x[2]||(x[2]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-10 w-10 mb-2 opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M13 10V3L4 14h7v7l9-11h-7z"})],-1),e("p",{class:"text-sm"},"暂无请求记录",-1)])]))])]),_:1})]),_:1}))}}),Ts={class:"flex items-center justify-between"},Ms={class:"flex items-center gap-2"},Is={key:0,class:"flex flex-col items-center justify-center h-40 text-muted-foreground"},Ss={class:"relative h-40"},As={class:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none z-0"},Rs={class:"text-2xl font-bold text-foreground"},Ds={class:"relative z-10 h-full"},Ps={class:"grid grid-cols-2 sm:grid-cols-4 gap-3 mt-4 pt-4 border-t"},js={class:"text-center"},Hs={class:"text-xs text-muted-foreground mb-1"},Ls={class:"font-bold tabular-nums text-sm text-primary"},Bs={class:"text-center"},zs={class:"font-bold tabular-nums text-sm"},Os={class:"text-center"},Vs={class:"text-center"},Ns=ae({__name:"QuotaChart",props:{used:{},remaining:{},total:{},unit:{},type:{},dailyQuota:{}},setup(d){ye.register(Xe,be,Me);const a=d,{tooltipOptions:g,getColor:v,chartAnimation:C,isDark:k}=$e(),w=ne(null);Je(k,()=>{var x,_;(_=(x=w.value)==null?void 0:x.chart)==null||_.update("none")});const n=l(()=>a.type!=="count"),T=x=>n.value?X(x):x.toString(),b=l(()=>{const x=P(a.total),_=Math.min(P(a.used),x),p=Math.max(x-_,0);return{total:x,used:_,remaining:p}}),I=l(()=>({labels:["已使用","剩余"],datasets:[{data:[b.value.used,b.value.remaining],backgroundColor:[v(2),v(1)],borderWidth:0,cutout:"75%",borderRadius:4}]})),z=l(()=>({responsive:!0,maintainAspectRatio:!1,animation:C,plugins:{legend:{display:!1},tooltip:{...g.value,titleFont:{size:13},bodyFont:{size:12},callbacks:{label:x=>{const _=P(x.raw),p=b.value.total>0?(_/b.value.total*100).toFixed(1):"0",m=n.value?X(_):_;return`${x.label}: ${m} (${p}%)`}}}}})),$=l(()=>b.value.total===0?0:Math.round(b.value.used/b.value.total*100)),S=l(()=>b.value.total>0);return(x,_)=>(c(),H(t(G),{class:"h-full"},{default:u(()=>[o(t(we),{class:"pb-2"},{default:u(()=>[e("div",Ts,[e("div",Ms,[o(t(Mt),{class:"h-5 w-5 text-muted-foreground"}),o(t(ke),{class:"text-base"},{default:u(()=>[..._[0]||(_[0]=[A("额度使用",-1)])]),_:1})]),d.unit?(c(),H(t(xe),{key:0,variant:"secondary",class:"text-xs font-normal"},{default:u(()=>[A(i(d.unit),1)]),_:1})):E("",!0)])]),_:1}),o(t(W),null,{default:u(()=>[S.value?(c(),y(re,{key:1},[e("div",Ss,[e("div",As,[e("span",Rs,i($.value)+"% ",1),_[2]||(_[2]=e("span",{class:"text-xs text-muted-foreground"},"已使用",-1))]),e("div",Ds,[o(t(et),{ref_key:"chartRef",ref:w,data:I.value,options:z.value},null,8,["data","options"])])]),e("div",Ps,[e("div",js,[e("div",Hs,i(d.type==="duration"?"每日额度":d.type==="count"?"基础次数":"基础额度"),1),e("div",Ls,i(d.type==="count"?t(P)(d.dailyQuota??0):T(t(P)(d.dailyQuota??0))),1)]),e("div",Bs,[_[3]||(_[3]=e("div",{class:"text-xs text-muted-foreground mb-1"},"总额度",-1)),e("div",zs,i(T(b.value.total)),1)]),e("div",Os,[_[4]||(_[4]=e("div",{class:"text-xs text-muted-foreground mb-1"},"已使用",-1)),e("div",{class:"font-bold tabular-nums text-sm",style:Z({color:t(v)(2)})},i(T(b.value.used)),5)]),e("div",Vs,[_[5]||(_[5]=e("div",{class:"text-xs text-muted-foreground mb-1"},"剩余",-1)),e("div",{class:"font-bold tabular-nums text-sm",style:Z({color:t(v)(1)})},i(T(b.value.remaining)),5)])])],64)):(c(),y("div",Is,[..._[1]||(_[1]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-10 w-10 mb-2 opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})],-1),e("p",{class:"text-sm"},"暂无配额信息",-1)])]))]),_:1})]),_:1}))}}),Es={class:"flex flex-wrap justify-between items-center gap-2"},Ks={class:"flex items-center gap-2"},Fs={key:0,class:"flex rounded-lg bg-muted p-0.5 gap-0.5"},Us=["onClick"],Qs={class:"h-56"},Ws={key:0,class:"flex items-center justify-center h-full"},Gs={key:1,class:"flex flex-col items-center justify-center h-full text-muted-foreground"},Ys={class:"text-xs text-muted-foreground"},Zs={key:0,class:"flex items-center gap-1.5"},Xs={class:"text-xs text-muted-foreground"},Ue=8,Js=ae({__name:"ModelTrend",props:{data:{},period:{},loading:{type:Boolean}},setup(d){ye.register(ze,Oe,We,Ge,Ve,be,Me,Ye);const a=d,g=ne("tokens"),{tooltipOptions:v,xScaleOptions:C,yScaleOptions:k,isDark:w,getColor:n,getFillColor:T,chartAnimation:b}=$e();function I(f,h){return P(h==="tokens"?f.total_tokens:h==="cost"?f.cost:f.requests)}const z=l(()=>{const f=new Map;for(const h of a.data)for(const D of h.models)f.set(D.model,(f.get(D.model)||0)+I(D,g.value));return Array.from(f.entries()).sort((h,D)=>D[1]-h[1]).map(([h])=>h)}),$=l(()=>z.value.slice(0,Ue)),S=l(()=>z.value.slice(Ue)),x=l(()=>S.value.length>0),_=l(()=>`其他 (${S.value.length} 个模型)`),p=l(()=>w.value?"hsl(240, 5%, 46%)":"hsl(240, 5%, 64%)"),m=l(()=>a.data.length>0&&z.value.length>0);function R(f,h,D){const N=f.models.find(ee=>ee.model===h);return N?I(N,D):0}const M=l(()=>{const f=Ne(a.data.map(D=>D.date),a.period),h=$.value.map((D,N)=>({label:D,data:a.data.map(ee=>R(ee,D,g.value)),borderColor:n(N),backgroundColor:T(N,.15),fill:!0,tension:.4,borderWidth:2,pointRadius:0,pointHoverRadius:4}));if(x.value){const D=S.value;h.push({label:_.value,data:a.data.map(N=>{let ee=0;for(const r of D)ee+=R(N,r,g.value);return ee}),borderColor:p.value,backgroundColor:p.value.replace("hsl(","hsla(").replace(")",", 0.15)"),fill:!0,tension:.4,borderWidth:2,pointRadius:0,pointHoverRadius:4})}return{labels:f,datasets:h}});function L(f){return g.value==="tokens"?f>=1e6?`${(f/1e6).toFixed(1)}M`:f>=1e3?`${(f/1e3).toFixed(1)}K`:f.toString():g.value==="cost"?X(f):f.toString()}function B(f){return g.value==="tokens"?f.toLocaleString():g.value==="cost"?X(f):`${f} 次`}const J=l(()=>({responsive:!0,maintainAspectRatio:!1,animation:b,interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!1},tooltip:{...v.value,callbacks:{label:f=>{const h=P(f.raw);return h===0?"":`${f.dataset.label}: ${B(h)}`}},filter:f=>P(f.raw)>0}},scales:{x:C.value,y:{...k.value,ticks:{...k.value.ticks,callback:f=>L(f)}}}})),Y=[{value:"tokens",label:"Tokens"},{value:"cost",label:"消费"},{value:"requests",label:"请求"}];return(f,h)=>(c(),H(t(G),{class:"h-full"},{default:u(()=>[o(t(we),{class:"pb-2"},{default:u(()=>[e("div",Es,[e("div",Ks,[o(t(Bt),{class:"h-5 w-5 text-muted-foreground"}),o(t(ke),{class:"text-base"},{default:u(()=>[...h[0]||(h[0]=[A("模型使用趋势",-1)])]),_:1})]),m.value||d.loading?(c(),y("div",Fs,[(c(),y(re,null,_e(Y,D=>e("button",{key:D.value,class:F(["px-3 py-1 text-xs font-medium rounded-md transition-colors",g.value===D.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"]),onClick:N=>g.value=D.value},i(D.label),11,Us)),64))])):E("",!0)])]),_:1}),o(t(W),null,{default:u(()=>[e("div",Qs,[d.loading?(c(),y("div",Ws,[o(t(Te),{class:"h-8 w-8 animate-spin text-primary"})])):m.value?m.value?(c(),H(t(Ze),{key:2,data:M.value,options:J.value},null,8,["data","options"])):E("",!0):(c(),y("div",Gs,[o(t(tt),{class:"h-12 w-12 mb-2 opacity-50"}),h[1]||(h[1]=e("p",{class:"text-sm"},"暂无模型使用数据",-1)),h[2]||(h[2]=e("p",{class:"text-xs mt-1"},"该时间段内没有模型使用记录",-1))]))]),m.value||d.loading?(c(),y("div",{key:0,class:F(["flex flex-wrap gap-x-4 gap-y-1.5 mt-3 pt-3 border-t border-border",{invisible:d.loading}]),style:{"min-height":"28px"}},[(c(!0),y(re,null,_e($.value,(D,N)=>(c(),y("div",{key:D,class:"flex items-center gap-1.5"},[e("span",{class:"w-2.5 h-2.5 rounded-full shrink-0",style:Z({background:t(n)(N)})},null,4),e("span",Ys,i(D),1)]))),128)),x.value?(c(),y("div",Zs,[e("span",{class:"w-2.5 h-2.5 rounded-full shrink-0",style:Z({background:p.value})},null,4),e("span",Xs,i(_.value),1)])):E("",!0)],2)):E("",!0)]),_:1})]),_:1}))}}),ea={class:"space-y-4"},ta={class:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3"},sa={class:"grid grid-cols-1 lg:grid-cols-3 gap-4"},aa={key:0,class:"lg:col-span-1"},oa=ae({__name:"UsageTrends",props:{usageHistory:{},selectedPeriod:{},isLoading:{type:Boolean},quotaUsed:{},quotaRemaining:{},quotaTotal:{},quotaUnit:{},quotaType:{},quotaDailyQuota:{},modelTrendData:{}},emits:["update:selectedPeriod"],setup(d,{emit:a}){const g=d,v=a,C=[{value:"24h",label:"24小时"},{value:"7d",label:"7天"},{value:"14d",label:"14天"},{value:"30d",label:"30天"}];function k(n){const T=String(n);C.some(b=>b.value===T)&&T!==g.selectedPeriod&&v("update:selectedPeriod",T)}const w=l(()=>(g.quotaTotal??0)>0);return(n,T)=>(c(),y("div",ea,[e("div",ta,[T[0]||(T[0]=e("div",null,[e("h2",{class:"text-lg font-semibold"},"使用趋势"),e("p",{class:"text-sm text-muted-foreground"},"查看 API 使用统计")],-1)),o(t(Ft),{"model-value":d.selectedPeriod,class:"w-full sm:w-auto","onUpdate:modelValue":k},{default:u(()=>[o(t(Ut),{class:"flex-wrap h-auto w-full sm:w-auto justify-start"},{default:u(()=>[(c(),y(re,null,_e(C,b=>o(t(Qt),{key:b.value,value:b.value},{default:u(()=>[A(i(b.label),1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value"])]),e("div",sa,[w.value?(c(),y("div",aa,[o(Ns,{used:d.quotaUsed||0,remaining:d.quotaRemaining||0,total:d.quotaTotal||0,unit:d.quotaUnit||"",type:d.quotaType||"","daily-quota":d.quotaDailyQuota||0},null,8,["used","remaining","total","unit","type","daily-quota"])])):E("",!0),e("div",{class:F(w.value?"lg:col-span-2":"lg:col-span-3")},[o(fs,{data:d.usageHistory,period:d.selectedPeriod,loading:d.isLoading},null,8,["data","period","loading"])],2)]),e("div",null,[o(Cs,{data:d.usageHistory,period:d.selectedPeriod,loading:d.isLoading},null,8,["data","period","loading"])]),e("div",null,[d.isLoading||d.modelTrendData&&d.modelTrendData.length>0?(c(),H(Js,{key:0,data:d.modelTrendData||[],period:d.selectedPeriod,loading:d.isLoading},null,8,["data","period","loading"])):E("",!0)])]))}}),la={class:"flex flex-col md:flex-row md:gap-5"},na={class:"md:w-[45%] lg:w-[40%] shrink-0 space-y-2"},ra={class:"flex flex-wrap items-center gap-2"},ia={class:"w-8 h-8 rounded-lg bg-amber-500/10 dark:bg-amber-400/10 flex items-center justify-center"},ua={class:"text-sm font-medium"},da={class:"text-xs"},ca={class:"flex items-baseline gap-1"},ma={class:"text-lg font-bold tabular-nums text-primary"},pa={class:"text-sm text-muted-foreground"},fa={class:"flex items-center gap-3"},va={class:"text-xs font-medium tabular-nums text-muted-foreground shrink-0"},xa={class:"flex-1 min-w-0"},ga={class:"flex items-center gap-1.5 mb-2"},ha={class:"space-y-1.5"},_a=ae({__name:"QuotaPackBar",props:{packInfo:{}},setup(d){const a=d,g=ne(Date.now());Qe(()=>{g.value=Date.now()},6e4);const v=l(()=>a.packInfo.total<=0?0:Math.round(a.packInfo.used/a.packInfo.total*100)),C=l(()=>100-v.value),k=l(()=>{const $=C.value;return $>50?"bg-emerald-500":$>20?"bg-amber-500":"bg-red-500"}),w=l(()=>(g.value,it(a.packInfo.expiresAt))),n=l(()=>{if(g.value,!a.packInfo.expiresAt)return!1;const $=new Date(a.packInfo.expiresAt);return ut($,new Date)<24}),T=l(()=>a.packInfo.type==="count"?`${a.packInfo.remaining} 次`:X(a.packInfo.remaining)),b=l(()=>a.packInfo.type==="count"?`${a.packInfo.total} 次`:X(a.packInfo.total)),I=l(()=>a.packInfo.status==="active"?{label:"生效中",class:"border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-400"}:{label:"已耗尽",class:"border-gray-300 bg-gray-100 text-gray-600 dark:border-gray-500/30 dark:bg-gray-500/10 dark:text-gray-400"}),z=l(()=>{const $=[];return n.value&&a.packInfo.status==="active"&&$.push({icon:Ie,text:"配额包即将过期,请尽快使用剩余额度",class:"text-red-500 dark:text-red-400"}),a.packInfo.status==="used_up"&&$.push({icon:Ie,text:"配额包已耗尽,如需继续使用请联系管理员增购",class:"text-muted-foreground/50"}),$.push({icon:Ht,text:`基础配额用完后自动使用${a.packInfo.label}`},{icon:At,text:"有效期内未使用完的额度不会退还"},{icon:je,text:"配额包到期后剩余额度将自动失效"},{icon:Vt,text:"如需续期或增购请联系管理员"}),$});return($,S)=>(c(),H(t(G),null,{default:u(()=>[o(t(W),{class:"py-3 px-5"},{default:u(()=>[e("div",la,[e("div",na,[e("div",ra,[e("div",ia,[o(t(St),{class:"h-4 w-4 text-amber-600 dark:text-amber-400"})]),e("span",ua,i(d.packInfo.label),1),o(t(xe),{variant:"outline",class:F(["text-xs",I.value.class])},{default:u(()=>[A(i(I.value.label),1)]),_:1},8,["class"]),w.value?(c(),y("div",{key:0,class:F(["flex items-center gap-1 ml-auto md:ml-0",n.value?"text-red-500":"text-muted-foreground"])},[n.value?(c(),H(t(Ie),{key:0,class:"h-3.5 w-3.5"})):(c(),H(t(je),{key:1,class:"h-3.5 w-3.5"})),e("span",da,i(w.value),1)],2)):E("",!0)]),e("div",ca,[e("span",ma,i(T.value),1),e("span",pa," / "+i(b.value),1)]),e("div",fa,[o(t(It),{"model-value":v.value,class:"h-1.5 flex-1","indicator-class":k.value},null,8,["model-value","indicator-class"]),e("span",va,i(v.value)+"% ",1)])]),S[1]||(S[1]=e("div",{class:"my-3 border-t border-dashed border-border/40 md:hidden"},null,-1)),S[2]||(S[2]=e("div",{class:"hidden md:block border-l border-dashed border-border/40"},null,-1)),e("div",xa,[e("div",ga,[o(t(ve),{class:"h-3.5 w-3.5 text-amber-500/70 dark:text-amber-400/70"}),S[0]||(S[0]=e("span",{class:"text-xs font-medium text-amber-600/80 dark:text-amber-400/70"}," 注意事项 ",-1))]),e("ul",ha,[(c(!0),y(re,null,_e(z.value,(x,_)=>(c(),y("li",{key:_,class:"flex items-start gap-1.5"},[(c(),H(kt(x.icon),{class:F(["h-3 w-3 mt-0.5 shrink-0",x.class||"text-amber-500/70 dark:text-amber-400/70"])},null,8,["class"])),e("span",{class:F(["text-xs leading-relaxed",x.class||"text-muted-foreground"])},i(x.text),3)]))),128))])])])]),_:1})]),_:1}))}}),ya={class:"flex items-center justify-between"},ba={class:"flex items-center gap-2"},ka={key:0,class:"flex items-center justify-center min-h-[200px] text-muted-foreground"},wa={key:1,class:"flex flex-col items-center justify-center py-10 text-muted-foreground"},$a={key:2,class:"grid grid-cols-1 lg:grid-cols-3 gap-6"},qa={class:"flex items-center justify-center lg:col-span-1"},Ca={class:"relative"},Ta={class:"relative w-40 h-40"},Ma={class:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none z-0"},Ia={class:"text-lg font-bold text-foreground tabular-nums"},Sa={class:"relative z-10 h-full"},Aa={class:"font-medium"},Ra={class:"text-muted-foreground"},Da={class:"lg:col-span-2 space-y-4"},Pa={class:"flex items-center justify-between gap-2"},ja={class:"flex items-center gap-2 min-w-0"},Ha={class:"text-sm font-medium truncate"},La={class:"flex items-center gap-3 shrink-0"},Ba={class:"text-sm font-bold tabular-nums"},za={class:"text-xs text-muted-foreground tabular-nums w-12 text-right"},Oa={class:"w-full h-2 rounded-full bg-muted overflow-hidden"},Va={class:"flex items-center gap-3 text-[11px] text-muted-foreground"},ge=5,Na=ae({__name:"ModelCostBreakdown",props:{modelCosts:{},loading:{type:Boolean},period:{}},setup(d){ye.register(Xe,be);const a=d,{isDark:g,palette:v}=$e(),C=l(()=>({"24h":"24小时","7d":"近7天","14d":"近14天","30d":"近30天"})[a.period||""]||"累计"),k=ne(!1),w=ne({title:"",body:""}),n=ne({x:0,y:0}),T=l(()=>[...a.modelCosts].sort((R,M)=>M.cost-R.cost)),b=l(()=>{if(T.value.length<=ge)return T.value;const R=T.value.slice(0,ge),M=T.value.slice(ge),L=M.reduce((Y,f)=>Y+f.cost,0),B=M.reduce((Y,f)=>Y+f.tokens,0),J=M.reduce((Y,f)=>Y+f.requests,0);return[...R,{model:`其他 (${M.length} 个模型)`,cost:L,tokens:B,requests:J,percentage:0}]}),I=l(()=>a.modelCosts.length>0),z=l(()=>a.modelCosts.reduce((R,M)=>R+M.cost,0));function $(R){return z.value<=0?0:R/z.value*100}const S=l(()=>{const R=v.value.slice(0,ge);if(T.value.length>ge){const M=g.value?"hsl(240, 5%, 46%)":"hsl(240, 5%, 64%)";return[...R,M]}return v.value.slice(0,T.value.length)}),x=l(()=>({labels:b.value.map(R=>R.model),datasets:[{data:b.value.map(R=>R.cost),backgroundColor:S.value.slice(0,b.value.length),borderWidth:0,borderRadius:3}]})),_=l(()=>({responsive:!0,maintainAspectRatio:!1,cutout:"70%",plugins:{legend:{display:!1},tooltip:{enabled:!1,external:R=>{var h,D,N,ee;const{chart:M,tooltip:L}=R;if(L.opacity===0){k.value=!1;return}const B=((h=L.title)==null?void 0:h[0])||"",J=((ee=(N=(D=L.body)==null?void 0:D[0])==null?void 0:N.lines)==null?void 0:ee[0])||"";w.value={title:B,body:J};const{offsetLeft:Y,offsetTop:f}=M.canvas;n.value={x:Y+L.caretX,y:f+L.caretY},k.value=!0},callbacks:{label:R=>{const M=R.raw,L=z.value,B=L>0?(M/L*100).toFixed(1):"0";return`${X(M)} (${B}%)`}}}}})),p=["bg-chart-1","bg-chart-2","bg-chart-3","bg-chart-4","bg-rose-500"];function m(R){return R>=ge?"bg-zinc-400":p[R%p.length]}return(R,M)=>(c(),H(t(G),null,{default:u(()=>[o(t(we),{class:"pb-3"},{default:u(()=>[e("div",ya,[e("div",ba,[o(t(Lt),{class:"h-5 w-5 text-muted-foreground"}),o(t(ke),{class:"text-base"},{default:u(()=>[...M[0]||(M[0]=[A("模型消费明细",-1)])]),_:1})]),o(t(xe),{variant:"outline",class:"text-xs text-muted-foreground"},{default:u(()=>[A(i(C.value),1)]),_:1})])]),_:1}),o(t(W),{class:"pt-0"},{default:u(()=>[d.loading?(c(),y("div",ka,[o(t(Te),{class:"h-8 w-8 animate-spin text-primary"})])):I.value?(c(),y("div",$a,[e("div",qa,[e("div",Ca,[e("div",Ta,[e("div",Ma,[e("span",Ia,i(t(X)(z.value)),1),M[3]||(M[3]=e("span",{class:"text-[11px] text-muted-foreground"},"总消费",-1))]),e("div",Sa,[o(t(et),{data:x.value,options:_.value},null,8,["data","options"])])]),wt(e("div",{class:"absolute z-50 pointer-events-none px-3 py-2 rounded-lg border text-xs shadow-md whitespace-nowrap bg-popover text-popover-foreground border-border",style:Z({left:`${n.value.x}px`,top:`${n.value.y}px`,transform:"translate(-50%, -120%)"})},[e("div",Aa,i(w.value.title),1),e("div",Ra,i(w.value.body),1)],4),[[$t,k.value]])])]),e("div",Da,[(c(!0),y(re,null,_e(b.value,(L,B)=>(c(),y("div",{key:L.model,class:"space-y-2"},[e("div",Pa,[e("div",ja,[e("span",{class:F(["w-2.5 h-2.5 rounded-full shrink-0",m(B)])},null,2),e("span",Ha,i(L.model),1)]),e("div",La,[e("span",Ba,i(t(X)(L.cost)),1),e("span",za,i($(L.cost).toFixed(1))+"% ",1)])]),e("div",Oa,[e("div",{class:F(["h-full rounded-full transition-all duration-500",m(B)]),style:Z({width:`${Math.max($(L.cost),1)}%`})},null,6)]),e("div",Va,[e("span",null,i(t(fe)(L.tokens))+" tokens",1),M[4]||(M[4]=e("span",null,"·",-1)),e("span",null,i(L.requests)+" 次请求",1)])]))),128))])])):(c(),y("div",wa,[o(t(tt),{class:"h-10 w-10 mb-2 opacity-50"}),M[1]||(M[1]=e("p",{class:"text-sm"},"暂无模型消费数据",-1)),M[2]||(M[2]=e("p",{class:"text-xs mt-1 text-muted-foreground/70"}," 使用 API 后将在此展示各模型消费占比 ",-1))]))]),_:1})]),_:1}))}}),Ea={class:"max-w-7xl mx-auto"},Ka={key:0,class:"py-10"},Fa={class:"mt-4 text-xl font-semibold tracking-tight text-foreground"},Ua={class:"mt-2 max-w-xl text-sm leading-6 text-muted-foreground"},Qa={class:"sm:hidden mb-4"},Wa={class:"flex items-center justify-between"},Ga={class:"flex items-center gap-1.5"},Ya={class:"truncate"},Za={key:0,class:"mb-6 rounded-lg border border-amber-200 dark:border-amber-500/20 bg-amber-50 dark:bg-amber-500/5 p-4"},Xa={class:"flex gap-3"},Ja={class:"shrink-0 mt-0.5"},eo={key:1,class:"mb-6 rounded-lg border border-red-200 dark:border-red-500/20 bg-red-50 dark:bg-red-500/5 p-4"},to={class:"flex gap-3"},so={class:"shrink-0 mt-0.5"},ao={key:2,class:"mb-6 rounded-lg border border-red-200 dark:border-red-500/20 bg-red-50 dark:bg-red-500/5 p-4"},oo={class:"flex gap-3"},lo={class:"shrink-0 mt-0.5"},no={key:3,class:"mb-6 rounded-lg border border-blue-200 dark:border-blue-500/20 bg-blue-50 dark:bg-blue-500/5 p-4"},ro={class:"flex gap-3"},io={class:"shrink-0 mt-0.5"},uo={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-8"},co={class:"flex items-start justify-between"},mo={class:"space-y-1"},po={class:"flex items-center gap-1.5"},fo={class:"text-xs font-medium text-muted-foreground uppercase tracking-wide"},vo={class:"text-xs text-white"},xo={class:"text-xs text-white/70"},go={class:"text-2xl font-bold tabular-nums text-primary"},ho={class:"text-xs text-muted-foreground"},_o={key:0,class:"text-amber-500"},yo={class:"relative flex items-center justify-center"},bo={class:"w-14 h-14 -rotate-90"},ko={class:"absolute text-xs font-semibold text-primary transition-colors duration-200"},wo={class:"flex items-start justify-between"},$o={class:"space-y-1"},qo={class:"flex items-center gap-1.5"},Co={class:"text-xs space-y-1"},To={class:"text-2xl font-bold tabular-nums text-chart-2"},Mo={class:"text-xs text-muted-foreground"},Io={class:"w-12 h-12 rounded-xl bg-chart-2/10 flex items-center justify-center"},So={class:"flex items-start justify-between"},Ao={class:"space-y-1"},Ro={class:"text-2xl font-bold tabular-nums text-chart-4"},Do={class:"text-xs text-muted-foreground"},Po={class:"w-12 h-12 rounded-xl bg-chart-4/10 flex items-center justify-center"},jo={class:"flex items-start justify-between"},Ho={class:"space-y-1"},Lo={class:"text-2xl font-bold tabular-nums text-chart-3"},Bo={class:"text-xs text-muted-foreground"},zo={class:"w-12 h-12 rounded-xl bg-chart-3/10 flex items-center justify-center"},Oo={class:"mb-6"},Vo={class:"mb-6"},No={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 text-sm"},Eo={class:"flex items-center gap-3"},Ko={class:"w-9 h-9 rounded-lg bg-muted flex items-center justify-center flex-shrink-0"},Fo={class:"font-medium"},Uo={class:"flex items-center gap-3"},Qo={class:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"rgba(245, 158, 11, 0.1)"}},Wo={class:"font-medium"},Go={class:"flex items-center gap-3"},Yo={class:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"rgba(59, 130, 246, 0.1)"}},Zo={class:"flex items-center gap-3"},Xo={class:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"rgba(34, 197, 94, 0.1)"}},Jo={class:"font-medium"},fl=ae({__name:"Dashboard",setup(d){const a=dt(),g=ne(Date.now());Qe(()=>{g.value=Date.now()},6e4);const v=ne("24h"),C=ne(!1);let k=0;const w=l(()=>{var r,s;return((r=a.usageHistory)==null?void 0:r.period)===v.value&&((s=a.modelTrends)==null?void 0:s.period)===v.value}),n=l(()=>a.apiKeyInfo),T=l(()=>{var r;return((r=a.usageHistory)==null?void 0:r.data)||[]}),b=l(()=>{var r;return((r=a.modelTrends)==null?void 0:r.data)||[]}),I=l(()=>a.isBootstrapping),z=l(()=>!I.value&&!n.value),$=l(()=>!I.value&&!n.value?a.error:null),S=l(()=>{var r;return((r=a.invalidKeyRecovery)==null?void 0:r.mode)==="relogin"}),x=l(()=>$.value?"当前 Key 信息加载失败":S.value?"当前 Key 已失效":"暂无可展示的 Key 信息"),_=l(()=>$.value?$.value:S.value?"请先确认恢复弹窗,系统会带您返回欢迎页重新添加可用 Key。":"请从左侧切换其他可用 Key,或稍后重试。"),p=l(()=>{const r=new Map;for(const j of b.value)for(const q of j.models){const V=r.get(q.model);V?(V.cost+=q.cost,V.tokens+=q.total_tokens,V.requests+=q.requests):r.set(q.model,{cost:q.cost,tokens:q.total_tokens,requests:q.requests})}const s=[...r.values()].reduce((j,q)=>j+q.cost,0);return[...r.entries()].map(([j,q])=>({model:j,cost:q.cost,tokens:q.tokens,requests:q.requests,percentage:s>0?q.cost/s*100:0}))}),m=l(()=>{g.value;const r=n.value;return!(r!=null&&r.quota)||r.billing_type!=="duration"?"":ct(r.quota.next_reset_at)}),R=l(()=>{var q;const r=n.value,s=((q=r==null?void 0:r.quota)==null?void 0:q.reset_timezone)||"Asia/Shanghai";return{"Asia/Shanghai":"北京时间",UTC:"UTC","America/New_York":"纽约时间","Europe/London":"伦敦时间"}[s]||s}),M=l(()=>{var s,j,q,V,U;if(((s=n.value)==null?void 0:s.status)==="disabled")return"已禁用";g.value;const r=(q=(j=n.value)==null?void 0:j.timestamps)==null?void 0:q.expires_at;if(!r){const K=(U=(V=n.value)==null?void 0:V.timestamps)==null?void 0:U.validity_days;return K&&K>0?`${K} 天(激活后计算)`:"永久有效"}return mt(r)}),L=l(()=>M.value==="已过期"),B=l(()=>{const r=n.value;if(!(r!=null&&r.quota))return null;const s=r.quota,j=r.billing_type;return j==="quota"?{type:"quota",total:s.total_quota||0,used:s.used_quota||0,remaining:s.remaining_quota||0,unit:"$",label:"额度"}:j==="count"?{type:"count",total:s.max_requests||0,used:s.request_count||0,remaining:s.remaining_count||0,unit:"次",label:"请求次数"}:j==="duration"?{type:"duration",total:s.daily_quota||0,used:s.daily_spent||0,remaining:s.daily_remaining||0,unit:"美元",label:"每日额度",nextResetAt:s.next_reset_at}:null}),J=l(()=>{const r=n.value;if(!(r!=null&&r.quota))return null;const s=r.quota,j=r.billing_type,q=Ce(s.quota_pack_expires_at),V=Ce(s.requests_pack_expires_at),U=q&&s.quota_pack||0,K=q&&s.quota_pack_remaining||0,oe=V&&s.requests_pack||0,qe=V&&s.requests_pack_remaining||0;if(j==="quota"){const ie=s.total_quota||0,ue=s.remaining_quota||0,te=ie+U,O=Math.max(0,ue+K);return{type:"quota",total:te,used:Math.max(0,te-O),remaining:O,unit:"$"}}if(j==="count"){const ie=s.max_requests||0,ue=s.remaining_count||0,te=ie+oe,O=Math.max(0,ue+qe);return{type:"count",total:te,used:Math.max(0,te-O),remaining:O,unit:"次"}}if(j==="duration"){const ie=s.daily_quota||0,ue=s.daily_remaining||0,te=ie+U,O=Math.max(0,ue+K);return{type:"duration",total:te,used:Math.max(0,te-O),remaining:O,unit:"美元"}}return null}),Y=l(()=>!B.value||B.value.total===0?0:Math.round(B.value.used/B.value.total*100)),f=l(()=>{const r=n.value;if(!(r!=null&&r.quota))return null;const s=r.quota,j=r.billing_type;if(j==="duration"||j==="quota"){if(s.quota_pack!==void 0&&s.quota_pack!==null){const q=s.quota_pack;if(q<=0)return null;const V=s.quota_pack_used||0,U=s.quota_pack_remaining||0,K=s.quota_pack_expires_at;if(!Ce(K))return null;let oe="active";return U<=0&&(oe="used_up"),{type:"quota",total:q,used:V,remaining:U,expiresAt:K,status:oe,unit:"$",label:"配额包"}}}else if(j==="count"&&s.requests_pack!==void 0&&s.requests_pack!==null){const q=s.requests_pack;if(q<=0)return null;const V=s.requests_pack_used||0,U=s.requests_pack_remaining||0,K=s.requests_pack_expires_at;if(!Ce(K))return null;let oe="active";return U<=0&&(oe="used_up"),{type:"count",total:q,used:V,remaining:U,expiresAt:K,status:oe,unit:"次",label:"请求包"}}return null}),h=l(()=>{var s;const r=(s=n.value)==null?void 0:s.usage;return r?{totalSpent:r.total_spent||0,dailySpent:r.daily_total_spent||r.daily_spent||0,requestCount:r.request_count||0,dailyRequestCount:r.daily_request_count||0,inputTokens:r.input_tokens||0,outputTokens:r.output_tokens||0,cacheReadTokens:r.cache_read_tokens||0,cacheWriteTokens:r.cache_write_tokens||0,totalTokens:r.total_tokens||0}:{totalSpent:0,dailySpent:0,requestCount:0,dailyRequestCount:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,totalTokens:0}});async function D(r){const s=++k;if(!n.value){C.value=!1;return}if(r==="initial"&&w.value){C.value=!1;return}C.value=!0;try{await Promise.all([a.fetchUsageHistory(v.value),a.fetchModelTrends(v.value)])}finally{s===k&&(C.value=!1)}}const{reload:N}=Dt(async({reason:r})=>{await D(r)});async function ee(){await a.bootstrapSession()==="ready"&&await N("retry")}return Je(v,()=>{N("period-change")}),(r,s)=>{var j,q,V,U,K,oe,qe,ie,ue,te;return c(),y("div",Ea,[z.value?(c(),y("div",Ka,[o(t(G),{class:"border-border/60 bg-card/80 shadow-sm backdrop-blur-xl"},{default:u(()=>[o(t(W),{class:"flex flex-col items-center px-6 py-10 text-center sm:px-10"},{default:u(()=>[e("div",{class:F(["flex h-14 w-14 items-center justify-center rounded-2xl border shadow-sm",$.value?"border-red-500/20 bg-red-500/10 text-red-500":"border-amber-500/20 bg-amber-500/10 text-amber-500"])},[$.value?(c(),H(t(Kt),{key:0,class:"h-6 w-6"})):(c(),H(t(pt),{key:1,class:"h-6 w-6"}))],2),o(t(xe),{variant:"outline",class:F(["mt-4 rounded-full",$.value?"border-red-500/20 bg-red-500/10 text-red-600 dark:text-red-400":"border-amber-500/20 bg-amber-500/10 text-amber-600 dark:text-amber-400"])},{default:u(()=>[A(i($.value?"加载失败":"Key 处理中"),1)]),_:1},8,["class"]),e("h2",Fa,i(x.value),1),e("p",Ua,i(_.value),1),$.value?(c(),H(t(ft),{key:0,class:"mt-6",onClick:ee},{default:u(()=>[o(t(Fe),{class:"mr-2 h-4 w-4"}),s[1]||(s[1]=A(" 重新加载 ",-1))]),_:1})):E("",!0)]),_:1})]),_:1})])):(c(),y(re,{key:1},[e("div",Qa,[o(t(G),null,{default:u(()=>[o(t(W),{class:"py-3 px-4"},{default:u(()=>{var O,de,ce,me;return[e("div",Wa,[e("div",Ga,[o(t(xe),{variant:"outline",class:"text-xs font-mono rounded-full px-2.5"},{default:u(()=>{var Q;return[A(i((Q=n.value)==null?void 0:Q.key_preview),1)]}),_:1}),o(t(xe),{variant:"outline",class:F(["text-xs rounded-full px-2.5 gap-1 max-w-[13rem]",t(vt)(((O=n.value)==null?void 0:O.service_type)||"").badge]),title:t(Ke)(((de=n.value)==null?void 0:de.service_type)||"",(ce=n.value)==null?void 0:ce.sub_service_type_name)},{default:u(()=>{var Q,se,pe,he;return[((Q=n.value)==null?void 0:Q.service_type)==="claude"?(c(),H(t(qt),{key:0,class:"h-3 w-3"})):((se=n.value)==null?void 0:se.service_type)==="codex"?(c(),H(t(Ct),{key:1,class:"h-3 w-3"})):E("",!0),e("span",Ya,i(t(Ke)(((pe=n.value)==null?void 0:pe.service_type)||"",(he=n.value)==null?void 0:he.sub_service_type_name)),1)]}),_:1},8,["class","title"])]),o(t(xe),{variant:"outline",class:F(["text-xs rounded-full px-2.5 gap-1.5",t(xt)(((me=n.value)==null?void 0:me.status)||"")])},{default:u(()=>{var Q,se;return[e("span",{class:F(["h-1.5 w-1.5 rounded-full shrink-0",t(gt)(((Q=n.value)==null?void 0:Q.status)||"")])},null,2),A(" "+i(t(ht)(((se=n.value)==null?void 0:se.status)||"")),1)]}),_:1},8,["class"])])]}),_:1})]),_:1})]),((j=n.value)==null?void 0:j.status)==="inactive"?(c(),y("div",Za,[e("div",Xa,[e("div",Ja,[o(t(ve),{class:"h-5 w-5 text-amber-500"})]),s[2]||(s[2]=e("div",{class:"text-sm"},[e("p",{class:"font-medium text-amber-800 dark:text-amber-400"}," 此 API Key 尚未激活 "),e("p",{class:"mt-1 text-amber-700/80 dark:text-amber-400/70"}," 通过 Claude Code 或 Codex CLI 发起首次 API 请求后将自动激活。激活后有效期开始计算,使用数据将在此处展示。 ")],-1))])])):((q=n.value)==null?void 0:q.status)==="expired"?(c(),y("div",eo,[e("div",to,[e("div",so,[o(t(ve),{class:"h-5 w-5 text-red-500"})]),s[3]||(s[3]=e("div",{class:"text-sm"},[e("p",{class:"font-medium text-red-800 dark:text-red-400"}," 此 API Key 已过期 "),e("p",{class:"mt-1 text-red-700/80 dark:text-red-400/70"}," 您的 API Key 有效期已结束,无法继续使用 API 服务。请联系管理员续期或获取新的密钥。 ")],-1))])])):((V=n.value)==null?void 0:V.status)==="disabled"?(c(),y("div",ao,[e("div",oo,[e("div",lo,[o(t(ve),{class:"h-5 w-5 text-red-500"})]),s[4]||(s[4]=e("div",{class:"text-sm"},[e("p",{class:"font-medium text-red-800 dark:text-red-400"}," 此 API Key 已被禁用 "),e("p",{class:"mt-1 text-red-700/80 dark:text-red-400/70"}," 您的 API Key 已被管理员禁用,无法继续使用 API 服务。如有疑问请联系管理员。 ")],-1))])])):((U=n.value)==null?void 0:U.status)==="linked"?(c(),y("div",no,[e("div",ro,[e("div",io,[o(t(ve),{class:"h-5 w-5 text-blue-500"})]),s[5]||(s[5]=e("div",{class:"text-sm"},[e("p",{class:"font-medium text-blue-800 dark:text-blue-400"}," 此卡已绑定到主卡 "),e("p",{class:"mt-1 text-blue-700/80 dark:text-blue-400/70"}," 此 API Key 已作为子卡绑定到主卡,通过主卡消耗额度。如需独立使用,请前往叠卡管理页面解绑。 ")],-1))])])):E("",!0),e("div",uo,[o(t(G),null,{default:u(()=>[o(t(W),{class:"p-5"},{default:u(()=>{var O,de,ce,me,Q,se,pe;return[e("div",co,[e("div",mo,[e("div",po,[e("p",fo,i(((O=B.value)==null?void 0:O.label)||"额度"),1),((de=B.value)==null?void 0:de.type)==="duration"&&m.value?(c(),H(t(Ae),{key:0},{default:u(()=>[o(t(Re),null,{default:u(()=>[o(t(De),null,{default:u(()=>[o(t(Fe),{class:"h-3 w-3 text-muted-foreground"})]),_:1}),o(t(Pe),null,{default:u(()=>[e("p",vo,i(m.value),1),e("p",xo,i(R.value)+" 00:00 额度刷新 ",1)]),_:1})]),_:1})]),_:1})):E("",!0)]),e("p",go,i(((ce=B.value)==null?void 0:ce.type)==="count"?(me=B.value)==null?void 0:me.remaining:t(X)(((Q=B.value)==null?void 0:Q.remaining)||0)),1),e("p",ho,[A(i(t(_t)(((se=n.value)==null?void 0:se.billing_type)||""))+" ",1),((pe=B.value)==null?void 0:pe.type)==="duration"&&m.value?(c(),y("span",_o," · "+i(m.value),1)):E("",!0)])]),e("div",yo,[n.value?(c(),y(re,{key:1},[(c(),y("svg",bo,[s[8]||(s[8]=e("circle",{cx:"28",cy:"28",r:"24",stroke:"currentColor","stroke-width":"4",fill:"none",class:"text-muted transition-colors duration-200"},null,-1)),e("circle",{cx:"28",cy:"28",r:"24",stroke:"currentColor","stroke-width":"4",fill:"none","stroke-linecap":"round",class:"text-primary transition-colors duration-200",style:Z({strokeDasharray:`${Y.value*1.508} 150.8`,transition:"stroke-dasharray 500ms ease, color 200ms ease-out"})},null,4)])),e("span",ko,i(Y.value)+"%",1)],64)):(c(),y(re,{key:0},[s[6]||(s[6]=e("svg",{class:"w-14 h-14 -rotate-90"},[e("circle",{cx:"28",cy:"28",r:"24",stroke:"currentColor","stroke-width":"4",fill:"none",class:"text-primary/20 transition-colors duration-200"}),e("circle",{cx:"28",cy:"28",r:"24",stroke:"currentColor","stroke-width":"4",fill:"none","stroke-dasharray":"37.7 150.8","stroke-linecap":"round",class:"text-primary/60 animate-spin origin-center transition-colors duration-200"})],-1)),s[7]||(s[7]=e("span",{class:"absolute text-xs font-semibold text-primary/40 transition-colors duration-200"},"--%",-1))],64))])])]}),_:1})]),_:1}),o(t(G),null,{default:u(()=>[o(t(W),{class:"p-5"},{default:u(()=>[e("div",wo,[e("div",$o,[e("div",qo,[s[13]||(s[13]=e("p",{class:"text-xs font-medium text-muted-foreground uppercase tracking-wide"}," 总 Tokens ",-1)),o(t(Ae),null,{default:u(()=>[o(t(Re),null,{default:u(()=>[o(t(De),null,{default:u(()=>[o(t(ve),{class:"h-3 w-3 text-muted-foreground"})]),_:1}),o(t(Pe),{class:"max-w-xs"},{default:u(()=>[e("div",Co,[e("p",null,[s[9]||(s[9]=e("strong",null,"输入:",-1)),A(" "+i(t(fe)(h.value.inputTokens)),1)]),e("p",null,[s[10]||(s[10]=e("strong",null,"输出:",-1)),A(" "+i(t(fe)(h.value.outputTokens)),1)]),e("p",null,[s[11]||(s[11]=e("strong",null,"缓存读取:",-1)),A(" "+i(t(fe)(h.value.cacheReadTokens)),1)]),e("p",null,[s[12]||(s[12]=e("strong",null,"缓存创建:",-1)),A(" "+i(t(fe)(h.value.cacheWriteTokens)),1)])])]),_:1})]),_:1})]),_:1})]),e("p",To,i(t(fe)(h.value.totalTokens)),1),e("p",Mo," 入 "+i(t(fe)(h.value.inputTokens))+" / 出 "+i(t(fe)(h.value.outputTokens)),1)]),e("div",Io,[o(t(Nt),{class:"h-6 w-6 text-chart-2"})])])]),_:1})]),_:1}),o(t(G),null,{default:u(()=>[o(t(W),{class:"p-5"},{default:u(()=>[e("div",So,[e("div",Ao,[s[14]||(s[14]=e("p",{class:"text-xs font-medium text-muted-foreground uppercase tracking-wide"}," 请求次数 ",-1)),e("p",Ro,i(h.value.requestCount),1),e("p",Do," 今日 "+i(h.value.dailyRequestCount)+" 次 ",1)]),e("div",Po,[o(t(Rt),{class:"h-6 w-6 text-chart-4"})])])]),_:1})]),_:1}),o(t(G),null,{default:u(()=>[o(t(W),{class:"p-5"},{default:u(()=>[e("div",jo,[e("div",Ho,[s[15]||(s[15]=e("p",{class:"text-xs font-medium text-muted-foreground uppercase tracking-wide"}," 累计消费 ",-1)),e("p",Lo,i(t(X)(h.value.totalSpent)),1),e("p",Bo," 今日 "+i(t(X)(h.value.dailySpent)),1)]),e("div",zo,[o(t(zt),{class:"h-6 w-6 text-chart-3"})])])]),_:1})]),_:1})]),f.value?(c(),H(_a,{key:4,"pack-info":f.value,class:"mb-8 -mt-4"},null,8,["pack-info"])):E("",!0),e("div",Oo,[o(oa,{"usage-history":T.value,"selected-period":v.value,"is-loading":C.value,"quota-used":((K=J.value)==null?void 0:K.used)||0,"quota-remaining":((oe=J.value)==null?void 0:oe.remaining)||0,"quota-total":((qe=J.value)==null?void 0:qe.total)||0,"quota-unit":((ie=J.value)==null?void 0:ie.unit)||"","quota-type":((ue=J.value)==null?void 0:ue.type)||"","quota-daily-quota":((te=B.value)==null?void 0:te.total)||0,"model-trend-data":b.value,"onUpdate:selectedPeriod":s[0]||(s[0]=O=>v.value=O)},null,8,["usage-history","selected-period","is-loading","quota-used","quota-remaining","quota-total","quota-unit","quota-type","quota-daily-quota","model-trend-data"])]),e("div",Vo,[o(Na,{"model-costs":p.value,loading:C.value,period:v.value},null,8,["model-costs","loading","period"])]),o(t(G),null,{default:u(()=>[o(t(W),{class:"py-4 px-6"},{default:u(()=>{var O,de,ce,me,Q,se,pe,he,Ee;return[e("div",No,[e("div",Eo,[e("div",Ko,[o(t(Pt),{class:"h-4 w-4 text-muted-foreground"})]),e("div",null,[s[16]||(s[16]=e("p",{class:"text-xs text-muted-foreground"},"激活时间",-1)),e("p",Fo,i((de=(O=n.value)==null?void 0:O.timestamps)!=null&&de.activated_at?t(Se)(n.value.timestamps.activated_at,"yyyy-MM-dd HH:mm:ss"):"未激活"),1)])]),e("div",Uo,[e("div",Qo,[o(t(je),{class:"h-4 w-4",style:{color:"#f59e0b"}})]),e("div",null,[s[17]||(s[17]=e("p",{class:"text-xs text-muted-foreground"},"过期时间",-1)),e("p",Wo,i((me=(ce=n.value)==null?void 0:ce.timestamps)!=null&&me.expires_at?t(Se)(n.value.timestamps.expires_at,"yyyy-MM-dd HH:mm:ss"):(se=(Q=n.value)==null?void 0:Q.timestamps)!=null&&se.validity_days&&n.value.timestamps.validity_days>0?`激活后 ${n.value.timestamps.validity_days} 天`:"永不过期"),1)])]),e("div",Go,[e("div",Yo,[o(t(Ot),{class:"h-4 w-4",style:{color:"#3b82f6"}})]),e("div",null,[s[18]||(s[18]=e("p",{class:"text-xs text-muted-foreground"},"剩余时间",-1)),e("p",{class:F(["font-medium",{"text-red-500":L.value||((pe=n.value)==null?void 0:pe.status)==="disabled"}])},i(M.value),3)])]),e("div",Zo,[e("div",Xo,[o(t(jt),{class:"h-4 w-4",style:{color:"#22c55e"}})]),e("div",null,[s[19]||(s[19]=e("p",{class:"text-xs text-muted-foreground"},"最后使用",-1)),e("p",Jo,i((Ee=(he=n.value)==null?void 0:he.timestamps)!=null&&Ee.last_used_at?t(Se)(n.value.timestamps.last_used_at,"yyyy-MM-dd HH:mm:ss"):"从未使用"),1)])])])]}),_:1})]),_:1})],64))])}}});export{fl as default};
@@ -0,0 +1 @@
1
+ .sf-enter-active[data-v-f6c24705]{transition:opacity .15s ease-out}.sf-leave-active[data-v-f6c24705]{transition:opacity .1s ease-in}.sf-enter-from[data-v-f6c24705],.sf-leave-to[data-v-f6c24705]{opacity:0}.fade-enter-active[data-v-bc32f76d],.fade-leave-active[data-v-bc32f76d]{transition:opacity .2s ease}.fade-enter-from[data-v-bc32f76d],.fade-leave-to[data-v-bc32f76d]{opacity:0}