ccgauge 1.2.0 → 1.2.1
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.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-build-manifest.json +33 -33
- package/.next/standalone/.next/app-path-routes-manifest.json +7 -7
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/blocks/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/export/usage/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/scan/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/turns/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/usage/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/models/page.js +1 -1
- package/.next/standalone/.next/server/app/models/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/page.js +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/sessions/page.js +1 -1
- package/.next/standalone/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page.js +2 -2
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/usage/page.js +1 -1
- package/.next/standalone/.next/server/app/usage/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +7 -7
- package/.next/standalone/.next/server/chunks/697.js +1 -1
- package/.next/standalone/.next/server/functions-config-manifest.json +5 -5
- package/.next/standalone/.next/server/middleware-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/static/chunks/app/usage/page-8ff1ec4ef6aa86a0.js +1 -0
- package/.next/standalone/package.json +1 -1
- package/CHANGELOG.md +24 -0
- package/dist/mcp/server.mjs +2 -2
- package/package.json +1 -1
- package/.next/standalone/.next/static/chunks/app/usage/page-1ffeadfacd55c9f0.js +0 -1
- /package/.next/standalone/.next/static/{KYCxLofmJUzQwVpdBlibl → OqoHJlqnd6wl-Y-PBHJaU}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{KYCxLofmJUzQwVpdBlibl → OqoHJlqnd6wl-Y-PBHJaU}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[430],{1467:(e,t,r)=>{"use strict";r.d(t,{UsageDataIsland:()=>P});var n=r(95155),a=r(12115),s=r(20063),o=r(51148),l=r(79808),i=r(7331),c=r(25016);function d(e){var t;let{label:r,value:a,hint:s,delta:o,deltaTitle:l,progress:i,accent:d="default",className:h}=e;return(0,n.jsxs)("div",{className:(0,c.cn)("card card-pad relative flex flex-col gap-2 min-h-[132px] overflow-hidden","default"!==d&&"pt-[18px] sm:pt-[22px]",h),children:["default"!==d&&(0,n.jsx)(u,{tone:d}),(0,n.jsx)("div",{className:"label truncate",children:r}),(0,n.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap min-w-0",children:[(0,n.jsx)("div",{className:"num-hero min-w-0 max-w-full",children:a}),o&&"firstTime"in o&&o.firstTime&&(0,n.jsx)("span",{className:"pill text-[11px] font-medium whitespace-nowrap text-brand bg-brand/10 border border-brand/20",title:l,children:null!=(t=o.label)?t:"NEW"}),o&&"value"in o&&Number.isFinite(o.value)&&(0,n.jsx)(m,{value:o.value,positiveIsGood:o.positiveIsGood,title:l})]}),s&&(0,n.jsx)("div",{className:"text-xs text-text-secondary mt-auto leading-snug",children:s}),i&&(0,n.jsx)("div",{className:"mt-auto pt-2",children:(0,n.jsx)(x,{value:i.value,tone:i.tone})})]})}function u(e){let{tone:t}=e;return(0,n.jsx)("div",{"aria-hidden":!0,className:(0,c.cn)("absolute left-0 right-0 top-0 h-[3px] bg-gradient-to-r",{brand:"from-brand/0 via-brand/70 to-brand/0",success:"from-success/0 via-success/70 to-success/0",warning:"from-warning/0 via-warning/70 to-warning/0"}[t])})}function m(e){let{value:t,positiveIsGood:r=!0,title:a}=e,s=t>=0;return(0,n.jsxs)("span",{className:(0,c.cn)("pill text-[11px] font-medium whitespace-nowrap border",s===r?"text-success bg-success/10 border-success/20":"text-danger bg-danger/10 border-danger/20"),title:a,children:[s?"↑":"↓"," ",Math.abs(t).toFixed(0),"%"]})}function x(e){let{value:t,tone:r="brand"}=e,a=Math.max(0,Math.min(1,t));return(0,n.jsx)("div",{className:"h-1.5 w-full bg-bg-surface-hi rounded-full overflow-hidden",children:(0,n.jsx)("div",{className:(0,c.cn)("h-full rounded-full transition-all duration-500 ease-out-soft",{brand:"bg-brand",success:"bg-success",warning:"bg-warning",danger:"bg-danger"}[r]),style:{width:"".concat(100*a,"%")}})})}var h=r(38059),p=r(47650);function b(e){let{children:t,content:r,className:s,panelClassName:o,align:l="left",delay:i=100,maxWidth:d=360}=e,u=(0,a.useRef)(null),m=(0,a.useRef)(null),x=(0,a.useRef)(null),[h,b]=(0,a.useState)(null),[g,f]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1);function y(){x.current&&(window.clearTimeout(x.current),x.current=null),v||(m.current=window.setTimeout(()=>{let e=function(){let e,t=u.current;if(!t)return null;let r=t.getBoundingClientRect(),n=Math.min(d,window.innerWidth-16),a=window.innerHeight-r.bottom<200?"top":"bottom";return"right"===l?(e=Math.min(r.right,window.innerWidth-8))-n<8&&(e=n+8):(e=Math.max(r.left,8))+n>window.innerWidth-8&&(e=window.innerWidth-n-8),{x:e,y:"bottom"===a?r.bottom+8:r.top-8,placement:a,align:l}}();e&&(b(e),j(!0))},i))}function w(){m.current&&(window.clearTimeout(m.current),m.current=null),x.current=window.setTimeout(()=>j(!1),80)}return(0,a.useEffect)(()=>f(!0),[]),(0,a.useEffect)(()=>()=>{m.current&&window.clearTimeout(m.current),x.current&&window.clearTimeout(x.current)},[]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{ref:u,onMouseEnter:y,onMouseLeave:w,onFocus:y,onBlur:w,className:(0,c.cn)("inline-block",s),children:t}),g&&h&&(0,p.createPortal)((0,n.jsx)("div",{onMouseEnter:()=>{x.current&&(window.clearTimeout(x.current),x.current=null)},onMouseLeave:w,style:{position:"fixed",left:"right"===h.align?void 0:h.x,right:"right"===h.align?window.innerWidth-h.x:void 0,top:"bottom"===h.placement?h.y:void 0,bottom:"top"===h.placement?window.innerHeight-h.y:void 0,maxWidth:d,transform:v?"translateY(0) scale(1)":"bottom"===h.placement?"translateY(-4px) scale(0.98)":"translateY(4px) scale(0.98)",opacity:+!!v,transitionProperty:"opacity, transform",transitionDuration:"120ms",transitionTimingFunction:"cubic-bezier(0.16, 1, 0.3, 1)",transformOrigin:"bottom"===h.placement?"top":"bottom",pointerEvents:v?"auto":"none"},className:(0,c.cn)("z-50 card border-border-hi shadow-xl rounded-button",o),children:r}),document.body)]})}var g=r(20857),f=r(40464);let v=[{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}],j="ccgauge.usage.cols.v4";function y(){return v.reduce((e,t)=>(e[t.id]=t.defaultVisible,e),{})}function w(e){let{rows:t,totalCount:r,page:l,pageCount:i,sort:d,query:u,codexFastActive:m}=e,x=(0,o.kj)(),{locale:h}=(0,o.s9)(),p=(0,s.usePathname)(),b=(0,s.useSearchParams)(),{pending:w,navigate:k}=(0,f.q)(),[T,C]=(0,a.useState)(new Set),[E,K]=(0,a.useState)(y),[R,L]=(0,a.useState)(!1),[P,M]=(0,a.useState)(u),A=(0,a.useRef)(null),I=(0,a.useRef)(null);function D(e){let t=new URLSearchParams(b.toString());for(let[r,n]of Object.entries(e))void 0===n||""===n?t.delete(r):t.set(r,n);let r=t.toString();k(r?"".concat(p,"?").concat(r):p)}function F(e){D({page:e>0?String(e+1):void 0})}(0,a.useEffect)(()=>{K(function(){try{let e=window.localStorage.getItem(j);if(!e)return y();let t=JSON.parse(e),r=y();for(let e of v)"boolean"==typeof t[e.id]&&(r[e.id]=t[e.id]);return r}catch(e){return y()}}())},[]),(0,a.useEffect)(()=>{window.localStorage.setItem(j,JSON.stringify(E))},[E]),(0,a.useEffect)(()=>{M(u)},[u]),(0,a.useEffect)(()=>{function e(e){A.current&&!A.current.contains(e.target)&&L(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,a.useEffect)(()=>()=>{I.current&&(window.clearTimeout(I.current),I.current=null)},[]);let W=v.filter(e=>E[e.id]),V=W.length+1,O=W.length;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-3 flex-wrap",children:[(0,n.jsx)("input",{value:P,onChange:e=>{var t;M(t=e.target.value),I.current&&window.clearTimeout(I.current),I.current=window.setTimeout(()=>{D({q:t.trim()||void 0,page:void 0})},300)},placeholder:x("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,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:"text-xs text-text-tertiary tabular-nums",children:x("common.rows",{count:r.toLocaleString()})}),(0,n.jsxs)("div",{ref:A,className:"relative",children:[(0,n.jsxs)("button",{onClick:()=>L(e=>!e),className:"btn",children:[x("usage.columns.button"),(0,n.jsx)("span",{className:"ml-1 text-text-tertiary tabular-nums",children:O})]}),R&&(0,n.jsxs)("div",{className:"absolute right-0 mt-1 w-56 card border-border-hi shadow-lg p-2 z-30",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-1.5 pb-1.5 mb-1 border-b border-border",children:[(0,n.jsx)("span",{className:"text-xs text-text-tertiary uppercase tracking-wide",children:x("usage.columns.title")}),(0,n.jsx)("button",{onClick:()=>K(y()),className:"text-xs text-text-tertiary hover:text-text-primary",children:x("usage.columns.reset")})]}),(0,n.jsx)("div",{className:"max-h-72 overflow-auto",children:v.map(e=>(0,n.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,n.jsx)("input",{type:"checkbox",checked:!!E[e.id],onChange:t=>K(r=>({...r,[e.id]:t.target.checked})),className:"accent-brand"}),(0,n.jsx)("span",{className:"text-text-secondary",children:x(e.labelKey)})]},e.id))})]})]}),(0,n.jsx)("button",{onClick:function(){let e=new URLSearchParams(b.toString());window.location.href="/api/export/usage?".concat(e.toString())},className:"btn",children:x("common.exportCsv")})]})]}),(0,n.jsx)("div",{className:(0,c.cn)("card overflow-hidden transition-opacity",w&&"opacity-60 cursor-progress pointer-events-none"),"aria-busy":w,children:(0,n.jsx)(g.H,{children:(0,n.jsxs)("table",{className:"w-full text-sm",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{className:"border-b border-border bg-bg-surface-hi/30",children:[(0,n.jsx)(S,{children:(0,n.jsx)("span",{className:"sr-only",children:"expand"})}),W.map(e=>(0,n.jsx)(S,{align:e.align,sorted:!!e.sortKey&&d.key===e.sortKey,dir:d.dir,onClick:e.sortKey?()=>{var t;let r;return t=e.sortKey,r="desc",void(d.key===t&&(r="asc"===d.dir?"desc":"asc"),D({sort:"timestamp"===t?void 0:t,dir:"desc"===r?void 0:r,page:void 0}))}:void 0,children:x(e.labelKey)},e.id))]})}),(0,n.jsxs)("tbody",{children:[t.map(e=>{let t=T.has(e.turnId),r=e.userText.trim()||x("usage.turn.noPrompt");return(0,n.jsx)(N,{turn:e,isOpen:t,onToggle:()=>{var t;return t=e.turnId,void C(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},userText:r,expandLabel:x("usage.turn.expand"),collapseLabel:x("usage.turn.collapse"),activeColumns:W,locale:h,t:x,codexFastActive:m},e.turnId)}),0===t.length&&(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:V,className:"px-3 py-8 text-center text-text-tertiary text-sm",children:x("common.noMatchingRows")})})]})]})})}),i>1&&(0,n.jsxs)("div",{className:"flex items-center justify-between mt-3 text-xs text-text-secondary",children:[(0,n.jsx)("span",{children:x("common.pageOf",{page:l+1,total:i})}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{onClick:()=>F(0),disabled:0===l,className:"btn-ghost disabled:opacity-40",children:x("common.first")}),(0,n.jsx)("button",{onClick:()=>F(l-1),disabled:0===l,className:"btn-ghost disabled:opacity-40",children:x("common.prev")}),(0,n.jsx)("button",{onClick:()=>F(l+1),disabled:l>=i-1,className:"btn-ghost disabled:opacity-40",children:x("common.next")}),(0,n.jsx)("button",{onClick:()=>F(i-1),disabled:l>=i-1,className:"btn-ghost disabled:opacity-40",children:x("common.last")})]})]})]})}function N(e){let{turn:t,isOpen:r,onToggle:a,userText:s,expandLabel:o,collapseLabel:l,activeColumns:i,locale:d,t:u,codexFastActive:m}=e,x=(1===t.models.length?(0,c.P6)(t.models[0]):"".concat((0,c.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,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-surface-hi/40 cursor-pointer",onClick:a,children:[(0,n.jsx)("td",{className:"px-2 py-2 text-text-tertiary w-6 text-center select-none",children:(0,n.jsx)("span",{title:r?l:o,className:"inline-block w-4",children:r?"▾":"▸"})}),i.map(e=>(0,n.jsx)("td",{className:(0,c.cn)("px-3 py-2","right"===e.align?"text-right":"text-left"),children:function(e,t,r,a,s,o,l,i){switch(e){case"time":return(0,n.jsx)("span",{className:"num-mono text-text-secondary whitespace-nowrap text-xs",title:"started ".concat((0,c.r6)(t.timestamp),"\nended ").concat((0,c.r6)(t.endTimestamp)),children:(0,c.r6)(t.timestamp)});case"duration":return(0,n.jsx)("span",{className:"num-mono text-text-secondary whitespace-nowrap text-xs",title:"".concat((0,c.r6)(t.timestamp)," → ").concat((0,c.r6)(t.endTimestamp)),children:(0,c.a3)(t.durationMs)});case"prompt":return(0,n.jsx)(b,{maxWidth:460,panelClassName:"p-3 text-sm text-text-secondary leading-relaxed",content:(0,n.jsx)("div",{className:"whitespace-pre-wrap break-words",children:s}),children:(0,n.jsx)("span",{className:"block text-text-secondary truncate max-w-[280px]",children:s})});case"model":return(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap",children:[(0,n.jsxs)("span",{className:"text-text-primary",children:[r,i&&"codex"===t.source&&(0,n.jsx)("span",{className:"font-semibold text-warning",title:l("usage.badge.fastHint"),children:"\xb7".concat(l("usage.badge.fast"))})]}),t.hasWorkflowSubagents&&(0,n.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-[10px] font-semibold leading-none bg-brand/10 text-brand border border-brand/20",title:l("usage.badge.workflowHint",{count:t.workflowSubagentCount}),children:[(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,n.jsx)("path",{d:"M13 2 3 14h7l-1 8 10-12h-7z"})}),l("usage.badge.workflow"),t.workflowSubagentCount>1?" \xd7".concat(t.workflowSubagentCount):""]})]});case"project":return(0,n.jsx)("span",{className:"block text-text-secondary truncate max-w-[180px]",title:t.cwd,children:t.projectLabel||(0,c.PJ)(t.cwd)});case"session":return(0,n.jsx)("span",{className:"num-mono text-text-tertiary text-xs",title:t.sessionId,children:(0,c.BC)(t.sessionId)});case"calls":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:t.callCount});case"input":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:(0,c.jh)(t.inputTokens,o)});case"output":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:(0,c.jh)(t.outputTokens,o)});case"cacheRead":return(0,n.jsx)("span",{className:"num-mono text-success",children:(0,c.jh)(t.cacheReadTokens,o)});case"cacheWrite":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:(0,c.jh)(t.cacheCreationTokens,o)});case"total":return(0,n.jsx)(b,{align:"right",maxWidth:300,panelClassName:"p-0 overflow-hidden",content:(0,n.jsx)(k,{row:t,locale:o,t:l}),children:(0,n.jsx)("span",{className:"num-mono text-text-primary font-medium border-b border-dashed border-border hover:border-text-tertiary cursor-help",children:(0,c.jh)(t.totalTokens,o)})});case"cost":return(0,n.jsx)("span",{className:"num-mono text-text-primary font-medium",children:(0,c.l7)(t.cost)});case"tools":return(0,n.jsx)("span",{className:"block text-xs text-text-tertiary truncate max-w-[160px]",title:t.toolNames.join(", "),children:a})}}(e.id,t,x,h,s,d,u,m)},e.id))]}),r&&t.children.map(e=>(0,n.jsxs)("tr",{className:"border-b border-border last:border-b-0 bg-bg-surface-hi/20 text-text-tertiary",children:[(0,n.jsx)("td",{className:"px-2 py-1.5 w-6"}),i.map(r=>(0,n.jsx)("td",{className:(0,c.cn)("px-3 py-1.5","right"===r.align?"text-right":"text-left"),children:function(e,t,r,a,s,o){switch(e){case"time":return(0,n.jsx)("span",{className:"num-mono whitespace-nowrap text-xs inline-block translate-x-5",children:(0,c.r6)(t.timestamp)});case"duration":return(0,n.jsx)("span",{className:"text-xs text-text-tertiary",children:"—"});case"prompt":{var l;let e=(null!=(l=t.directPrompt)?l:"").trim();if(e&&e!==r.trim())return(0,n.jsx)("span",{className:"block text-xs text-text-secondary truncate max-w-[320px]",title:e,children:e});if(!t.toolNames.length)return(0,n.jsx)("span",{className:"text-xs text-text-tertiary",children:"—"});let a=t.toolNames.join(", "),s=t.toolNames.slice(0,3).join(", ")+(t.toolNames.length>3?"…":"");return(0,n.jsx)("span",{className:"block text-xs text-text-secondary truncate max-w-[280px]",title:a,children:s})}case"model":return(0,n.jsxs)("span",{className:"whitespace-nowrap",children:[(0,c.P6)(t.model),t.effort?" \xb7 ".concat(t.effort):"",o&&"codex"===t.source&&(0,n.jsx)("span",{className:"font-semibold text-warning",title:s("usage.badge.fastHint"),children:"\xb7".concat(s("usage.badge.fast"))})]});case"project":return(0,n.jsx)("span",{className:"block truncate max-w-[180px]",title:t.cwd,children:t.projectLabel||(0,c.PJ)(t.cwd)});case"session":return(0,n.jsx)("span",{className:"num-mono text-xs",title:t.sessionId,children:(0,c.BC)(t.sessionId)});case"calls":return(0,n.jsx)("span",{className:"num-mono",children:"1"});case"input":return(0,n.jsx)("span",{className:"num-mono",children:(0,c.jh)(t.inputTokens,a)});case"output":return(0,n.jsx)("span",{className:"num-mono",children:(0,c.jh)(t.outputTokens,a)});case"cacheRead":return(0,n.jsx)("span",{className:"num-mono text-success",children:(0,c.jh)(t.cacheReadTokens,a)});case"cacheWrite":return(0,n.jsx)("span",{className:"num-mono",children:(0,c.jh)(t.cacheCreationTokens,a)});case"total":return(0,n.jsx)(b,{align:"right",maxWidth:300,panelClassName:"p-0 overflow-hidden",content:(0,n.jsx)(k,{row:t,locale:a,t:s}),children:(0,n.jsx)("span",{className:"num-mono border-b border-dashed border-border/60 hover:border-text-tertiary cursor-help",children:(0,c.jh)(t.totalTokens,a)})});case"cost":return(0,n.jsx)("span",{className:"num-mono",children:(0,c.l7)(t.cost)});case"tools":return(0,n.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,d,u,m)},r.id))]},e.uuid))]})}function k(e){let{row:t,locale:r,t:s}=e,o=[{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,n.jsxs)("div",{className:"text-xs",children:[(0,n.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,n.jsxs)("div",{className:"px-3 py-2",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[auto_1fr_auto] gap-x-3 gap-y-1.5 items-center",children:[(0,n.jsx)("span",{}),(0,n.jsx)("span",{className:"text-text-tertiary text-[10px] uppercase tracking-wide text-right",children:s("usage.breakdown.headerTokens")}),(0,n.jsx)("span",{className:"text-text-tertiary text-[10px] uppercase tracking-wide text-right",children:s("usage.breakdown.headerCost")}),o.map(e=>(0,n.jsxs)(a.Fragment,{children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-2 text-text-secondary",children:[(0,n.jsx)("span",{className:(0,c.cn)("w-2 h-2 rounded-sm",e.dot)}),e.label]}),(0,n.jsx)("span",{className:(0,c.cn)("num-mono text-right",e.tone),children:(0,c.jh)(e.tokens,r)}),(0,n.jsx)("span",{className:"num-mono text-right text-text-secondary",children:(0,c.l7)(e.cost)}),"output"===e.key&&t.reasoningTokens>0&&(0,n.jsxs)(a.Fragment,{children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-2 text-text-tertiary pl-4 text-[11px]",children:[(0,n.jsx)("span",{className:"text-text-tertiary",children:"↳"}),s("usage.breakdown.reasoning")]}),(0,n.jsx)("span",{className:"num-mono text-right text-text-tertiary text-[11px]",children:(0,c.jh)(t.reasoningTokens,r)}),(0,n.jsx)("span",{className:"text-right text-text-tertiary text-[11px]",children:s("usage.breakdown.reasoningNote")})]},"reasoning-detail")]},e.key))]}),(0,n.jsxs)("div",{className:"mt-2 pt-2 border-t border-border grid grid-cols-[auto_1fr_auto] gap-x-3 items-center",children:[(0,n.jsx)("span",{className:"text-text-secondary font-medium",children:s("usage.breakdown.total")}),(0,n.jsx)("span",{className:"num-mono text-right text-text-primary font-medium",children:(0,c.jh)(t.totalTokens,r)}),(0,n.jsx)("span",{className:"num-mono text-right text-text-primary font-medium",children:(0,c.l7)(t.cost)})]})]})]})}function S(e){let{children:t,align:r="left",sorted:a,dir:s,onClick:o}=e;return(0,n.jsx)("th",{className:(0,c.cn)("px-3 py-2 text-xs font-medium text-text-tertiary uppercase tracking-wide whitespace-nowrap","right"===r?"text-right":"text-left",o&&"cursor-pointer hover:text-text-primary select-none"),onClick:o,children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:[t,a&&(0,n.jsx)("span",{className:"text-[10px]",children:"asc"===s?"▲":"▼"})]})})}var T=r(76669),C=r(63847);function E(e){let{paramKey:t,defaultValue:r,options:a,ariaLabel:l}=e,i=(0,s.usePathname)(),d=(0,s.useSearchParams)(),u=(0,o.kj)(),{pending:m,navigate:x}=(0,f.q)(),h=d.get(t)||r,p=a.some(e=>e.value===h)?h:r,{containerRef:b,rect:g}=(0,T.S)(p),v=null===g;function j(e){let r=new URLSearchParams(d.toString());r.set(t,e),x("".concat(i,"?").concat(r.toString()))}return(0,n.jsx)("div",{className:(0,c.cn)("inline-flex rounded-button border border-border bg-bg-surface p-0.5",m&&"opacity-60 cursor-progress"),"aria-busy":m,children:(0,n.jsxs)("div",{ref:b,role:"radiogroup","aria-label":l,onKeyDown:function(e){var t,r;if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();let n=(a.findIndex(e=>e.value===p)+("ArrowRight"===e.key?1:-1)+a.length)%a.length;j(a[n].value);let s=null==(t=b.current)?void 0:t.querySelectorAll('button[role="radio"]');null==s||null==(r=s[n])||r.focus()},className:"relative flex gap-0.5",children:[(0,n.jsx)(C.j,{rect:g,className:"ring-1 ring-brand/40"}),a.map(e=>{let t=p===e.value;return(0,n.jsx)("button",{role:"radio","data-tab":e.value,"aria-checked":t,tabIndex:t?0:-1,onClick:()=>j(e.value),className:(0,c.cn)("relative z-10 px-2.5 py-1 text-xs rounded transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",t?(0,c.cn)("text-white font-semibold",v&&"bg-brand-strong shadow-sm ring-1 ring-brand/40"):"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:u(e.tk)},e.value)})]})})}let K=[{value:"hour",tk:"gran.hour"},{value:"day",tk:"gran.day"},{value:"week",tk:"gran.week"},{value:"month",tk:"gran.month"}];function R(e){let{defaultValue:t="day"}=e,r=(0,o.kj)();return(0,n.jsx)(E,{paramKey:"gran",defaultValue:t,options:K,ariaLabel:r("gran.label")})}let L=new Map;function P(e){let{initial:t,costFootnote:r}=e,u=(0,o.kj)(),{locale:m}=(0,o.s9)(),x=(0,s.useSearchParams)();t&&!L.has(t.url)&&L.set(t.url,t.payload);let p=(0,a.useMemo)(()=>{var e;return(e=x.toString())?"/api/turns?".concat(e):"/api/turns"},[x]),[b,g]=(0,a.useState)(()=>{var e;return null!=(e=L.get(p))?e:null}),[f,v]=(0,a.useState)(!L.has(p)),[j,y]=(0,a.useState)(null),N=(0,a.useRef)(0);if((0,a.useEffect)(()=>{let e=++N.current,t=L.get(p);t?(g(t),v(!1)):v(!0),y(null),fetch(p,{cache:"no-store"}).then(e=>{if(!e.ok)throw Error("HTTP ".concat(e.status));return e.json()}).then(t=>{e===N.current&&(L.set(p,t),g(t),v(!1))}).catch(t=>{e===N.current&&(y(t.message),v(!1))})},[p]),(0,a.useEffect)(()=>{function e(){L.clear(),N.current++;let e=N.current;fetch(p,{cache:"no-store"}).then(e=>e.json()).then(t=>{e===N.current&&(L.set(p,t),g(t))}).catch(()=>{})}return window.addEventListener("ccgauge:refresh",e),()=>window.removeEventListener("ccgauge:refresh",e)},[p]),!b)return j?(0,n.jsxs)("div",{className:"card mt-4 p-6 text-sm text-warning",children:[u("common.empty.title"),": ",j]}):(0,n.jsx)(M,{});if(!b.hasAnyRecords)return(0,n.jsx)(i.pp,{title:u("common.empty.title"),desc:u("common.empty.desc")});let k=b.totals.totalTokens>0?b.totals.cacheReadTokens/Math.max(1,b.totals.cacheReadTokens+b.totals.inputTokens+b.totals.cacheCreationTokens):0;return(0,n.jsxs)("div",{className:f?"opacity-90":"","aria-busy":f,children:[(0,n.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-4",children:[(0,n.jsx)(d,{label:u("usage.kpi.totalTokens"),value:(0,c.jh)(b.totals.totalTokens,m)}),(0,n.jsx)(d,{label:u("usage.kpi.totalCost"),value:(0,c.az)(b.totals.cost),hint:r||void 0}),(0,n.jsx)(d,{label:u("usage.kpi.cacheSaved"),value:(0,c.az)(b.totals.saved),accent:"success"}),(0,n.jsx)(d,{label:u("usage.kpi.cacheHit"),value:(0,c.R8)(k,0),accent:"success"})]}),(0,n.jsx)(i.wn,{title:u("usage.trend"),desc:u("usage.trend.gran",{gran:(0,l.nA)(m,"gran.".concat(b.gran))}),right:(0,n.jsx)(R,{defaultValue:b.gran}),className:"mt-4",children:(0,n.jsx)(h.TokenStackChart,{data:b.trend})}),(0,n.jsx)(i.wn,{title:u("usage.requests.title"),desc:u("usage.requests.desc"),children:(0,n.jsx)(w,{rows:b.turns,totalCount:b.totalCount,page:b.page,pageCount:b.pageCount,sort:b.sort,query:b.query,codexFastActive:b.codexFastActive})})]})}function M(){return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mt-4",children:Array.from({length:4}).map((e,t)=>(0,n.jsxs)("div",{className:"card p-4",children:[(0,n.jsx)("div",{className:"h-3 w-24 rounded bg-bg-surface-hi/40 animate-pulse"}),(0,n.jsx)("div",{className:"h-7 w-28 mt-3 rounded bg-bg-surface-hi/60 animate-pulse"})]},t))}),(0,n.jsx)("div",{className:"card mt-4 h-72 bg-bg-surface-hi/30 animate-pulse"}),(0,n.jsx)("div",{className:"card mt-4 p-4 space-y-2",children:Array.from({length:8}).map((e,t)=>(0,n.jsx)("div",{className:"h-7 rounded bg-bg-surface-hi/40 animate-pulse"},t))})]})}},8336:(e,t,r)=>{"use strict";r.d(t,{ModelFilter:()=>l});var n=r(95155),a=r(35850),s=r(25016),o=r(51148);function l(e){let{all:t,selected:r}=e,l=(0,o.kj)();return(0,n.jsx)(a.K,{paramKey:"models",all:t,selected:r,render:s.P6,labelAllKey:"filter.modelAll",labelSingleKey:"filter.modelSingle",labelMultiKey:"filter.modelMulti",ariaLabel:l("filter.modelLabel")})}},14920:(e,t,r)=>{"use strict";r.d(t,{ProjectFilter:()=>l});var n=r(95155),a=r(35850),s=r(25016),o=r(51148);function l(e){let{all:t,selected:r}=e,l=(0,o.kj)();return(0,n.jsx)(a.K,{paramKey:"projects",all:t,selected:r,render:s.PJ,labelAllKey:"filter.projectAll",labelSingleKey:"filter.projectSingle",labelMultiKey:"filter.projectMulti",ariaLabel:l("filter.projectLabel")})}},20857:(e,t,r)=>{"use strict";r.d(t,{H:()=>o});var n=r(95155),a=r(12115),s=r(25016);function o(e){let{children:t,className:r}=e,o=(0,a.useRef)(null),[l,i]=(0,a.useState)(!1),[c,d]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=o.current;if(!e)return;function t(){if(!e)return;let{scrollLeft:t,scrollWidth:r,clientWidth:n}=e;i(t>4),d(t+n<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,n.jsxs)("div",{className:(0,s.cn)("relative",r),children:[(0,n.jsx)("div",{ref:o,className:"overflow-x-auto",children:t}),(0,n.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",l?"opacity-100":"opacity-0")}),(0,n.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")})]})}},35850:(e,t,r)=>{"use strict";r.d(t,{K:()=>c});var n=r(95155),a=r(20063),s=r(12115),o=r(25016),l=r(51148),i=r(40464);function c(e){let t,{paramKey:r,all:c,selected:d,render:u=e=>e,labelAllKey:m,labelSingleKey:x,labelMultiKey:h,ariaLabel:p,searchThreshold:b=6}=e,g=(0,a.usePathname)(),f=(0,a.useSearchParams)(),v=(0,l.kj)(),{pending:j,navigate:y}=(0,i.q)(),[w,N]=(0,s.useState)(!1),[k,S]=(0,s.useState)(""),[T,C]=(0,s.useState)(0),E=(0,s.useRef)(null),K=(0,s.useRef)(null),R=(0,s.useRef)(null),L=(0,s.useRef)(null),P=(0,s.useId)(),M=(0,s.useId)();(0,s.useEffect)(()=>{if(w)return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)};function e(e){E.current&&!E.current.contains(e.target)&&N(!1)}function t(e){if("Escape"===e.key){var t;N(!1),null==(t=K.current)||t.focus()}}},[w]),(0,s.useEffect)(()=>{w&&c.length>=b&&requestAnimationFrame(()=>{var e;return null==(e=R.current)?void 0:e.focus()}),w||(S(""),C(0))},[w,c.length,b]);let A=(0,s.useMemo)(()=>{let e=k.trim().toLowerCase();return e?c.filter(t=>u(t).toLowerCase().includes(e)||t.toLowerCase().includes(e)):c},[c,k,u]);function I(e){let t=new URLSearchParams(f.toString());0===e.size?t.delete(r):t.set(r,Array.from(e).join(","));let n=t.toString();y(n?"".concat(g,"?").concat(n):g)}function D(e){let t=new Set(d);t.has(e)?t.delete(e):t.add(e),I(t)}function F(e){if("ArrowDown"===e.key)e.preventDefault(),C(e=>Math.min(A.length-1,e+1));else if("ArrowUp"===e.key)e.preventDefault(),C(e=>Math.max(0,e-1));else if("Enter"===e.key){e.preventDefault();let t=A[T];t&&D(t)}else"Home"===e.key?(e.preventDefault(),C(0)):"End"===e.key&&(e.preventDefault(),C(A.length-1))}t=0===d.length?v(m):1===d.length?v(x,{value:u(d[0])}):v(h,{count:d.length});let W=c.length>=b;return(0,n.jsxs)("div",{ref:E,className:(0,o.cn)("relative",j&&"opacity-60 cursor-progress"),"aria-busy":j,children:[(0,n.jsxs)("button",{ref:K,id:P,onClick:()=>N(e=>!e),className:"btn focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40","aria-haspopup":"listbox","aria-expanded":w,"aria-controls":M,"aria-label":p,children:[t,(0,n.jsx)("span",{className:"text-text-tertiary ml-1","aria-hidden":!0,children:"▾"})]}),w&&(0,n.jsxs)("div",{id:M,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:[d.length>0&&(0,n.jsxs)("div",{className:"px-2 pt-2 pb-1.5 border-b border-border flex flex-wrap gap-1 items-center",children:[d.slice(0,6).map(e=>(0,n.jsxs)("button",{onClick:()=>D(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(u(e)),title:u(e),children:[(0,n.jsx)("span",{className:"truncate",children:u(e)}),(0,n.jsx)("span",{"aria-hidden":!0,className:"text-brand/70",children:"\xd7"})]},e)),d.length>6&&(0,n.jsxs)("span",{className:"text-[11px] text-text-tertiary px-1",children:["+",d.length-6]}),(0,n.jsx)("button",{onClick:function(){I(new Set)},className:"ml-auto text-[11px] text-text-tertiary hover:text-text-primary px-1.5 py-0.5",children:v("filter.clearAll")})]}),W&&(0,n.jsx)("div",{className:"p-2 border-b border-border",children:(0,n.jsx)("input",{ref:R,value:k,onChange:e=>{S(e.target.value),C(0)},onKeyDown:e=>{("ArrowDown"===e.key||"ArrowUp"===e.key||"Enter"===e.key||"Home"===e.key||"End"===e.key)&&F(e)},placeholder:v("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,n.jsxs)("div",{ref:L,onKeyDown:F,className:"max-h-64 overflow-y-auto p-1 outline-none",tabIndex:-1,children:[0===A.length&&(0,n.jsx)("div",{className:"text-xs text-text-tertiary px-2 py-3 text-center",children:v("filter.noOptions")}),A.map((e,t)=>{let r=d.includes(e),a=t===T;return(0,n.jsxs)("button",{role:"option","aria-selected":r,onMouseEnter:()=>C(t),onClick:()=>D(e),className:(0,o.cn)("w-full text-left text-sm px-2 py-1.5 rounded flex items-center gap-2 transition-colors",a?"bg-bg-surface-hi":"hover:bg-bg-surface-hi",r&&"text-text-primary"),children:[(0,n.jsx)("span",{className:(0,o.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,n.jsx)("span",{className:"truncate",children:u(e)})]},e)})]})]})]})}},40464:(e,t,r)=>{"use strict";r.d(t,{q:()=>s});var n=r(12115),a=r(20063);function s(){let e=(0,a.useRouter)(),[t,r]=(0,n.useTransition)();return{pending:t,navigate:function(t){r(()=>{e.push(t)})}}}},44512:(e,t,r)=>{"use strict";r.d(t,{OverviewToggle:()=>c});var n=r(95155),a=r(12115),s=r(25016),o=r(51148);let l="data-usage-overview",i="hidden";function c(){let e=(0,o.kj)(),[t,r]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{r(document.documentElement.getAttribute(l)===i)},[]),(0,n.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(l,i):document.documentElement.removeAttribute(l)},"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,n.jsx)(d,{open:!t}),(0,n.jsx)("span",{className:"hidden sm:inline",children:e("usage.overview.label")})]})}function d(e){let{open:t}=e;return(0,n.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,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M9.88 9.88a3 3 0 0 0 4.24 4.24"}),(0,n.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,n.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,n.jsx)("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]})})}},73896:(e,t,r)=>{"use strict";r.d(t,{RangePicker:()=>v});var n=r(95155),a=r(20063),s=r(12115),o=r(25016),l=r(51148),i=r(76243),c=r(76043),d=r(82006);function u(e){let{selected:t,onSelect:r,toDate:a}=e,{locale:s}=(0,l.s9)(),o="zh"===s?c.g:d.c,u=null!=a?a:new Date;return(0,n.jsx)(i.h,{mode:"range",locale:o,selected:t,onSelect:r,endMonth:u,disabled:{after:u},numberOfMonths:1})}var m=r(40464);let x=[{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"}],h=/^\d{4}-\d{2}-\d{2}$/;function p(e){if(!h.test(e)||!h.exec(e))return!1;let t=Number(e.slice(0,4)),r=Number(e.slice(5,7)),n=Number(e.slice(8,10)),a=new Date(t,r-1,n);return!Number.isNaN(a.getTime())&&a.getFullYear()===t&&a.getMonth()===r-1&&a.getDate()===n}function b(e){if(!p(e))return;let t=Number(e.slice(0,4));return new Date(t,Number(e.slice(5,7))-1,Number(e.slice(8,10)))}function g(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(r,"-").concat(n)}function f(e,t){if(!p(e))return e;let r=new Date(e+"T00:00:00");return new Intl.DateTimeFormat(t,{month:"short",day:"numeric"}).format(r)}function v(e){let{defaultValue:t="7d"}=e,r=(0,a.usePathname)(),i=(0,a.useSearchParams)(),{t:c,locale:d}=(0,l.s9)(),{pending:h,navigate:p}=(0,m.q)(),v=i.get("range")||t,j=x.some(e=>e.value===v),y="custom"===v,w=j?v:y?"custom":t,N=i.get("from")||"",k=i.get("to")||"",[S,T]=(0,s.useState)(!1),[C,E]=(0,s.useState)(()=>({from:b(N),to:b(k)})),K=(0,s.useRef)(null);(0,s.useEffect)(()=>{E({from:b(N),to:b(k)})},[N,k,S]),(0,s.useEffect)(()=>{if(S)return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)};function e(e){K.current&&!K.current.contains(e.target)&&T(!1)}function t(e){"Escape"===e.key&&T(!1)}},[S]);let R=y&&N?k?"".concat(f(N,d)," – ").concat(f(k,d)):"".concat(f(N,d)," →"):c("range.custom"),L=(null==C?void 0:C.from)?new Intl.DateTimeFormat(d,{year:"numeric",month:"short",day:"numeric"}).format(C.from):"",P=(null==C?void 0:C.to)?new Intl.DateTimeFormat(d,{year:"numeric",month:"short",day:"numeric"}).format(C.to):"";return(0,n.jsxs)("div",{ref:K,className:(0,o.cn)("flex items-center gap-1",h&&"opacity-60 cursor-progress"),"aria-busy":h,children:[(0,n.jsx)("div",{role:"radiogroup","aria-label":c("range.label"),className:"inline-flex rounded-button border border-border bg-bg-surface p-0.5 gap-0.5",children:x.map(e=>{let t=w===e.value;return(0,n.jsx)("button",{role:"radio","aria-checked":t,tabIndex:t?0:-1,onClick:()=>(function(e){let t=new URLSearchParams(i.toString());t.set("range",e),t.delete("from"),t.delete("to"),p("".concat(r,"?").concat(t.toString())),T(!1)})(e.value),className:(0,o.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:c(e.tk)},e.value)})}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)("button",{type:"button","aria-haspopup":"dialog","aria-expanded":S,onClick:()=>T(e=>!e),className:(0,o.cn)("px-2.5 py-1 text-xs rounded-button border transition-all inline-flex items-center gap-1","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",y?"bg-brand-strong text-white font-semibold shadow-sm ring-1 ring-brand/40 border-transparent":"border-border bg-bg-surface text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:[(0,n.jsx)("span",{children:R}),(0,n.jsx)("span",{"aria-hidden":!0,className:(0,o.cn)(y?"text-white/80":"text-text-tertiary"),children:"▾"})]}),S&&(0,n.jsxs)("div",{role:"dialog","aria-label":c("range.custom"),className:"absolute right-0 mt-1.5 z-20 w-[324px] rounded-card border border-border-hi bg-bg-elevated shadow-popover",children:[(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3 px-4 pt-4 pb-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:"label",children:c("range.from")}),(0,n.jsx)("div",{className:(0,o.cn)("mt-1 text-sm tabular-nums truncate",(null==C?void 0:C.from)?"text-text-primary font-semibold":"text-text-tertiary"),children:(null==C?void 0:C.from)?L:"—"})]}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:"label",children:c("range.to")}),(0,n.jsx)("div",{className:(0,o.cn)("mt-1 text-sm tabular-nums truncate",(null==C?void 0:C.to)?"text-text-primary font-semibold":"text-text-tertiary"),children:(null==C?void 0:C.to)?P:"—"})]})]}),(0,n.jsx)("div",{className:"divider-soft"}),(0,n.jsx)("div",{className:"px-3 pt-3 pb-2 flex justify-center",children:(0,n.jsx)(u,{selected:C,onSelect:E})}),(0,n.jsx)("div",{className:"divider-soft"}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 px-4 py-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>T(!1),className:"btn-ghost text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",children:c("range.cancel")}),(0,n.jsx)("button",{type:"button",onClick:function(){let e=null==C?void 0:C.from;if(!e)return;let t=null==C?void 0:C.to,n=new URLSearchParams(i.toString());n.set("range","custom"),n.set("from",g(e)),t?n.set("to",g(t)):n.delete("to"),p("".concat(r,"?").concat(n.toString())),T(!1)},disabled:!(null==C?void 0:C.from),className:(0,o.cn)("inline-flex items-center justify-center px-3 py-1.5 rounded-button text-sm font-semibold transition-colors","bg-brand-strong text-white","hover:bg-brand-hover","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-brand-strong","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40"),children:c("range.customApply")})]})]})]})]})}},78826:(e,t,r)=>{Promise.resolve().then(r.bind(r,77549)),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,73896)),Promise.resolve().then(r.bind(r,1467))}},e=>{e.O(0,[760,930,253,148,567,441,255,358],()=>e(e.s=78826)),_N_E=e.O()}]);
|
|
File without changes
|
|
File without changes
|