ccgauge 1.0.1 → 1.0.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 (79) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-build-manifest.json +39 -39
  3. package/.next/standalone/.next/app-path-routes-manifest.json +8 -8
  4. package/.next/standalone/.next/build-manifest.json +2 -2
  5. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  6. package/.next/standalone/.next/server/app/api/blocks/route.js +1 -1
  7. package/.next/standalone/.next/server/app/api/blocks/route.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/api/blocks/route_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/api/export/usage/route.js +1 -1
  10. package/.next/standalone/.next/server/app/api/export/usage/route.js.nft.json +1 -1
  11. package/.next/standalone/.next/server/app/api/export/usage/route_client-reference-manifest.js +1 -1
  12. package/.next/standalone/.next/server/app/api/pricing/route.js +1 -1
  13. package/.next/standalone/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
  14. package/.next/standalone/.next/server/app/api/projects/route.js +1 -1
  15. package/.next/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  17. package/.next/standalone/.next/server/app/api/scan/route.js +1 -1
  18. package/.next/standalone/.next/server/app/api/scan/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/scan/route_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/api/sessions/route.js +1 -1
  21. package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/api/usage/route.js +1 -1
  24. package/.next/standalone/.next/server/app/api/usage/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/usage/route_client-reference-manifest.js +1 -1
  26. package/.next/standalone/.next/server/app/models/page.js +2 -2
  27. package/.next/standalone/.next/server/app/models/page.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/models/page_client-reference-manifest.js +1 -1
  29. package/.next/standalone/.next/server/app/page.js +2 -2
  30. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  32. package/.next/standalone/.next/server/app/projects/[id]/page.js +2 -2
  33. package/.next/standalone/.next/server/app/projects/[id]/page.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/projects/[id]/page_client-reference-manifest.js +1 -1
  35. package/.next/standalone/.next/server/app/projects/page.js +1 -1
  36. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  38. package/.next/standalone/.next/server/app/sessions/[id]/page.js +2 -2
  39. package/.next/standalone/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  41. package/.next/standalone/.next/server/app/sessions/page.js +1 -1
  42. package/.next/standalone/.next/server/app/sessions/page.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  44. package/.next/standalone/.next/server/app/settings/page.js +1 -1
  45. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  47. package/.next/standalone/.next/server/app/usage/page.js +3 -3
  48. package/.next/standalone/.next/server/app/usage/page.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/usage/page_client-reference-manifest.js +1 -1
  50. package/.next/standalone/.next/server/app-paths-manifest.json +8 -8
  51. package/.next/standalone/.next/server/chunks/567.js +3 -3
  52. package/.next/standalone/.next/server/chunks/716.js +1 -1
  53. package/.next/standalone/.next/server/chunks/{775.js → 971.js} +1 -1
  54. package/.next/standalone/.next/server/chunks/98.js +1 -0
  55. package/.next/standalone/.next/server/functions-config-manifest.json +1 -1
  56. package/.next/standalone/.next/server/pages/500.html +1 -1
  57. package/.next/standalone/.next/static/chunks/148-0a1e1b0207b89e3f.js +1 -0
  58. package/.next/standalone/.next/static/chunks/app/layout-2512ccdfb13aeb17.js +1 -0
  59. package/.next/standalone/.next/static/chunks/app/page-19d3e77d4aa35a63.js +1 -0
  60. package/.next/standalone/.next/static/chunks/app/usage/{page-63c230b1e2c5c63c.js → page-18fd820a3111bd5b.js} +1 -1
  61. package/.next/standalone/.next/static/css/406e067663b8b429.css +3 -0
  62. package/.next/standalone/node_modules/next/node_modules/postcss/package.json +0 -0
  63. package/.next/standalone/package.json +1 -1
  64. package/.next/standalone/public/claude-logo.webp +0 -0
  65. package/.next/standalone/public/codex-logo.png +0 -0
  66. package/CHANGELOG.md +297 -0
  67. package/README.md +19 -6
  68. package/README.zh-CN.md +19 -6
  69. package/bin/cli.mjs +37 -17
  70. package/dist/mcp/server.mjs +40 -23695
  71. package/dist/report/index.mjs +42 -18
  72. package/package.json +16 -18
  73. package/.next/standalone/.next/server/chunks/155.js +0 -1
  74. package/.next/standalone/.next/static/chunks/148-d2db1767205d1ca8.js +0 -1
  75. package/.next/standalone/.next/static/chunks/app/layout-ca9328306c8cbb8e.js +0 -1
  76. package/.next/standalone/.next/static/chunks/app/page-11fc9a0ded501248.js +0 -1
  77. package/.next/standalone/.next/static/css/b34dbb2d1cbeaf5e.css +0 -3
  78. /package/.next/standalone/.next/static/{2kImy5ZkabMplKu3i19s7 → alqi5oQtTQUdpxp2x0yAt}/_buildManifest.js +0 -0
  79. /package/.next/standalone/.next/static/{2kImy5ZkabMplKu3i19s7 → alqi5oQtTQUdpxp2x0yAt}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";exports.id=775,exports.ids=[775],exports.modules={24919:(a,b,c)=>{c.d(b,{TokenStackChart:()=>o});var d=c(21124),e=c(6077),f=c(72400),g=c(57495),h=c(59296),i=c(16803),j=c(11767),k=c(18311),l=c(15514),m=c(15519);let n={input:"rgb(var(--chart-input))",output:"rgb(var(--chart-output))",cacheRead:"rgb(var(--chart-cache-read))",cacheCreation:"rgb(var(--chart-cache-create))"};function o({data:a,height:b="h-72"}){let c=(0,m.kj)(),{locale:o}=(0,m.s9)();return a.length?(0,d.jsxs)("div",{className:`${b} w-full`,children:[(0,d.jsx)(e.u,{width:"100%",height:"100%",children:(0,d.jsxs)(f.E,{data:a,margin:{top:12,right:8,bottom:4,left:8},barCategoryGap:"22%",children:[(0,d.jsx)(g.d,{stroke:"rgb(var(--chart-grid))",strokeOpacity:.6,strokeDasharray:"3 3",vertical:!1}),(0,d.jsx)(h.W,{dataKey:"label",tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,interval:"preserveStartEnd",minTickGap:32,tickMargin:8}),(0,d.jsx)(i.h,{tickFormatter:a=>(0,l.jh)(Number(a),o),tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,width:56,tickMargin:4}),(0,d.jsx)(j.m,{content:(0,d.jsx)(q,{}),cursor:{fill:"rgb(var(--text-primary) / 0.05)",radius:4}}),(0,d.jsx)(k.y,{dataKey:"input",stackId:"a",fill:n.input,isAnimationActive:!1}),(0,d.jsx)(k.y,{dataKey:"cacheCreation",stackId:"a",fill:n.cacheCreation,isAnimationActive:!1}),(0,d.jsx)(k.y,{dataKey:"cacheRead",stackId:"a",fill:n.cacheRead,isAnimationActive:!1}),(0,d.jsx)(k.y,{dataKey:"output",stackId:"a",fill:n.output,radius:[4,4,0,0],isAnimationActive:!1})]})}),(0,d.jsxs)("div",{className:"flex items-center flex-wrap justify-center gap-4 text-xs text-text-secondary mt-2",children:[(0,d.jsx)(p,{color:n.input,label:c("chart.legend.input")}),(0,d.jsx)(p,{color:n.cacheCreation,label:c("chart.legend.cacheWrite")}),(0,d.jsx)(p,{color:n.cacheRead,label:c("chart.legend.cacheRead")}),(0,d.jsx)(p,{color:n.output,label:c("chart.legend.output")})]})]}):(0,d.jsx)("div",{className:`${b} flex items-center justify-center text-text-tertiary text-sm`,children:c("chart.empty")})}function p({color:a,label:b}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-2.5 h-2.5 rounded-sm",style:{background:a}}),(0,d.jsx)("span",{children:b})]})}function q(a){let b=(0,m.kj)(),{locale:c}=(0,m.s9)();if(!a.active||!a.payload||!a.payload.length)return null;let e=a.payload[0].payload,f=e.input+e.output+e.cacheRead+e.cacheCreation;return(0,d.jsxs)("div",{className:"card-elevated border border-border-hi rounded-card p-3 text-xs min-w-[200px]",children:[(0,d.jsx)("div",{className:"font-medium text-text-primary mb-2",children:a.label}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)(r,{color:n.input,label:b("chart.legend.input"),value:e.input,locale:c}),(0,d.jsx)(r,{color:n.cacheCreation,label:b("chart.legend.cacheWrite"),value:e.cacheCreation,locale:c}),(0,d.jsx)(r,{color:n.cacheRead,label:b("chart.legend.cacheRead"),value:e.cacheRead,locale:c}),(0,d.jsx)(r,{color:n.output,label:b("chart.legend.output"),value:e.output,locale:c})]}),(0,d.jsxs)("div",{className:"mt-2 pt-2 border-t border-border flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-text-secondary",children:b("chart.tooltip.total")}),(0,d.jsx)("span",{className:"num-mono text-text-primary",children:(0,l.jh)(f,c)})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,d.jsx)("span",{className:"text-text-secondary",children:b("chart.tooltip.cost")}),(0,d.jsx)("span",{className:"num-mono text-brand",children:(0,l.az)(e.cost)})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,d.jsx)("span",{className:"text-text-secondary",children:b("chart.tooltip.requests")}),(0,d.jsx)("span",{className:"num-mono text-text-primary",children:e.requests})]})]})}function r({color:a,label:b,value:c,locale:e}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-text-secondary",children:[(0,d.jsx)("span",{className:"w-2 h-2 rounded-sm",style:{background:a}}),b]}),(0,d.jsx)("span",{className:"num-mono text-text-primary",children:(0,l.jh)(c,e)})]})}},37583:(a,b,c)=>{c.d(b,{pp:()=>h,qK:()=>g,wn:()=>f});var d=c(75338),e=c(95012);function f({title:a,desc:b,right:c,children:f,className:g,inlineDesc:h,fillBody:i}){return(0,d.jsxs)("section",{className:(0,e.cn)("card overflow-hidden",i&&"flex flex-col",g),children:[(a||c)&&(0,d.jsxs)("header",{className:(0,e.cn)("section-header","flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4","px-5 sm:px-6 pt-4 sm:pt-5 pb-3 border-b border-border"),children:[(0,d.jsxs)("div",{className:(0,e.cn)("min-w-0",h&&"sm:flex sm:items-baseline sm:gap-2.5"),children:[a&&(0,d.jsx)("h2",{className:"text-[15px] font-semibold text-text-primary tracking-tight leading-tight",children:a}),b&&(0,d.jsx)("p",{className:(0,e.cn)("text-xs text-text-secondary leading-relaxed",h?"mt-1 sm:mt-0":"mt-1.5"),children:b})]}),c&&(0,d.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),(0,d.jsx)("div",{className:(0,e.cn)("p-5 sm:p-6",i&&"flex-1 flex flex-col"),children:f})]})}function g({title:a,desc:b,right:c,children:e}){return(0,d.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-6 sm:py-8 space-y-5 sm:space-y-6",children:[(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end sm:justify-between gap-3 sm:gap-4",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h1",{className:"text-2xl sm:text-[1.75rem] font-semibold tracking-tight leading-tight truncate",children:a}),b&&(0,d.jsx)("p",{className:"text-sm text-text-secondary mt-1.5 leading-relaxed",children:b})]}),c&&(0,d.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),e]})}function h({title:a,desc:b,icon:c,action:e}){return(0,d.jsxs)("div",{className:"card text-center py-14 sm:py-16 px-6 flex flex-col items-center gap-3",children:[(0,d.jsx)("div",{className:"w-12 h-12 rounded-full bg-bg-surface-hi border border-border flex items-center justify-center text-text-tertiary",children:c??(0,d.jsx)(i,{})}),(0,d.jsx)("div",{className:"text-base font-medium text-text-primary",children:a}),b&&(0,d.jsx)("div",{className:"text-sm text-text-tertiary max-w-md leading-relaxed",children:b}),e&&(0,d.jsx)("div",{className:"mt-2",children:e})]})}function i(){return(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"M9 9h.01M15 9h.01M9 15c1 1 2 1.5 3 1.5s2-.5 3-1.5"})]})}},50160:(a,b,c)=>{c.d(b,{SI:()=>e});var d=c(60704);function e(a){let b=(0,d.sO)(a.source),{pricing:c}=b.resolvePricing(a.model);return b.costFromUsage(a.usage,c)}},67803:(a,b,c)=>{c.d(b,{$M:()=>n,OJ:()=>l,a6:()=>j,a9:()=>k,bo:()=>h,pb:()=>m});var d=c(50160),e=c(60704),f=c(95012);let g=["hour","day","week","month"];function h(a){return"string"==typeof a&&g.includes(a)}function i(a,b){return!(a.source!==b.source||b.from&&a.timestamp<b.from.toISOString()||b.to&&a.timestamp>b.to.toISOString())&&(!b.models||!b.models.length||!!b.models.includes(a.model))&&(!b.projects||!b.projects.length||!!b.projects.includes(a.cwd))}function j(a,b,c){let e=new Map;for(let f of a){if(!i(f,c))continue;let{key:a,label:g}=function(a,b){let c=new Date(a),d=c.getFullYear(),e=String(c.getMonth()+1).padStart(2,"0"),f=String(c.getDate()).padStart(2,"0"),g=String(c.getHours()).padStart(2,"0");if("hour"===b)return{key:`${d}-${e}-${f}T${g}`,label:`${e}/${f} ${g}:00`};if("day"===b)return{key:`${d}-${e}-${f}`,label:`${e}/${f}`};if("week"===b){let a=new Date(c),b=a.getDay()||7;a.setDate(a.getDate()-b+1);let d=String(a.getMonth()+1).padStart(2,"0"),e=String(a.getDate()).padStart(2,"0");return{key:`${a.getFullYear()}-W${d}${e}`,label:`Wk ${d}/${e}`}}return{key:`${d}-${e}`,label:`${d}-${e}`}}(f.timestamp,b),h=e.get(a);h||(h={key:a,label:g,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,totalTokens:0,cost:0,saved:0,requests:0,models:{}},e.set(a,h)),function(a,b){let c=(0,d.SI)(b);a.inputTokens+=b.usage.input_tokens,a.outputTokens+=b.usage.output_tokens,a.cacheReadTokens+=b.usage.cache_read_input_tokens,a.cacheCreationTokens+=b.usage.cache_creation_input_tokens,a.totalTokens=a.inputTokens+a.outputTokens+a.cacheReadTokens+a.cacheCreationTokens,a.cost+=c.total,a.saved+=c.saved,a.requests+=1;let e=a.models[b.model]??{tokens:0,cost:0,requests:0};e.tokens+=b.usage.input_tokens+b.usage.output_tokens+b.usage.cache_read_input_tokens+b.usage.cache_creation_input_tokens,e.cost+=c.total,e.requests+=1,a.models[b.model]=e}(h,f)}return Array.from(e.values()).sort((a,b)=>a.key.localeCompare(b.key))}function k(a,b){let c=new Map;for(let f of a){if(!i(f,b))continue;let a=c.get(f.model);if(!a){let{pricing:b,matchType:d}=(0,e.sO)(f.source).resolvePricing(f.model);a={model:f.model,source:f.source,requests:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,totalTokens:0,cost:0,saved:0,pricing:b,pricingResolved:"exact"===d||"date-stripped"===d||"prefix-stripped"===d},c.set(f.model,a)}let g=(0,d.SI)(f);a.requests+=1,a.inputTokens+=f.usage.input_tokens,a.outputTokens+=f.usage.output_tokens,a.cacheReadTokens+=f.usage.cache_read_input_tokens,a.cacheCreationTokens+=f.usage.cache_creation_input_tokens,a.totalTokens=a.inputTokens+a.outputTokens+a.cacheReadTokens+a.cacheCreationTokens,a.cost+=g.total,a.saved+=g.saved}return Array.from(c.values()).sort((a,b)=>b.cost-a.cost)}function l(a,b){let c=new Map,e=new Map;for(let g of a){if(!i(g,b))continue;let a=g.cwd||"(unknown)",h=c.get(a);h||(h={cwd:a,projectName:(0,f.PJ)(a),sessions:0,requests:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,totalTokens:0,cost:0,saved:0,firstActivity:g.timestamp,lastActivity:g.timestamp,models:[]},c.set(a,h),e.set(a,new Set)),e.get(a).add(g.sessionId);let j=(0,d.SI)(g);h.requests+=1,h.inputTokens+=g.usage.input_tokens,h.outputTokens+=g.usage.output_tokens,h.cacheReadTokens+=g.usage.cache_read_input_tokens,h.cacheCreationTokens+=g.usage.cache_creation_input_tokens,h.totalTokens=h.inputTokens+h.outputTokens+h.cacheReadTokens+h.cacheCreationTokens,h.cost+=j.total,h.saved+=j.saved,g.timestamp<h.firstActivity&&(h.firstActivity=g.timestamp),g.timestamp>h.lastActivity&&(h.lastActivity=g.timestamp),h.models.includes(g.model)||h.models.push(g.model)}for(let[a,b]of e)c.get(a).sessions=b.size;return Array.from(c.values()).sort((a,b)=>b.cost-a.cost)}function m(a,b,c){let e=new Map;for(let b of a){if(!i(b,c))continue;let a=b.sessionId||b.uuid,g=e.get(a);g||(g={sessionId:a,cwd:b.cwd,projectName:(0,f.PJ)(b.cwd),startTime:b.timestamp,endTime:b.timestamp,durationMs:0,requests:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,totalTokens:0,cost:0,saved:0,models:[],modelBreakdown:{}},e.set(a,g));let h=(0,d.SI)(b);g.requests+=1,g.inputTokens+=b.usage.input_tokens,g.outputTokens+=b.usage.output_tokens,g.cacheReadTokens+=b.usage.cache_read_input_tokens,g.cacheCreationTokens+=b.usage.cache_creation_input_tokens,g.totalTokens=g.inputTokens+g.outputTokens+g.cacheReadTokens+g.cacheCreationTokens,g.cost+=h.total,g.saved+=h.saved,b.timestamp<g.startTime&&(g.startTime=b.timestamp),b.timestamp>g.endTime&&(g.endTime=b.timestamp),g.models.includes(b.model)||g.models.push(b.model);let j=g.modelBreakdown[b.model]??{tokens:0,cost:0,requests:0};j.tokens+=b.usage.input_tokens+b.usage.output_tokens+b.usage.cache_read_input_tokens+b.usage.cache_creation_input_tokens,j.cost+=h.total,j.requests+=1,g.modelBreakdown[b.model]=j}let g=new Map;for(let a of b){let b=g.get(a.sessionId);(!b||a.timestamp<b.timestamp)&&g.set(a.sessionId,a)}for(let a of e.values()){a.durationMs=Math.max(0,new Date(a.endTime).getTime()-new Date(a.startTime).getTime());let b=g.get(a.sessionId);b&&b.textPreview&&(a.firstUserMessage=b.textPreview,a.title=b.textPreview.slice(0,80))}return Array.from(e.values()).sort((a,b)=>b.endTime.localeCompare(a.endTime))}function n(a,b){let c=0,e=0,f=0,g=0,h=0,j=0,k=0;for(let l of a){if(!i(l,b))continue;let a=(0,d.SI)(l);c+=l.usage.input_tokens,e+=l.usage.output_tokens,f+=l.usage.cache_read_input_tokens,g+=l.usage.cache_creation_input_tokens,h+=a.total,j+=a.saved,k+=1}return{inputTokens:c,outputTokens:e,cacheReadTokens:f,cacheCreationTokens:g,totalTokens:c+e+f+g,cost:h,saved:j,requests:k}}},89605:(a,b,c)=>{c.d(b,{TokenStackChart:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call TokenStackChart() from the server but TokenStackChart is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/zuopeng.cheng/personal/workspace/ccgauge/components/charts/token-stack-chart.tsx","TokenStackChart")}};
1
+ "use strict";exports.id=971,exports.ids=[971],exports.modules={24919:(a,b,c)=>{c.d(b,{TokenStackChart:()=>o});var d=c(21124),e=c(6077),f=c(72400),g=c(57495),h=c(59296),i=c(16803),j=c(11767),k=c(18311),l=c(15514),m=c(15519);let n={input:"rgb(var(--chart-input))",output:"rgb(var(--chart-output))",cacheRead:"rgb(var(--chart-cache-read))",cacheCreation:"rgb(var(--chart-cache-create))"};function o({data:a,height:b="h-72"}){let c=(0,m.kj)(),{locale:o}=(0,m.s9)();return a.length?(0,d.jsxs)("div",{className:`${b} w-full`,children:[(0,d.jsx)(e.u,{width:"100%",height:"100%",children:(0,d.jsxs)(f.E,{data:a,margin:{top:12,right:8,bottom:4,left:8},barCategoryGap:"22%",children:[(0,d.jsx)(g.d,{stroke:"rgb(var(--chart-grid))",strokeOpacity:.6,strokeDasharray:"3 3",vertical:!1}),(0,d.jsx)(h.W,{dataKey:"label",tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,interval:"preserveStartEnd",minTickGap:32,tickMargin:8}),(0,d.jsx)(i.h,{tickFormatter:a=>(0,l.jh)(Number(a),o),tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,width:56,tickMargin:4}),(0,d.jsx)(j.m,{content:(0,d.jsx)(q,{}),cursor:{fill:"rgb(var(--text-primary) / 0.05)",radius:4}}),(0,d.jsx)(k.y,{dataKey:"input",stackId:"a",fill:n.input,isAnimationActive:!1}),(0,d.jsx)(k.y,{dataKey:"cacheCreation",stackId:"a",fill:n.cacheCreation,isAnimationActive:!1}),(0,d.jsx)(k.y,{dataKey:"cacheRead",stackId:"a",fill:n.cacheRead,isAnimationActive:!1}),(0,d.jsx)(k.y,{dataKey:"output",stackId:"a",fill:n.output,radius:[4,4,0,0],isAnimationActive:!1})]})}),(0,d.jsxs)("div",{className:"flex items-center flex-wrap justify-center gap-4 text-xs text-text-secondary mt-2",children:[(0,d.jsx)(p,{color:n.input,label:c("chart.legend.input")}),(0,d.jsx)(p,{color:n.cacheCreation,label:c("chart.legend.cacheWrite")}),(0,d.jsx)(p,{color:n.cacheRead,label:c("chart.legend.cacheRead")}),(0,d.jsx)(p,{color:n.output,label:c("chart.legend.output")})]})]}):(0,d.jsx)("div",{className:`${b} flex items-center justify-center text-text-tertiary text-sm`,children:c("chart.empty")})}function p({color:a,label:b}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-2.5 h-2.5 rounded-sm",style:{background:a}}),(0,d.jsx)("span",{children:b})]})}function q(a){let b=(0,m.kj)(),{locale:c}=(0,m.s9)();if(!a.active||!a.payload||!a.payload.length)return null;let e=a.payload[0].payload,f=e.input+e.output+e.cacheRead+e.cacheCreation;return(0,d.jsxs)("div",{className:"card-elevated border border-border-hi rounded-card p-3 text-xs min-w-[200px]",children:[(0,d.jsx)("div",{className:"font-medium text-text-primary mb-2",children:a.label}),(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)(r,{color:n.input,label:b("chart.legend.input"),value:e.input,locale:c}),(0,d.jsx)(r,{color:n.cacheCreation,label:b("chart.legend.cacheWrite"),value:e.cacheCreation,locale:c}),(0,d.jsx)(r,{color:n.cacheRead,label:b("chart.legend.cacheRead"),value:e.cacheRead,locale:c}),(0,d.jsx)(r,{color:n.output,label:b("chart.legend.output"),value:e.output,locale:c})]}),(0,d.jsxs)("div",{className:"mt-2 pt-2 border-t border-border flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-text-secondary",children:b("chart.tooltip.total")}),(0,d.jsx)("span",{className:"num-mono text-text-primary",children:(0,l.jh)(f,c)})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,d.jsx)("span",{className:"text-text-secondary",children:b("chart.tooltip.cost")}),(0,d.jsx)("span",{className:"num-mono text-brand",children:(0,l.az)(e.cost)})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,d.jsx)("span",{className:"text-text-secondary",children:b("chart.tooltip.requests")}),(0,d.jsx)("span",{className:"num-mono text-text-primary",children:e.requests})]})]})}function r({color:a,label:b,value:c,locale:e}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-text-secondary",children:[(0,d.jsx)("span",{className:"w-2 h-2 rounded-sm",style:{background:a}}),b]}),(0,d.jsx)("span",{className:"num-mono text-text-primary",children:(0,l.jh)(c,e)})]})}},37583:(a,b,c)=>{c.d(b,{pp:()=>h,qK:()=>g,wn:()=>f});var d=c(75338),e=c(95012);function f({title:a,desc:b,right:c,children:f,className:g,inlineDesc:h,fillBody:i}){return(0,d.jsxs)("section",{className:(0,e.cn)("card overflow-hidden",i&&"flex flex-col",g),children:[(a||c)&&(0,d.jsxs)("header",{className:(0,e.cn)("section-header","flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4","px-5 sm:px-6 pt-4 sm:pt-5 pb-3 border-b border-border"),children:[(0,d.jsxs)("div",{className:(0,e.cn)("min-w-0",h&&"sm:flex sm:items-baseline sm:gap-2.5"),children:[a&&(0,d.jsx)("h2",{className:"text-[15px] font-semibold text-text-primary tracking-tight leading-tight",children:a}),b&&(0,d.jsx)("p",{className:(0,e.cn)("text-xs text-text-secondary leading-relaxed",h?"mt-1 sm:mt-0":"mt-1.5"),children:b})]}),c&&(0,d.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),(0,d.jsx)("div",{className:(0,e.cn)("p-5 sm:p-6",i&&"flex-1 flex flex-col"),children:f})]})}function g({title:a,desc:b,right:c,children:e}){return(0,d.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-6 sm:py-8 space-y-5 sm:space-y-6",children:[(0,d.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-end sm:justify-between gap-3 sm:gap-4",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h1",{className:"text-2xl sm:text-[1.75rem] font-semibold tracking-tight leading-tight truncate",children:a}),b&&(0,d.jsx)("p",{className:"text-sm text-text-secondary mt-1.5 leading-relaxed",children:b})]}),c&&(0,d.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:c})]}),e]})}function h({title:a,desc:b,icon:c,action:e}){return(0,d.jsxs)("div",{className:"card text-center py-14 sm:py-16 px-6 flex flex-col items-center gap-3",children:[(0,d.jsx)("div",{className:"w-12 h-12 rounded-full bg-bg-surface-hi border border-border flex items-center justify-center text-text-tertiary",children:c??(0,d.jsx)(i,{})}),(0,d.jsx)("div",{className:"text-base font-medium text-text-primary",children:a}),b&&(0,d.jsx)("div",{className:"text-sm text-text-tertiary max-w-md leading-relaxed",children:b}),e&&(0,d.jsx)("div",{className:"mt-2",children:e})]})}function i(){return(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"M9 9h.01M15 9h.01M9 15c1 1 2 1.5 3 1.5s2-.5 3-1.5"})]})}},50160:(a,b,c)=>{c.d(b,{SI:()=>e});var d=c(60704);function e(a){let b=(0,d.sO)(a.source),{pricing:c}=b.resolvePricing(a.model);return b.costFromUsage(a.usage,c)}},67803:(a,b,c)=>{c.d(b,{$M:()=>p,OJ:()=>n,a3:()=>i,a6:()=>l,a9:()=>m,bo:()=>h,pb:()=>o});var d=c(50160),e=c(60704),f=c(95012);let g=["hour","day","week","month"];function h(a){return"string"==typeof a&&g.includes(a)}function i(a,b){let c=new Date(a),d=c.getFullYear(),e=String(c.getMonth()+1).padStart(2,"0"),f=String(c.getDate()).padStart(2,"0"),g=String(c.getHours()).padStart(2,"0");if("hour"===b)return{key:`${d}-${e}-${f}T${g}`,label:`${e}/${f} ${g}:00`};if("day"===b)return{key:`${d}-${e}-${f}`,label:`${e}/${f}`};if("week"===b){let a=new Date(c),b=a.getDay()||7;a.setDate(a.getDate()-b+1);let d=String(a.getMonth()+1).padStart(2,"0"),e=String(a.getDate()).padStart(2,"0");return{key:`${a.getFullYear()}-W${d}${e}`,label:`Wk ${d}/${e}`}}return{key:`${d}-${e}`,label:`${d}-${e}`}}function j(a){return{source:a.source,fromIso:a.from?.toISOString(),toIso:a.to?.toISOString(),models:a.models&&a.models.length?new Set(a.models):void 0,projects:a.projects&&a.projects.length?new Set(a.projects):void 0}}function k(a,b){return a.source===b.source&&(!b.fromIso||!(a.timestamp<b.fromIso))&&(!b.toIso||!(a.timestamp>b.toIso))&&(!b.models||!!b.models.has(a.model))&&(!b.projects||!!b.projects.has(a.cwd))}function l(a,b,c){let e=new Map,f=j(c);for(let c of a){if(!k(c,f))continue;let{key:a,label:g}=i(c.timestamp,b),h=e.get(a);h||(h={key:a,label:g,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,totalTokens:0,cost:0,saved:0,requests:0,models:{}},e.set(a,h)),function(a,b){let c=(0,d.SI)(b);a.inputTokens+=b.usage.input_tokens,a.outputTokens+=b.usage.output_tokens,a.cacheReadTokens+=b.usage.cache_read_input_tokens,a.cacheCreationTokens+=b.usage.cache_creation_input_tokens,a.totalTokens=a.inputTokens+a.outputTokens+a.cacheReadTokens+a.cacheCreationTokens,a.cost+=c.total,a.saved+=c.saved,a.requests+=1;let e=a.models[b.model]??{tokens:0,cost:0,requests:0};e.tokens+=b.usage.input_tokens+b.usage.output_tokens+b.usage.cache_read_input_tokens+b.usage.cache_creation_input_tokens,e.cost+=c.total,e.requests+=1,a.models[b.model]=e}(h,c)}return Array.from(e.values()).sort((a,b)=>a.key.localeCompare(b.key))}function m(a,b){let c=new Map,f=j(b);for(let b of a){if(!k(b,f))continue;let a=c.get(b.model);if(!a){let{pricing:d,matchType:f}=(0,e.sO)(b.source).resolvePricing(b.model);a={model:b.model,source:b.source,requests:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,totalTokens:0,cost:0,saved:0,pricing:d,pricingResolved:"exact"===f||"date-stripped"===f||"prefix-stripped"===f},c.set(b.model,a)}let g=(0,d.SI)(b);a.requests+=1,a.inputTokens+=b.usage.input_tokens,a.outputTokens+=b.usage.output_tokens,a.cacheReadTokens+=b.usage.cache_read_input_tokens,a.cacheCreationTokens+=b.usage.cache_creation_input_tokens,a.totalTokens=a.inputTokens+a.outputTokens+a.cacheReadTokens+a.cacheCreationTokens,a.cost+=g.total,a.saved+=g.saved}return Array.from(c.values()).sort((a,b)=>b.cost-a.cost)}function n(a,b){let c=new Map,e=new Map,g=j(b);for(let h of a){if(!k(h,g))continue;let a=h.cwd||"(unknown)",i=c.get(a);i||(i={source:b.source,cwd:a,projectName:(0,f.PJ)(a),sessions:0,requests:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,totalTokens:0,cost:0,saved:0,firstActivity:h.timestamp,lastActivity:h.timestamp,models:[]},c.set(a,i),e.set(a,new Set)),e.get(a).add(h.sessionId);let j=(0,d.SI)(h);i.requests+=1,i.inputTokens+=h.usage.input_tokens,i.outputTokens+=h.usage.output_tokens,i.cacheReadTokens+=h.usage.cache_read_input_tokens,i.cacheCreationTokens+=h.usage.cache_creation_input_tokens,i.totalTokens=i.inputTokens+i.outputTokens+i.cacheReadTokens+i.cacheCreationTokens,i.cost+=j.total,i.saved+=j.saved,h.timestamp<i.firstActivity&&(i.firstActivity=h.timestamp),h.timestamp>i.lastActivity&&(i.lastActivity=h.timestamp),i.models.includes(h.model)||i.models.push(h.model)}for(let[a,b]of e)c.get(a).sessions=b.size;return Array.from(c.values()).sort((a,b)=>b.cost-a.cost)}function o(a,b,c){let e=new Map,g=j(c);for(let b of a){if(!k(b,g))continue;let a=b.sessionId||b.uuid,c=e.get(a);c||(c={sessionId:a,source:b.source,cwd:b.cwd,projectName:(0,f.PJ)(b.cwd),startTime:b.timestamp,endTime:b.timestamp,durationMs:0,requests:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,totalTokens:0,cost:0,saved:0,models:[],modelBreakdown:{}},e.set(a,c));let h=(0,d.SI)(b);c.requests+=1,c.inputTokens+=b.usage.input_tokens,c.outputTokens+=b.usage.output_tokens,c.cacheReadTokens+=b.usage.cache_read_input_tokens,c.cacheCreationTokens+=b.usage.cache_creation_input_tokens,c.totalTokens=c.inputTokens+c.outputTokens+c.cacheReadTokens+c.cacheCreationTokens,c.cost+=h.total,c.saved+=h.saved,b.timestamp<c.startTime&&(c.startTime=b.timestamp),b.timestamp>c.endTime&&(c.endTime=b.timestamp),c.models.includes(b.model)||c.models.push(b.model);let i=c.modelBreakdown[b.model]??{tokens:0,cost:0,requests:0};i.tokens+=b.usage.input_tokens+b.usage.output_tokens+b.usage.cache_read_input_tokens+b.usage.cache_creation_input_tokens,i.cost+=h.total,i.requests+=1,c.modelBreakdown[b.model]=i}let h=new Map;for(let a of b){let b=h.get(a.sessionId);(!b||a.timestamp<b.timestamp)&&h.set(a.sessionId,a)}for(let a of e.values()){a.durationMs=Math.max(0,new Date(a.endTime).getTime()-new Date(a.startTime).getTime());let b=h.get(a.sessionId);b&&b.textPreview&&(a.firstUserMessage=b.textPreview,a.title=b.textPreview.slice(0,80))}return Array.from(e.values()).sort((a,b)=>b.endTime.localeCompare(a.endTime))}function p(a,b){let c=0,e=0,f=0,g=0,h=0,i=0,l=0,m=j(b);for(let b of a){if(!k(b,m))continue;let a=(0,d.SI)(b);c+=b.usage.input_tokens,e+=b.usage.output_tokens,f+=b.usage.cache_read_input_tokens,g+=b.usage.cache_creation_input_tokens,h+=a.total,i+=a.saved,l+=1}return{inputTokens:c,outputTokens:e,cacheReadTokens:f,cacheCreationTokens:g,totalTokens:c+e+f+g,cost:h,saved:i,requests:l}}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=98,exports.ids=[98],exports.modules={49098:(a,b,c)=>{c.d(b,{So:()=>s,mo:()=>u,TF:()=>t});var d=c(60704),e=c(73024),f=c(76760),g=c.n(f),h=c(48161),i=c.n(h);let j="default";function k(a){let b=a===j?"index-v2.json":`index-${a}-v2.json`;return g().join(process.env.CCGAUGE_STATE_DIR?process.env.CCGAUGE_STATE_DIR:g().join(i().homedir(),".ccgauge"),"cache",b)}async function l(a=j){let b=k(a);try{let a=await e.promises.readFile(b,"utf8"),c=JSON.parse(a);if(2!==c.schemaVersion||!Array.isArray(c.files))return null;return c}catch{return null}}async function m(a,b=j){let c=k(b),d=g().dirname(c);await e.promises.mkdir(d,{recursive:!0});let f={schemaVersion:2,savedAt:a.savedAt,files:a.files},h=`${c}.tmp-${process.pid}`;await e.promises.writeFile(h,JSON.stringify(f)),await e.promises.rename(h,c)}let n=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\/subagents\/agent-[^/]+\.jsonl$/i;class o{constructor(a=j){this.files=new Map,this.snapshot=null,this.watchers=new Map,this.pollTimer=null,this.snapshotRebuildTimer=null,this.persistTimer=null,this.fileDebouncers=new Map,this.initPromise=null,this.isIndexing=!1,this.lastIndexedAt=null,this.indexDurationMs=null,this.existingDirs=[],this.dirToProvider=new Map,this.errors=[],this.loadedFromDisk=!1,this.lastWorkStart=null,this.rescanPromise=null,this.cacheName=a}init(){return this.initPromise||(this.initPromise=this.doInit()),this.initPromise}async doInit(){let a=Date.now();this.isIndexing=!0,this.lastWorkStart=a;try{await this.detectProviderDirs();let b=await l(this.cacheName);this.loadedFromDisk=null!==b;let c=new Map;if(b)for(let a of b.files)c.set(a.filePath,a);await this.fullScan(c),this.rebuildSnapshotNow(),this.indexDurationMs=Date.now()-a,this.lastIndexedAt=new Date().toISOString(),this.syncWatchersToDirs(),this.setupPolling(),this.schedulePersist()}finally{this.isIndexing=!1}}async detectProviderDirs(){let a=new Map,b=[];for(let c of(0,d.R0)())for(let d of c.getDirs())await p(d)&&!a.has(d)&&(a.set(d,c),b.push(d));let c=[],e=[];for(let b of a.keys())this.dirToProvider.has(b)||c.push(b);for(let b of this.dirToProvider.keys())a.has(b)||e.push(b);return this.dirToProvider=a,this.existingDirs=b,{added:c,removed:e}}async fullScan(a){let b=[];for(let[a,c]of this.dirToProvider)for(let d of(await q(a,c)))b.push({file:d,provider:c});let c=new Set(b.map(a=>a.file));for(let d of(await Promise.all(b.map(async({file:b,provider:c})=>{try{let d=await e.promises.stat(b),f=a.get(b);if(f&&f.source===c.id&&f.parserVersion===c.parserVersion&&f.mtimeMs===d.mtimeMs&&f.size===d.size)return void this.files.set(b,{source:c.id,parserVersion:c.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:f.assistantRecords,userRecords:f.userRecords,parentLinks:f.parentLinks});let g=await c.parseFile(b);this.files.set(b,{source:c.id,parserVersion:c.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:g.assistant,userRecords:g.user,parentLinks:g.parentLinks})}catch(a){this.recordError(`parse ${b}: ${a.message}`)}})),Array.from(this.files.keys())))c.has(d)||this.files.delete(d)}syncWatchersToDirs(){for(let[a,b]of this.watchers)if(!this.dirToProvider.has(a)){try{b.close()}catch{}this.watchers.delete(a)}for(let[a,b]of this.dirToProvider)if(!this.watchers.has(a))try{let c=(0,e.watch)(a,{recursive:!0},(c,d)=>{if(!d||"string"!=typeof d||!d.endsWith(".jsonl"))return;let e=g().join(a,d);this.scheduleFileReconcile(e,b)});c.on("error",b=>{this.recordError(`watcher ${a}: ${b.message}`)}),this.watchers.set(a,c)}catch(b){this.recordError(`watch ${a}: ${b.message}`)}}setupPolling(){this.pollTimer&&clearInterval(this.pollTimer);let a="mcp"===this.cacheName,b=process.env.CCGAUGE_POLL_FALLBACK;"1"!==b&&("0"===b||a)||(this.pollTimer=setInterval(()=>{this.pollOnce().catch(a=>this.recordError(`poll: ${a.message}`))},3e4),this.pollTimer.unref?.())}async pollOnce(){let a=Date.now(),b=await this.detectProviderDirs(),c=b.added.length>0||b.removed.length>0;c&&this.syncWatchersToDirs();let d=[];for(let[a,b]of this.dirToProvider)for(let c of(await q(a,b)))d.push({file:c,provider:b});let f=new Set(d.map(a=>a.file));for(let a of(await Promise.all(d.map(async({file:a,provider:b})=>{try{let d=await e.promises.stat(a),f=this.files.get(a);if(f&&f.mtimeMs===d.mtimeMs&&f.size===d.size)return;let g=await b.parseFile(a);this.files.set(a,{source:b.id,parserVersion:b.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:g.assistant,userRecords:g.user,parentLinks:g.parentLinks}),c=!0}catch(b){this.recordError(`poll-parse ${a}: ${b.message}`)}})),Array.from(this.files.keys())))f.has(a)||(this.files.delete(a),c=!0);c&&(this.lastWorkStart=a,this.scheduleSnapshotRebuild(),this.schedulePersist())}scheduleFileReconcile(a,b){let c=this.fileDebouncers.get(a);c&&clearTimeout(c);let d=setTimeout(()=>{this.fileDebouncers.delete(a),this.reconcileFile(a,b).catch(b=>this.recordError(`reconcile ${a}: ${b.message}`))},200);d.unref?.(),this.fileDebouncers.set(a,d)}async reconcileFile(a,b){let c=Date.now(),d=null;try{d=await e.promises.stat(a)}catch{}if(!d||!d.isFile()){this.files.has(a)&&(this.files.delete(a),this.lastWorkStart=c,this.scheduleSnapshotRebuild(),this.schedulePersist());return}let f=this.files.get(a);if(!f||f.mtimeMs!==d.mtimeMs||f.size!==d.size)try{let e=await b.parseFile(a);this.files.set(a,{source:b.id,parserVersion:b.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:e.assistant,userRecords:e.user,parentLinks:e.parentLinks}),this.lastWorkStart=c,this.scheduleSnapshotRebuild(),this.schedulePersist()}catch(b){this.recordError(`parse ${a}: ${b.message}`)}}scheduleSnapshotRebuild(){this.snapshotRebuildTimer&&clearTimeout(this.snapshotRebuildTimer),this.snapshotRebuildTimer=setTimeout(()=>{this.snapshotRebuildTimer=null,this.rebuildSnapshotNow()},100),this.snapshotRebuildTimer.unref?.()}rebuildSnapshotNow(){let a=Date.now(),b=this.lastWorkStart??a,c=[],d=[],e={},f=0,g={claude:{source:"claude",filesScanned:0,recordsParsed:0,assistantRecords:0,scannedDirs:[]},codex:{source:"codex",filesScanned:0,recordsParsed:0,assistantRecords:0,scannedDirs:[]}};for(let[a,b]of this.dirToProvider)g[b.id].scannedDirs.push(a);for(let a of this.files.values()){for(let[b,f]of(c.push(...a.assistantRecords),d.push(...a.userRecords),a.parentLinks))e[b]=f;f+=a.assistantRecords.length+a.userRecords.length,g[a.source].filesScanned+=1,g[a.source].recordsParsed+=a.assistantRecords.length+a.userRecords.length}let h=(function(a){let b=new Map;for(let c of a){let a=function(a){let b=`${a.source}:`;return a.messageId&&a.requestId?`${b}${a.messageId}::${a.requestId}`:a.messageId?`${b}mid:${a.messageId}`:a.requestId?`${b}req:${a.requestId}`:`${b}uuid:${a.uuid}`}(c),d=b.get(a);if(!d){b.set(a,c);continue}c.timestamp<d.timestamp&&b.set(a,c)}return Array.from(b.values())})(c).sort((a,b)=>a.timestamp.localeCompare(b.timestamp)),i=(function(a){let b=new Set;return a.filter(a=>{let c=a.uuid;return!c||!b.has(c)&&(b.add(c),!0)})})(d).sort((a,b)=>a.timestamp.localeCompare(b.timestamp));for(let a of(!function({assistantRecords:a,userRecords:b,parentMap:c}){let d=new Map;for(let b of a){if(b.isSidechain||!b.sessionId)continue;let a=d.get(b.sessionId);a||(a=[],d.set(b.sessionId,a)),a.push(b)}for(let a of d.values())a.sort((a,b)=>a.timestamp<b.timestamp?-1:+(a.timestamp>b.timestamp));let e=new Map;for(let a of b){if(!a.isSidechain)continue;let b=e.get(a.filePath);(!b||a.timestamp<b.timestamp)&&e.set(a.filePath,a)}let f={subagentFiles:0,relinked:0,orphans:0,alreadyLinked:0};for(let[a,b]of e){let e,g=function(a){let b=n.exec(a);return b?b[1]:null}(a);if(!g)continue;if(f.subagentFiles+=1,null!=c[b.uuid]){f.alreadyLinked+=1;continue}let h=d.get(g);if(!h||0===h.length){f.orphans+=1;continue}let i=b.timestamp;for(let a=h.length-1;a>=0;a-=1)if(h[a].timestamp<=i){e=h[a];break}e||(e=h[0]),c[b.uuid]=e.uuid,f.relinked+=1}}({assistantRecords:h,userRecords:i,parentMap:e}),h))g[a.source].assistantRecords+=1;let j={filesScanned:this.files.size,recordsParsed:f,assistantRecords:h.length,durationMs:Date.now()-b,scannedDirs:this.existingDirs};this.snapshot={records:h,userRecords:i,parentMap:e,stats:j,bySource:Object.values(g)},this.lastWorkStart=null}getSnapshot(){if(!this.snapshot)throw Error("Indexer not initialized — call init() first.");return this.snapshot}async forceRescan(){if(!this.initPromise)return await this.init(),this.snapshot;if(this.rescanPromise)return this.rescanPromise;this.rescanPromise=this.runRescan();try{return await this.rescanPromise}finally{this.rescanPromise=null}}async runRescan(){let a=Date.now();this.isIndexing=!0,this.lastWorkStart=a;try{return this.files.clear(),await this.detectProviderDirs(),await this.fullScan(new Map),this.rebuildSnapshotNow(),this.indexDurationMs=Date.now()-a,this.lastIndexedAt=new Date().toISOString(),this.syncWatchersToDirs(),this.schedulePersist(),this.snapshot}finally{this.isIndexing=!1}}getStatus(){let a=this.snapshot;return{initialized:null!==a,isIndexing:this.isIndexing,lastIndexedAt:this.lastIndexedAt,indexDurationMs:this.indexDurationMs,filesIndexed:this.files.size,recordsIndexed:a?.stats.assistantRecords??0,bySource:a?.bySource??[],watchers:this.watchers.size,errors:this.errors.slice(-20),pendingReconciles:this.fileDebouncers.size,loadedFromDisk:this.loadedFromDisk}}schedulePersist(){this.persistTimer&&clearTimeout(this.persistTimer),this.persistTimer=setTimeout(()=>{this.persistTimer=null;let a=[];for(let[b,c]of this.files)a.push({filePath:b,source:c.source,parserVersion:c.parserVersion,mtimeMs:c.mtimeMs,size:c.size,assistantRecords:c.assistantRecords,userRecords:c.userRecords,parentLinks:c.parentLinks});m({savedAt:new Date().toISOString(),files:a},this.cacheName).catch(a=>this.recordError(`persist: ${a.message}`))},2e3),this.persistTimer.unref?.()}recordError(a){let b=`${new Date().toISOString()} ${function(a){let b=(0,h.homedir)();if(!b)return a;let c=b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return a.replace(RegExp(c,"g"),"~")}(a)}`;this.errors.push(b),this.errors.length>40&&this.errors.splice(0,this.errors.length-20),process.env.CCGAUGE_DEBUG&&console.error(`[ccgauge:indexer] ${new Date().toISOString()} ${a}`)}disposeWatchers(){for(let a of this.watchers.values())try{a.close()}catch{}this.watchers.clear()}dispose(){for(let a of(this.disposeWatchers(),this.pollTimer&&clearInterval(this.pollTimer),this.snapshotRebuildTimer&&clearTimeout(this.snapshotRebuildTimer),this.persistTimer&&clearTimeout(this.persistTimer),this.fileDebouncers.values()))clearTimeout(a);this.fileDebouncers.clear()}}async function p(a){try{return(await e.promises.stat(a)).isDirectory()}catch{return!1}}async function q(a,b){let c=[];async function d(a,f){let h;if(!(f>8)){try{h=await e.promises.readdir(a,{withFileTypes:!0})}catch{return}for(let e of h){let h=g().join(a,e.name);if(e.isDirectory()){if(b.shouldSkipDir(e.name))continue;await d(h,f+1)}else e.isFile()&&e.name.endsWith(".jsonl")&&c.push(h)}}}return await d(a,0),c}let r=function(a=j){let b=(globalThis.__ccgaugeIndexers||(globalThis.__ccgaugeIndexers=new Map),globalThis.__ccgaugeIndexers),c=b.get(a);return c||(c=new o(a),b.set(a,c)),c}();async function s(a={}){return a.force?r.forceRescan():(await r.init(),r.getSnapshot())}function t(){return(0,d.R0)().map(a=>({source:a.id,dirs:a.getDirs()}))}function u(){return r.getStatus()}}};
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "version": 1,
3
3
  "functions": {
4
+ "/api/pricing": {},
4
5
  "/api/projects": {},
5
6
  "/api/blocks": {},
6
- "/api/pricing": {},
7
7
  "/api/scan": {},
8
8
  "/api/sessions": {},
9
9
  "/api/usage": {},
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-3fcacae817f3ffab.js" defer=""></script><script src="/_next/static/chunks/framework-1a308e28e19f1a97.js" defer=""></script><script src="/_next/static/chunks/main-69f0897f4e7ce710.js" defer=""></script><script src="/_next/static/chunks/pages/_app-5addca2b3b969fde.js" defer=""></script><script src="/_next/static/chunks/pages/_error-022e4ac7bbb9914f.js" defer=""></script><script src="/_next/static/2kImy5ZkabMplKu3i19s7/_buildManifest.js" defer=""></script><script src="/_next/static/2kImy5ZkabMplKu3i19s7/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"2kImy5ZkabMplKu3i19s7","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-3fcacae817f3ffab.js" defer=""></script><script src="/_next/static/chunks/framework-1a308e28e19f1a97.js" defer=""></script><script src="/_next/static/chunks/main-69f0897f4e7ce710.js" defer=""></script><script src="/_next/static/chunks/pages/_app-5addca2b3b969fde.js" defer=""></script><script src="/_next/static/chunks/pages/_error-022e4ac7bbb9914f.js" defer=""></script><script src="/_next/static/alqi5oQtTQUdpxp2x0yAt/_buildManifest.js" defer=""></script><script src="/_next/static/alqi5oQtTQUdpxp2x0yAt/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"alqi5oQtTQUdpxp2x0yAt","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[148],{51148:(e,t,s)=>{s.d(t,{CY:()=>d,s9:()=>u,kj:()=>m});var o=s(95155),i=s(12115),a=s(20063),n=s(79808);let c="ccgauge_locale",r=(0,i.createContext)({locale:n.Xn,setLocale:()=>{},t:e=>e}),l="ccgauge.locale";function d(e){let{initialLocale:t,children:s}=e,d=(0,a.useRouter)();(0,i.useEffect)(()=>{try{let e=localStorage.getItem(l);e&&e!==t&&("en"===e||"zh"===e)&&(document.cookie="".concat(c,"=").concat(e,"; path=/; max-age=").concat(31536e3,"; SameSite=Lax"),d.refresh())}catch(e){}},[]);let u=(0,i.useCallback)(e=>{try{localStorage.setItem(l,e)}catch(e){}document.cookie="".concat(c,"=").concat(e,"; path=/; max-age=").concat(31536e3,"; SameSite=Lax"),d.refresh()},[d]),m=(0,i.useCallback)((e,s)=>(0,n.nA)(t,e,s),[t]),g=(0,i.useMemo)(()=>({locale:t,setLocale:u,t:m}),[t,u,m]);return(0,o.jsx)(r.Provider,{value:g,children:s})}function u(){return(0,i.useContext)(r)}function m(){return(0,i.useContext)(r).t}},79808:(e,t,s)=>{s.d(t,{Xn:()=>o,nA:()=>a});let o="en",i={en:{"brand.tagline":"usage dashboard for AI coding CLIs","nav.overview":"Overview","nav.usage":"Usage","nav.sessions":"Sessions","nav.projects":"Projects","nav.models":"Models","nav.settings":"Settings","nav.localBadge":"local","nav.source":"Data source","source.claude":"Claude","source.codex":"Codex","source.all":"All","cost.footnote.codex":"Cost shown is the OpenAI API equivalent (subscription plans pay differently).","common.requests":"requests","common.tokens":"tokens","common.cost":"Cost","common.savedViaCache":"Saved {amount} via cache","common.savedTodayViaCache":"Saved {amount} today","common.live":"live","common.allModels":"All","common.allProjects":"All","common.unknown":"(unknown)","common.session":"Session","common.sessions":"sessions","common.projects":"projects","common.req":"req","common.day":"day","common.days":"days","common.activity":"activity","common.fallbackPrice":"fallback price","common.thinking":"thinking","common.lastActivity":"last activity","common.empty.title":"No usage data yet","common.empty.desc":"Open Claude Code, send a message, then refresh.","common.refresh":"Refresh","common.search":"Search…","common.searchPlaceholder":"Search model, project, session, tool…","common.exportCsv":"Export CSV","common.rows":"{count} rows","common.prev":"‹ Prev","common.next":"Next ›","common.first":"\xab","common.last":"\xbb","common.pageOf":"Page {page} of {total}","common.allSessions":"← All sessions","common.allProjectsLink":"← All projects","common.noMatchingRows":"No matching rows","range.label":"Date range","range.today":"Today","range.7d":"7d","range.30d":"30d","range.90d":"90d","range.all":"All","gran.label":"Granularity","gran.hour":"Hour","gran.day":"Day","gran.week":"Week","gran.month":"Month","overview.title":"Overview","overview.subtitle":"{count} requests across {files} files \xb7 scan in {ms}ms","overview.subtitle.empty":"Scanned {dirs} directory(ies). Open Claude Code, send a message, then refresh.","overview.empty.title":"No usage data yet","overview.kpi.tokensToday":"Tokens today","overview.kpi.costToday":"Cost today","overview.kpi.thisMonth":"This month","overview.kpi.cacheHit":"Cache hit rate","overview.kpi.topModel":"Top model","overview.kpi.activeSessions":"Sessions today","overview.kpi.activeSessions.hint":"{count} project(s)","overview.kpi.thisMonth.hint":"{tokens} tokens \xb7 {req} req","overview.kpi.tokensToday.hint":"{count} requests","overview.kpi.topModel.hint":"{pct} of cost this month","overview.kpi.cacheHit.hint":"Saved {amount} today","overview.delta.title":"vs yesterday","overview.delta.firstTime":"NEW","common.loading":"Loading…","common.error.title":"Something went wrong","common.error.desc":"Failed to load this page. Try again.","common.error.retry":"Retry","overview.trend.title":"Usage trend","overview.trend.desc":"Last 30 days \xb7 {metric}","overview.trend.desc.tokens":"stacked by token type","overview.trend.desc.conversations":"conversations per day","overview.trend.metric.tokens":"Tokens","overview.trend.metric.conversations":"Conversations","overview.trend.activeDays":"{n} day with activity","overview.trend.activeDays.plural":"{n} days with activity","overview.costByModel.title":"Cost by model","overview.costByModel.desc":"This month, sorted by spend","activity.title":"Activity","activity.subtitle":"Lifetime stats and when you usually code","activity.sessions":"Sessions","activity.messages":"Messages","activity.totalTokens":"Total tokens","activity.activeDays":"Active days","activity.currentStreak":"Current streak","activity.longestStreak":"Longest streak","activity.streakCombinedLabel":"Streak (cur / max)","activity.streakCombinedValue":"{current} / {longest} d","activity.peakHour":"Peak hour","activity.favoriteModel":"Favorite model","activity.streakValue":"{n}d","activity.dow.0":"Sun","activity.dow.1":"Mon","activity.dow.2":"Tue","activity.dow.3":"Wed","activity.dow.4":"Thu","activity.dow.5":"Fri","activity.dow.6":"Sat","activity.heatmap.tooltip":"{dow} \xb7 {hour} \xb7 {count} messages","activity.heatmap.messages":"Messages","activity.heatmap.tokens":"Tokens","activity.heatmap.shareLabel":"Share","activity.heatmap.intensityLabel":"Of peak","activity.heatmap.empty":"No activity","activity.comparison":"You've used ~{multiplier}\xd7 more tokens than {ref}.","activity.ref.haiku":"a haiku","activity.ref.tweet":"a tweet","activity.ref.littlePrince":"The Little Prince","activity.ref.gatsby":"The Great Gatsby","activity.ref.hobbit":"The Hobbit","activity.ref.lotrTrilogy":"the Lord of the Rings trilogy","activity.ref.warAndPeace":"War and Peace","activity.ref.harryPotterAll":"all 7 Harry Potter books","activity.ref.encyclopediaBritannica":"the Encyclopedia Britannica","activity.ref.wikipediaEn":"all of English Wikipedia","block.title":"Active 5h block","block.remaining":"remaining","block.elapsed":"Time elapsed {pct}%","block.tokensSuffix":"tokens","block.spentSoFar":"Spent so far","block.burnPerMin":"Burn / min","block.projectedTotal":"Projected total","block.requests":"Requests","block.empty":"No active block","block.emptyDesc":"Send a message in Claude Code to start one.","block.disclaimer":"Wall-clock progress of the 5h window — not your plan quota.","chart.legend.input":"Input","chart.legend.output":"Output","chart.legend.cacheRead":"Cache read","chart.legend.cacheWrite":"Cache write","chart.tooltip.total":"Total","chart.tooltip.cost":"Cost","chart.tooltip.requests":"Requests","chart.tooltip.conversations":"Conversations","chart.empty":"No data in this range","chart.empty.short":"No data","usage.title":"Usage","usage.subtitle":"{count} turns in selected range","usage.col.calls":"Calls","usage.col.userMessage":"Prompt","usage.overview.label":"Overview","usage.overview.show":"Show overview (KPIs + trend)","usage.overview.hide":"Hide overview (KPIs + trend)","usage.turn.expand":"Expand","usage.turn.collapse":"Collapse","usage.turn.callsCount":"{count} calls","usage.turn.noPrompt":"(no user text)","usage.requests.desc":"One row per turn (user message + tool calls); click ▸ to expand","usage.kpi.totalTokens":"Total tokens","usage.kpi.totalCost":"Total cost","usage.kpi.cacheSaved":"Cache saved","usage.kpi.cacheHit":"Cache hit","usage.trend":"Trend","usage.trend.gran":"Granularity: {gran}","usage.requests.title":"Requests","usage.col.time":"Time","usage.col.duration":"Duration","usage.col.model":"Model","usage.col.project":"Project","usage.col.session":"Session","usage.col.input":"Input","usage.col.output":"Output","usage.col.cacheRead":"Cache R","usage.col.cacheWrite":"Cache W","usage.col.cost":"Cost","usage.col.tools":"Tools","usage.col.total":"Total","usage.columns.button":"Columns","usage.columns.title":"Visible columns","usage.columns.reset":"Reset","usage.breakdown.title":"Token breakdown","usage.breakdown.headerTokens":"Tokens","usage.breakdown.headerCost":"Cost","usage.breakdown.total":"Total","usage.breakdown.reasoning":"reasoning","usage.breakdown.reasoningNote":"incl. above","filter.modelLabel":"Model","filter.projectLabel":"Project","filter.modelAll":"Model: All","filter.projectAll":"Project: All","filter.modelSingle":"Model: {value}","filter.projectSingle":"Project: {value}","filter.modelMulti":"Model: {count}","filter.projectMulti":"Project: {count}","filter.clearAll":"Clear all","filter.noOptions":"No options","sessions.title":"Sessions","sessions.subtitle":"{count} sessions \xb7 sorted by most recent activity","sessions.col.session":"Session","sessions.col.project":"Project","sessions.col.models":"Model(s)","sessions.col.requests":"Requests","sessions.col.tokens":"Tokens","sessions.col.cost":"Cost","sessions.col.duration":"Duration","sessions.col.lastActivity":"Last activity","sessions.untitled":"Session {hash}","sessions.empty":"No sessions yet","session.kpi.requests":"Requests","session.kpi.totalTokens":"Total tokens","session.kpi.cost":"Cost","session.kpi.duration":"Duration","session.timeline.title":"Message timeline","session.timeline.desc":"In order; newest at the bottom","session.perMessage.title":"Per-message tokens","session.modelsInSession":"Models in this session","session.modelLine":"{requests} req \xb7 {tokens} tokens","session.token.in":"in","session.token.out":"out","session.token.cacheR":"cache r","session.token.cacheW":"cache w","projects.title":"Projects","projects.subtitle":"{count} projects \xb7 sorted by spend","projects.empty":"No projects yet","projects.stat.sessions":"Sessions","projects.stat.requests":"Requests","projects.stat.tokens":"Tokens","project.activity":"Activity (last 30 days)","project.sessions.title":"Sessions ({count})","models.title":"Models","models.subtitle":"{count} model(s) used in total","models.empty":"No model usage yet","models.share.cost":"Cost share","models.share.tokens":"Tokens share","models.share.cacheHit":"Cache hit","models.field.requests":"Requests","models.field.savedByCache":"Saved by cache","models.field.input1M":"Input / 1M","models.field.output1M":"Output / 1M","models.field.cacheRead1M":"Cache read / 1M","models.field.pctOfTotal":"{pct} of total spend \xb7 {tokens} tokens","models.eachTrend":"Combined trend (last 30 days)","settings.title":"Settings","settings.subtitle":"Data sources, pricing, and behavior","settings.dataSources.title":"Data sources","settings.dataSources.desc":"ccgauge scans these locations for JSONL files","settings.dataSources.active":"active","settings.dataSources.notPresent":"not present","settings.dataSources.envHint":"Override with {env1} or {env2} environment variables (the dashboard appends {appendix}).","settings.rescan":"Rescan now","settings.rescanning":"Rescanning…","settings.scanStats.title":"Scan stats","settings.scanStats.files":"Files scanned","settings.scanStats.records":"Records parsed","settings.scanStats.assistant":"Assistant records (deduped)","settings.scanStats.duration":"Scan duration","settings.pricing.title":"Pricing table","settings.pricing.desc":"USD per 1M tokens \xb7 built-in snapshot, fuzzy match for date-suffixed model names","settings.pricing.col.model":"Model","settings.pricing.col.input":"Input","settings.pricing.col.output":"Output","settings.pricing.col.write5m":"Cache write 5m","settings.pricing.col.write1h":"Cache write 1h","settings.pricing.col.read":"Cache read","settings.preferences.title":"Preferences","settings.preferences.language":"Language","settings.preferences.theme":"Theme","settings.theme.light":"Light","settings.theme.dark":"Dark","settings.theme.system":"System","settings.about.title":"About","settings.about.subtitle":"Version {version} \xb7 MIT licensed","settings.about.line1":"Fully local: data never leaves your machine; no telemetry, no network calls.","settings.about.line2":"Read-only: ccgauge only reads JSONL files, never writes back to ~/.claude.","settings.about.line3":'Cache: scan results are memoized for 5s; click "Rescan" to force a fresh read.',"settings.about.line4":"Stop with Ctrl+C in the terminal that started ccgauge.","settings.indexer.desc":"Background indexer keeps the cache fresh via file watchers.","settings.indexer.lastIndexedAt":"Last indexed","settings.indexer.indexDuration":"Last index time","settings.indexer.watchers":"Active watchers","settings.indexer.loadedFromDisk":"Loaded from disk","settings.indexer.status":"Status","settings.indexer.indexing":"indexing…","settings.indexer.idle":"idle","settings.indexer.recentErrors":"Recent indexer errors","common.yes":"yes","common.no":"no","lang.label":"Language","lang.en":"English","lang.zh":"中文","theme.label":"Theme"},zh:{"brand.tagline":"AI 编程 CLI 的本地用量看板","nav.overview":"概览","nav.usage":"用量","nav.sessions":"会话","nav.projects":"项目","nav.models":"模型","nav.settings":"设置","nav.localBadge":"本地","nav.source":"数据源","source.claude":"Claude","source.codex":"Codex","source.all":"全部","cost.footnote.codex":"按 OpenAI API 单价折算估值(订阅计划实际计费不同)","common.requests":"次请求","common.tokens":"tokens","common.cost":"花费","common.savedViaCache":"通过缓存节省 {amount}","common.savedTodayViaCache":"今日缓存节省 {amount}","common.live":"进行中","common.allModels":"全部","common.allProjects":"全部","common.unknown":"(未知)","common.session":"会话","common.sessions":"个会话","common.projects":"个项目","common.req":"请求","common.day":"天","common.days":"天","common.activity":"活跃","common.fallbackPrice":"使用兜底单价","common.thinking":"思考","common.lastActivity":"最近活跃","common.empty.title":"暂无用量数据","common.empty.desc":"打开 Claude Code 发送一条消息后刷新本页。","common.refresh":"刷新","common.search":"搜索…","common.searchPlaceholder":"搜索模型 / 项目 / 会话 / 工具…","common.exportCsv":"导出 CSV","common.rows":"{count} 行","common.prev":"‹ 上一页","common.next":"下一页 ›","common.first":"\xab","common.last":"\xbb","common.pageOf":"第 {page} / {total} 页","common.allSessions":"← 返回会话列表","common.allProjectsLink":"← 返回项目列表","common.noMatchingRows":"没有匹配的记录","range.label":"时间范围","range.today":"今天","range.7d":"7 天","range.30d":"30 天","range.90d":"90 天","range.all":"全部","gran.label":"粒度","gran.hour":"小时","gran.day":"天","gran.week":"周","gran.month":"月","overview.title":"概览","overview.subtitle":"{count} 次请求,覆盖 {files} 个文件 \xb7 扫描耗时 {ms}ms","overview.subtitle.empty":"已扫描 {dirs} 个目录。打开 Claude Code 发一条消息后刷新本页。","overview.empty.title":"暂无用量数据","overview.kpi.tokensToday":"今日 tokens","overview.kpi.costToday":"今日花费","overview.kpi.thisMonth":"本月累计","overview.kpi.cacheHit":"缓存命中率","overview.kpi.topModel":"主力模型","overview.kpi.activeSessions":"今日会话","overview.kpi.activeSessions.hint":"涉及 {count} 个项目","overview.kpi.thisMonth.hint":"{tokens} tokens \xb7 {req} 次请求","overview.kpi.tokensToday.hint":"{count} 次请求","overview.kpi.topModel.hint":"本月成本占比 {pct}","overview.kpi.cacheHit.hint":"今日缓存节省 {amount}","overview.delta.title":"相比昨日","overview.delta.firstTime":"首次","common.loading":"加载中…","common.error.title":"出错了","common.error.desc":"加载失败,请重试。","common.error.retry":"重试","overview.trend.title":"用量趋势","overview.trend.desc":"近 30 天 \xb7 {metric}","overview.trend.desc.tokens":"按 token 类型堆叠","overview.trend.desc.conversations":"每日对话次数","overview.trend.metric.tokens":"Token","overview.trend.metric.conversations":"对话次数","overview.trend.activeDays":"{n} 天有数据","overview.trend.activeDays.plural":"{n} 天有数据","overview.costByModel.title":"按模型成本分布","overview.costByModel.desc":"本月,按花费排序","activity.title":"活动统计","activity.subtitle":"总览数据 + 每天什么时段最忙","activity.sessions":"会话","activity.messages":"消息","activity.totalTokens":"总 tokens","activity.activeDays":"活跃天数","activity.currentStreak":"当前连续","activity.longestStreak":"最长连续","activity.streakCombinedLabel":"当前 / 最长连续","activity.streakCombinedValue":"{current} / {longest} 天","activity.peakHour":"高峰小时","activity.favoriteModel":"最常用模型","activity.streakValue":"{n} 天","activity.dow.0":"周日","activity.dow.1":"周一","activity.dow.2":"周二","activity.dow.3":"周三","activity.dow.4":"周四","activity.dow.5":"周五","activity.dow.6":"周六","activity.heatmap.tooltip":"周{dow} \xb7 {hour} \xb7 {count} 条消息","activity.heatmap.messages":"消息数","activity.heatmap.tokens":"Tokens","activity.heatmap.shareLabel":"占总数","activity.heatmap.intensityLabel":"占峰值","activity.heatmap.empty":"无活动","activity.comparison":"你用掉的 token 大约是 {ref} 的 {multiplier}\xd7。","activity.ref.haiku":"一首俳句","activity.ref.tweet":"一条推文","activity.ref.littlePrince":"《小王子》","activity.ref.gatsby":"《了不起的盖茨比》","activity.ref.hobbit":"《霍比特人》","activity.ref.lotrTrilogy":"《魔戒》三部曲","activity.ref.warAndPeace":"《战争与和平》","activity.ref.harryPotterAll":"《哈利\xb7波特》全 7 册","activity.ref.encyclopediaBritannica":"《大英百科全书》","activity.ref.wikipediaEn":"英文维基百科全部","block.title":"当前 5h block","block.remaining":"剩余","block.elapsed":"时间进度 {pct}%","block.tokensSuffix":"tokens","block.spentSoFar":"已花费","block.burnPerMin":"每分钟消耗","block.projectedTotal":"预计总花费","block.requests":"请求数","block.empty":"当前无活跃 block","block.emptyDesc":"在 Claude Code 中发送消息会启动一个新 block。","block.disclaimer":"仅是 5h 窗口的钟表进度,不是你的套餐配额。","chart.legend.input":"输入","chart.legend.output":"输出","chart.legend.cacheRead":"缓存读取","chart.legend.cacheWrite":"缓存写入","chart.tooltip.total":"合计","chart.tooltip.cost":"花费","chart.tooltip.requests":"请求数","chart.tooltip.conversations":"对话次数","chart.empty":"区间内无数据","chart.empty.short":"暂无数据","usage.title":"用量明细","usage.subtitle":"当前筛选范围内 {count} 轮对话","usage.kpi.totalTokens":"总 tokens","usage.kpi.totalCost":"总花费","usage.kpi.cacheSaved":"缓存节省","usage.kpi.cacheHit":"缓存命中","usage.trend":"趋势","usage.trend.gran":"粒度:{gran}","usage.requests.title":"对话轮次","usage.requests.desc":"每轮对话一行(用户消息 + 工具调用),点击 ▸ 展开明细","usage.col.calls":"调用","usage.col.userMessage":"提示","usage.overview.label":"概览","usage.overview.show":"显示概览(KPI + 趋势)","usage.overview.hide":"隐藏概览(KPI + 趋势)","usage.turn.expand":"展开","usage.turn.collapse":"收起","usage.turn.callsCount":"{count} 次调用","usage.turn.noPrompt":"(无用户文本)","usage.col.time":"时间","usage.col.duration":"耗时","usage.col.model":"模型","usage.col.project":"项目","usage.col.session":"会话","usage.col.input":"输入","usage.col.output":"输出","usage.col.cacheRead":"缓存读","usage.col.cacheWrite":"缓存写","usage.col.cost":"花费","usage.col.tools":"工具","usage.col.total":"总量","usage.columns.button":"列","usage.columns.title":"显示列","usage.columns.reset":"重置","usage.breakdown.title":"总量明细","usage.breakdown.headerTokens":"Token","usage.breakdown.headerCost":"花费","usage.breakdown.total":"合计","usage.breakdown.reasoning":"其中推理","usage.breakdown.reasoningNote":"已含在 output","filter.modelLabel":"模型","filter.projectLabel":"项目","filter.modelAll":"模型:全部","filter.projectAll":"项目:全部","filter.modelSingle":"模型:{value}","filter.projectSingle":"项目:{value}","filter.modelMulti":"模型:{count} 个","filter.projectMulti":"项目:{count} 个","filter.clearAll":"清除筛选","filter.noOptions":"没有可选项","sessions.title":"会话","sessions.subtitle":"共 {count} 个会话 \xb7 按最近活跃排序","sessions.col.session":"会话","sessions.col.project":"项目","sessions.col.models":"模型","sessions.col.requests":"请求数","sessions.col.tokens":"Tokens","sessions.col.cost":"花费","sessions.col.duration":"时长","sessions.col.lastActivity":"最近活跃","sessions.untitled":"会话 {hash}","sessions.empty":"暂无会话","session.kpi.requests":"请求数","session.kpi.totalTokens":"总 tokens","session.kpi.cost":"花费","session.kpi.duration":"时长","session.timeline.title":"消息时间线","session.timeline.desc":"按时间正序,最新的在最下方","session.perMessage.title":"逐条消息 tokens","session.modelsInSession":"本会话使用的模型","session.modelLine":"{requests} 次 \xb7 {tokens} tokens","session.token.in":"输入","session.token.out":"输出","session.token.cacheR":"缓存读","session.token.cacheW":"缓存写","projects.title":"项目","projects.subtitle":"共 {count} 个项目 \xb7 按花费排序","projects.empty":"暂无项目","projects.stat.sessions":"会话","projects.stat.requests":"请求","projects.stat.tokens":"Tokens","project.activity":"活跃情况(近 30 天)","project.sessions.title":"会话({count})","models.title":"模型","models.subtitle":"共使用过 {count} 个模型","models.empty":"暂无模型用量","models.share.cost":"成本占比","models.share.tokens":"Tokens 占比","models.share.cacheHit":"缓存命中","models.field.requests":"请求数","models.field.savedByCache":"缓存节省","models.field.input1M":"输入 / 1M","models.field.output1M":"输出 / 1M","models.field.cacheRead1M":"缓存读 / 1M","models.field.pctOfTotal":"占总花费 {pct} \xb7 {tokens} tokens","models.eachTrend":"整体趋势(近 30 天)","settings.title":"设置","settings.subtitle":"数据源、价格表与行为偏好","settings.dataSources.title":"数据源","settings.dataSources.desc":"ccgauge 会扫描以下路径的 JSONL 文件","settings.dataSources.active":"已启用","settings.dataSources.notPresent":"不存在","settings.dataSources.envHint":"可以通过环境变量 {env1} 或 {env2} 自定义路径(看板会自动追加 {appendix})。","settings.rescan":"立即重新扫描","settings.rescanning":"扫描中…","settings.scanStats.title":"扫描统计","settings.scanStats.files":"扫描文件数","settings.scanStats.records":"解析记录数","settings.scanStats.assistant":"去重后 assistant 记录","settings.scanStats.duration":"扫描耗时","settings.pricing.title":"价格表","settings.pricing.desc":"美元 / 1M tokens \xb7 内置快照,对带日期后缀的模型名做 fuzzy 匹配","settings.pricing.col.model":"模型","settings.pricing.col.input":"输入","settings.pricing.col.output":"输出","settings.pricing.col.write5m":"缓存写入 5 分钟","settings.pricing.col.write1h":"缓存写入 1 小时","settings.pricing.col.read":"缓存读取","settings.preferences.title":"偏好设置","settings.preferences.language":"语言","settings.preferences.theme":"主题","settings.theme.light":"亮色","settings.theme.dark":"暗色","settings.theme.system":"跟随系统","settings.about.title":"关于","settings.about.subtitle":"版本 {version} \xb7 MIT 协议","settings.about.line1":"完全本地:数据从不离开你的机器,没有任何遥测、没有任何网络调用。","settings.about.line2":"只读:ccgauge 只读取 JSONL,绝不会写回 ~/.claude。","settings.about.line3":'缓存:扫描结果会缓存 5 秒;点击"重新扫描"可强制刷新。',"settings.about.line4":"在启动 ccgauge 的终端按 Ctrl+C 即可停止。","settings.indexer.desc":"后台 indexer 通过文件监听增量维护缓存。","settings.indexer.lastIndexedAt":"最近索引时间","settings.indexer.indexDuration":"最近索引耗时","settings.indexer.watchers":"活跃 watcher 数","settings.indexer.loadedFromDisk":"从磁盘恢复","settings.indexer.status":"状态","settings.indexer.indexing":"索引中…","settings.indexer.idle":"空闲","settings.indexer.recentErrors":"最近的索引错误","common.yes":"是","common.no":"否","lang.label":"语言","lang.en":"English","lang.zh":"中文","theme.label":"主题"}};function a(e,t,s){var o;let a=null==(o=i[e])?void 0:o[t];if(void 0===a&&(a=i.en[t]),void 0===a&&(a=t),s)for(let[e,t]of Object.entries(s))a=a.replace(RegExp("\\{".concat(e,"\\}"),"g"),String(t));return a}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{12112:(e,t,r)=>{"use strict";r.d(t,{Providers:()=>s});var n=r(95155),a=r(51148),i=r(84479);function s(e){let{locale:t,theme:r,children:s}=e;return(0,n.jsx)(a.CY,{initialLocale:t,children:(0,n.jsx)(i.N,{initialTheme:r,children:s})})}},21264:(e,t,r)=>{"use strict";r.d(t,{LanguageSwitcher:()=>c});var n=r(95155),a=r(51148);let i={en:"EN",zh:"中"},s={en:"zh",zh:"en"},o={en:"English",zh:"中文"};function c(){let{locale:e,setLocale:t,t:r}=(0,a.s9)(),c=s[e];return(0,n.jsx)("button",{onClick:()=>t(c),className:"h-7 w-9 inline-flex items-center justify-center rounded-md border border-border bg-bg-surface text-xs font-medium text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi hover:border-border-hi transition-colors",title:"".concat(r("lang.label"),": ").concat(o[e]," → ").concat(o[c]),"aria-label":r("lang.label"),children:i[e]})}},25016:(e,t,r)=>{"use strict";r.d(t,{BC:()=>g,P6:()=>f,PJ:()=>m,R8:()=>d,a3:()=>h,az:()=>c,cn:()=>i,jh:()=>o,l7:()=>l,r6:()=>u});var n=r(2821),a=r(75889);function i(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.QP)((0,n.$)(t))}function s(e,t){var r;return new Intl.NumberFormat("en-US",{maximumFractionDigits:null!=(r=null==t?void 0:t.maxFrac)?r:0}).format(e)}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return Number.isFinite(e)?"zh"===t?e>=1e8?(e/1e8).toFixed(2)+"亿":e>=1e4?(e/1e4).toFixed(1)+"万":s(e):e>=1e9?(e/1e9).toFixed(2)+"B":e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":s(e):"0"}function c(e,t){var r,n;return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:null!=(r=null==t?void 0:t.minFrac)?r:2,maximumFractionDigits:null!=(n=null==t?void 0:t.maxFrac)?n:2}).format(e)}function l(e){return 0===e?"$0":e<.01?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(e):c(e)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isFinite(e)?"".concat((100*e).toFixed(t),"%"):"0%"}function h(e){if(e<1e3)return"".concat(e,"ms");let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let r=Math.floor(t/60);if(r<60){let e=t%60;return e?"".concat(r,"m ").concat(e,"s"):"".concat(r,"m")}let n=Math.floor(r/60),a=r%60;return a?"".concat(n,"h ").concat(a,"m"):"".concat(n,"h")}function u(e){let t="string"==typeof e||"number"==typeof e?new Date(e):e;if(Number.isNaN(t.getTime()))return"";let r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0");return"".concat(r,"-").concat(n,"-").concat(a," ").concat(i,":").concat(s,":").concat(o)}function m(e){if(!e)return"(unknown)";let t=e.replace(/[/\\]+$/,"").split(/[/\\]+/);return t[t.length-1]||e}function g(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.replace(/-/g,"").slice(0,t):""}let x={mini:"Mini",nano:"Nano",pro:"Pro",turbo:"Turbo",preview:"Preview"};function f(e){if(!e)return"(unknown)";let t=e.replace(/^(vertex_ai|bedrock|anthropic|openai)\//,""),r=t.toLowerCase();if(r.startsWith("gpt-")||/^o\d/.test(r))return r.startsWith("gpt-")?"GPT-"+t.slice(4).split("-").map(e=>{var t;return null!=(t=x[e.toLowerCase()])?t:e}).join(" "):t.toUpperCase();let n=t.replace(/-(\d{8})$/,""),a=(n=n.replace(/^claude-/,"")).split("-");if(a.length>=2){let e=a[0],t=a.slice(1).join(".");return p(e)+" "+t}return p(n.replace(/-/g," "))}function p(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}},41290:()=>{},44703:(e,t,r)=>{"use strict";r.d(t,{ThemeSwitcher:()=>o});var n=r(95155),a=r(84479),i=r(51148);let s={light:"dark",dark:"system",system:"light"};function o(){let{theme:e,resolved:t,setTheme:r}=(0,a.D)(),{t:o}=(0,i.s9)(),l=s[e];return(0,n.jsx)("button",{onClick:()=>r(l),className:"h-7 w-9 inline-flex items-center justify-center rounded-md border border-border bg-bg-surface text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi hover:border-border-hi transition-colors",title:"".concat(o("theme.label"),": ").concat(o("settings.theme.".concat(e))," (").concat(t,") → ").concat(o("settings.theme.".concat(l))),"aria-label":o("theme.label"),children:(0,n.jsx)(c,{theme:e})})}function c(e){let{theme:t}=e;return"light"===t?(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,n.jsx)("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):"dark"===t?(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:(0,n.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,n.jsx)("path",{d:"M12 3v18"}),(0,n.jsx)("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]})}},57581:(e,t,r)=>{"use strict";r.d(t,{Nav:()=>p});var n=r(95155),a=r(52619),i=r.n(a),s=r(20063),o=r(25016),c=r(51148),l=r(21264),d=r(44703);function h(e){let{className:t,withBackground:r=!0}=e;return(0,n.jsxs)("svg",{viewBox:"0 0 64 64",fill:"none","aria-hidden":!0,className:(0,o.cn)("block",t),children:[r&&(0,n.jsx)("rect",{width:"64",height:"64",rx:"14",className:"fill-brand"}),(0,n.jsx)("path",{d:"M14 41 A18 18 0 0 1 50 41",stroke:"currentColor",strokeOpacity:r?.32:.25,strokeWidth:"4.5",strokeLinecap:"round",className:r?"text-white":""}),(0,n.jsx)("path",{d:"M14 41 A18 18 0 0 1 43.2 25.4",stroke:"currentColor",strokeWidth:"4.5",strokeLinecap:"round",className:r?"text-white":"text-brand"}),(0,n.jsx)("line",{x1:"32",y1:"41",x2:"42",y2:"27",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",className:r?"text-white":"text-brand"}),(0,n.jsx)("circle",{cx:"32",cy:"41",r:"3",className:r?"fill-white":"fill-brand"})]})}var u=r(12115);function m(e){let{available:t,initial:r,providers:a}=e,i=(0,s.useRouter)(),o=(0,s.usePathname)(),l=(0,s.useSearchParams)(),d=(0,c.kj)(),{locale:h}=(0,c.s9)(),[m,f]=(0,u.useTransition)(),p=l.get("source"),b=p&&("all"===p?t.length>=2:t.includes(p))?p:null,[v,k]=(0,u.useState)(null!=b?b:r);if((0,u.useEffect)(()=>{b&&b!==v&&k(b)},[b,v]),t.length<2)return null;let j=e=>{var t;if(e===v)return;k(e),t=e,"undefined"!=typeof document&&(document.cookie="".concat("ccgauge_source","=").concat(encodeURIComponent(t),"; path=/; max-age=").concat(31536e3,"; SameSite=Lax"));let r=new URLSearchParams(l.toString());r.set("source",e);let n=/^\/sessions\/[^/]+|^\/projects\/[^/]+/.test(o)?"/".concat(o.split("/")[1],"?").concat(r.toString()):"".concat(o,"?").concat(r.toString());f(()=>{i.push(n)})},w=a.filter(e=>t.includes(e.id));return(0,n.jsxs)("div",{role:"group","aria-label":d("nav.source"),className:"inline-flex items-center rounded-md border border-border bg-bg-surface p-0.5 gap-0.5",title:d("nav.source"),children:[(0,n.jsx)(x,{active:"all"===v,label:d("source.all"),onSelect:()=>j("all"),disabled:m,providers:w}),w.map(e=>{let t=e.id===v,r="zh"===h?e.displayZh:e.displayEn;return(0,n.jsxs)("button",{type:"button",onClick:()=>j(e.id),"aria-pressed":t,disabled:m,className:"px-2.5 h-6 text-xs inline-flex items-center gap-1.5 rounded transition-all ".concat(t?"bg-brand-strong text-white font-semibold shadow-sm ring-1 ring-brand/40":"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:[(0,n.jsx)(g,{provider:e,active:t}),(0,n.jsx)("span",{children:r})]},e.id)})]})}function g(e){let{provider:t,active:r}=e;return t.logoSrc?(0,n.jsx)("img",{src:t.logoSrc,alt:"","aria-hidden":!0,className:"w-4 h-4 rounded-[3px] object-contain shrink-0 ".concat(r?"ring-1 ring-white/40":"")}):(0,n.jsx)("span",{className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-full text-[9px] font-bold leading-none ".concat(r?"ring-1 ring-white/40":""),style:{background:t.bg,color:t.fg},children:t.shortLabel})}function x(e){let{active:t,label:r,onSelect:a,disabled:i,providers:s}=e;return(0,n.jsxs)("button",{type:"button",onClick:a,"aria-pressed":t,disabled:i,className:"px-2.5 h-6 text-xs inline-flex items-center gap-1.5 rounded transition-all ".concat(t?"bg-brand-strong text-white font-semibold shadow-sm ring-1 ring-brand/40":"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:[(0,n.jsx)("span",{className:"relative inline-flex items-center w-[26px] h-4 shrink-0","aria-hidden":!0,children:s.slice(0,2).map((e,r)=>{let a=10*(0!==r);return e.logoSrc?(0,n.jsx)("img",{src:e.logoSrc,alt:"",className:"absolute w-4 h-4 rounded-[3px] object-contain ring-1 ".concat(t?"ring-white/40":"ring-bg-surface"),style:{left:a,zIndex:s.length-r}},e.id):(0,n.jsx)("span",{className:"absolute inline-flex items-center justify-center w-3.5 h-3.5 rounded-full text-[9px] font-bold leading-none ring-1 ".concat(t?"ring-white/40":"ring-bg-surface"),style:{background:e.bg,color:e.fg,left:a,zIndex:s.length-r},children:e.shortLabel},e.id)})}),(0,n.jsx)("span",{children:r})]})}let f=[{href:"/",tk:"nav.overview",exact:!0},{href:"/usage",tk:"nav.usage"},{href:"/sessions",tk:"nav.sessions"},{href:"/projects",tk:"nav.projects"},{href:"/models",tk:"nav.models"},{href:"/settings",tk:"nav.settings"}];function p(e){let{availableProviders:t,initialSource:r,providerInfos:a}=e,u=(0,s.usePathname)(),g=(0,c.kj)();return(0,n.jsx)("header",{className:"sticky top-0 z-30 border-b border-border bg-bg-base/85 backdrop-blur-md supports-[backdrop-filter]:bg-bg-base/70",children:(0,n.jsxs)("div",{className:"max-w-7xl mx-auto px-3 sm:px-6 h-14 flex items-center gap-2 sm:gap-4",children:[(0,n.jsxs)(i(),{href:"/",className:"flex items-center gap-2 font-semibold tracking-tight whitespace-nowrap shrink-0 text-text-primary hover:opacity-90 transition-opacity","aria-label":"ccgauge home",children:[(0,n.jsx)(h,{className:"w-7 h-7"}),(0,n.jsx)("span",{className:"hidden xs:inline sm:inline",children:"ccgauge"}),(0,n.jsx)("span",{className:"text-xs text-text-tertiary font-normal hidden lg:inline",children:g("brand.tagline")})]}),(0,n.jsx)("nav",{className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto nav-scroller","aria-label":"Primary",children:f.map(e=>{let t=e.exact?u===e.href:u===e.href||u.startsWith(e.href+"/");return(0,n.jsxs)(i(),{href:e.href,prefetch:!1,"aria-current":t?"page":void 0,className:(0,o.cn)("relative px-2.5 sm:px-3 py-1.5 text-sm rounded-button font-medium whitespace-nowrap shrink-0","transition-colors duration-150",t?"text-text-primary":"text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi/60"),children:[g(e.tk),t&&(0,n.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute left-2 right-2 -bottom-[12px] h-[2px] bg-brand rounded-full"})]},e.href)})}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,n.jsx)(m,{available:t,initial:r,providers:a}),(0,n.jsx)("span",{className:"pill bg-bg-surface-hi text-text-tertiary text-[10px] uppercase tracking-wide hidden md:inline-flex",children:g("nav.localBadge")}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(l.LanguageSwitcher,{}),(0,n.jsx)(d.ThemeSwitcher,{})]})]})]})})}},79076:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,41290,23)),Promise.resolve().then(r.bind(r,57581)),Promise.resolve().then(r.bind(r,12112))},84479:(e,t,r)=>{"use strict";r.d(t,{N:()=>d,D:()=>h});var n=r(95155),a=r(12115);let i="ccgauge_theme",s=(0,a.createContext)({theme:"dark",resolved:"dark",setTheme:()=>{}}),o="ccgauge.theme";function c(e){return"light"===e?"light":"dark"===e?"dark":window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function l(e){if("undefined"==typeof document)return;let t=document.documentElement,r=c(e);t.classList.remove("theme-light","theme-dark"),t.classList.add("light"===r?"theme-light":"theme-dark"),t.setAttribute("data-theme",r)}function d(e){let{initialTheme:t,children:r}=e,[d,h]=(0,a.useState)(t),[u,m]=(0,a.useState)(()=>"system"===t?"dark":t);(0,a.useEffect)(()=>{try{let e=localStorage.getItem(o);if("light"===e||"dark"===e||"system"===e){e!==t&&(document.cookie="".concat(i,"=").concat(e,"; path=/; max-age=").concat(31536e3,"; SameSite=Lax")),h(e);let r=c(e);m(r),l(e)}else{let e=c(t);m(e),l(t)}}catch(e){m(c(t)),l(t)}},[]),(0,a.useEffect)(()=>{if("system"!==d)return;let e=window.matchMedia("(prefers-color-scheme: light)"),t=()=>{m(e.matches?"light":"dark"),l("system")};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[d]);let g=(0,a.useCallback)(e=>{try{localStorage.setItem(o,e)}catch(e){}document.cookie="".concat(i,"=").concat(e,"; path=/; max-age=").concat(31536e3,"; SameSite=Lax"),h(e),m(c(e)),l(e)},[]);return(0,n.jsx)(s.Provider,{value:{theme:d,resolved:u,setTheme:g},children:r})}function h(){return(0,a.useContext)(s)}}},e=>{e.O(0,[741,760,619,148,441,255,358],()=>e(e.s=79076)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{7331:(e,t,a)=>{"use strict";a.d(t,{wn:()=>n});var r=a(95155),s=a(25016);function n(e){let{title:t,desc:a,right:n,children:i,className:c,inlineDesc:l,fillBody:o}=e;return(0,r.jsxs)("section",{className:(0,s.cn)("card overflow-hidden",o&&"flex flex-col",c),children:[(t||n)&&(0,r.jsxs)("header",{className:(0,s.cn)("section-header","flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4","px-5 sm:px-6 pt-4 sm:pt-5 pb-3 border-b border-border"),children:[(0,r.jsxs)("div",{className:(0,s.cn)("min-w-0",l&&"sm:flex sm:items-baseline sm:gap-2.5"),children:[t&&(0,r.jsx)("h2",{className:"text-[15px] font-semibold text-text-primary tracking-tight leading-tight",children:t}),a&&(0,r.jsx)("p",{className:(0,s.cn)("text-xs text-text-secondary leading-relaxed",l?"mt-1 sm:mt-0":"mt-1.5"),children:a})]}),n&&(0,r.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),(0,r.jsx)("div",{className:(0,s.cn)("p-5 sm:p-6",o&&"flex-1 flex flex-col"),children:i})]})}},8608:(e,t,a)=>{"use strict";a.d(t,{ModelBarChart:()=>c});var r=a(95155),s=a(25016),n=a(51148);let i={opus:"rgb(var(--chart-output))",sonnet:"rgb(var(--chart-input))",haiku:"rgb(var(--chart-cache-read))"};function c(e){let{models:t}=e,a=(0,n.kj)(),{locale:c}=(0,n.s9)();if(!t.length)return(0,r.jsx)("div",{className:"text-sm text-text-tertiary",children:a("chart.empty")});let l=Math.max(...t.map(e=>e.cost),1e-4),o=t.reduce((e,t)=>e+t.cost,0);return(0,r.jsx)("div",{className:"space-y-3.5",children:t.map(e=>{let t=o>0?e.cost/o:0;return(0,r.jsxs)("div",{className:"space-y-1.5 group",children:[(0,r.jsxs)("div",{className:"flex items-baseline justify-between gap-3 text-sm",children:[(0,r.jsx)("span",{className:"font-medium text-text-primary truncate",children:(0,s.P6)(e.model)}),(0,r.jsxs)("span",{className:"text-xs text-text-tertiary tabular-nums flex-1 text-right",children:[(0,s.jh)(e.totalTokens,c)," \xb7 ",(0,s.R8)(t)]}),(0,r.jsx)("span",{className:"num-mono font-medium text-text-primary min-w-[80px] text-right",children:(0,s.az)(e.cost)})]}),(0,r.jsx)("div",{className:"h-2 w-full bg-bg-surface-hi rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-all duration-500 ease-out-soft group-hover:brightness-110",style:{width:"".concat(e.cost/l*100,"%"),background:function(e){for(let t of Object.keys(i))if(e.toLowerCase().includes(t))return i[t];return"rgb(var(--chart-cache-create))"}(e.model)}})})]},e.model)})})}},12623:(e,t,a)=>{"use strict";a.d(t,{ActivityStatsSection:()=>l});var r=a(95155),s=a(12115),n=a(25016),i=a(7331),c=a(79808);function l(e){var t;let{stats:a,comparison:n,locale:l,className:x}=e,m=(0,s.useCallback)((e,t)=>(0,c.nA)(l,e,t),[l]),u=[{label:m("activity.activeDays"),value:a.activeDays.toLocaleString()},{label:m("activity.streakCombinedLabel"),value:m("activity.streakCombinedValue",{current:a.currentStreak,longest:a.longestStreak})},{label:m("activity.peakHour"),value:a.peakHour<0?"—":h(a.peakHour,l)}];return(0,r.jsx)(i.wn,{title:m("activity.title"),desc:m("activity.subtitle"),inlineDesc:!0,fillBody:!0,className:x,children:(0,r.jsxs)("div",{className:"flex flex-col md:flex-row gap-5 md:gap-8 items-stretch flex-1",children:[(0,r.jsx)("div",{className:"grid grid-cols-3 md:flex md:flex-col md:w-[170px] md:shrink-0 gap-2.5",children:u.map(e=>(0,r.jsx)(o,{label:e.label,value:e.value},e.label))}),(0,r.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col",children:[(0,r.jsx)(d,{data:a.heatmap,tokens:a.tokenHeatmap,max:a.heatmapMax,locale:l}),n&&(0,r.jsx)("div",{className:"mt-auto pt-4 text-xs text-text-tertiary leading-relaxed",children:m("activity.comparison",{multiplier:(t=n.multiplier)<10?t.toFixed(1):t<1e3?Math.round(t).toString():t<1e6?(t/1e3).toFixed(1)+"K":(t/1e6).toFixed(1)+"M",ref:m("activity.ref.".concat(n.refKey))})})]})]})})}function o(e){let{label:t,value:a}=e;return(0,r.jsxs)("div",{className:"rounded-button bg-bg-surface-hi/60 border border-border px-3.5 py-3 flex-1 flex flex-col justify-center min-h-[64px]",children:[(0,r.jsx)("div",{className:"text-[11px] uppercase tracking-[0.06em] text-text-tertiary font-semibold truncate",children:t}),(0,r.jsx)("div",{className:"num-mono text-xl font-semibold text-text-primary mt-1 leading-none truncate",children:a})]})}function d(e){let{data:t,tokens:a,max:n,locale:i}=e,l=(0,s.useCallback)((e,t)=>(0,c.nA)(i,e,t),[i]),o=[0,3,6,9,12,15,18,21],[d,m]=(0,s.useState)(null),h=(0,s.useMemo)(()=>{let e=0,r=0,s=0;for(let a of t)for(let t of a)e+=t;for(let e of a)for(let t of e)r+=t,t>s&&(s=t);return{messages:e,tokens:r,maxTokens:s}},[t,a]);function p(e,r,s){let n=e.currentTarget.getBoundingClientRect();m({dow:r,hour:s,count:t[r][s],tokens:a[r][s],rect:{left:n.left,top:n.top,width:n.width,height:n.height}})}return(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsxs)("div",{className:"grid gap-y-[3px] [grid-template-columns:auto_1fr] items-center",children:[t.map((e,t)=>(0,r.jsx)(x,{dow:t,row:e,max:n,t:l,onCellHover:p,onLeave:()=>m(null)},t)),(0,r.jsx)("div",{className:"text-[10px] text-text-tertiary opacity-0 select-none pr-2",children:"."}),(0,r.jsx)("div",{className:"grid [grid-template-columns:repeat(24,minmax(0,1fr))] text-[10px] text-text-tertiary tabular-nums gap-[3px] mt-1",children:Array.from({length:24}).map((e,t)=>{var a;return(0,r.jsx)("div",{className:"text-center leading-none",children:o.includes(t)?(a=t,"zh"===i?"".concat(a):0===a?"12a":a<12?"".concat(a,"a"):12===a?"12p":"".concat(a-12,"p")):""},t)})})]}),d&&(0,r.jsx)(u,{hover:d,locale:i,totalMessages:h.messages,totalTokens:h.tokens,maxCount:n,maxTokens:h.maxTokens,t:l})]})}function x(e){let{dow:t,row:a,max:s,t:n,onCellHover:i,onLeave:c}=e,l=n("activity.dow.".concat(t));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"text-[11px] text-text-tertiary tabular-nums pr-2.5 leading-none whitespace-nowrap",children:l}),(0,r.jsx)("div",{className:"grid [grid-template-columns:repeat(24,minmax(0,1fr))] gap-[3px]",onMouseLeave:c,children:a.map((e,a)=>(0,r.jsx)(m,{count:e,max:s,onHover:e=>i(e,t,a)},a))})]})}function m(e){let{count:t,max:a,onHover:s}=e,i=a>0&&t>0?Math.sqrt(t/a):0,c=t?{backgroundColor:"rgb(var(--brand) / ".concat((.18+.82*i).toFixed(2),")")}:{};return(0,r.jsx)("div",{onMouseEnter:s,className:(0,n.cn)("aspect-square rounded-[3px] transition-transform duration-100","hover:scale-125 hover:ring-1 hover:ring-brand/60 hover:z-10 relative",!t&&"bg-bg-surface-hi"),style:c})}function u(e){let{hover:t,locale:a,totalMessages:s,totalTokens:i,maxCount:c,maxTokens:l,t:o}=e,d=t.rect.left+t.rect.width/2,x=t.rect.top<96,m=x?t.rect.top+t.rect.height+8:t.rect.top-8,u=o("activity.dow.".concat(t.dow)),p=function(e,t){let a=(e+1)%24;return"zh"===t?"".concat(e.toString().padStart(2,"0"),":00 – ").concat(a.toString().padStart(2,"0"),":00"):"".concat(h(e,t)," – ").concat(h(a,t))}(t.hour,a),f=s>0?t.count/s*100:0,v=c>0?t.count/c*100:0,g=i>0?t.tokens/i*100:0,b=l>0?t.tokens/l*100:0;return(0,r.jsx)("div",{role:"tooltip",className:"pointer-events-none fixed z-50",style:{left:d,top:m,transform:"translate(-50%, ".concat(x?"0%":"-100%",")")},children:(0,r.jsxs)("div",{className:"card-elevated rounded-button px-3 py-2 text-xs whitespace-nowrap shadow-xl border border-border-hi bg-bg-elevated min-w-[180px]",children:[(0,r.jsxs)("div",{className:"font-semibold text-text-primary mb-1",children:[u," \xb7 ",p]}),t.count>0?(0,r.jsxs)("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-text-secondary tabular-nums",children:[(0,r.jsx)("span",{className:"text-text-tertiary",children:o("activity.heatmap.messages")}),(0,r.jsxs)("span",{className:"text-right",children:[t.count.toLocaleString(),(0,r.jsxs)("span",{className:"text-text-tertiary ml-1.5",children:["\xb7 ",f.toFixed(1),"% / ",v.toFixed(0),"%"]})]}),(0,r.jsx)("span",{className:"text-text-tertiary",children:o("activity.heatmap.tokens")}),(0,r.jsxs)("span",{className:"text-right",children:[(0,n.jh)(t.tokens,a),(0,r.jsxs)("span",{className:"text-text-tertiary ml-1.5",children:["\xb7 ",g.toFixed(1),"% / ",b.toFixed(0),"%"]})]})]}):(0,r.jsx)("div",{className:"text-text-tertiary",children:o("activity.heatmap.empty")})]})})}function h(e,t){return"zh"===t?"".concat(e,":00"):0===e?"12 AM":e<12?"".concat(e," AM"):12===e?"12 PM":"".concat(e-12," PM")}},25016:(e,t,a)=>{"use strict";a.d(t,{BC:()=>h,P6:()=>f,PJ:()=>u,R8:()=>d,a3:()=>x,az:()=>l,cn:()=>n,jh:()=>c,l7:()=>o,r6:()=>m});var r=a(2821),s=a(75889);function n(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,s.QP)((0,r.$)(t))}function i(e,t){var a;return new Intl.NumberFormat("en-US",{maximumFractionDigits:null!=(a=null==t?void 0:t.maxFrac)?a:0}).format(e)}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return Number.isFinite(e)?"zh"===t?e>=1e8?(e/1e8).toFixed(2)+"亿":e>=1e4?(e/1e4).toFixed(1)+"万":i(e):e>=1e9?(e/1e9).toFixed(2)+"B":e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":i(e):"0"}function l(e,t){var a,r;return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:null!=(a=null==t?void 0:t.minFrac)?a:2,maximumFractionDigits:null!=(r=null==t?void 0:t.maxFrac)?r:2}).format(e)}function o(e){return 0===e?"$0":e<.01?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(e):l(e)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isFinite(e)?"".concat((100*e).toFixed(t),"%"):"0%"}function x(e){if(e<1e3)return"".concat(e,"ms");let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let a=Math.floor(t/60);if(a<60){let e=t%60;return e?"".concat(a,"m ").concat(e,"s"):"".concat(a,"m")}let r=Math.floor(a/60),s=a%60;return s?"".concat(r,"h ").concat(s,"m"):"".concat(r,"h")}function m(e){let t="string"==typeof e||"number"==typeof e?new Date(e):e;if(Number.isNaN(t.getTime()))return"";let a=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0"),n=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0");return"".concat(a,"-").concat(r,"-").concat(s," ").concat(n,":").concat(i,":").concat(c)}function u(e){if(!e)return"(unknown)";let t=e.replace(/[/\\]+$/,"").split(/[/\\]+/);return t[t.length-1]||e}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.replace(/-/g,"").slice(0,t):""}let p={mini:"Mini",nano:"Nano",pro:"Pro",turbo:"Turbo",preview:"Preview"};function f(e){if(!e)return"(unknown)";let t=e.replace(/^(vertex_ai|bedrock|anthropic|openai)\//,""),a=t.toLowerCase();if(a.startsWith("gpt-")||/^o\d/.test(a))return a.startsWith("gpt-")?"GPT-"+t.slice(4).split("-").map(e=>{var t;return null!=(t=p[e.toLowerCase()])?t:e}).join(" "):t.toUpperCase();let r=t.replace(/-(\d{8})$/,""),s=(r=r.replace(/^claude-/,"")).split("-");if(s.length>=2){let e=s[0],t=s.slice(1).join(".");return v(e)+" "+t}return v(r.replace(/-/g," "))}function v(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}},25763:(e,t,a)=>{"use strict";a.d(t,{BlockProgress:()=>c});var r=a(95155),s=a(12115),n=a(25016),i=a(51148);function c(e){let{initial:t,className:a,sourceLabel:s,compact:c,headerRight:o}=e,d=(0,i.kj)(),{locale:x}=(0,i.s9)(),m=e=>(0,n.jh)(e,x),u=(0,n.cn)("card flex flex-col",c?"p-4 min-h-[160px]":"card-pad min-h-[180px]",a),h=(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("div",{className:"label whitespace-nowrap",children:d("block.title")}),s&&(0,r.jsxs)("span",{className:"text-[10px] uppercase tracking-wide text-text-tertiary font-medium whitespace-nowrap",children:["\xb7 ",s]})]});if(!t.hasBlock||!t.endTime||!t.startTime)return(0,r.jsxs)("div",{className:u,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[h,o]}),(0,r.jsx)("div",{className:"text-sm text-text-tertiary mt-4",children:d("block.empty")}),(0,r.jsx)("div",{className:"text-xs text-text-tertiary mt-1",children:d("block.emptyDesc")})]});let p=(0,r.jsxs)("span",{className:"pill bg-success/10 text-success border border-success/20 whitespace-nowrap",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-success mr-1 animate-pulse"}),d("common.live")]});return(0,r.jsxs)("div",{className:u,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[h,null!=o?o:p]}),(0,r.jsx)(l,{startTime:t.startTime,endTime:t.endTime,totalTokens:t.totalTokens,remainingLabel:d("block.remaining"),renderElapsed:e=>d("block.elapsed",{pct:e}),tokensSuffix:d("block.tokensSuffix"),fmtTokens:m}),(0,r.jsxs)("div",{className:"mt-4 pt-4 border-t border-border grid grid-cols-2 gap-3 text-xs",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-text-tertiary",children:d("block.spentSoFar")}),(0,r.jsx)("div",{className:"num-mono text-text-primary mt-0.5 text-base",children:(0,n.az)(t.cost)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-text-tertiary",children:d("block.burnPerMin")}),(0,r.jsx)("div",{className:"num-mono text-text-primary mt-0.5 text-base",children:m(t.burnRatePerMin)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-text-tertiary",children:d("block.projectedTotal")}),(0,r.jsx)("div",{className:"num-mono text-text-secondary mt-0.5",children:(0,n.az)(t.projectedCost)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-text-tertiary",children:d("block.requests")}),(0,r.jsx)("div",{className:"num-mono text-text-secondary mt-0.5",children:t.requests})]})]}),(0,r.jsx)("div",{className:"mt-auto pt-3 text-[11px] leading-relaxed text-text-tertiary",children:d("block.disclaimer")})]})}function l(e){let{startTime:t,endTime:a,totalTokens:n,remainingLabel:i,renderElapsed:c,tokensSuffix:l,fmtTokens:o}=e,[d,x]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{let e=setInterval(()=>x(Date.now()),1e3);return()=>clearInterval(e)},[]);let m=new Date(t).getTime(),u=new Date(a).getTime(),h=Math.max(0,d-m),p=Math.max(0,u-d),f=Math.min(1,h/(u-m)),v=c((100*f).toFixed(1));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mt-3 flex items-baseline gap-2",children:[(0,r.jsx)("div",{className:"num-hero",children:function(e){if(e<=0)return"0s";let t=Math.floor(e/1e3),a=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60;return a>0?"".concat(a,"h ").concat(String(r).padStart(2,"0"),"m"):r>0?"".concat(r,"m ").concat(String(s).padStart(2,"0"),"s"):"".concat(s,"s")}(p)}),(0,r.jsx)("div",{className:"text-xs text-text-secondary",children:i})]}),(0,r.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-text-secondary",children:[(0,r.jsx)("span",{children:v}),(0,r.jsxs)("span",{className:"num-mono",children:[o(n)," ",l]})]}),(0,r.jsx)("div",{className:"h-1.5 bg-bg-surface-hi rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-gradient-to-r from-brand to-brand-hover transition-all",style:{width:"".concat(100*f,"%")},suppressHydrationWarning:!0})})]})]})}},30633:(e,t,a)=>{"use strict";a.d(t,{BlockProgressSwitcher:()=>i});var r=a(95155),s=a(12115),n=a(25763);function i(e){var t;let{slots:a,defaultSource:i,className:c}=e,l=Math.max(0,a.findIndex(e=>e.source===i)),[o,d]=(0,s.useState)(l),x=null!=(t=a[o])?t:a[0];return(0,r.jsx)(n.BlockProgress,{initial:x.initial,sourceLabel:x.label,className:c,headerRight:(0,r.jsx)("div",{role:"tablist","aria-label":"Active 5h block source",className:"inline-flex items-center rounded-md border border-border bg-bg-surface p-0.5 gap-0.5",children:a.map((e,t)=>{let a=t===o;return(0,r.jsx)("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>d(t),className:"px-2 h-5 text-[11px] inline-flex items-center rounded transition-all ".concat(a?"bg-brand-strong text-white font-semibold shadow-sm":"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:e.label},e.source)})})})}},36850:(e,t,a)=>{Promise.resolve().then(a.bind(a,12623)),Promise.resolve().then(a.bind(a,30633)),Promise.resolve().then(a.bind(a,25763)),Promise.resolve().then(a.bind(a,8608)),Promise.resolve().then(a.bind(a,74387))},38059:(e,t,a)=>{"use strict";a.d(t,{TokenStackChart:()=>h});var r=a(95155),s=a(26991),n=a(94632),i=a(68425),c=a(47734),l=a(73697),o=a(23508),d=a(26736),x=a(25016),m=a(51148);let u={input:"rgb(var(--chart-input))",output:"rgb(var(--chart-output))",cacheRead:"rgb(var(--chart-cache-read))",cacheCreation:"rgb(var(--chart-cache-create))"};function h(e){let{data:t,height:a="h-72"}=e,h=(0,m.kj)(),{locale:v}=(0,m.s9)();return t.length?(0,r.jsxs)("div",{className:"".concat(a," w-full"),children:[(0,r.jsx)(s.u,{width:"100%",height:"100%",children:(0,r.jsxs)(n.E,{data:t,margin:{top:12,right:8,bottom:4,left:8},barCategoryGap:"22%",children:[(0,r.jsx)(i.d,{stroke:"rgb(var(--chart-grid))",strokeOpacity:.6,strokeDasharray:"3 3",vertical:!1}),(0,r.jsx)(c.W,{dataKey:"label",tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,interval:"preserveStartEnd",minTickGap:32,tickMargin:8}),(0,r.jsx)(l.h,{tickFormatter:e=>(0,x.jh)(Number(e),v),tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,width:56,tickMargin:4}),(0,r.jsx)(o.m,{content:(0,r.jsx)(f,{}),cursor:{fill:"rgb(var(--text-primary) / 0.05)",radius:4}}),(0,r.jsx)(d.y,{dataKey:"input",stackId:"a",fill:u.input,isAnimationActive:!1}),(0,r.jsx)(d.y,{dataKey:"cacheCreation",stackId:"a",fill:u.cacheCreation,isAnimationActive:!1}),(0,r.jsx)(d.y,{dataKey:"cacheRead",stackId:"a",fill:u.cacheRead,isAnimationActive:!1}),(0,r.jsx)(d.y,{dataKey:"output",stackId:"a",fill:u.output,radius:[4,4,0,0],isAnimationActive:!1})]})}),(0,r.jsxs)("div",{className:"flex items-center flex-wrap justify-center gap-4 text-xs text-text-secondary mt-2",children:[(0,r.jsx)(p,{color:u.input,label:h("chart.legend.input")}),(0,r.jsx)(p,{color:u.cacheCreation,label:h("chart.legend.cacheWrite")}),(0,r.jsx)(p,{color:u.cacheRead,label:h("chart.legend.cacheRead")}),(0,r.jsx)(p,{color:u.output,label:h("chart.legend.output")})]})]}):(0,r.jsx)("div",{className:"".concat(a," flex items-center justify-center text-text-tertiary text-sm"),children:h("chart.empty")})}function p(e){let{color:t,label:a}=e;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-2.5 h-2.5 rounded-sm",style:{background:t}}),(0,r.jsx)("span",{children:a})]})}function f(e){let t=(0,m.kj)(),{locale:a}=(0,m.s9)();if(!e.active||!e.payload||!e.payload.length)return null;let s=e.payload[0].payload,n=s.input+s.output+s.cacheRead+s.cacheCreation;return(0,r.jsxs)("div",{className:"card-elevated border border-border-hi rounded-card p-3 text-xs min-w-[200px]",children:[(0,r.jsx)("div",{className:"font-medium text-text-primary mb-2",children:e.label}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(v,{color:u.input,label:t("chart.legend.input"),value:s.input,locale:a}),(0,r.jsx)(v,{color:u.cacheCreation,label:t("chart.legend.cacheWrite"),value:s.cacheCreation,locale:a}),(0,r.jsx)(v,{color:u.cacheRead,label:t("chart.legend.cacheRead"),value:s.cacheRead,locale:a}),(0,r.jsx)(v,{color:u.output,label:t("chart.legend.output"),value:s.output,locale:a})]}),(0,r.jsxs)("div",{className:"mt-2 pt-2 border-t border-border flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.total")}),(0,r.jsx)("span",{className:"num-mono text-text-primary",children:(0,x.jh)(n,a)})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,r.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.cost")}),(0,r.jsx)("span",{className:"num-mono text-brand",children:(0,x.az)(s.cost)})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,r.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.requests")}),(0,r.jsx)("span",{className:"num-mono text-text-primary",children:s.requests})]})]})}function v(e){let{color:t,label:a,value:s,locale:n}=e;return(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-text-secondary",children:[(0,r.jsx)("span",{className:"w-2 h-2 rounded-sm",style:{background:t}}),a]}),(0,r.jsx)("span",{className:"num-mono text-text-primary",children:(0,x.jh)(s,n)})]})}},74387:(e,t,a)=>{"use strict";a.d(t,{OverviewTrendCard:()=>v});var r=a(95155),s=a(12115),n=a(7331),i=a(38059),c=a(26991),l=a(94632),o=a(68425),d=a(47734),x=a(73697),m=a(23508),u=a(26736),h=a(51148);function p(e){let{data:t,height:a="h-72"}=e,s=(0,h.kj)(),{locale:n}=(0,h.s9)();return t.length?(0,r.jsx)("div",{className:"".concat(a," w-full"),children:(0,r.jsx)(c.u,{width:"100%",height:"100%",children:(0,r.jsxs)(l.E,{data:t,margin:{top:12,right:8,bottom:4,left:8},barCategoryGap:"22%",children:[(0,r.jsx)(o.d,{stroke:"rgb(var(--chart-grid))",strokeOpacity:.6,strokeDasharray:"3 3",vertical:!1}),(0,r.jsx)(d.W,{dataKey:"label",tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,interval:"preserveStartEnd",minTickGap:32,tickMargin:8}),(0,r.jsx)(x.h,{tickFormatter:e=>{let t;return t=Number(e),"zh"===n&&t>=1e4?"".concat((t/1e4).toFixed(1),"万"):t.toLocaleString()},tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,width:56,tickMargin:4}),(0,r.jsx)(m.m,{content:(0,r.jsx)(f,{}),cursor:{fill:"rgb(var(--text-primary) / 0.05)",radius:4}}),(0,r.jsx)(u.y,{dataKey:"turns",fill:"rgb(var(--brand))",radius:[4,4,0,0],isAnimationActive:!1})]})})}):(0,r.jsx)("div",{className:"".concat(a," flex items-center justify-center text-text-tertiary text-sm"),children:s("chart.empty")})}function f(e){var t;let a=(0,h.kj)();if(!e.active||!e.payload||!e.payload.length)return null;let s=e.payload[0].payload;return(0,r.jsxs)("div",{className:"card-elevated border border-border-hi rounded-card p-3 text-xs min-w-[180px]",children:[(0,r.jsx)("div",{className:"font-medium text-text-primary mb-2",children:e.label}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-text-secondary",children:a("chart.tooltip.conversations")}),(0,r.jsx)("span",{className:"num-mono text-text-primary",children:(null!=(t=s.turns)?t:0).toLocaleString()})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1 text-text-tertiary",children:[(0,r.jsx)("span",{children:a("chart.tooltip.requests")}),(0,r.jsx)("span",{className:"num-mono",children:s.requests.toLocaleString()})]})]})}function v(e){let{data:t,activeDaysHint:a}=e,c=(0,h.kj)(),[l,o]=(0,s.useState)("tokens"),d=c("tokens"===l?"overview.trend.desc.tokens":"overview.trend.desc.conversations");return(0,r.jsx)(n.wn,{title:c("overview.trend.title"),desc:c("overview.trend.desc",{metric:d}),right:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(g,{value:l,onChange:o}),(0,r.jsx)("span",{className:"text-xs text-text-tertiary whitespace-nowrap",children:a})]}),children:"tokens"===l?(0,r.jsx)(i.TokenStackChart,{data:t}):(0,r.jsx)(p,{data:t})})}function g(e){let{value:t,onChange:a}=e,s=(0,h.kj)();return(0,r.jsx)("div",{role:"tablist","aria-label":s("overview.trend.title"),className:"inline-flex items-center rounded-md border border-border bg-bg-surface p-0.5 gap-0.5",children:[{id:"tokens",labelKey:"overview.trend.metric.tokens"},{id:"conversations",labelKey:"overview.trend.metric.conversations"}].map(e=>{let n=e.id===t;return(0,r.jsx)("button",{type:"button",role:"tab","aria-selected":n,onClick:()=>a(e.id),className:"px-2.5 h-6 text-xs inline-flex items-center rounded transition-all ".concat(n?"bg-brand-strong text-white font-semibold shadow-sm":"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:s(e.labelKey)},e.id)})})}}},e=>{e.O(0,[760,930,148,441,255,358],()=>e(e.s=36850)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[430],{1189:(e,t,r)=>{"use strict";r.d(t,{V:()=>o});var a=r(95155),n=r(20063),s=r(12115),l=r(25016),i=r(51148);function o(e){let{paramKey:t,defaultValue:r,options:o,ariaLabel:c}=e,d=(0,n.useRouter)(),u=(0,n.usePathname)(),m=(0,n.useSearchParams)(),x=(0,i.kj)(),h=m.get(t)||r,p=o.some(e=>e.value===h)?h:r,b=(0,s.useRef)(null);function g(e){let r=new URLSearchParams(m.toString());r.set(t,e),d.push("".concat(u,"?").concat(r.toString()))}return(0,a.jsx)("div",{ref:b,role:"radiogroup","aria-label":c,onKeyDown:function(e){var t,r;if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();let a=(o.findIndex(e=>e.value===p)+("ArrowRight"===e.key?1:-1)+o.length)%o.length;g(o[a].value);let n=null==(t=b.current)?void 0:t.querySelectorAll('button[role="radio"]');null==n||null==(r=n[a])||r.focus()},className:"inline-flex rounded-button border border-border bg-bg-surface p-0.5 gap-0.5",children:o.map(e=>{let t=p===e.value;return(0,a.jsx)("button",{role:"radio","aria-checked":t,tabIndex:t?0:-1,onClick:()=>g(e.value),className:(0,l.cn)("px-2.5 py-1 text-xs rounded transition-all","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",t?"bg-brand-strong text-white font-semibold shadow-sm ring-1 ring-brand/40":"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:x(e.tk)},e.value)})})}},7152:(e,t,r)=>{"use strict";r.d(t,{RangePicker:()=>i});var a=r(95155),n=r(1189),s=r(51148);let l=[{value:"1d",tk:"range.today"},{value:"7d",tk:"range.7d"},{value:"30d",tk:"range.30d"},{value:"90d",tk:"range.90d"},{value:"all",tk:"range.all"}];function i(e){let{defaultValue:t="7d"}=e,r=(0,s.kj)();return(0,a.jsx)(n.V,{paramKey:"range",defaultValue:t,options:l,ariaLabel:r("range.label")})}},8336:(e,t,r)=>{"use strict";r.d(t,{ModelFilter:()=>i});var a=r(95155),n=r(35850),s=r(25016),l=r(51148);function i(e){let{all:t,selected:r}=e,i=(0,l.kj)();return(0,a.jsx)(n.K,{paramKey:"models",all:t,selected:r,render:s.P6,labelAllKey:"filter.modelAll",labelSingleKey:"filter.modelSingle",labelMultiKey:"filter.modelMulti",ariaLabel:i("filter.modelLabel")})}},14920:(e,t,r)=>{"use strict";r.d(t,{ProjectFilter:()=>i});var a=r(95155),n=r(35850),s=r(25016),l=r(51148);function i(e){let{all:t,selected:r}=e,i=(0,l.kj)();return(0,a.jsx)(n.K,{paramKey:"projects",all:t,selected:r,render:s.PJ,labelAllKey:"filter.projectAll",labelSingleKey:"filter.projectSingle",labelMultiKey:"filter.projectMulti",ariaLabel:i("filter.projectLabel")})}},16633:(e,t,r)=>{"use strict";r.d(t,{GranularityPicker:()=>i});var a=r(95155),n=r(1189),s=r(51148);let l=[{value:"hour",tk:"gran.hour"},{value:"day",tk:"gran.day"},{value:"week",tk:"gran.week"},{value:"month",tk:"gran.month"}];function i(e){let{defaultValue:t="day"}=e,r=(0,s.kj)();return(0,a.jsx)(n.V,{paramKey:"gran",defaultValue:t,options:l,ariaLabel:r("gran.label")})}},20857:(e,t,r)=>{"use strict";r.d(t,{H:()=>l});var a=r(95155),n=r(12115),s=r(25016);function l(e){let{children:t,className:r}=e,l=(0,n.useRef)(null),[i,o]=(0,n.useState)(!1),[c,d]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=l.current;if(!e)return;function t(){if(!e)return;let{scrollLeft:t,scrollWidth:r,clientWidth:a}=e;o(t>4),d(t+a<r-4)}t(),e.addEventListener("scroll",t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),()=>{e.removeEventListener("scroll",t),r.disconnect()}},[]),(0,a.jsxs)("div",{className:(0,s.cn)("relative",r),children:[(0,a.jsx)("div",{ref:l,className:"overflow-x-auto",children:t}),(0,a.jsx)("div",{"aria-hidden":!0,className:(0,s.cn)("pointer-events-none absolute left-0 top-0 bottom-0 w-8 bg-gradient-to-r from-bg-surface to-transparent transition-opacity duration-150",i?"opacity-100":"opacity-0")}),(0,a.jsx)("div",{"aria-hidden":!0,className:(0,s.cn)("pointer-events-none absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-bg-surface to-transparent transition-opacity duration-150",c?"opacity-100":"opacity-0")})]})}},25016:(e,t,r)=>{"use strict";r.d(t,{BC:()=>h,P6:()=>b,PJ:()=>x,R8:()=>d,a3:()=>u,az:()=>o,cn:()=>s,jh:()=>i,l7:()=>c,r6:()=>m});var a=r(2821),n=r(75889);function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.QP)((0,a.$)(t))}function l(e,t){var r;return new Intl.NumberFormat("en-US",{maximumFractionDigits:null!=(r=null==t?void 0:t.maxFrac)?r:0}).format(e)}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return Number.isFinite(e)?"zh"===t?e>=1e8?(e/1e8).toFixed(2)+"亿":e>=1e4?(e/1e4).toFixed(1)+"万":l(e):e>=1e9?(e/1e9).toFixed(2)+"B":e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":l(e):"0"}function o(e,t){var r,a;return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:null!=(r=null==t?void 0:t.minFrac)?r:2,maximumFractionDigits:null!=(a=null==t?void 0:t.maxFrac)?a:2}).format(e)}function c(e){return 0===e?"$0":e<.01?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(e):o(e)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isFinite(e)?"".concat((100*e).toFixed(t),"%"):"0%"}function u(e){if(e<1e3)return"".concat(e,"ms");let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let r=Math.floor(t/60);if(r<60){let e=t%60;return e?"".concat(r,"m ").concat(e,"s"):"".concat(r,"m")}let a=Math.floor(r/60),n=r%60;return n?"".concat(a,"h ").concat(n,"m"):"".concat(a,"h")}function m(e){let t="string"==typeof e||"number"==typeof e?new Date(e):e;if(Number.isNaN(t.getTime()))return"";let r=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),l=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return"".concat(r,"-").concat(a,"-").concat(n," ").concat(s,":").concat(l,":").concat(i)}function x(e){if(!e)return"(unknown)";let t=e.replace(/[/\\]+$/,"").split(/[/\\]+/);return t[t.length-1]||e}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.replace(/-/g,"").slice(0,t):""}let p={mini:"Mini",nano:"Nano",pro:"Pro",turbo:"Turbo",preview:"Preview"};function b(e){if(!e)return"(unknown)";let t=e.replace(/^(vertex_ai|bedrock|anthropic|openai)\//,""),r=t.toLowerCase();if(r.startsWith("gpt-")||/^o\d/.test(r))return r.startsWith("gpt-")?"GPT-"+t.slice(4).split("-").map(e=>{var t;return null!=(t=p[e.toLowerCase()])?t:e}).join(" "):t.toUpperCase();let a=t.replace(/-(\d{8})$/,""),n=(a=a.replace(/^claude-/,"")).split("-");if(n.length>=2){let e=n[0],t=n.slice(1).join(".");return g(e)+" "+t}return g(a.replace(/-/g," "))}function g(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}},25577:(e,t,r)=>{"use strict";r.d(t,{UsageTable:()=>h});var a=r(95155),n=r(12115),s=r(20063),l=r(25016),i=r(51148),o=r(47650);function c(e){let{children:t,content:r,className:s,panelClassName:i,align:c="left",delay:d=100,maxWidth:u=360}=e,m=(0,n.useRef)(null),x=(0,n.useRef)(null),h=(0,n.useRef)(null),[p,b]=(0,n.useState)(null),[g,f]=(0,n.useState)(!1),[j,y]=(0,n.useState)(!1);function v(){h.current&&(window.clearTimeout(h.current),h.current=null),j||(x.current=window.setTimeout(()=>{let e=function(){let e,t=m.current;if(!t)return null;let r=t.getBoundingClientRect(),a=Math.min(u,window.innerWidth-16),n=window.innerHeight-r.bottom<200?"top":"bottom";return"right"===c?(e=Math.min(r.right,window.innerWidth-8))-a<8&&(e=a+8):(e=Math.max(r.left,8))+a>window.innerWidth-8&&(e=window.innerWidth-a-8),{x:e,y:"bottom"===n?r.bottom+8:r.top-8,placement:n,align:c}}();e&&(b(e),y(!0))},d))}function w(){x.current&&(window.clearTimeout(x.current),x.current=null),h.current=window.setTimeout(()=>y(!1),80)}return(0,n.useEffect)(()=>f(!0),[]),(0,n.useEffect)(()=>()=>{x.current&&window.clearTimeout(x.current),h.current&&window.clearTimeout(h.current)},[]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{ref:m,onMouseEnter:v,onMouseLeave:w,onFocus:v,onBlur:w,className:(0,l.cn)("inline-block",s),children:t}),g&&p&&(0,o.createPortal)((0,a.jsx)("div",{onMouseEnter:()=>{h.current&&(window.clearTimeout(h.current),h.current=null)},onMouseLeave:w,style:{position:"fixed",left:"right"===p.align?void 0:p.x,right:"right"===p.align?window.innerWidth-p.x:void 0,top:"bottom"===p.placement?p.y:void 0,bottom:"top"===p.placement?window.innerHeight-p.y:void 0,maxWidth:u,transform:j?"translateY(0) scale(1)":"bottom"===p.placement?"translateY(-4px) scale(0.98)":"translateY(4px) scale(0.98)",opacity:+!!j,transitionProperty:"opacity, transform",transitionDuration:"120ms",transitionTimingFunction:"cubic-bezier(0.16, 1, 0.3, 1)",transformOrigin:"bottom"===p.placement?"top":"bottom",pointerEvents:j?"auto":"none"},className:(0,l.cn)("z-50 card border-border-hi shadow-xl rounded-button",i),children:r}),document.body)]})}var d=r(20857);let u=[{id:"time",labelKey:"usage.col.time",sortKey:"timestamp",defaultVisible:!0},{id:"duration",labelKey:"usage.col.duration",align:"right",sortKey:"durationMs",defaultVisible:!0},{id:"prompt",labelKey:"usage.col.userMessage",defaultVisible:!0},{id:"model",labelKey:"usage.col.model",defaultVisible:!0},{id:"project",labelKey:"usage.col.project",defaultVisible:!0},{id:"session",labelKey:"usage.col.session",defaultVisible:!1},{id:"calls",labelKey:"usage.col.calls",align:"right",sortKey:"callCount",defaultVisible:!1},{id:"input",labelKey:"usage.col.input",align:"right",sortKey:"inputTokens",defaultVisible:!1},{id:"output",labelKey:"usage.col.output",align:"right",sortKey:"outputTokens",defaultVisible:!1},{id:"cacheRead",labelKey:"usage.col.cacheRead",align:"right",sortKey:"cacheReadTokens",defaultVisible:!1},{id:"cacheWrite",labelKey:"usage.col.cacheWrite",align:"right",sortKey:"cacheCreationTokens",defaultVisible:!1},{id:"total",labelKey:"usage.col.total",align:"right",sortKey:"totalTokens",defaultVisible:!0},{id:"cost",labelKey:"usage.col.cost",align:"right",sortKey:"cost",defaultVisible:!1},{id:"tools",labelKey:"usage.col.tools",defaultVisible:!0}],m="ccgauge.usage.cols.v3";function x(){return u.reduce((e,t)=>(e[t.id]=t.defaultVisible,e),{})}function h(e){let{rows:t,totalCount:r,page:l,pageCount:o,sort:c,query:h}=e,b=(0,i.kj)(),{locale:f}=(0,i.s9)(),j=(0,s.useRouter)(),y=(0,s.usePathname)(),v=(0,s.useSearchParams)(),[w,N]=(0,n.useState)(new Set),[k,S]=(0,n.useState)(x),[C,K]=(0,n.useState)(!1),[R,T]=(0,n.useState)(h),P=(0,n.useRef)(null),E=(0,n.useRef)(null);function L(e){let t=new URLSearchParams(v.toString());for(let[r,a]of Object.entries(e))void 0===a||""===a?t.delete(r):t.set(r,a);let r=t.toString();j.push(r?"".concat(y,"?").concat(r):y)}function M(e){L({page:e>0?String(e+1):void 0})}(0,n.useEffect)(()=>{S(function(){try{let e=window.localStorage.getItem(m);if(!e)return x();let t=JSON.parse(e),r=x();for(let e of u)"boolean"==typeof t[e.id]&&(r[e.id]=t[e.id]);return r}catch(e){return x()}}())},[]),(0,n.useEffect)(()=>{window.localStorage.setItem(m,JSON.stringify(k))},[k]),(0,n.useEffect)(()=>{T(h)},[h]),(0,n.useEffect)(()=>{function e(e){P.current&&!P.current.contains(e.target)&&K(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,n.useEffect)(()=>()=>{E.current&&(window.clearTimeout(E.current),E.current=null)},[]);let F=u.filter(e=>k[e.id]),A=F.length+1,I=F.length;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-3 flex-wrap",children:[(0,a.jsx)("input",{value:R,onChange:e=>{var t;T(t=e.target.value),E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{L({q:t.trim()||void 0,page:void 0})},300)},placeholder:b("common.searchPlaceholder"),className:"px-3 py-1.5 text-sm rounded-button border border-border bg-bg-surface focus:outline-none focus:border-border-hi w-72 placeholder:text-text-tertiary text-text-primary"}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"text-xs text-text-tertiary tabular-nums",children:b("common.rows",{count:r.toLocaleString()})}),(0,a.jsxs)("div",{ref:P,className:"relative",children:[(0,a.jsxs)("button",{onClick:()=>K(e=>!e),className:"btn",children:[b("usage.columns.button"),(0,a.jsx)("span",{className:"ml-1 text-text-tertiary tabular-nums",children:I})]}),C&&(0,a.jsxs)("div",{className:"absolute right-0 mt-1 w-56 card border-border-hi shadow-lg p-2 z-30",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-1.5 pb-1.5 mb-1 border-b border-border",children:[(0,a.jsx)("span",{className:"text-xs text-text-tertiary uppercase tracking-wide",children:b("usage.columns.title")}),(0,a.jsx)("button",{onClick:()=>S(x()),className:"text-xs text-text-tertiary hover:text-text-primary",children:b("usage.columns.reset")})]}),(0,a.jsx)("div",{className:"max-h-72 overflow-auto",children:u.map(e=>(0,a.jsxs)("label",{className:"flex items-center gap-2 px-1.5 py-1.5 text-sm rounded hover:bg-bg-surface-hi cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:!!k[e.id],onChange:t=>S(r=>({...r,[e.id]:t.target.checked})),className:"accent-brand"}),(0,a.jsx)("span",{className:"text-text-secondary",children:b(e.labelKey)})]},e.id))})]})]}),(0,a.jsx)("button",{onClick:function(){let e=new URLSearchParams(v.toString());window.location.href="/api/export/usage?".concat(e.toString())},className:"btn",children:b("common.exportCsv")})]})]}),(0,a.jsx)("div",{className:"card overflow-hidden",children:(0,a.jsx)(d.H,{children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-border bg-bg-surface-hi/30",children:[(0,a.jsx)(g,{children:(0,a.jsx)("span",{className:"sr-only",children:"expand"})}),F.map(e=>(0,a.jsx)(g,{align:e.align,sorted:!!e.sortKey&&c.key===e.sortKey,dir:c.dir,onClick:e.sortKey?()=>{var t;let r;return t=e.sortKey,r="desc",void(c.key===t&&(r="asc"===c.dir?"desc":"asc"),L({sort:"timestamp"===t?void 0:t,dir:"desc"===r?void 0:r,page:void 0}))}:void 0,children:b(e.labelKey)},e.id))]})}),(0,a.jsxs)("tbody",{children:[t.map(e=>{let t=w.has(e.turnId),r=e.userText.trim()||b("usage.turn.noPrompt");return(0,a.jsx)(p,{turn:e,isOpen:t,onToggle:()=>{var t;return t=e.turnId,void N(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},userText:r,expandLabel:b("usage.turn.expand"),collapseLabel:b("usage.turn.collapse"),activeColumns:F,locale:f,t:b},e.turnId)}),0===t.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:A,className:"px-3 py-8 text-center text-text-tertiary text-sm",children:b("common.noMatchingRows")})})]})]})})}),o>1&&(0,a.jsxs)("div",{className:"flex items-center justify-between mt-3 text-xs text-text-secondary",children:[(0,a.jsx)("span",{children:b("common.pageOf",{page:l+1,total:o})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>M(0),disabled:0===l,className:"btn-ghost disabled:opacity-40",children:b("common.first")}),(0,a.jsx)("button",{onClick:()=>M(l-1),disabled:0===l,className:"btn-ghost disabled:opacity-40",children:b("common.prev")}),(0,a.jsx)("button",{onClick:()=>M(l+1),disabled:l>=o-1,className:"btn-ghost disabled:opacity-40",children:b("common.next")}),(0,a.jsx)("button",{onClick:()=>M(o-1),disabled:l>=o-1,className:"btn-ghost disabled:opacity-40",children:b("common.last")})]})]})]})}function p(e){let{turn:t,isOpen:r,onToggle:n,userText:s,expandLabel:i,collapseLabel:o,activeColumns:d,locale:u,t:m}=e,x=(1===t.models.length?(0,l.P6)(t.models[0]):"".concat((0,l.P6)(t.models[0])," +").concat(t.models.length-1))+(t.efforts.length?1===t.efforts.length?" \xb7 ".concat(t.efforts[0]):" \xb7 ".concat(t.efforts[0],"+").concat(t.efforts.length-1):""),h=t.toolNames.length?t.toolNames.slice(0,3).join(", ")+(t.toolNames.length>3?"…":""):"—";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-surface-hi/40 cursor-pointer",onClick:n,children:[(0,a.jsx)("td",{className:"px-2 py-2 text-text-tertiary w-6 text-center select-none",children:(0,a.jsx)("span",{title:r?o:i,className:"inline-block w-4",children:r?"▾":"▸"})}),d.map(e=>(0,a.jsx)("td",{className:(0,l.cn)("px-3 py-2","right"===e.align?"text-right":"text-left"),children:function(e,t,r,n,s,i,o){switch(e){case"time":return(0,a.jsx)("span",{className:"num-mono text-text-secondary whitespace-nowrap text-xs",title:"started ".concat((0,l.r6)(t.timestamp),"\nended ").concat((0,l.r6)(t.endTimestamp)),children:(0,l.r6)(t.timestamp)});case"duration":return(0,a.jsx)("span",{className:"num-mono text-text-secondary whitespace-nowrap text-xs",title:"".concat((0,l.r6)(t.timestamp)," → ").concat((0,l.r6)(t.endTimestamp)),children:(0,l.a3)(t.durationMs)});case"prompt":return(0,a.jsx)(c,{maxWidth:460,panelClassName:"p-3 text-sm text-text-secondary leading-relaxed",content:(0,a.jsx)("div",{className:"whitespace-pre-wrap break-words",children:s}),children:(0,a.jsx)("span",{className:"block text-text-secondary truncate max-w-[280px]",children:s})});case"model":return(0,a.jsx)("span",{className:"text-text-primary whitespace-nowrap",children:r});case"project":return(0,a.jsx)("span",{className:"block text-text-secondary truncate max-w-[180px]",title:t.cwd,children:t.projectLabel||(0,l.PJ)(t.cwd)});case"session":return(0,a.jsx)("span",{className:"num-mono text-text-tertiary text-xs",title:t.sessionId,children:(0,l.BC)(t.sessionId)});case"calls":return(0,a.jsx)("span",{className:"num-mono text-text-secondary",children:t.callCount});case"input":return(0,a.jsx)("span",{className:"num-mono text-text-secondary",children:(0,l.jh)(t.inputTokens,i)});case"output":return(0,a.jsx)("span",{className:"num-mono text-text-secondary",children:(0,l.jh)(t.outputTokens,i)});case"cacheRead":return(0,a.jsx)("span",{className:"num-mono text-success",children:(0,l.jh)(t.cacheReadTokens,i)});case"cacheWrite":return(0,a.jsx)("span",{className:"num-mono text-text-secondary",children:(0,l.jh)(t.cacheCreationTokens,i)});case"total":return(0,a.jsx)(c,{align:"right",maxWidth:300,panelClassName:"p-0 overflow-hidden",content:(0,a.jsx)(b,{row:t,locale:i,t:o}),children:(0,a.jsx)("span",{className:"num-mono text-text-primary font-medium border-b border-dashed border-border hover:border-text-tertiary cursor-help",children:(0,l.jh)(t.totalTokens,i)})});case"cost":return(0,a.jsx)("span",{className:"num-mono text-text-primary font-medium",children:(0,l.l7)(t.cost)});case"tools":return(0,a.jsx)("span",{className:"block text-xs text-text-tertiary truncate max-w-[160px]",title:t.toolNames.join(", "),children:n})}}(e.id,t,x,h,s,u,m)},e.id))]}),r&&t.children.map(e=>(0,a.jsxs)("tr",{className:"border-b border-border last:border-b-0 bg-bg-surface-hi/20 text-text-tertiary",children:[(0,a.jsx)("td",{className:"px-2 py-1.5 w-6"}),d.map(r=>(0,a.jsx)("td",{className:(0,l.cn)("px-3 py-1.5","right"===r.align?"text-right":"text-left"),children:function(e,t,r,n,s){switch(e){case"time":return(0,a.jsx)("span",{className:"num-mono whitespace-nowrap pl-5 text-xs",children:(0,l.r6)(t.timestamp)});case"duration":return(0,a.jsx)("span",{className:"text-xs text-text-tertiary",children:"—"});case"prompt":{var i;let e=(null!=(i=t.directPrompt)?i:"").trim();if(e&&e!==r.trim())return(0,a.jsx)("span",{className:"block text-xs text-text-secondary truncate max-w-[320px]",title:e,children:e});if(!t.toolNames.length)return(0,a.jsx)("span",{className:"text-xs text-text-tertiary",children:"—"});let n=t.toolNames.join(", "),s=t.toolNames.slice(0,3).join(", ")+(t.toolNames.length>3?"…":"");return(0,a.jsx)("span",{className:"block text-xs text-text-secondary truncate max-w-[280px]",title:n,children:s})}case"model":return(0,a.jsxs)("span",{className:"whitespace-nowrap",children:[(0,l.P6)(t.model),t.effort?" \xb7 ".concat(t.effort):""]});case"project":return(0,a.jsx)("span",{className:"block truncate max-w-[180px]",title:t.cwd,children:t.projectLabel||(0,l.PJ)(t.cwd)});case"session":return(0,a.jsx)("span",{className:"num-mono text-xs",title:t.sessionId,children:(0,l.BC)(t.sessionId)});case"calls":return(0,a.jsx)("span",{className:"num-mono",children:"1"});case"input":return(0,a.jsx)("span",{className:"num-mono",children:(0,l.jh)(t.inputTokens,n)});case"output":return(0,a.jsx)("span",{className:"num-mono",children:(0,l.jh)(t.outputTokens,n)});case"cacheRead":return(0,a.jsx)("span",{className:"num-mono text-success",children:(0,l.jh)(t.cacheReadTokens,n)});case"cacheWrite":return(0,a.jsx)("span",{className:"num-mono",children:(0,l.jh)(t.cacheCreationTokens,n)});case"total":return(0,a.jsx)(c,{align:"right",maxWidth:300,panelClassName:"p-0 overflow-hidden",content:(0,a.jsx)(b,{row:t,locale:n,t:s}),children:(0,a.jsx)("span",{className:"num-mono border-b border-dashed border-border/60 hover:border-text-tertiary cursor-help",children:(0,l.jh)(t.totalTokens,n)})});case"cost":return(0,a.jsx)("span",{className:"num-mono",children:(0,l.l7)(t.cost)});case"tools":return(0,a.jsx)("span",{className:"block text-xs truncate max-w-[160px]",title:t.toolNames.join(", "),children:t.toolNames.length?t.toolNames.join(", "):"—"})}}(r.id,e,t.userText,u,m)},r.id))]},e.uuid))]})}function b(e){let{row:t,locale:r,t:s}=e,i=[{key:"input",label:s("usage.col.input"),tokens:t.inputTokens,cost:t.costInput,tone:"text-text-primary",dot:"bg-chart-input"},{key:"output",label:s("usage.col.output"),tokens:t.outputTokens,cost:t.costOutput,tone:"text-text-primary",dot:"bg-chart-output"},{key:"cacheRead",label:s("usage.col.cacheRead"),tokens:t.cacheReadTokens,cost:t.costCacheRead,tone:"text-success",dot:"bg-chart-cache-read"},{key:"cacheWrite",label:s("usage.col.cacheWrite"),tokens:t.cacheCreationTokens,cost:t.costCacheWrite,tone:"text-text-primary",dot:"bg-chart-cache-create"}];return(0,a.jsxs)("div",{className:"text-xs",children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-border bg-bg-surface-hi/40 text-text-tertiary uppercase tracking-wide font-medium",children:s("usage.breakdown.title")}),(0,a.jsxs)("div",{className:"px-3 py-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[auto_1fr_auto] gap-x-3 gap-y-1.5 items-center",children:[(0,a.jsx)("span",{}),(0,a.jsx)("span",{className:"text-text-tertiary text-[10px] uppercase tracking-wide text-right",children:s("usage.breakdown.headerTokens")}),(0,a.jsx)("span",{className:"text-text-tertiary text-[10px] uppercase tracking-wide text-right",children:s("usage.breakdown.headerCost")}),i.map(e=>(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-2 text-text-secondary",children:[(0,a.jsx)("span",{className:(0,l.cn)("w-2 h-2 rounded-sm",e.dot)}),e.label]}),(0,a.jsx)("span",{className:(0,l.cn)("num-mono text-right",e.tone),children:(0,l.jh)(e.tokens,r)}),(0,a.jsx)("span",{className:"num-mono text-right text-text-secondary",children:(0,l.l7)(e.cost)}),"output"===e.key&&t.reasoningTokens>0&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-2 text-text-tertiary pl-4 text-[11px]",children:[(0,a.jsx)("span",{className:"text-text-tertiary",children:"↳"}),s("usage.breakdown.reasoning")]}),(0,a.jsx)("span",{className:"num-mono text-right text-text-tertiary text-[11px]",children:(0,l.jh)(t.reasoningTokens,r)}),(0,a.jsx)("span",{className:"text-right text-text-tertiary text-[11px]",children:s("usage.breakdown.reasoningNote")})]},"reasoning-detail")]},e.key))]}),(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-border grid grid-cols-[auto_1fr_auto] gap-x-3 items-center",children:[(0,a.jsx)("span",{className:"text-text-secondary font-medium",children:s("usage.breakdown.total")}),(0,a.jsx)("span",{className:"num-mono text-right text-text-primary font-medium",children:(0,l.jh)(t.totalTokens,r)}),(0,a.jsx)("span",{className:"num-mono text-right text-text-primary font-medium",children:(0,l.l7)(t.cost)})]})]})]})}function g(e){let{children:t,align:r="left",sorted:n,dir:s,onClick:i}=e;return(0,a.jsx)("th",{className:(0,l.cn)("px-3 py-2 text-xs font-medium text-text-tertiary uppercase tracking-wide whitespace-nowrap","right"===r?"text-right":"text-left",i&&"cursor-pointer hover:text-text-primary select-none"),onClick:i,children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1",children:[t,n&&(0,a.jsx)("span",{className:"text-[10px]",children:"asc"===s?"▲":"▼"})]})})}},35850:(e,t,r)=>{"use strict";r.d(t,{K:()=>o});var a=r(95155),n=r(20063),s=r(12115),l=r(25016),i=r(51148);function o(e){let t,{paramKey:r,all:o,selected:c,render:d=e=>e,labelAllKey:u,labelSingleKey:m,labelMultiKey:x,ariaLabel:h,searchThreshold:p=6}=e,b=(0,n.useRouter)(),g=(0,n.usePathname)(),f=(0,n.useSearchParams)(),j=(0,i.kj)(),[y,v]=(0,s.useState)(!1),[w,N]=(0,s.useState)(""),[k,S]=(0,s.useState)(0),C=(0,s.useRef)(null),K=(0,s.useRef)(null),R=(0,s.useRef)(null),T=(0,s.useRef)(null),P=(0,s.useId)(),E=(0,s.useId)();(0,s.useEffect)(()=>{if(y)return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)};function e(e){C.current&&!C.current.contains(e.target)&&v(!1)}function t(e){if("Escape"===e.key){var t;v(!1),null==(t=K.current)||t.focus()}}},[y]),(0,s.useEffect)(()=>{y&&o.length>=p&&requestAnimationFrame(()=>{var e;return null==(e=R.current)?void 0:e.focus()}),y||(N(""),S(0))},[y,o.length,p]);let L=(0,s.useMemo)(()=>{let e=w.trim().toLowerCase();return e?o.filter(t=>d(t).toLowerCase().includes(e)||t.toLowerCase().includes(e)):o},[o,w,d]);function M(e){let t=new URLSearchParams(f.toString());0===e.size?t.delete(r):t.set(r,Array.from(e).join(","));let a=t.toString();b.push(a?"".concat(g,"?").concat(a):g)}function F(e){let t=new Set(c);t.has(e)?t.delete(e):t.add(e),M(t)}function A(e){if("ArrowDown"===e.key)e.preventDefault(),S(e=>Math.min(L.length-1,e+1));else if("ArrowUp"===e.key)e.preventDefault(),S(e=>Math.max(0,e-1));else if("Enter"===e.key){e.preventDefault();let t=L[k];t&&F(t)}else"Home"===e.key?(e.preventDefault(),S(0)):"End"===e.key&&(e.preventDefault(),S(L.length-1))}t=0===c.length?j(u):1===c.length?j(m,{value:d(c[0])}):j(x,{count:c.length});let I=o.length>=p;return(0,a.jsxs)("div",{ref:C,className:"relative",children:[(0,a.jsxs)("button",{ref:K,id:P,onClick:()=>v(e=>!e),className:"btn focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40","aria-haspopup":"listbox","aria-expanded":y,"aria-controls":E,"aria-label":h,children:[t,(0,a.jsx)("span",{className:"text-text-tertiary ml-1","aria-hidden":!0,children:"▾"})]}),y&&(0,a.jsxs)("div",{id:E,role:"listbox","aria-multiselectable":"true","aria-labelledby":P,className:"absolute right-0 mt-1 w-72 card border-border-hi shadow-lg z-20 overflow-hidden",children:[c.length>0&&(0,a.jsxs)("div",{className:"px-2 pt-2 pb-1.5 border-b border-border flex flex-wrap gap-1 items-center",children:[c.slice(0,6).map(e=>(0,a.jsxs)("button",{onClick:()=>F(e),className:"inline-flex items-center gap-1 max-w-[160px] pl-2 pr-1.5 py-0.5 text-[11px] rounded-full bg-brand/10 text-brand border border-brand/20 hover:bg-brand/15","aria-label":"Remove ".concat(d(e)),title:d(e),children:[(0,a.jsx)("span",{className:"truncate",children:d(e)}),(0,a.jsx)("span",{"aria-hidden":!0,className:"text-brand/70",children:"\xd7"})]},e)),c.length>6&&(0,a.jsxs)("span",{className:"text-[11px] text-text-tertiary px-1",children:["+",c.length-6]}),(0,a.jsx)("button",{onClick:function(){M(new Set)},className:"ml-auto text-[11px] text-text-tertiary hover:text-text-primary px-1.5 py-0.5",children:j("filter.clearAll")})]}),I&&(0,a.jsx)("div",{className:"p-2 border-b border-border",children:(0,a.jsx)("input",{ref:R,value:w,onChange:e=>{N(e.target.value),S(0)},onKeyDown:e=>{("ArrowDown"===e.key||"ArrowUp"===e.key||"Enter"===e.key||"Home"===e.key||"End"===e.key)&&A(e)},placeholder:j("common.searchPlaceholder"),className:"w-full px-2 py-1 text-sm rounded border border-border bg-bg-surface focus:outline-none focus:border-border-hi placeholder:text-text-tertiary text-text-primary"})}),(0,a.jsxs)("div",{ref:T,onKeyDown:A,className:"max-h-64 overflow-y-auto p-1 outline-none",tabIndex:-1,children:[0===L.length&&(0,a.jsx)("div",{className:"text-xs text-text-tertiary px-2 py-3 text-center",children:j("filter.noOptions")}),L.map((e,t)=>{let r=c.includes(e),n=t===k;return(0,a.jsxs)("button",{role:"option","aria-selected":r,onMouseEnter:()=>S(t),onClick:()=>F(e),className:(0,l.cn)("w-full text-left text-sm px-2 py-1.5 rounded flex items-center gap-2 transition-colors",n?"bg-bg-surface-hi":"hover:bg-bg-surface-hi",r&&"text-text-primary"),children:[(0,a.jsx)("span",{className:(0,l.cn)("w-3.5 h-3.5 rounded-sm border flex items-center justify-center text-[10px] flex-shrink-0",r?"bg-brand border-brand text-white":"border-border-hi"),"aria-hidden":!0,children:r?"✓":""}),(0,a.jsx)("span",{className:"truncate",children:d(e)})]},e)})]})]})]})}},36392:(e,t,r)=>{Promise.resolve().then(r.bind(r,77549)),Promise.resolve().then(r.bind(r,38059)),Promise.resolve().then(r.bind(r,16633)),Promise.resolve().then(r.bind(r,8336)),Promise.resolve().then(r.bind(r,44512)),Promise.resolve().then(r.bind(r,14920)),Promise.resolve().then(r.bind(r,7152)),Promise.resolve().then(r.bind(r,25577))},38059:(e,t,r)=>{"use strict";r.d(t,{TokenStackChart:()=>h});var a=r(95155),n=r(26991),s=r(94632),l=r(68425),i=r(47734),o=r(73697),c=r(23508),d=r(26736),u=r(25016),m=r(51148);let x={input:"rgb(var(--chart-input))",output:"rgb(var(--chart-output))",cacheRead:"rgb(var(--chart-cache-read))",cacheCreation:"rgb(var(--chart-cache-create))"};function h(e){let{data:t,height:r="h-72"}=e,h=(0,m.kj)(),{locale:g}=(0,m.s9)();return t.length?(0,a.jsxs)("div",{className:"".concat(r," w-full"),children:[(0,a.jsx)(n.u,{width:"100%",height:"100%",children:(0,a.jsxs)(s.E,{data:t,margin:{top:12,right:8,bottom:4,left:8},barCategoryGap:"22%",children:[(0,a.jsx)(l.d,{stroke:"rgb(var(--chart-grid))",strokeOpacity:.6,strokeDasharray:"3 3",vertical:!1}),(0,a.jsx)(i.W,{dataKey:"label",tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,interval:"preserveStartEnd",minTickGap:32,tickMargin:8}),(0,a.jsx)(o.h,{tickFormatter:e=>(0,u.jh)(Number(e),g),tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,width:56,tickMargin:4}),(0,a.jsx)(c.m,{content:(0,a.jsx)(b,{}),cursor:{fill:"rgb(var(--text-primary) / 0.05)",radius:4}}),(0,a.jsx)(d.y,{dataKey:"input",stackId:"a",fill:x.input,isAnimationActive:!1}),(0,a.jsx)(d.y,{dataKey:"cacheCreation",stackId:"a",fill:x.cacheCreation,isAnimationActive:!1}),(0,a.jsx)(d.y,{dataKey:"cacheRead",stackId:"a",fill:x.cacheRead,isAnimationActive:!1}),(0,a.jsx)(d.y,{dataKey:"output",stackId:"a",fill:x.output,radius:[4,4,0,0],isAnimationActive:!1})]})}),(0,a.jsxs)("div",{className:"flex items-center flex-wrap justify-center gap-4 text-xs text-text-secondary mt-2",children:[(0,a.jsx)(p,{color:x.input,label:h("chart.legend.input")}),(0,a.jsx)(p,{color:x.cacheCreation,label:h("chart.legend.cacheWrite")}),(0,a.jsx)(p,{color:x.cacheRead,label:h("chart.legend.cacheRead")}),(0,a.jsx)(p,{color:x.output,label:h("chart.legend.output")})]})]}):(0,a.jsx)("div",{className:"".concat(r," flex items-center justify-center text-text-tertiary text-sm"),children:h("chart.empty")})}function p(e){let{color:t,label:r}=e;return(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-sm",style:{background:t}}),(0,a.jsx)("span",{children:r})]})}function b(e){let t=(0,m.kj)(),{locale:r}=(0,m.s9)();if(!e.active||!e.payload||!e.payload.length)return null;let n=e.payload[0].payload,s=n.input+n.output+n.cacheRead+n.cacheCreation;return(0,a.jsxs)("div",{className:"card-elevated border border-border-hi rounded-card p-3 text-xs min-w-[200px]",children:[(0,a.jsx)("div",{className:"font-medium text-text-primary mb-2",children:e.label}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(g,{color:x.input,label:t("chart.legend.input"),value:n.input,locale:r}),(0,a.jsx)(g,{color:x.cacheCreation,label:t("chart.legend.cacheWrite"),value:n.cacheCreation,locale:r}),(0,a.jsx)(g,{color:x.cacheRead,label:t("chart.legend.cacheRead"),value:n.cacheRead,locale:r}),(0,a.jsx)(g,{color:x.output,label:t("chart.legend.output"),value:n.output,locale:r})]}),(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-border flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.total")}),(0,a.jsx)("span",{className:"num-mono text-text-primary",children:(0,u.jh)(s,r)})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,a.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.cost")}),(0,a.jsx)("span",{className:"num-mono text-brand",children:(0,u.az)(n.cost)})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,a.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.requests")}),(0,a.jsx)("span",{className:"num-mono text-text-primary",children:n.requests})]})]})}function g(e){let{color:t,label:r,value:n,locale:s}=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-text-secondary",children:[(0,a.jsx)("span",{className:"w-2 h-2 rounded-sm",style:{background:t}}),r]}),(0,a.jsx)("span",{className:"num-mono text-text-primary",children:(0,u.jh)(n,s)})]})}},44512:(e,t,r)=>{"use strict";r.d(t,{OverviewToggle:()=>c});var a=r(95155),n=r(12115),s=r(25016),l=r(51148);let i="data-usage-overview",o="hidden";function c(){let e=(0,l.kj)(),[t,r]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{r(document.documentElement.getAttribute(i)===o)},[]),(0,a.jsxs)("button",{type:"button",onClick:function(){let e=!t;r(e);try{localStorage.setItem("ccgauge.usage.overview.hidden",e?"1":"0")}catch(e){}e?document.documentElement.setAttribute(i,o):document.documentElement.removeAttribute(i)},"aria-pressed":!t,title:e(t?"usage.overview.show":"usage.overview.hide"),className:(0,s.cn)("inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-button text-xs font-medium","border transition-colors duration-150",t?"border-border bg-bg-surface text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi":"border-brand/40 bg-brand/12 text-brand hover:bg-brand/20 hover:border-brand/60"),children:[(0,a.jsx)(d,{open:!t}),(0,a.jsx)("span",{className:"hidden sm:inline",children:e("usage.overview.label")})]})}function d(e){let{open:t}=e;return(0,a.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("path",{d:"M9.88 9.88a3 3 0 0 0 4.24 4.24"}),(0,a.jsx)("path",{d:"M10.73 5.08A11 11 0 0 1 12 5c6.5 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),(0,a.jsx)("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3.5 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),(0,a.jsx)("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]})})}},77549:(e,t,r)=>{"use strict";r.d(t,{AutoRefresh:()=>s});var a=r(12115),n=r(20063);function s(e){let{intervalMs:t=15e3}=e,r=(0,n.useRouter)(),s=(0,a.useRef)(!1);return(0,a.useEffect)(()=>{if(t<=0)return;let e=null;function a(){if(!document.hidden&&!s.current){s.current=!0;try{r.refresh()}finally{Promise.resolve().then(()=>{s.current=!1})}}}return e=window.setInterval(a,t),document.addEventListener("visibilitychange",a),()=>{null!==e&&window.clearInterval(e),document.removeEventListener("visibilitychange",a)}},[r,t]),null}}},e=>{e.O(0,[760,930,148,441,255,358],()=>e(e.s=36392)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[430],{1189:(e,t,r)=>{"use strict";r.d(t,{V:()=>o});var a=r(95155),n=r(20063),s=r(12115),l=r(25016),i=r(51148);function o(e){let{paramKey:t,defaultValue:r,options:o,ariaLabel:c}=e,d=(0,n.useRouter)(),u=(0,n.usePathname)(),m=(0,n.useSearchParams)(),x=(0,i.kj)(),h=m.get(t)||r,p=o.some(e=>e.value===h)?h:r,b=(0,s.useRef)(null);function g(e){let r=new URLSearchParams(m.toString());r.set(t,e),d.push("".concat(u,"?").concat(r.toString()))}return(0,a.jsx)("div",{ref:b,role:"radiogroup","aria-label":c,onKeyDown:function(e){var t,r;if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();let a=(o.findIndex(e=>e.value===p)+("ArrowRight"===e.key?1:-1)+o.length)%o.length;g(o[a].value);let n=null==(t=b.current)?void 0:t.querySelectorAll('button[role="radio"]');null==n||null==(r=n[a])||r.focus()},className:"inline-flex rounded-button border border-border bg-bg-surface p-0.5 gap-0.5",children:o.map(e=>{let t=p===e.value;return(0,a.jsx)("button",{role:"radio","aria-checked":t,tabIndex:t?0:-1,onClick:()=>g(e.value),className:(0,l.cn)("px-2.5 py-1 text-xs rounded transition-all","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",t?"bg-brand-strong text-white font-semibold shadow-sm ring-1 ring-brand/40":"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:x(e.tk)},e.value)})})}},7152:(e,t,r)=>{"use strict";r.d(t,{RangePicker:()=>i});var a=r(95155),n=r(1189),s=r(51148);let l=[{value:"1d",tk:"range.today"},{value:"7d",tk:"range.7d"},{value:"30d",tk:"range.30d"},{value:"90d",tk:"range.90d"},{value:"all",tk:"range.all"}];function i(e){let{defaultValue:t="7d"}=e,r=(0,s.kj)();return(0,a.jsx)(n.V,{paramKey:"range",defaultValue:t,options:l,ariaLabel:r("range.label")})}},8336:(e,t,r)=>{"use strict";r.d(t,{ModelFilter:()=>i});var a=r(95155),n=r(35850),s=r(25016),l=r(51148);function i(e){let{all:t,selected:r}=e,i=(0,l.kj)();return(0,a.jsx)(n.K,{paramKey:"models",all:t,selected:r,render:s.P6,labelAllKey:"filter.modelAll",labelSingleKey:"filter.modelSingle",labelMultiKey:"filter.modelMulti",ariaLabel:i("filter.modelLabel")})}},14920:(e,t,r)=>{"use strict";r.d(t,{ProjectFilter:()=>i});var a=r(95155),n=r(35850),s=r(25016),l=r(51148);function i(e){let{all:t,selected:r}=e,i=(0,l.kj)();return(0,a.jsx)(n.K,{paramKey:"projects",all:t,selected:r,render:s.PJ,labelAllKey:"filter.projectAll",labelSingleKey:"filter.projectSingle",labelMultiKey:"filter.projectMulti",ariaLabel:i("filter.projectLabel")})}},16633:(e,t,r)=>{"use strict";r.d(t,{GranularityPicker:()=>i});var a=r(95155),n=r(1189),s=r(51148);let l=[{value:"hour",tk:"gran.hour"},{value:"day",tk:"gran.day"},{value:"week",tk:"gran.week"},{value:"month",tk:"gran.month"}];function i(e){let{defaultValue:t="day"}=e,r=(0,s.kj)();return(0,a.jsx)(n.V,{paramKey:"gran",defaultValue:t,options:l,ariaLabel:r("gran.label")})}},20857:(e,t,r)=>{"use strict";r.d(t,{H:()=>l});var a=r(95155),n=r(12115),s=r(25016);function l(e){let{children:t,className:r}=e,l=(0,n.useRef)(null),[i,o]=(0,n.useState)(!1),[c,d]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=l.current;if(!e)return;function t(){if(!e)return;let{scrollLeft:t,scrollWidth:r,clientWidth:a}=e;o(t>4),d(t+a<r-4)}t(),e.addEventListener("scroll",t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),()=>{e.removeEventListener("scroll",t),r.disconnect()}},[]),(0,a.jsxs)("div",{className:(0,s.cn)("relative",r),children:[(0,a.jsx)("div",{ref:l,className:"overflow-x-auto",children:t}),(0,a.jsx)("div",{"aria-hidden":!0,className:(0,s.cn)("pointer-events-none absolute left-0 top-0 bottom-0 w-8 bg-gradient-to-r from-bg-surface to-transparent transition-opacity duration-150",i?"opacity-100":"opacity-0")}),(0,a.jsx)("div",{"aria-hidden":!0,className:(0,s.cn)("pointer-events-none absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-bg-surface to-transparent transition-opacity duration-150",c?"opacity-100":"opacity-0")})]})}},25016:(e,t,r)=>{"use strict";r.d(t,{BC:()=>h,P6:()=>b,PJ:()=>x,R8:()=>d,a3:()=>u,az:()=>o,cn:()=>s,jh:()=>i,l7:()=>c,r6:()=>m});var a=r(2821),n=r(75889);function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,n.QP)((0,a.$)(t))}function l(e,t){var r;return new Intl.NumberFormat("en-US",{maximumFractionDigits:null!=(r=null==t?void 0:t.maxFrac)?r:0}).format(e)}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return Number.isFinite(e)?"zh"===t?e>=1e8?(e/1e8).toFixed(2)+"亿":e>=1e4?(e/1e4).toFixed(1)+"万":l(e):e>=1e9?(e/1e9).toFixed(2)+"B":e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":l(e):"0"}function o(e,t){var r,a;return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:null!=(r=null==t?void 0:t.minFrac)?r:2,maximumFractionDigits:null!=(a=null==t?void 0:t.maxFrac)?a:2}).format(e)}function c(e){return 0===e?"$0":e<.01?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(e):o(e)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isFinite(e)?"".concat((100*e).toFixed(t),"%"):"0%"}function u(e){if(e<1e3)return"".concat(e,"ms");let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let r=Math.floor(t/60);if(r<60){let e=t%60;return e?"".concat(r,"m ").concat(e,"s"):"".concat(r,"m")}let a=Math.floor(r/60),n=r%60;return n?"".concat(a,"h ").concat(n,"m"):"".concat(a,"h")}function m(e){let t="string"==typeof e||"number"==typeof e?new Date(e):e;if(Number.isNaN(t.getTime()))return"";let r=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),l=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return"".concat(r,"-").concat(a,"-").concat(n," ").concat(s,":").concat(l,":").concat(i)}function x(e){if(!e)return"(unknown)";let t=e.replace(/[/\\]+$/,"").split(/[/\\]+/);return t[t.length-1]||e}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.replace(/-/g,"").slice(0,t):""}let p={mini:"Mini",nano:"Nano",pro:"Pro",turbo:"Turbo",preview:"Preview"};function b(e){if(!e)return"(unknown)";let t=e.replace(/^(vertex_ai|bedrock|anthropic|openai)\//,""),r=t.toLowerCase();if(r.startsWith("gpt-")||/^o\d/.test(r))return r.startsWith("gpt-")?"GPT-"+t.slice(4).split("-").map(e=>{var t;return null!=(t=p[e.toLowerCase()])?t:e}).join(" "):t.toUpperCase();let a=t.replace(/-(\d{8})$/,""),n=(a=a.replace(/^claude-/,"")).split("-");if(n.length>=2){let e=n[0],t=n.slice(1).join(".");return g(e)+" "+t}return g(a.replace(/-/g," "))}function g(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}},25577:(e,t,r)=>{"use strict";r.d(t,{UsageTable:()=>h});var a=r(95155),n=r(12115),s=r(20063),l=r(25016),i=r(51148),o=r(47650);function c(e){let{children:t,content:r,className:s,panelClassName:i,align:c="left",delay:d=100,maxWidth:u=360}=e,m=(0,n.useRef)(null),x=(0,n.useRef)(null),h=(0,n.useRef)(null),[p,b]=(0,n.useState)(null),[g,f]=(0,n.useState)(!1),[j,y]=(0,n.useState)(!1);function v(){h.current&&(window.clearTimeout(h.current),h.current=null),j||(x.current=window.setTimeout(()=>{let e=function(){let e,t=m.current;if(!t)return null;let r=t.getBoundingClientRect(),a=Math.min(u,window.innerWidth-16),n=window.innerHeight-r.bottom<200?"top":"bottom";return"right"===c?(e=Math.min(r.right,window.innerWidth-8))-a<8&&(e=a+8):(e=Math.max(r.left,8))+a>window.innerWidth-8&&(e=window.innerWidth-a-8),{x:e,y:"bottom"===n?r.bottom+8:r.top-8,placement:n,align:c}}();e&&(b(e),y(!0))},d))}function w(){x.current&&(window.clearTimeout(x.current),x.current=null),h.current=window.setTimeout(()=>y(!1),80)}return(0,n.useEffect)(()=>f(!0),[]),(0,n.useEffect)(()=>()=>{x.current&&window.clearTimeout(x.current),h.current&&window.clearTimeout(h.current)},[]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{ref:m,onMouseEnter:v,onMouseLeave:w,onFocus:v,onBlur:w,className:(0,l.cn)("inline-block",s),children:t}),g&&p&&(0,o.createPortal)((0,a.jsx)("div",{onMouseEnter:()=>{h.current&&(window.clearTimeout(h.current),h.current=null)},onMouseLeave:w,style:{position:"fixed",left:"right"===p.align?void 0:p.x,right:"right"===p.align?window.innerWidth-p.x:void 0,top:"bottom"===p.placement?p.y:void 0,bottom:"top"===p.placement?window.innerHeight-p.y:void 0,maxWidth:u,transform:j?"translateY(0) scale(1)":"bottom"===p.placement?"translateY(-4px) scale(0.98)":"translateY(4px) scale(0.98)",opacity:+!!j,transitionProperty:"opacity, transform",transitionDuration:"120ms",transitionTimingFunction:"cubic-bezier(0.16, 1, 0.3, 1)",transformOrigin:"bottom"===p.placement?"top":"bottom",pointerEvents:j?"auto":"none"},className:(0,l.cn)("z-50 card border-border-hi shadow-xl rounded-button",i),children:r}),document.body)]})}var d=r(20857);let u=[{id:"time",labelKey:"usage.col.time",sortKey:"timestamp",defaultVisible:!0},{id:"duration",labelKey:"usage.col.duration",align:"right",sortKey:"durationMs",defaultVisible:!1},{id:"prompt",labelKey:"usage.col.userMessage",defaultVisible:!0},{id:"model",labelKey:"usage.col.model",defaultVisible:!0},{id:"project",labelKey:"usage.col.project",defaultVisible:!0},{id:"session",labelKey:"usage.col.session",defaultVisible:!1},{id:"calls",labelKey:"usage.col.calls",align:"right",sortKey:"callCount",defaultVisible:!1},{id:"input",labelKey:"usage.col.input",align:"right",sortKey:"inputTokens",defaultVisible:!1},{id:"output",labelKey:"usage.col.output",align:"right",sortKey:"outputTokens",defaultVisible:!1},{id:"cacheRead",labelKey:"usage.col.cacheRead",align:"right",sortKey:"cacheReadTokens",defaultVisible:!1},{id:"cacheWrite",labelKey:"usage.col.cacheWrite",align:"right",sortKey:"cacheCreationTokens",defaultVisible:!1},{id:"total",labelKey:"usage.col.total",align:"right",sortKey:"totalTokens",defaultVisible:!0},{id:"cost",labelKey:"usage.col.cost",align:"right",sortKey:"cost",defaultVisible:!1},{id:"tools",labelKey:"usage.col.tools",defaultVisible:!1}],m="ccgauge.usage.cols.v4";function x(){return u.reduce((e,t)=>(e[t.id]=t.defaultVisible,e),{})}function h(e){let{rows:t,totalCount:r,page:l,pageCount:o,sort:c,query:h}=e,b=(0,i.kj)(),{locale:f}=(0,i.s9)(),j=(0,s.useRouter)(),y=(0,s.usePathname)(),v=(0,s.useSearchParams)(),[w,N]=(0,n.useState)(new Set),[k,S]=(0,n.useState)(x),[C,K]=(0,n.useState)(!1),[R,T]=(0,n.useState)(h),P=(0,n.useRef)(null),E=(0,n.useRef)(null);function L(e){let t=new URLSearchParams(v.toString());for(let[r,a]of Object.entries(e))void 0===a||""===a?t.delete(r):t.set(r,a);let r=t.toString();j.push(r?"".concat(y,"?").concat(r):y)}function M(e){L({page:e>0?String(e+1):void 0})}(0,n.useEffect)(()=>{S(function(){try{let e=window.localStorage.getItem(m);if(!e)return x();let t=JSON.parse(e),r=x();for(let e of u)"boolean"==typeof t[e.id]&&(r[e.id]=t[e.id]);return r}catch(e){return x()}}())},[]),(0,n.useEffect)(()=>{window.localStorage.setItem(m,JSON.stringify(k))},[k]),(0,n.useEffect)(()=>{T(h)},[h]),(0,n.useEffect)(()=>{function e(e){P.current&&!P.current.contains(e.target)&&K(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,n.useEffect)(()=>()=>{E.current&&(window.clearTimeout(E.current),E.current=null)},[]);let F=u.filter(e=>k[e.id]),A=F.length+1,I=F.length;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-3 flex-wrap",children:[(0,a.jsx)("input",{value:R,onChange:e=>{var t;T(t=e.target.value),E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{L({q:t.trim()||void 0,page:void 0})},300)},placeholder:b("common.searchPlaceholder"),className:"px-3 py-1.5 text-sm rounded-button border border-border bg-bg-surface focus:outline-none focus:border-border-hi w-72 placeholder:text-text-tertiary text-text-primary"}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"text-xs text-text-tertiary tabular-nums",children:b("common.rows",{count:r.toLocaleString()})}),(0,a.jsxs)("div",{ref:P,className:"relative",children:[(0,a.jsxs)("button",{onClick:()=>K(e=>!e),className:"btn",children:[b("usage.columns.button"),(0,a.jsx)("span",{className:"ml-1 text-text-tertiary tabular-nums",children:I})]}),C&&(0,a.jsxs)("div",{className:"absolute right-0 mt-1 w-56 card border-border-hi shadow-lg p-2 z-30",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-1.5 pb-1.5 mb-1 border-b border-border",children:[(0,a.jsx)("span",{className:"text-xs text-text-tertiary uppercase tracking-wide",children:b("usage.columns.title")}),(0,a.jsx)("button",{onClick:()=>S(x()),className:"text-xs text-text-tertiary hover:text-text-primary",children:b("usage.columns.reset")})]}),(0,a.jsx)("div",{className:"max-h-72 overflow-auto",children:u.map(e=>(0,a.jsxs)("label",{className:"flex items-center gap-2 px-1.5 py-1.5 text-sm rounded hover:bg-bg-surface-hi cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:!!k[e.id],onChange:t=>S(r=>({...r,[e.id]:t.target.checked})),className:"accent-brand"}),(0,a.jsx)("span",{className:"text-text-secondary",children:b(e.labelKey)})]},e.id))})]})]}),(0,a.jsx)("button",{onClick:function(){let e=new URLSearchParams(v.toString());window.location.href="/api/export/usage?".concat(e.toString())},className:"btn",children:b("common.exportCsv")})]})]}),(0,a.jsx)("div",{className:"card overflow-hidden",children:(0,a.jsx)(d.H,{children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-border bg-bg-surface-hi/30",children:[(0,a.jsx)(g,{children:(0,a.jsx)("span",{className:"sr-only",children:"expand"})}),F.map(e=>(0,a.jsx)(g,{align:e.align,sorted:!!e.sortKey&&c.key===e.sortKey,dir:c.dir,onClick:e.sortKey?()=>{var t;let r;return t=e.sortKey,r="desc",void(c.key===t&&(r="asc"===c.dir?"desc":"asc"),L({sort:"timestamp"===t?void 0:t,dir:"desc"===r?void 0:r,page:void 0}))}:void 0,children:b(e.labelKey)},e.id))]})}),(0,a.jsxs)("tbody",{children:[t.map(e=>{let t=w.has(e.turnId),r=e.userText.trim()||b("usage.turn.noPrompt");return(0,a.jsx)(p,{turn:e,isOpen:t,onToggle:()=>{var t;return t=e.turnId,void N(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},userText:r,expandLabel:b("usage.turn.expand"),collapseLabel:b("usage.turn.collapse"),activeColumns:F,locale:f,t:b},e.turnId)}),0===t.length&&(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:A,className:"px-3 py-8 text-center text-text-tertiary text-sm",children:b("common.noMatchingRows")})})]})]})})}),o>1&&(0,a.jsxs)("div",{className:"flex items-center justify-between mt-3 text-xs text-text-secondary",children:[(0,a.jsx)("span",{children:b("common.pageOf",{page:l+1,total:o})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>M(0),disabled:0===l,className:"btn-ghost disabled:opacity-40",children:b("common.first")}),(0,a.jsx)("button",{onClick:()=>M(l-1),disabled:0===l,className:"btn-ghost disabled:opacity-40",children:b("common.prev")}),(0,a.jsx)("button",{onClick:()=>M(l+1),disabled:l>=o-1,className:"btn-ghost disabled:opacity-40",children:b("common.next")}),(0,a.jsx)("button",{onClick:()=>M(o-1),disabled:l>=o-1,className:"btn-ghost disabled:opacity-40",children:b("common.last")})]})]})]})}function p(e){let{turn:t,isOpen:r,onToggle:n,userText:s,expandLabel:i,collapseLabel:o,activeColumns:d,locale:u,t:m}=e,x=(1===t.models.length?(0,l.P6)(t.models[0]):"".concat((0,l.P6)(t.models[0])," +").concat(t.models.length-1))+(t.efforts.length?1===t.efforts.length?" \xb7 ".concat(t.efforts[0]):" \xb7 ".concat(t.efforts[0],"+").concat(t.efforts.length-1):""),h=t.toolNames.length?t.toolNames.slice(0,3).join(", ")+(t.toolNames.length>3?"…":""):"—";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-surface-hi/40 cursor-pointer",onClick:n,children:[(0,a.jsx)("td",{className:"px-2 py-2 text-text-tertiary w-6 text-center select-none",children:(0,a.jsx)("span",{title:r?o:i,className:"inline-block w-4",children:r?"▾":"▸"})}),d.map(e=>(0,a.jsx)("td",{className:(0,l.cn)("px-3 py-2","right"===e.align?"text-right":"text-left"),children:function(e,t,r,n,s,i,o){switch(e){case"time":return(0,a.jsx)("span",{className:"num-mono text-text-secondary whitespace-nowrap text-xs",title:"started ".concat((0,l.r6)(t.timestamp),"\nended ").concat((0,l.r6)(t.endTimestamp)),children:(0,l.r6)(t.timestamp)});case"duration":return(0,a.jsx)("span",{className:"num-mono text-text-secondary whitespace-nowrap text-xs",title:"".concat((0,l.r6)(t.timestamp)," → ").concat((0,l.r6)(t.endTimestamp)),children:(0,l.a3)(t.durationMs)});case"prompt":return(0,a.jsx)(c,{maxWidth:460,panelClassName:"p-3 text-sm text-text-secondary leading-relaxed",content:(0,a.jsx)("div",{className:"whitespace-pre-wrap break-words",children:s}),children:(0,a.jsx)("span",{className:"block text-text-secondary truncate max-w-[280px]",children:s})});case"model":return(0,a.jsx)("span",{className:"text-text-primary whitespace-nowrap",children:r});case"project":return(0,a.jsx)("span",{className:"block text-text-secondary truncate max-w-[180px]",title:t.cwd,children:t.projectLabel||(0,l.PJ)(t.cwd)});case"session":return(0,a.jsx)("span",{className:"num-mono text-text-tertiary text-xs",title:t.sessionId,children:(0,l.BC)(t.sessionId)});case"calls":return(0,a.jsx)("span",{className:"num-mono text-text-secondary",children:t.callCount});case"input":return(0,a.jsx)("span",{className:"num-mono text-text-secondary",children:(0,l.jh)(t.inputTokens,i)});case"output":return(0,a.jsx)("span",{className:"num-mono text-text-secondary",children:(0,l.jh)(t.outputTokens,i)});case"cacheRead":return(0,a.jsx)("span",{className:"num-mono text-success",children:(0,l.jh)(t.cacheReadTokens,i)});case"cacheWrite":return(0,a.jsx)("span",{className:"num-mono text-text-secondary",children:(0,l.jh)(t.cacheCreationTokens,i)});case"total":return(0,a.jsx)(c,{align:"right",maxWidth:300,panelClassName:"p-0 overflow-hidden",content:(0,a.jsx)(b,{row:t,locale:i,t:o}),children:(0,a.jsx)("span",{className:"num-mono text-text-primary font-medium border-b border-dashed border-border hover:border-text-tertiary cursor-help",children:(0,l.jh)(t.totalTokens,i)})});case"cost":return(0,a.jsx)("span",{className:"num-mono text-text-primary font-medium",children:(0,l.l7)(t.cost)});case"tools":return(0,a.jsx)("span",{className:"block text-xs text-text-tertiary truncate max-w-[160px]",title:t.toolNames.join(", "),children:n})}}(e.id,t,x,h,s,u,m)},e.id))]}),r&&t.children.map(e=>(0,a.jsxs)("tr",{className:"border-b border-border last:border-b-0 bg-bg-surface-hi/20 text-text-tertiary",children:[(0,a.jsx)("td",{className:"px-2 py-1.5 w-6"}),d.map(r=>(0,a.jsx)("td",{className:(0,l.cn)("px-3 py-1.5","right"===r.align?"text-right":"text-left"),children:function(e,t,r,n,s){switch(e){case"time":return(0,a.jsx)("span",{className:"num-mono whitespace-nowrap text-xs inline-block translate-x-5",children:(0,l.r6)(t.timestamp)});case"duration":return(0,a.jsx)("span",{className:"text-xs text-text-tertiary",children:"—"});case"prompt":{var i;let e=(null!=(i=t.directPrompt)?i:"").trim();if(e&&e!==r.trim())return(0,a.jsx)("span",{className:"block text-xs text-text-secondary truncate max-w-[320px]",title:e,children:e});if(!t.toolNames.length)return(0,a.jsx)("span",{className:"text-xs text-text-tertiary",children:"—"});let n=t.toolNames.join(", "),s=t.toolNames.slice(0,3).join(", ")+(t.toolNames.length>3?"…":"");return(0,a.jsx)("span",{className:"block text-xs text-text-secondary truncate max-w-[280px]",title:n,children:s})}case"model":return(0,a.jsxs)("span",{className:"whitespace-nowrap",children:[(0,l.P6)(t.model),t.effort?" \xb7 ".concat(t.effort):""]});case"project":return(0,a.jsx)("span",{className:"block truncate max-w-[180px]",title:t.cwd,children:t.projectLabel||(0,l.PJ)(t.cwd)});case"session":return(0,a.jsx)("span",{className:"num-mono text-xs",title:t.sessionId,children:(0,l.BC)(t.sessionId)});case"calls":return(0,a.jsx)("span",{className:"num-mono",children:"1"});case"input":return(0,a.jsx)("span",{className:"num-mono",children:(0,l.jh)(t.inputTokens,n)});case"output":return(0,a.jsx)("span",{className:"num-mono",children:(0,l.jh)(t.outputTokens,n)});case"cacheRead":return(0,a.jsx)("span",{className:"num-mono text-success",children:(0,l.jh)(t.cacheReadTokens,n)});case"cacheWrite":return(0,a.jsx)("span",{className:"num-mono",children:(0,l.jh)(t.cacheCreationTokens,n)});case"total":return(0,a.jsx)(c,{align:"right",maxWidth:300,panelClassName:"p-0 overflow-hidden",content:(0,a.jsx)(b,{row:t,locale:n,t:s}),children:(0,a.jsx)("span",{className:"num-mono border-b border-dashed border-border/60 hover:border-text-tertiary cursor-help",children:(0,l.jh)(t.totalTokens,n)})});case"cost":return(0,a.jsx)("span",{className:"num-mono",children:(0,l.l7)(t.cost)});case"tools":return(0,a.jsx)("span",{className:"block text-xs truncate max-w-[160px]",title:t.toolNames.join(", "),children:t.toolNames.length?t.toolNames.join(", "):"—"})}}(r.id,e,t.userText,u,m)},r.id))]},e.uuid))]})}function b(e){let{row:t,locale:r,t:s}=e,i=[{key:"input",label:s("usage.col.input"),tokens:t.inputTokens,cost:t.costInput,tone:"text-text-primary",dot:"bg-chart-input"},{key:"output",label:s("usage.col.output"),tokens:t.outputTokens,cost:t.costOutput,tone:"text-text-primary",dot:"bg-chart-output"},{key:"cacheRead",label:s("usage.col.cacheRead"),tokens:t.cacheReadTokens,cost:t.costCacheRead,tone:"text-success",dot:"bg-chart-cache-read"},{key:"cacheWrite",label:s("usage.col.cacheWrite"),tokens:t.cacheCreationTokens,cost:t.costCacheWrite,tone:"text-text-primary",dot:"bg-chart-cache-create"}];return(0,a.jsxs)("div",{className:"text-xs",children:[(0,a.jsx)("div",{className:"px-3 py-2 border-b border-border bg-bg-surface-hi/40 text-text-tertiary uppercase tracking-wide font-medium",children:s("usage.breakdown.title")}),(0,a.jsxs)("div",{className:"px-3 py-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[auto_1fr_auto] gap-x-3 gap-y-1.5 items-center",children:[(0,a.jsx)("span",{}),(0,a.jsx)("span",{className:"text-text-tertiary text-[10px] uppercase tracking-wide text-right",children:s("usage.breakdown.headerTokens")}),(0,a.jsx)("span",{className:"text-text-tertiary text-[10px] uppercase tracking-wide text-right",children:s("usage.breakdown.headerCost")}),i.map(e=>(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-2 text-text-secondary",children:[(0,a.jsx)("span",{className:(0,l.cn)("w-2 h-2 rounded-sm",e.dot)}),e.label]}),(0,a.jsx)("span",{className:(0,l.cn)("num-mono text-right",e.tone),children:(0,l.jh)(e.tokens,r)}),(0,a.jsx)("span",{className:"num-mono text-right text-text-secondary",children:(0,l.l7)(e.cost)}),"output"===e.key&&t.reasoningTokens>0&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-2 text-text-tertiary pl-4 text-[11px]",children:[(0,a.jsx)("span",{className:"text-text-tertiary",children:"↳"}),s("usage.breakdown.reasoning")]}),(0,a.jsx)("span",{className:"num-mono text-right text-text-tertiary text-[11px]",children:(0,l.jh)(t.reasoningTokens,r)}),(0,a.jsx)("span",{className:"text-right text-text-tertiary text-[11px]",children:s("usage.breakdown.reasoningNote")})]},"reasoning-detail")]},e.key))]}),(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-border grid grid-cols-[auto_1fr_auto] gap-x-3 items-center",children:[(0,a.jsx)("span",{className:"text-text-secondary font-medium",children:s("usage.breakdown.total")}),(0,a.jsx)("span",{className:"num-mono text-right text-text-primary font-medium",children:(0,l.jh)(t.totalTokens,r)}),(0,a.jsx)("span",{className:"num-mono text-right text-text-primary font-medium",children:(0,l.l7)(t.cost)})]})]})]})}function g(e){let{children:t,align:r="left",sorted:n,dir:s,onClick:i}=e;return(0,a.jsx)("th",{className:(0,l.cn)("px-3 py-2 text-xs font-medium text-text-tertiary uppercase tracking-wide whitespace-nowrap","right"===r?"text-right":"text-left",i&&"cursor-pointer hover:text-text-primary select-none"),onClick:i,children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1",children:[t,n&&(0,a.jsx)("span",{className:"text-[10px]",children:"asc"===s?"▲":"▼"})]})})}},35850:(e,t,r)=>{"use strict";r.d(t,{K:()=>o});var a=r(95155),n=r(20063),s=r(12115),l=r(25016),i=r(51148);function o(e){let t,{paramKey:r,all:o,selected:c,render:d=e=>e,labelAllKey:u,labelSingleKey:m,labelMultiKey:x,ariaLabel:h,searchThreshold:p=6}=e,b=(0,n.useRouter)(),g=(0,n.usePathname)(),f=(0,n.useSearchParams)(),j=(0,i.kj)(),[y,v]=(0,s.useState)(!1),[w,N]=(0,s.useState)(""),[k,S]=(0,s.useState)(0),C=(0,s.useRef)(null),K=(0,s.useRef)(null),R=(0,s.useRef)(null),T=(0,s.useRef)(null),P=(0,s.useId)(),E=(0,s.useId)();(0,s.useEffect)(()=>{if(y)return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)};function e(e){C.current&&!C.current.contains(e.target)&&v(!1)}function t(e){if("Escape"===e.key){var t;v(!1),null==(t=K.current)||t.focus()}}},[y]),(0,s.useEffect)(()=>{y&&o.length>=p&&requestAnimationFrame(()=>{var e;return null==(e=R.current)?void 0:e.focus()}),y||(N(""),S(0))},[y,o.length,p]);let L=(0,s.useMemo)(()=>{let e=w.trim().toLowerCase();return e?o.filter(t=>d(t).toLowerCase().includes(e)||t.toLowerCase().includes(e)):o},[o,w,d]);function M(e){let t=new URLSearchParams(f.toString());0===e.size?t.delete(r):t.set(r,Array.from(e).join(","));let a=t.toString();b.push(a?"".concat(g,"?").concat(a):g)}function F(e){let t=new Set(c);t.has(e)?t.delete(e):t.add(e),M(t)}function A(e){if("ArrowDown"===e.key)e.preventDefault(),S(e=>Math.min(L.length-1,e+1));else if("ArrowUp"===e.key)e.preventDefault(),S(e=>Math.max(0,e-1));else if("Enter"===e.key){e.preventDefault();let t=L[k];t&&F(t)}else"Home"===e.key?(e.preventDefault(),S(0)):"End"===e.key&&(e.preventDefault(),S(L.length-1))}t=0===c.length?j(u):1===c.length?j(m,{value:d(c[0])}):j(x,{count:c.length});let I=o.length>=p;return(0,a.jsxs)("div",{ref:C,className:"relative",children:[(0,a.jsxs)("button",{ref:K,id:P,onClick:()=>v(e=>!e),className:"btn focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40","aria-haspopup":"listbox","aria-expanded":y,"aria-controls":E,"aria-label":h,children:[t,(0,a.jsx)("span",{className:"text-text-tertiary ml-1","aria-hidden":!0,children:"▾"})]}),y&&(0,a.jsxs)("div",{id:E,role:"listbox","aria-multiselectable":"true","aria-labelledby":P,className:"absolute right-0 mt-1 w-72 card border-border-hi shadow-lg z-20 overflow-hidden",children:[c.length>0&&(0,a.jsxs)("div",{className:"px-2 pt-2 pb-1.5 border-b border-border flex flex-wrap gap-1 items-center",children:[c.slice(0,6).map(e=>(0,a.jsxs)("button",{onClick:()=>F(e),className:"inline-flex items-center gap-1 max-w-[160px] pl-2 pr-1.5 py-0.5 text-[11px] rounded-full bg-brand/10 text-brand border border-brand/20 hover:bg-brand/15","aria-label":"Remove ".concat(d(e)),title:d(e),children:[(0,a.jsx)("span",{className:"truncate",children:d(e)}),(0,a.jsx)("span",{"aria-hidden":!0,className:"text-brand/70",children:"\xd7"})]},e)),c.length>6&&(0,a.jsxs)("span",{className:"text-[11px] text-text-tertiary px-1",children:["+",c.length-6]}),(0,a.jsx)("button",{onClick:function(){M(new Set)},className:"ml-auto text-[11px] text-text-tertiary hover:text-text-primary px-1.5 py-0.5",children:j("filter.clearAll")})]}),I&&(0,a.jsx)("div",{className:"p-2 border-b border-border",children:(0,a.jsx)("input",{ref:R,value:w,onChange:e=>{N(e.target.value),S(0)},onKeyDown:e=>{("ArrowDown"===e.key||"ArrowUp"===e.key||"Enter"===e.key||"Home"===e.key||"End"===e.key)&&A(e)},placeholder:j("common.searchPlaceholder"),className:"w-full px-2 py-1 text-sm rounded border border-border bg-bg-surface focus:outline-none focus:border-border-hi placeholder:text-text-tertiary text-text-primary"})}),(0,a.jsxs)("div",{ref:T,onKeyDown:A,className:"max-h-64 overflow-y-auto p-1 outline-none",tabIndex:-1,children:[0===L.length&&(0,a.jsx)("div",{className:"text-xs text-text-tertiary px-2 py-3 text-center",children:j("filter.noOptions")}),L.map((e,t)=>{let r=c.includes(e),n=t===k;return(0,a.jsxs)("button",{role:"option","aria-selected":r,onMouseEnter:()=>S(t),onClick:()=>F(e),className:(0,l.cn)("w-full text-left text-sm px-2 py-1.5 rounded flex items-center gap-2 transition-colors",n?"bg-bg-surface-hi":"hover:bg-bg-surface-hi",r&&"text-text-primary"),children:[(0,a.jsx)("span",{className:(0,l.cn)("w-3.5 h-3.5 rounded-sm border flex items-center justify-center text-[10px] flex-shrink-0",r?"bg-brand border-brand text-white":"border-border-hi"),"aria-hidden":!0,children:r?"✓":""}),(0,a.jsx)("span",{className:"truncate",children:d(e)})]},e)})]})]})]})}},36392:(e,t,r)=>{Promise.resolve().then(r.bind(r,77549)),Promise.resolve().then(r.bind(r,38059)),Promise.resolve().then(r.bind(r,16633)),Promise.resolve().then(r.bind(r,8336)),Promise.resolve().then(r.bind(r,44512)),Promise.resolve().then(r.bind(r,14920)),Promise.resolve().then(r.bind(r,7152)),Promise.resolve().then(r.bind(r,25577))},38059:(e,t,r)=>{"use strict";r.d(t,{TokenStackChart:()=>h});var a=r(95155),n=r(26991),s=r(94632),l=r(68425),i=r(47734),o=r(73697),c=r(23508),d=r(26736),u=r(25016),m=r(51148);let x={input:"rgb(var(--chart-input))",output:"rgb(var(--chart-output))",cacheRead:"rgb(var(--chart-cache-read))",cacheCreation:"rgb(var(--chart-cache-create))"};function h(e){let{data:t,height:r="h-72"}=e,h=(0,m.kj)(),{locale:g}=(0,m.s9)();return t.length?(0,a.jsxs)("div",{className:"".concat(r," w-full"),children:[(0,a.jsx)(n.u,{width:"100%",height:"100%",children:(0,a.jsxs)(s.E,{data:t,margin:{top:12,right:8,bottom:4,left:8},barCategoryGap:"22%",children:[(0,a.jsx)(l.d,{stroke:"rgb(var(--chart-grid))",strokeOpacity:.6,strokeDasharray:"3 3",vertical:!1}),(0,a.jsx)(i.W,{dataKey:"label",tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,interval:"preserveStartEnd",minTickGap:32,tickMargin:8}),(0,a.jsx)(o.h,{tickFormatter:e=>(0,u.jh)(Number(e),g),tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,width:56,tickMargin:4}),(0,a.jsx)(c.m,{content:(0,a.jsx)(b,{}),cursor:{fill:"rgb(var(--text-primary) / 0.05)",radius:4}}),(0,a.jsx)(d.y,{dataKey:"input",stackId:"a",fill:x.input,isAnimationActive:!1}),(0,a.jsx)(d.y,{dataKey:"cacheCreation",stackId:"a",fill:x.cacheCreation,isAnimationActive:!1}),(0,a.jsx)(d.y,{dataKey:"cacheRead",stackId:"a",fill:x.cacheRead,isAnimationActive:!1}),(0,a.jsx)(d.y,{dataKey:"output",stackId:"a",fill:x.output,radius:[4,4,0,0],isAnimationActive:!1})]})}),(0,a.jsxs)("div",{className:"flex items-center flex-wrap justify-center gap-4 text-xs text-text-secondary mt-2",children:[(0,a.jsx)(p,{color:x.input,label:h("chart.legend.input")}),(0,a.jsx)(p,{color:x.cacheCreation,label:h("chart.legend.cacheWrite")}),(0,a.jsx)(p,{color:x.cacheRead,label:h("chart.legend.cacheRead")}),(0,a.jsx)(p,{color:x.output,label:h("chart.legend.output")})]})]}):(0,a.jsx)("div",{className:"".concat(r," flex items-center justify-center text-text-tertiary text-sm"),children:h("chart.empty")})}function p(e){let{color:t,label:r}=e;return(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"w-2.5 h-2.5 rounded-sm",style:{background:t}}),(0,a.jsx)("span",{children:r})]})}function b(e){let t=(0,m.kj)(),{locale:r}=(0,m.s9)();if(!e.active||!e.payload||!e.payload.length)return null;let n=e.payload[0].payload,s=n.input+n.output+n.cacheRead+n.cacheCreation;return(0,a.jsxs)("div",{className:"card-elevated border border-border-hi rounded-card p-3 text-xs min-w-[200px]",children:[(0,a.jsx)("div",{className:"font-medium text-text-primary mb-2",children:e.label}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(g,{color:x.input,label:t("chart.legend.input"),value:n.input,locale:r}),(0,a.jsx)(g,{color:x.cacheCreation,label:t("chart.legend.cacheWrite"),value:n.cacheCreation,locale:r}),(0,a.jsx)(g,{color:x.cacheRead,label:t("chart.legend.cacheRead"),value:n.cacheRead,locale:r}),(0,a.jsx)(g,{color:x.output,label:t("chart.legend.output"),value:n.output,locale:r})]}),(0,a.jsxs)("div",{className:"mt-2 pt-2 border-t border-border flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.total")}),(0,a.jsx)("span",{className:"num-mono text-text-primary",children:(0,u.jh)(s,r)})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,a.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.cost")}),(0,a.jsx)("span",{className:"num-mono text-brand",children:(0,u.az)(n.cost)})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,a.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.requests")}),(0,a.jsx)("span",{className:"num-mono text-text-primary",children:n.requests})]})]})}function g(e){let{color:t,label:r,value:n,locale:s}=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-text-secondary",children:[(0,a.jsx)("span",{className:"w-2 h-2 rounded-sm",style:{background:t}}),r]}),(0,a.jsx)("span",{className:"num-mono text-text-primary",children:(0,u.jh)(n,s)})]})}},44512:(e,t,r)=>{"use strict";r.d(t,{OverviewToggle:()=>c});var a=r(95155),n=r(12115),s=r(25016),l=r(51148);let i="data-usage-overview",o="hidden";function c(){let e=(0,l.kj)(),[t,r]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{r(document.documentElement.getAttribute(i)===o)},[]),(0,a.jsxs)("button",{type:"button",onClick:function(){let e=!t;r(e);try{localStorage.setItem("ccgauge.usage.overview.hidden",e?"1":"0")}catch(e){}e?document.documentElement.setAttribute(i,o):document.documentElement.removeAttribute(i)},"aria-pressed":!t,title:e(t?"usage.overview.show":"usage.overview.hide"),className:(0,s.cn)("inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-button text-xs font-medium","border transition-colors duration-150",t?"border-border bg-bg-surface text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi":"border-brand/40 bg-brand/12 text-brand hover:bg-brand/20 hover:border-brand/60"),children:[(0,a.jsx)(d,{open:!t}),(0,a.jsx)("span",{className:"hidden sm:inline",children:e("usage.overview.label")})]})}function d(e){let{open:t}=e;return(0,a.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"}),(0,a.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("path",{d:"M9.88 9.88a3 3 0 0 0 4.24 4.24"}),(0,a.jsx)("path",{d:"M10.73 5.08A11 11 0 0 1 12 5c6.5 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),(0,a.jsx)("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3.5 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),(0,a.jsx)("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]})})}},77549:(e,t,r)=>{"use strict";r.d(t,{AutoRefresh:()=>s});var a=r(12115),n=r(20063);function s(e){let{intervalMs:t=15e3}=e,r=(0,n.useRouter)(),s=(0,a.useRef)(!1);return(0,a.useEffect)(()=>{if(t<=0)return;let e=null;function a(){if(!document.hidden&&!s.current){s.current=!0;try{r.refresh()}finally{Promise.resolve().then(()=>{s.current=!1})}}}return e=window.setInterval(a,t),document.addEventListener("visibilitychange",a),()=>{null!==e&&window.clearInterval(e),document.removeEventListener("visibilitychange",a)}},[r,t]),null}}},e=>{e.O(0,[760,930,148,441,255,358],()=>e(e.s=36392)),_N_E=e.O()}]);