diff --git a/README.md b/README.md index 61c3090d..d1c7d656 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,5 @@ This branch contains the pre-built frontend assets for Claude Relay Service. These files are automatically generated by the CI/CD pipeline. -Version: 1.1.263 -Build Date: 2026-01-22 13:58:01 UTC +Version: 1.1.264 +Build Date: 2026-01-23 02:41:59 UTC diff --git a/web/admin-spa/dist/assets/AccountUsageRecordsView-CAVEOn9q.js b/web/admin-spa/dist/assets/AccountUsageRecordsView-CAVEOn9q.js deleted file mode 100644 index c93a4ec3..00000000 --- a/web/admin-spa/dist/assets/AccountUsageRecordsView-CAVEOn9q.js +++ /dev/null @@ -1,2 +0,0 @@ -import{E as de,a as ie,b as ce,c as pe,d as ue}from"./element-plus-BSjV1f9S.js";import{b as G}from"./vendor-Dr8jvgFu.js";import{c as D,aX as ge,r as h,_ as O,o as J,q as xe,x as p,z as e,R as g,P as o,u as c,J as w,O as K,Q as $,ac as U,aU as ye,y as i,I as Q}from"./vue-vendor-DV7DYXbz.js";import{c as P,f as x,b0 as X,s as j}from"./index-BahP9Xx9.js";import{R as me}from"./RecordDetailModal-iWzEw88d.js";const ke={class:"space-y-4 p-4 lg:p-6"},fe={class:"flex flex-wrap items-center justify-between gap-3"},_e={class:"flex items-center gap-3"},ve={class:"text-xl font-bold text-gray-900 dark:text-gray-100"},be={class:"text-xs text-gray-500 dark:text-gray-400"},he={class:"text-xs text-gray-500 dark:text-gray-400"},we={class:"flex items-center gap-2 text-sm text-gray-500 dark:text-gray-400"},Re={key:0},Ie={key:1},Ce={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Te={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},De={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-gray-100"},Ke={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Pe={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-gray-100"},Se={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Ve={class:"mt-1 text-2xl font-bold text-yellow-600 dark:text-yellow-400"},ze={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Oe={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-gray-100"},$e={class:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},Ue={class:"flex flex-wrap items-center gap-3"},je={class:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900"},Ae={key:0,class:"flex items-center justify-center p-10 text-gray-500 dark:text-gray-400"},Ee={key:1},Fe={key:0,class:"flex flex-col items-center gap-2 p-10 text-gray-500 dark:text-gray-400"},Ne={key:1,class:"space-y-4"},Be={class:"hidden overflow-x-auto md:block"},Ye={class:"min-w-full divide-y divide-gray-200 dark:divide-gray-800"},Me={class:"divide-y divide-gray-200 bg-white dark:divide-gray-800 dark:bg-gray-900"},qe={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},He={class:"px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},Le={class:"flex flex-col"},Ge={class:"font-semibold"},Je={class:"text-xs text-gray-500 dark:text-gray-400"},Qe={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},Xe={class:"whitespace-nowrap px-4 py-3 text-sm text-blue-600 dark:text-blue-400"},Ze={class:"whitespace-nowrap px-4 py-3 text-sm text-green-600 dark:text-green-400"},We={class:"whitespace-nowrap px-4 py-3 text-sm text-purple-600 dark:text-purple-400"},et={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-800 dark:text-gray-100"},tt={class:"whitespace-nowrap px-4 py-3 text-sm text-yellow-600 dark:text-yellow-400"},at={class:"whitespace-nowrap px-4 py-3 text-right text-sm"},st={class:"space-y-3 md:hidden"},ot={class:"flex items-center justify-between"},lt={class:"text-sm font-semibold text-gray-900 dark:text-gray-100"},rt={class:"text-xs text-gray-500 dark:text-gray-400"},nt={class:"text-xs text-gray-500 dark:text-gray-400"},dt={class:"mt-3 grid grid-cols-2 gap-2 text-sm text-gray-700 dark:text-gray-300"},it={class:"text-yellow-600 dark:text-yellow-400"},ct={class:"flex items-center justify-between px-4 pb-4"},pt={class:"text-sm text-gray-500 dark:text-gray-400"},ft={__name:"AccountUsageRecordsView",setup(ut){const N=ge(),Z=ye(),f=D(()=>N.params.accountId),C=D(()=>N.query.platform),A=h(!1),S=h(!1),V=h([]),B=h([]),Y=h([]),n=O({currentPage:1,pageSize:50,totalRecords:0}),s=O({dateRange:null,model:"",apiKeyId:"",sortOrder:"desc"}),y=O({totalRequests:0,totalTokens:0,totalCost:0,avgCost:0}),R=O({id:f.value,name:"",platform:C.value||""}),E=h(!1),F=h(null),W=D(()=>R.name||R.id||f.value),M=D(()=>{const l={claude:"Claude官方","claude-console":"Claude Console",ccr:"Claude Console Relay",openai:"OpenAI","openai-responses":"OpenAI Responses",gemini:"Gemini","gemini-api":"Gemini API",droid:"Droid",unknown:"未知渠道"},t=R.platform||C.value||"unknown";return l[t]||"未知渠道"}),q=D(()=>!s.dateRange||s.dateRange.length!==2?"":`${P(s.dateRange[0])} ~ ${P(s.dateRange[1])}`),T=l=>{const t=typeof l=="number"?l:0;return t>=1?`$${t.toFixed(2)}`:t>=.001?`$${t.toFixed(4)}`:`$${t.toFixed(6)}`},H=l=>{const t={page:l,pageSize:n.pageSize,sortOrder:s.sortOrder};return s.model&&(t.model=s.model),s.apiKeyId&&(t.apiKeyId=s.apiKeyId),s.dateRange&&s.dateRange.length===2&&(t.startDate=G(s.dateRange[0]).toISOString(),t.endDate=G(s.dateRange[1]).toISOString()),C.value&&(t.platform=C.value),t},ee=l=>{var m,k,_,a,v;V.value=l.records||[];const t=l.pagination||{};n.currentPage=t.currentPage||1,n.pageSize=t.pageSize||n.pageSize,n.totalRecords=t.totalRecords||0;const r=l.filters||{};if(r.model!==void 0&&(s.model=r.model||""),r.apiKeyId!==void 0&&(s.apiKeyId=r.apiKeyId||""),r.sortOrder&&(s.sortOrder=r.sortOrder),r.startDate&&r.endDate){const b=[r.startDate,r.endDate],d=s.dateRange||[];(d[0]!==b[0]||d[1]!==b[1])&&(s.dateRange=b)}const u=l.summary||{};y.totalRequests=u.totalRequests||0,y.totalTokens=u.totalTokens||0,y.totalCost=u.totalCost||0,y.avgCost=u.avgCost||0,R.id=((m=l.accountInfo)==null?void 0:m.id)||f.value,R.name=((k=l.accountInfo)==null?void 0:k.name)||"",R.platform=((_=l.accountInfo)==null?void 0:_.platform)||C.value||"",B.value=((a=l.availableFilters)==null?void 0:a.models)||[],Y.value=((v=l.availableFilters)==null?void 0:v.apiKeys)||[]},I=async(l=n.currentPage)=>{A.value=!0;try{const t=await X(f.value,H(l));ee(t.data||{})}catch(t){j(`加载请求记录失败:${t.message||"未知错误"}`,"error")}finally{A.value=!1}},te=l=>{n.currentPage=l,I(l)},ae=l=>{n.pageSize=l,n.currentPage=1,I(1)},se=()=>{s.model="",s.apiKeyId="",s.dateRange=null,s.sortOrder="desc",n.currentPage=1,I(1)},L=l=>{F.value=l,E.value=!0},oe=()=>{E.value=!1,F.value=null},le=()=>{Z.push("/accounts")},re=async()=>{var l;if(!S.value){S.value=!0;try{const t=[];let r=1,u=1;const m=50;for(;r<=u&&r<=m;){const z=(await X(f.value,{...H(r),pageSize:200})).data||{};t.push(...z.records||[]),u=((l=z.pagination)==null?void 0:l.totalPages)||1,r+=1}if(t.length===0){j("没有可导出的记录","info");return}const _=[["时间","API Key","模型","输入Token","输出Token","缓存创建Token","缓存读取Token","总Token","费用"].join(",")];t.forEach(d=>{const z=[P(d.timestamp),d.apiKeyName||d.apiKeyId||"",d.model||"",d.inputTokens||0,d.outputTokens||0,d.cacheCreateTokens||0,d.cacheReadTokens||0,d.totalTokens||0,d.costFormatted||T(d.cost)];_.push(z.map(ne=>`"${String(ne).replace(/"/g,'""')}"`).join(","))});const a=new Blob([_.join(` -`)],{type:"text/csv;charset=utf-8;"}),v=URL.createObjectURL(a),b=document.createElement("a");b.href=v,b.download=`account-${f.value}-usage-records.csv`,b.click(),URL.revokeObjectURL(v),j("导出 CSV 成功","success")}catch(t){j(`导出失败:${t.message||"未知错误"}`,"error")}finally{S.value=!1}}};return J(()=>[s.model,s.apiKeyId,s.sortOrder],()=>{n.currentPage=1,I(1)}),J(()=>s.dateRange,()=>{n.currentPage=1,I(1)},{deep:!0}),xe(()=>{I()}),(l,t)=>{const r=de,u=ue,m=ie,k=ce,_=pe;return i(),p("div",ke,[e("div",fe,[e("div",_e,[e("button",{class:"rounded-full border border-gray-200 px-3 py-2 text-sm text-gray-700 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",onClick:le}," ← 返回 "),e("div",null,[t[4]||(t[4]=e("p",{class:"text-xs font-semibold uppercase tracking-wide text-blue-600 dark:text-blue-400"}," 账户请求详情时间线 ",-1)),e("h2",ve,o(W.value),1),e("p",be,"ID: "+o(f.value),1),e("p",he,"渠道:"+o(M.value),1)])]),e("div",we,[t[5]||(t[5]=e("i",{class:"fas fa-clock text-blue-500"},null,-1)),q.value?(i(),p("span",Re,o(q.value),1)):(i(),p("span",Ie,"显示近 5000 条记录"))])]),e("div",Ce,[e("div",Te,[t[6]||(t[6]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"总请求",-1)),e("p",De,o(c(x)(y.totalRequests)),1)]),e("div",Ke,[t[7]||(t[7]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"总 Token",-1)),e("p",Pe,o(c(x)(y.totalTokens)),1)]),e("div",Se,[t[8]||(t[8]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"总费用",-1)),e("p",Ve,o(T(y.totalCost)),1)]),e("div",ze,[t[9]||(t[9]=e("p",{class:"text-xs uppercase text-gray-500 dark:text-gray-400"},"平均费用/次",-1)),e("p",Oe,o(T(y.avgCost)),1)])]),e("div",$e,[e("div",Ue,[g(r,{modelValue:s.dateRange,"onUpdate:modelValue":t[0]||(t[0]=a=>s.dateRange=a),class:"max-w-[320px]",clearable:"","end-placeholder":"结束时间",format:"YYYY-MM-DD HH:mm:ss","start-placeholder":"开始时间",type:"datetimerange","unlink-panels":"","value-format":"YYYY-MM-DDTHH:mm:ss[Z]"},null,8,["modelValue"]),g(m,{modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=a=>s.model=a),class:"w-[180px]",clearable:"",filterable:"",placeholder:"所有模型"},{default:w(()=>[(i(!0),p($,null,U(B.value,a=>(i(),Q(u,{key:a,label:a,value:a},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),g(m,{modelValue:s.apiKeyId,"onUpdate:modelValue":t[2]||(t[2]=a=>s.apiKeyId=a),class:"w-[220px]",clearable:"",filterable:"",placeholder:"所有 API Key"},{default:w(()=>[(i(!0),p($,null,U(Y.value,a=>(i(),Q(u,{key:a.id,label:a.name||a.id,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),g(m,{modelValue:s.sortOrder,"onUpdate:modelValue":t[3]||(t[3]=a=>s.sortOrder=a),class:"w-[140px]",placeholder:"排序"},{default:w(()=>[g(u,{label:"时间降序",value:"desc"}),g(u,{label:"时间升序",value:"asc"})]),_:1},8,["modelValue"]),g(k,{onClick:se},{default:w(()=>t[10]||(t[10]=[e("i",{class:"fas fa-undo mr-2"},null,-1),K(" 重置 ",-1)])),_:1,__:[10]}),g(k,{loading:S.value,type:"primary",onClick:re},{default:w(()=>t[11]||(t[11]=[e("i",{class:"fas fa-file-export mr-2"},null,-1),K(" 导出 CSV ",-1)])),_:1,__:[11]},8,["loading"])])]),e("div",je,[A.value?(i(),p("div",Ae,t[12]||(t[12]=[e("i",{class:"fas fa-spinner fa-spin mr-2"},null,-1),K(" 加载中... ",-1)]))):(i(),p("div",Ee,[V.value.length===0?(i(),p("div",Fe,t[13]||(t[13]=[e("i",{class:"fas fa-inbox text-2xl"},null,-1),e("p",null,"暂无记录",-1)]))):(i(),p("div",Ne,[e("div",Be,[e("table",Ye,[t[15]||(t[15]=e("thead",{class:"bg-gray-50 dark:bg-gray-800"},[e("tr",null,[e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 时间 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," API Key "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 模型 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 输入 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 输出 "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 缓存(创/读) "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 总 Token "),e("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 费用 "),e("th",{class:"px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 操作 ")])],-1)),e("tbody",Me,[(i(!0),p($,null,U(V.value,a=>(i(),p("tr",{key:a.timestamp+a.model},[e("td",qe,o(c(P)(a.timestamp)),1),e("td",He,[e("div",Le,[e("span",Ge,o(a.apiKeyName||a.apiKeyId||"未知 Key"),1),e("span",Je," ID: "+o(a.apiKeyId),1)])]),e("td",Qe,o(a.model),1),e("td",Xe,o(c(x)(a.inputTokens)),1),e("td",Ze,o(c(x)(a.outputTokens)),1),e("td",We,o(c(x)(a.cacheCreateTokens))+" / "+o(c(x)(a.cacheReadTokens)),1),e("td",et,o(c(x)(a.totalTokens)),1),e("td",tt,o(a.costFormatted||T(a.cost)),1),e("td",at,[g(k,{size:"small",onClick:v=>L(a)},{default:w(()=>t[14]||(t[14]=[K("详情",-1)])),_:2,__:[14]},1032,["onClick"])])]))),128))])])]),e("div",st,[(i(!0),p($,null,U(V.value,a=>(i(),p("div",{key:a.timestamp+a.model,class:"rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900"},[e("div",ot,[e("div",null,[e("p",lt,o(a.apiKeyName||a.apiKeyId||"未知 Key"),1),e("p",rt," ID: "+o(a.apiKeyId)+" · "+o(c(P)(a.timestamp)),1),e("p",nt," 渠道:"+o(M.value),1)]),g(k,{size:"small",onClick:v=>L(a)},{default:w(()=>t[16]||(t[16]=[K("详情",-1)])),_:2,__:[16]},1032,["onClick"])]),e("div",dt,[e("div",null,"模型:"+o(a.model),1),e("div",null,"总 Token:"+o(c(x)(a.totalTokens)),1),e("div",null,"输入:"+o(c(x)(a.inputTokens)),1),e("div",null,"输出:"+o(c(x)(a.outputTokens)),1),e("div",null," 缓存创/读:"+o(c(x)(a.cacheCreateTokens))+" / "+o(c(x)(a.cacheReadTokens)),1),e("div",it," 费用:"+o(a.costFormatted||T(a.cost)),1)])]))),128))]),e("div",ct,[e("div",pt," 共 "+o(n.totalRecords)+" 条记录 ",1),g(_,{background:"","current-page":n.currentPage,layout:"prev, pager, next, sizes","page-size":n.pageSize,"page-sizes":[20,50,100,200],total:n.totalRecords,onCurrentChange:te,onSizeChange:ae},null,8,["current-page","page-size","total"])])]))]))]),g(me,{record:F.value,show:E.value,onClose:oe},null,8,["record","show"])])}}};export{ft as default}; diff --git a/web/admin-spa/dist/assets/AccountsView-CWWlCm8X.css b/web/admin-spa/dist/assets/AccountsView-CWWlCm8X.css deleted file mode 100644 index b24853b4..00000000 --- a/web/admin-spa/dist/assets/AccountsView-CWWlCm8X.css +++ /dev/null @@ -1 +0,0 @@ -@keyframes fadeIn-31bfe83b{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.animate-fadeIn[data-v-31bfe83b]{animation:fadeIn-31bfe83b .3s ease-out}.loading-spinner[data-v-3b48d107]{width:20px;height:20px;border:2px solid #e5e7eb;border-top:2px solid #14b8a6;border-radius:50%;animation:spin-3b48d107 1s linear infinite}@keyframes spin-3b48d107{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.loading-spinner[data-v-c29b5f70]{border-top-color:transparent;border-radius:9999px;animation:spin-c29b5f70 .8s linear infinite}@keyframes spin-c29b5f70{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes fadeIn-f19e4a71{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.animate-fadeIn[data-v-f19e4a71]{animation:fadeIn-f19e4a71 .2s ease-out}.loading-spinner[data-v-f19e4a71]{width:16px;height:16px;border:2px solid rgba(255,255,255,.3);border-top:2px solid white;border-radius:50%;animation:spin-f19e4a71 .8s linear infinite;display:inline-block}@keyframes spin-f19e4a71{0%{transform:rotate(0)}to{transform:rotate(360deg)}}[data-v-5e76f743] .balance-script-dialog{max-height:90vh;display:flex;flex-direction:column}[data-v-5e76f743] .balance-script-dialog .el-dialog__body{flex:1 1 auto;min-height:0;overflow:auto}[data-v-5e76f743] .balance-script-dialog .el-dialog__footer{border-top:1px solid rgba(229,231,235,.7)}.input-text[data-v-5e76f743]{width:100%;border-radius:.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:.5rem .75rem;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1));--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.input-text[data-v-5e76f743]:focus{--tw-border-opacity: 1;border-color:rgb(129 140 248 / var(--tw-border-opacity, 1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(199 210 254 / var(--tw-ring-opacity, 1))}.input-text[data-v-5e76f743]:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.input-text[data-v-5e76f743]:focus:is(.dark *){--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1));--tw-ring-opacity: 1;--tw-ring-color: rgb(79 70 229 / var(--tw-ring-opacity, 1))}.accounts-container[data-v-f3c6543e]{min-height:calc(100vh - 300px)}.loading-spinner[data-v-f3c6543e]{width:24px;height:24px;border:2px solid #e5e7eb;border-top:2px solid #3b82f6;border-radius:50%;animation:spin-f3c6543e 1s linear infinite}@keyframes spin-f3c6543e{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.table-wrapper[data-v-f3c6543e]{overflow:hidden;border-radius:12px;border:1px solid rgba(0,0,0,.05)}.dark .table-wrapper[data-v-f3c6543e]{border-color:#ffffff1a}.table-container[data-v-f3c6543e]{overflow-x:auto;overflow-y:hidden;margin:0;padding:0;max-width:100%;position:relative;-webkit-overflow-scrolling:touch}.table-container table[data-v-f3c6543e]{min-width:1400px;border-collapse:collapse;table-layout:auto}.table-container[data-v-f3c6543e]::-webkit-scrollbar{height:8px}.table-container[data-v-f3c6543e]::-webkit-scrollbar-track{background:#f3f4f6;border-radius:4px}.table-container[data-v-f3c6543e]::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:4px}.table-container[data-v-f3c6543e]::-webkit-scrollbar-thumb:hover{background:#9ca3af}.dark .table-container[data-v-f3c6543e]::-webkit-scrollbar-track{background:var(--bg-gradient-mid)}.dark .table-container[data-v-f3c6543e]::-webkit-scrollbar-thumb{background:var(--bg-gradient-end)}.dark .table-container[data-v-f3c6543e]::-webkit-scrollbar-thumb:hover{background:var(--text-secondary)}.table-container tbody tr:hover>td[data-v-f3c6543e]{background-color:rgba(var(--primary-rgb),.06)!important}.dark .table-container tbody tr:hover>td[data-v-f3c6543e]{background-color:rgba(var(--primary-rgb),.16)!important}.table-container tbody tr:nth-child(odd)>td[data-v-f3c6543e]{background-color:#fff}.table-container tbody tr:nth-child(2n)>td[data-v-f3c6543e]{background-color:#f9fafb}.dark .table-container tbody tr:nth-child(odd)>td[data-v-f3c6543e]{background-color:var(--bg-gradient-start)}.dark .table-container tbody tr:nth-child(2n)>td[data-v-f3c6543e]{background-color:var(--bg-gradient-mid)}.table-container thead .checkbox-column[data-v-f3c6543e],.table-container thead .name-column[data-v-f3c6543e]{z-index:30;background:linear-gradient(to bottom,#f9fafb,#f3f4f6)}.dark .table-container thead .checkbox-column[data-v-f3c6543e],.dark .table-container thead .name-column[data-v-f3c6543e]{background:linear-gradient(to bottom,var(--bg-gradient-mid),var(--bg-gradient-start))}.table-container thead .operations-column[data-v-f3c6543e]{z-index:30;background:linear-gradient(to bottom,#f9fafb,#f3f4f6)}.dark .table-container thead .operations-column[data-v-f3c6543e]{background:linear-gradient(to bottom,var(--bg-gradient-mid),var(--bg-gradient-start))}.table-container tbody .name-column[data-v-f3c6543e]{box-shadow:8px 0 12px -8px #0f172a29}.dark .table-container tbody .name-column[data-v-f3c6543e]{box-shadow:8px 0 12px -8px #1e293b73}.table-container tbody .operations-column[data-v-f3c6543e]{box-shadow:-8px 0 12px -8px #0f172a29}.dark .table-container tbody .operations-column[data-v-f3c6543e]{box-shadow:-8px 0 12px -8px #1e293b73} diff --git a/web/admin-spa/dist/assets/AccountsView-mqqu5LbU.js b/web/admin-spa/dist/assets/AccountsView-mqqu5LbU.js deleted file mode 100644 index 4407fd85..00000000 --- a/web/admin-spa/dist/assets/AccountsView-mqqu5LbU.js +++ /dev/null @@ -1,71 +0,0 @@ -import{b as qr,e as kr,f as Wr}from"./element-plus-BSjV1f9S.js";import{aP as Br,r as v,o as ve,V as Ha,x as n,y as o,z as e,L as m,K as b,al as je,aT as Et,O as f,aq as j,aa as Gr,P as u,aV as wa,aW as ka,C as $,c as Z,Z as Fr,an as Ie,Q as ke,q as ra,I as Xe,R as Ve,ac as Ne,u as Ye,a5 as Mt,B as Ze,aY as Qr,aU as Hr,D as ar,_ as hr,J as ot,Y as vt}from"./vue-vendor-DV7DYXbz.js";import{a4 as Jr,C as wr,D as $r,I as Ar,E as Cr,G as Tr,a5 as Ir,H as Ur,J as _r,a6 as Yr,a7 as Zr,a8 as Xr,a9 as es,aa as ts,ab as as,ac as rs,ad as ss,ae as ls,af as os,ag as ns,ah as is,ai as ds,aj as us,ak as ps,al as gs,am as cs,an as ha,ao as Kr,ap as ys,aq as Sr,ar as ms,as as xs,at as fs,au as bs,av as vs,aw as ks,ax as hs,ay as ws,az as $s,aA as As,aB as Cs,aC as Ts,s as V,c as Is,K as sr,aD as Us,aE as _s,aF as Ks,aG as Ss,_ as sa,aH as Ms,aI as Ds,aJ as Ps,aK as js,aL as Vs,aM as zs,aN as Ls,a as Rs,f as Je,aO as kt,aP as Mr,aQ as Dr,aR as Os,aS as Es,aT as Ns,F as qs,aU as Ws,aV as Bs,aW as Gs,aX as Fs,Z as cr,aY as Qs,aZ as Hs,a_ as Js,t as Ys,a$ as Zs}from"./index-BahP9Xx9.js";import{C as Ja}from"./ConfirmModal-C2rCOkXI.js";import{C as Xs}from"./chart-yFHxLHpB.js";import{C as Qa,_ as el}from"./ActionDropdown-GADQlLlI.js";import"./vendor-Dr8jvgFu.js";const yr={claude:{endpoint:"claude-accounts",stateKey:"claudeAccounts"},"claude-console":{endpoint:"claude-console-accounts",stateKey:"claudeConsoleAccounts"},bedrock:{endpoint:"bedrock-accounts",stateKey:"bedrockAccounts"},gemini:{endpoint:"gemini-accounts",stateKey:"geminiAccounts"},openai:{endpoint:"openai-accounts",stateKey:"openaiAccounts"},azure_openai:{endpoint:"azure-openai-accounts",stateKey:"azureOpenaiAccounts"},"openai-responses":{endpoint:"openai-responses-accounts",stateKey:"openaiResponsesAccounts"},droid:{endpoint:"droid-accounts",stateKey:"droidAccounts"}},Pr=Br("accounts",()=>{const F=v([]),_e=v([]),c=v([]),z=v([]),A=v([]),_=v([]),T=v([]),k=v([]),P=v(!1),O=v(null),Y=v(""),M=v("asc"),se={claudeAccounts:F,claudeConsoleAccounts:_e,bedrockAccounts:c,geminiAccounts:z,openaiAccounts:A,azureOpenaiAccounts:_,openaiResponsesAccounts:T,droidAccounts:k},ge=async(B,q)=>{P.value=!0;const Ee=await B();Ee.success?q.value=Ee.data||[]:O.value=Ee.message,P.value=!1},N=async(B,q,...Ee)=>{P.value=!0;const We=await B(...Ee);return We.success?await q():O.value=We.message,P.value=!1,We},E=()=>ge(wr,F),R=()=>ge($r,_e),y=()=>ge(Ar,c),p=()=>ge(Cr,z),D=()=>ge(Tr,A),de=()=>ge(Ir,_),le=()=>ge(Ur,T),ae=()=>ge(_r,k);return{claudeAccounts:F,claudeConsoleAccounts:_e,bedrockAccounts:c,geminiAccounts:z,openaiAccounts:A,azureOpenaiAccounts:_,openaiResponsesAccounts:T,droidAccounts:k,loading:P,error:O,sortBy:Y,sortOrder:M,fetchClaudeAccounts:E,fetchClaudeConsoleAccounts:R,fetchBedrockAccounts:y,fetchGeminiAccounts:p,fetchOpenAIAccounts:D,fetchAzureOpenAIAccounts:de,fetchOpenAIResponsesAccounts:le,fetchDroidAccounts:ae,fetchAllAccounts:async()=>{P.value=!0,await Promise.all([E(),R(),y(),p(),D(),de(),le(),ae()]),P.value=!1},createClaudeAccount:B=>N(Yr,E,B),createClaudeConsoleAccount:B=>N(Zr,R,B),createBedrockAccount:B=>N(Xr,y,B),createGeminiAccount:B=>N(es,p,B),createOpenAIAccount:B=>N(ts,D,B),createDroidAccount:B=>N(as,ae,B),updateDroidAccount:(B,q)=>N(ha,ae,B,q),createAzureOpenAIAccount:B=>N(rs,de,B),createOpenAIResponsesAccount:B=>N(ss,le,B),createGeminiApiAccount:B=>N(ls,p,B),updateClaudeAccount:(B,q)=>N(os,E,B,q),updateClaudeConsoleAccount:(B,q)=>N(ns,R,B,q),updateBedrockAccount:(B,q)=>N(is,y,B,q),updateGeminiAccount:(B,q)=>N(ds,p,B,q),updateOpenAIAccount:(B,q)=>N(us,D,B,q),updateAzureOpenAIAccount:(B,q)=>N(ps,de,B,q),updateOpenAIResponsesAccount:(B,q)=>N(gs,le,B,q),updateGeminiApiAccount:(B,q)=>N(cs,p,B,q),toggleAccount:async(B,q)=>{const Ee=yr[B];if(!Ee)return{success:!1,message:"未知平台"};P.value=!0;const We=await Kr(`/admin/${Ee.endpoint}/${q}/toggle`);return We.success?await ge(ys[`get${Ee.stateKey.charAt(0).toUpperCase()+Ee.stateKey.slice(1).replace("Accounts","")}AccountsApi`],se[Ee.stateKey]):O.value=We.message,P.value=!1,We},deleteAccount:async(B,q)=>{const Ee=yr[B];if(!Ee)return{success:!1,message:"未知平台"};P.value=!0;const We=await Sr(`/admin/${Ee.endpoint}/${q}`);return We.success?await{claude:E,"claude-console":R,bedrock:y,gemini:p,openai:D,azure_openai:de,"openai-responses":le,droid:ae}[B]():O.value=We.message,P.value=!1,We},refreshClaudeToken:async B=>{P.value=!0;const q=await ms(B);return q.success?await E():O.value=q.message,P.value=!1,q},generateClaudeAuthUrl:async B=>{const q=await xs(B);return q.success||(O.value=q.message),q.success?q.data:null},exchangeClaudeCode:async B=>{const q=await fs(B);return q.success||(O.value=q.message),q.success?q.data:null},generateClaudeSetupTokenUrl:async B=>{const q=await bs(B);return q.success||(O.value=q.message),q.success?q.data:null},exchangeClaudeSetupTokenCode:async B=>{const q=await vs(B);return q.success||(O.value=q.message),q.success?q.data:null},oauthWithCookie:async B=>{const q=await ks(B);return q.success||(O.value=q.message),q.success?q.data:null},oauthSetupTokenWithCookie:async B=>{const q=await hs(B);return q.success||(O.value=q.message),q.success?q.data:null},generateGeminiAuthUrl:async B=>{const q=await ws(B);return q.success||(O.value=q.message),q.success?q.data:null},exchangeGeminiCode:async B=>{const q=await $s(B);return q.success||(O.value=q.message),q.success?q.data:null},generateOpenAIAuthUrl:async B=>{const q=await As(B);return q.success||(O.value=q.message),q.success?q.data:null},exchangeOpenAICode:async B=>{const q=await Cs(B);return q.success||(O.value=q.message),q.success?q.data:null},generateDroidAuthUrl:async B=>{const q=await Ts(B);return q.success||(O.value=q.message),q.success?q.data:null},exchangeDroidCode:B=>Jr(B),sortAccounts:B=>{Y.value===B?M.value=M.value==="asc"?"desc":"asc":(Y.value=B,M.value="asc")},reset:()=>{F.value=[],_e.value=[],c.value=[],z.value=[],A.value=[],_.value=[],T.value=[],k.value=[],P.value=!1,O.value=null,Y.value="",M.value="asc"}}}),tl={class:"space-y-4"},al={class:"flex items-center justify-between"},rl={class:"flex cursor-pointer items-center"},sl={key:0,class:"space-y-4 rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-600 dark:bg-gray-800"},ll={class:"relative"},ol={key:0,class:"mt-1 text-xs text-red-500"},nl={key:1,class:"mt-1 text-xs text-green-500"},il={class:"grid grid-cols-2 gap-4"},dl={class:"space-y-4"},ul={class:"flex items-center"},pl={key:0,class:"grid grid-cols-2 gap-4"},gl={class:"relative"},cl=["type"],rr={__name:"ProxyConfig",props:{modelValue:{type:Object,default:()=>({enabled:!1,type:"socks5",host:"",port:"",username:"",password:""})}},emits:["update:modelValue"],setup(F,{emit:_e}){const c=F,z=_e,A=v({...c.modelValue}),_=v(!!(A.value.username||A.value.password)),T=v(!1),k=v(""),P=v(""),O=v(!1);ve(()=>c.modelValue,R=>{JSON.stringify(R)!==JSON.stringify(A.value)&&(A.value={...R},_.value=!!(R.username||R.password))},{deep:!0}),ve(()=>A.value.enabled,()=>{M()}),ve(()=>A.value.type,()=>{M()}),ve(()=>A.value.host,()=>{M()}),ve(()=>A.value.port,()=>{M()}),ve(()=>A.value.username,()=>{M()}),ve(()=>A.value.password,()=>{M()}),ve(_,R=>{R||(A.value.username="",A.value.password="",M())});let Y=null;function M(){Y&&clearTimeout(Y),Y=setTimeout(()=>{const R={...A.value};_.value||(R.username="",R.password=""),z("update:modelValue",R)},100)}function se(){if(P.value="",O.value=!1,!!k.value)try{const R=k.value.split("#")[0].trim();if(!R)return;const y=/^(socks5|https?):\/\/(?:([^:@]+):([^@]+)@)?([^:]+):(\d+)$/i,p=R.match(y);if(!p){const he=/^([^:]+):(\d+)$/,W=R.match(he);if(W){A.value.type="socks5",A.value.host=W[1],A.value.port=W[2],A.value.username="",A.value.password="",_.value=!1,O.value=!0,M(),setTimeout(()=>{O.value=!1},3e3);return}P.value="无效的代理URL格式,请检查输入";return}const[,D,de,le,ae,oe]=p;A.value.type=D.toLowerCase(),A.value.host=ae,A.value.port=oe,de&&le?(A.value.username=decodeURIComponent(de),A.value.password=decodeURIComponent(le),_.value=!0):(A.value.username="",A.value.password="",_.value=!1),O.value=!0,M(),setTimeout(()=>{O.value=!1},3e3)}catch{P.value="解析失败,请检查URL格式"}}function ge(){k.value="",P.value="",O.value=!1}function N(){setTimeout(()=>{se()},0)}function E(){const R=k.value.trim();R.includes("://")?(/^(socks5|https?):\/\/[^:]+:\d+/i.test(R)||/^(socks5|https?):\/\/[^:@]+:[^@]+@[^:]+:\d+/i.test(R))&&se():/^[^:]+:\d{2,5}$/.test(R)&&se()}return Ha(()=>{Y&&clearTimeout(Y)}),(R,y)=>(o(),n("div",tl,[e("div",al,[y[10]||(y[10]=e("h4",{class:"text-sm font-semibold text-gray-700 dark:text-gray-300"},"代理设置 (可选)",-1)),e("label",rl,[b(e("input",{"onUpdate:modelValue":y[0]||(y[0]=p=>A.value.enabled=p),class:"h-4 w-4 rounded border-gray-300 bg-gray-100 text-blue-600 focus:ring-blue-500",type:"checkbox"},null,512),[[je,A.value.enabled]]),y[9]||(y[9]=e("span",{class:"ml-2 text-sm text-gray-700 dark:text-gray-300"},"启用代理",-1))])]),A.value.enabled?(o(),n("div",sl,[y[22]||(y[22]=Et('
配置代理以访问受限的网络资源。支持 SOCKS5 和 HTTP 代理。
请确保代理服务器稳定可用,否则会影响账户的正常使用。
sessionKey 通常以 sk-ant-sid01- 开头
在浏览器中打开链接并完成授权
请在新标签页中打开授权链接,登录您的 Claude 账户并授权。
注意:如果您设置了代理,请确保浏览器也使用相同的代理访问授权页面。
在浏览器中打开链接并完成授权
请在新标签页中打开授权链接,登录您的 Gemini 账户并授权。
注意:如果您设置了代理,请确保浏览器也使用相同的代理访问授权页面。
在浏览器中打开链接并完成授权
请在新标签页中打开授权链接,登录您的 OpenAI 账户并授权。
重要提示:授权后页面可能会加载较长时间,请耐心等待。
当浏览器地址栏变为 http://localhost:1455/... 开头时,表示授权已完成。
注意:如果您设置了代理,请确保浏览器也使用相同的代理访问授权页面。
提示:您可以直接复制整个链接或仅复制 code 参数值,系统会自动识别。
• 完整链接示例:http://localhost:1455/auth/callback?code=ac_4hm8...
• 仅 Code 示例:ac_4hm8iqmx9A2fzMy_cwye7U3W7...
在浏览器中打开链接并完成授权
在浏览器中打开授权页面,输入上方验证码并登录 Factory / Droid 账户,最后点击允许授权。
完成授权后点击下方“完成授权”按钮,系统会自动获取访问令牌。
若提示授权仍在等待确认,请稍候片刻后系统会自动重试。
自定义您的站点品牌名称
上传自定义图标或输入图标URL
控制登录按钮在首页的显示
启用后,所有 /api/v1/messages 和 /claude/v1/messages 端点将强制验证 Claude Code CLI 客户端
此设置与 API Key 级别的客户端限制是 OR 逻辑:全局启用或 API Key 设置中启用,都会执行 Claude Code 验证。
启用后,系统会将原始会话 ID 绑定到首次使用的账户,确保上下文的一致性
工作原理:系统会提取请求中的原始 session ID (来自 metadata.user_id), 并将其与首次调度的账户绑定。后续使用相同 session ID 的请求将自动路由到同一账户。
新会话识别:如果绑定会话历史中没有该sessionId但请求中 messages.length > 1, 系统会认为这是一个污染的会话并拒绝请求。
启用后,同一账户的用户消息请求将串行执行,并在请求之间添加延迟,防止触发上游限流
工作原理:系统检测请求中最后一条消息的 role 是否为 user。用户消息请求需要排队串行执行,而工具调用结果、助手消息续传等不受此限制。
当 API Key 并发请求超限时进入队列等待,而非直接拒绝
工作原理:当 API Key 的并发请求超过 concurrencyLimit 时,超限请求会进入队列等待而非直接返回 429。适合 Claude Code Agent 并行工具调用场景。
方法一:官网下载(推荐)
https://nodejs.org/.msi 文件 方法二:使用包管理器
如果你安装了 Chocolatey 或 Scoop,可以使用命令行安装:
方法一:使用 Homebrew(推荐)
如果你已经安装了 Homebrew,使用它安装 Node.js 会更方便:
方法二:官网下载
https://nodejs.org/.pkg 文件 sudo方法一:使用 nvm(推荐)
nvm 可以方便地管理多个 Node.js 版本:
方法二:使用包管理器
安装完成后,输入以下命令检查是否安装成功:
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
如果遇到执行策略限制,运行:
WSL2 可以通过 /mnt/ 路径访问 Windows 文件:
⚠️ 必须将 OPENAI_API_KEY 设置为 null,否则 Codex 会优先使用它而忽略环境变量!
一键写入命令:
',3)),t("div",ke,[t("div",he,l(y.value),1)])]),t("div",Se,[o[11]||(o[11]=t("h6",{class:"mb-2 font-medium text-purple-800 dark:text-purple-300"}," 3. 设置环境变量 CRS_OAI_KEY ",-1)),o[12]||(o[12]=t("p",{class:"mb-3 text-sm text-purple-700 dark:text-purple-300"}," 设置环境变量 CRS_OAI_KEY 为您的 API 密钥(格式如 cr_xxxxxxxxxx): ",-1)),r.platform==="windows"?(a(),d(i,{key:0},[o[8]||(o[8]=v('系统级环境变量(推荐):
用户级环境变量 (不推荐)
💡 设置后需要重新打开终端窗口才能生效
',5))],64)):(a(),d(i,{key:1},[o[9]||(o[9]=v(' 检查当前 shell:echo $SHELL
如果之前配置过,建议先检查并清理旧配置:
如果有输出,说明已配置过,可以手动编辑文件修改或删除旧配置
删除用户级环境变量:
删除系统级环境变量:
从 zsh 配置中删除:
从 bash 配置中删除:
Daily usage trends would be displayed here
(Chart integration can be added with Chart.js, D3.js, or similar library)
Sign in to your account to manage your API keys
=0;--u)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,a;for(n=0,o=e.length;n m&&(m=_),h=(d*h+y)/++d):(v(),i.lineTo(y,_),g=k,d=0,p=m=_),b=_}v()}function pi(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?cl:ll}function hl(i){return i.stepped?la:i.tension||i.cubicInterpolationMode==="monotone"?ca:At}function dl(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Wn(i,t.options),i.stroke(n)}function ul(i,t,e,s){const{segments:n,options:o}=t,a=pi(t);for(const r of n)Wn(i,o,r.style),i.beginPath(),a(i,t,r,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const fl=typeof Path2D=="function";function gl(i,t,e,s){fl&&!t.options.segment?dl(i,t,e,s):ul(i,t,e,s)}class bt extends ot{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;ta(this._points,s,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=pa(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,a=Pn(this,{property:e,start:n,end:n});if(!a.length)return;const r=[],l=hl(s);let c,h;for(c=0,h=a.length;c ${e.replace(/\n/g,"c.box.fullSize),!0),s=Xt(Ut(t,"left"),!0),n=Xt(Ut(t,"right")),o=Xt(Ut(t,"top"),!0),a=Xt(Ut(t,"bottom")),r=ds(t,"x"),l=ds(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Ut(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function us(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function Ln(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function er(i,t,e,s){const{pos:n,box:o}=e,a=i.maxPadding;if(!T(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&Ln(a,o.getPadding());const r=Math.max(0,t.outerWidth-us(a,i,"left","right")),l=Math.max(0,t.outerHeight-us(a,i,"top","bottom")),c=r!==i.w,h=l!==i.h;return i.w=r,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function ir(i){const t=i.maxPadding;function e(s){const n=Math.max(t[s]-i[s],0);return i[s]+=n,n}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function sr(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return s(i?["left","right"]:["top","bottom"])}function Jt(i,t,e,s){const n=[];let o,a,r,l,c,h;for(o=0,a=i.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);Ln(u,J(s));const f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),g=Za(l.concat(c),d);Jt(r.fullSize,f,d,g),Jt(l,f,d,g),Jt(c,f,d,g)&&Jt(l,f,d,g),ir(f),fs(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,fs(r.rightAndBottom,f,d,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},I(r.chartArea,p=>{const m=p.box;Object.assign(m,i.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Rn{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,n){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):s)}}isAttached(t){return!0}updateConfig(t){}}class nr extends Rn{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Te="$chartjs",or={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},gs=i=>i===null||i==="";function ar(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Te]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",gs(n)){const o=Ji(i,"width");o!==void 0&&(i.width=o)}if(gs(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Ji(i,"height");o!==void 0&&(i.height=o)}return i}const In=ra?{passive:!0}:!1;function rr(i,t,e){i&&i.addEventListener(t,e,In)}function lr(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,In)}function cr(i,t){const e=or[i.type]||i.type,{x:s,y:n}=Ct(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function We(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function hr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||We(r.addedNodes,s),a=a&&!We(r.removedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function dr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||We(r.removedNodes,s),a=a&&!We(r.addedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const he=new Map;let ps=0;function En(){const i=window.devicePixelRatio;i!==ps&&(ps=i,he.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function ur(i,t){he.size||window.addEventListener("resize",En),he.set(i,t)}function fr(i){he.delete(i),he.size||window.removeEventListener("resize",En)}function gr(i,t,e){const s=i.canvas,n=s&&Ii(s);if(!n)return;const o=hn((r,l)=>{const c=n.clientWidth;e(r,l),ci==="left"?"right":i==="right"?"left":i,ms=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,bs=(i,t)=>Math.min(t||i,i);function xs(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;o({width:a[P]||0,height:r[P]||0});return{first:w(0),last:w(e-1),widest:w(k),highest:w(S),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return fo(this._alignToPixels?wt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&te.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s={meta:t,index:t.index,cancelable:!0},n=Dn(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(n&&$e(e,n),t.controller.draw(),n&&Ye(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return gt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=qa.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(n)),n}getContext(){return this.$context||(this.$context=vt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);re(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),a.update(o,{visible:s}),this.update(r=>r.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),ht.remove(this),t=0,e=this.data.datasets.length;ti.height-s/2?"bottom":"center"}function cc(i,t,e,s){const{x:n,width:o}=s,a=e.caretSize+e.caretPadding;if(i==="left"&&n+o+a>t.width||i==="right"&&n-o-a<0)return!0}function hc(i,t,e,s){const{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i;let c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),cc(c,i,t,e)&&(c="center"),c}function Ns(i,t,e){const s=e.yAlign||t.yAlign||lc(i,e);return{xAlign:e.xAlign||t.xAlign||hc(i,t,e,s),yAlign:s}}function dc(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function uc(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function Hs(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Tt(a);let g=dc(t,r);const p=uc(t,l,c);return l==="center"?r==="left"?g+=c:r==="right"&&(g-=c):r==="left"?g-=Math.max(h,u)+n:r==="right"&&(g+=Math.max(d,f)+n),{x:Y(g,0,s.width-t.width),y:Y(p,0,s.height-t.height)}}function Se(i,t,e){const s=J(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function js(i){return at([],dt(i))}function fc(i,t,e){return vt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function $s(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const Gn={beforeTitle:ct,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex"u"?Gn[t].call(e,s):n}class xi extends ot{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new Cn(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=fc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=Q(s,"beforeTitle",this,t),o=Q(s,"title",this,t),a=Q(s,"afterTitle",this,t);let r=[];return r=at(r,dt(n)),r=at(r,dt(o)),r=at(r,dt(a)),r}getBeforeBody(t,e){return js(Q(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return I(t,o=>{const a={before:[],lines:[],after:[]},r=$s(s,o);at(a.before,dt(Q(r,"beforeLabel",this,o))),at(a.lines,Q(r,"label",this,o)),at(a.after,dt(Q(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return js(Q(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=Q(s,"beforeFooter",this,t),o=Q(s,"footer",this,t),a=Q(s,"afterFooter",this,t);let r=[];return r=at(r,dt(n)),r=at(r,dt(o)),r=at(r,dt(a)),r}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;ln?{start:t-e,end:t}:{start:t,end:t+e}}function kc(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),s=[],n=[],o=i._pointLabels.length,a=i.options.pointLabels,r=a.centerPointLabels?R/o:0;for(let l=0;l{const n=z(this.options.pointLabels.callback,[e,s],this);return n||n===0?n:""}).filter((e,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?kc(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,s,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,s,n))}getIndexAngle(t){const e=F/(this._pointLabels.length||1),s=this.options.startAngle||0;return G(t*e+st(s))}getDistanceFromCenterForValue(t){if(O(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(O(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t+p)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,s,n){const o=this.options,a=o.ticks.callback;if(a)return z(a,[t,e,s],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=s[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=ft(i,"pos",t)),{pos:o,time:r}=i[s],{pos:a,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=ft(i,"time",t)),{time:o,pos:r}=i[s],{time:a,pos:l}=i[n]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class ki extends ue{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=we(e,this.min),this._tableRange=we(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let a,r,l,c,h;for(a=0,r=t.length;a{const[a,s]=[t[l],t[$r[l]]];return(s>0?a[s].offset:0)>=n?Ov(e,t,0,s,n,l):sN(e,t,rs(0,s),n,l)},Lv=({totalRow:e},{estimatedRowHeight:t,lastVisitedRowIndex:n,row:l})=>{let a=0;if(n>=e&&(n=e-1),n>=0){const i=l[n];a=i.offset+i.size}const r=(e-n-1)*t;return a+r},Bv=({totalColumn:e},{column:t,estimatedColumnWidth:n,lastVisitedColumnIndex:l})=>{let a=0;if(l>e&&(l=e-1),l>=0){const i=t[l];a=i.offset+i.size}const r=(e-l-1)*n;return a+r},rN={column:Bv,row:Lv},uc=(e,t,n,l,a,s,r)=>{const[i,u]=[s==="row"?e.height:e.width,rN[s]],c=sl(e,t,a,s),d=u(e,a),f=rs(0,Rv(d-i,c.offset)),m=rs(0,c.offset-i+r+c.size);switch(n===Ns&&(l>=m-i&&l<=f+i?n=xn:n=Jn),n){case ta:return f;case na:return m;case Jn:return Math.round(m+(f-m)/2);case xn:default:return l>=m&&l<=f?l:m>f||l0&&n.lazy&&n.defaultExpandAll&&!this.isLeafByUser&&this.expand(),ke(this.data)||gc(this,this.data),!this.data)return;const a=n.defaultExpandedKeys,s=n.key;s&&!qt(this.key)&&a&&a.includes(this.key)&&this.expand(null,n.autoExpandParent),s&&n.currentNodeKey!==void 0&&this.key===n.currentNodeKey&&(n.currentNode=this,n.currentNode.isCurrent=!0),n.lazy&&n._initDefaultCheckedNode(this),this.updateLeafState(),(this.level===1||((t=this.parent)==null?void 0:t.expanded)===!0)&&(this.canFocus=!0)}setData(t){ke(t)||gc(this,t),this.data=t,this.childNodes=[];let n;this.level===0&&ke(this.data)?n=this.data:n=Ma(this,"children")||[];for(let l=0,a=n.length;l-1)return t.childNodes[n+1]}return null}get previousSibling(){const t=this.parent;if(t){const n=t.childNodes.indexOf(this);if(n>-1)return n>0?t.childNodes[n-1]:null}return null}contains(t,n=!0){return(this.childNodes||[]).some(l=>l===t||n&&l.contains(t))}remove(){const t=this.parent;t&&t.removeChild(this)}insertChild(t,n,l){if(!t)throw new Error("InsertChild error: child is required.");if(!(t instanceof Wl)){if(!l){const a=this.getChildren(!0);a!=null&&a.includes(t.data)||(vt(n)||n<0?a==null||a.push(t.data):a==null||a.splice(n,0,t.data))}Object.assign(t,{parent:this,store:this.store}),t=kt(new Wl(t)),t instanceof Wl&&t.initialize()}t.level=this.level+1,vt(n)||n<0?this.childNodes.push(t):this.childNodes.splice(n,0,t),this.updateLeafState()}insertBefore(t,n){let l;n&&(l=this.childNodes.indexOf(n)),this.insertChild(t,l)}insertAfter(t,n){let l;n&&(l=this.childNodes.indexOf(n),l!==-1&&(l+=1)),this.insertChild(t,l)}removeChild(t){const n=this.getChildren()||[],l=n.indexOf(t.data);l>-1&&n.splice(l,1);const a=this.childNodes.indexOf(t);a>-1&&(this.store&&this.store.deregisterNode(t),t.parent=null,this.childNodes.splice(a,1)),this.updateLeafState()}removeChildByData(t){let n=null;for(let l=0;l${s}
`:""}
-
")}1)&&(s=1),s}function zo(s){return s<=1?"".concat(Number(s)*100,"%"):s}function Va(s){return s.length===1?"0"+s:String(s)}function NF(s,f,o){return{r:Dr(s,255)*255,g:Dr(f,255)*255,b:Dr(o,255)*255}}function c2(s,f,o){s=Dr(s,255),f=Dr(f,255),o=Dr(o,255);var c=Math.max(s,f,o),r=Math.min(s,f,o),e=0,w=0,A=(c+r)/2;if(c===r)w=0,e=0;else{var k=c-r;switch(w=A>.5?k/(2-c-r):k/(c+r),c){case s:e=(f-o)/k+(f>8}return function(V){var Ke=V.length,De=0,vt=0;if(2*Ke>B&&(B=2*Ke,U=Buffer.allocUnsafe(B)),Buffer.isBuffer(V))for(De=0;De