@aidotnet/server-darwin-arm64 0.14.3101 → 0.14.3103

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 (63) hide show
  1. package/bin/astra-server +2 -2
  2. package/bin/wwwroot/assets/ClientsPage-CbisrdvY.js +9 -0
  3. package/bin/wwwroot/assets/KeyPage-BJkqoRws.js +1 -0
  4. package/bin/wwwroot/assets/McpPage-lDbAQFBD.js +3 -0
  5. package/bin/wwwroot/assets/ModelDetailPage-2SDue3md.js +1 -0
  6. package/bin/wwwroot/assets/ModelsPage-Djwi1_69.js +1 -0
  7. package/bin/wwwroot/assets/PluginsPage-Cr3_QueY.js +2 -0
  8. package/bin/wwwroot/assets/PrivacyPage-K20lHsrR.js +1 -0
  9. package/bin/wwwroot/assets/ProviderDetailPage-dCLgz9IA.js +3 -0
  10. package/bin/wwwroot/assets/ProvidersPage-B3UD_FXO.js +3 -0
  11. package/bin/wwwroot/assets/SettingsPage-BOv88_uQ.js +2 -0
  12. package/bin/wwwroot/assets/SmartRoutingPage-DUdAF-mO.js +2 -0
  13. package/bin/wwwroot/assets/TokenDetailPage-DAFuMypb.js +1 -0
  14. package/bin/wwwroot/assets/{TokenPoolEditor-DfmDnnxw.js → TokenPoolEditor-CGc4q0xj.js} +1 -1
  15. package/bin/wwwroot/assets/TokensPage-BAszgNt-.js +1 -0
  16. package/bin/wwwroot/assets/TracesPage-zR4Nhppl.js +8 -0
  17. package/bin/wwwroot/assets/{TrayPanelPage-xke1V9tu.js → TrayPanelPage-BzWJbHrV.js} +1 -1
  18. package/bin/wwwroot/assets/TrayPanelView-C8TTq4KZ.js +1 -0
  19. package/bin/wwwroot/assets/alert-BKRTQ9va.js +15 -0
  20. package/bin/wwwroot/assets/{arrow-down-DeIGdMUk.js → arrow-down-4QyszMPK.js} +1 -1
  21. package/bin/wwwroot/assets/{arrow-left-DX1c-nYY.js → arrow-left-CgusYKe5.js} +1 -1
  22. package/bin/wwwroot/assets/{arrow-up-right-D--u8dK5.js → arrow-up-right-CgKLuRMO.js} +1 -1
  23. package/bin/wwwroot/assets/{chart-column-zt3ZRFLH.js → chart-column-DrO0zSNb.js} +1 -1
  24. package/bin/wwwroot/assets/{checkbox-BJe8ekJy.js → checkbox-JghCvxwP.js} +1 -1
  25. package/bin/wwwroot/assets/{cloud-download-DWw6s5ag.js → cloud-download-Cq6X58YR.js} +1 -1
  26. package/bin/wwwroot/assets/confirm-morph-bdMiffHC.js +1 -0
  27. package/bin/wwwroot/assets/{ellipsis-BH_FL485.js → ellipsis-C09AxsS6.js} +1 -1
  28. package/bin/wwwroot/assets/{external-link-Bb6sx3jt.js → external-link-B54WZqyE.js} +1 -1
  29. package/bin/wwwroot/assets/{folder-open-Bcx5mAII.js → folder-open-DbnPnrzj.js} +1 -1
  30. package/bin/wwwroot/assets/index-8z9hfQDF.css +1 -0
  31. package/bin/wwwroot/assets/index-Cj8lNw6g.js +120 -0
  32. package/bin/wwwroot/assets/{log-out-Ch09k2bC.js → log-out-ZnLW7wzx.js} +1 -1
  33. package/bin/wwwroot/assets/minus-DosBdkUl.js +1 -0
  34. package/bin/wwwroot/assets/overlays-CizKmvVN.js +41 -0
  35. package/bin/wwwroot/assets/{pencil-fY6CohHT.js → pencil-BuVygJ9-.js} +1 -1
  36. package/bin/wwwroot/assets/{power-B9MMcl6Y.js → power-CfEiSxDi.js} +1 -1
  37. package/bin/wwwroot/assets/radio-cards-6WsHN05O.js +1 -0
  38. package/bin/wwwroot/assets/{rotate-ccw-DsmSscuv.js → rotate-ccw-BhDSBCvo.js} +1 -1
  39. package/bin/wwwroot/assets/{sortable.esm-CO34h2h7.js → sortable.esm-4hCCGHPl.js} +1 -1
  40. package/bin/wwwroot/index.html +4 -4
  41. package/package.json +1 -1
  42. package/bin/wwwroot/assets/ClientsPage-BsCvaS4d.js +0 -9
  43. package/bin/wwwroot/assets/KeyPage-bkK0B_mk.js +0 -1
  44. package/bin/wwwroot/assets/ModelDetailPage-BEVSPYM6.js +0 -1
  45. package/bin/wwwroot/assets/ModelsPage-BGij6zvC.js +0 -1
  46. package/bin/wwwroot/assets/PluginsPage-dVUvE8Lf.js +0 -2
  47. package/bin/wwwroot/assets/PrivacyPage-B-YBfQ6J.js +0 -1
  48. package/bin/wwwroot/assets/ProviderDetailPage-CQQdpDSf.js +0 -3
  49. package/bin/wwwroot/assets/ProvidersPage-BwigLnKs.js +0 -3
  50. package/bin/wwwroot/assets/SettingsPage-CvpROKS2.js +0 -2
  51. package/bin/wwwroot/assets/SmartRoutingPage-CYh7mRot.js +0 -2
  52. package/bin/wwwroot/assets/TokenDetailPage-GwSz8QI6.js +0 -1
  53. package/bin/wwwroot/assets/TokensPage-0hOOzLVU.js +0 -1
  54. package/bin/wwwroot/assets/TracesPage-A45sREZP.js +0 -8
  55. package/bin/wwwroot/assets/TrayPanelView-CHh9-E76.js +0 -1
  56. package/bin/wwwroot/assets/alert-CuKAE1Sv.js +0 -15
  57. package/bin/wwwroot/assets/confirm-morph-DGAHV4QP.js +0 -1
  58. package/bin/wwwroot/assets/download-DR9BLMVt.js +0 -1
  59. package/bin/wwwroot/assets/index-CKrvKDIJ.js +0 -17
  60. package/bin/wwwroot/assets/index-CpGX4nAj.css +0 -1
  61. package/bin/wwwroot/assets/minus-UfPYsFrp.js +0 -1
  62. package/bin/wwwroot/assets/overlays-DeHu6TU_.js +0 -41
  63. package/bin/wwwroot/assets/radio-cards-Rq9vGqnw.js +0 -1
@@ -1 +1 @@
1
- import{Ba as e,Et as t,Fr as n,Ra as r,Ua as i,ct as a,za as o,zi as s}from"./alert-CuKAE1Sv.js";import{A as c,D as l,E as u,a as d,ct as f,j as p,o as m}from"./overlays-DeHu6TU_.js";import{t as h}from"./TrayPanelView-CHh9-E76.js";var g=i(e(),1),_=o(),v=new Set([`astra.theme`,`astra.accent`,`astra.locale`]);function y(){let{t:e}=a(),i=r(),{toast:o}=m(),y=s(),[b]=c(),x=p(),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(`overview`),E=l(b,{enabled:x.running,background:!0,live:S}),D=n(),O=(0,g.useRef)(null);(0,g.useLayoutEffect)(()=>{let e=document.documentElement;e.dataset.view=`tray`,e.style.background=`transparent`,document.body.style.background=`transparent`},[]);let k=(0,g.useCallback)(()=>{i.invalidateQueries({queryKey:[`stats`]}),i.invalidateQueries({queryKey:t.providers}),i.invalidateQueries({queryKey:t.clients}),i.invalidateQueries({queryKey:[`provider-accounts`]})},[i]);(0,g.useEffect)(()=>y?.tray.onVisibilityChanged(e=>{C(e),e&&(T(`overview`),k())}),[y,k]),(0,g.useEffect)(()=>{x.running&&k()},[x.running,k]),(0,g.useEffect)(()=>{let e=e=>{e.key&&v.has(e.key)&&window.location.reload()};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&y?.tray.command(`hide`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[y]),(0,g.useLayoutEffect)(()=>{let e=O.current;if(!e||!y)return;let t=[`header`,`tabs`,`body`,`footer`].map(t=>e.querySelector(`[data-tray-part="${t}"]`)),n=()=>{let n=e.offsetHeight-e.clientHeight,r=t.reduce((e,t)=>e+(t?.offsetHeight??0),0)+n;y.tray.resize(r)},r=new ResizeObserver(n);for(let e of t)e&&r.observe(e);return n(),()=>r.disconnect()},[y]),u(b,x,E.summary,E.plans);let A=e=>void y?.tray.command(e),j=async()=>{E.settings&&await f.copy(`${E.settings.gatewayBaseUrl}/v1`)&&o(e(`common.copied`))},M=async t=>{let n=E.providers;if(n.length===0)return;let r=await f.contextMenu(n.map(n=>({id:n.id,label:n.enabled?n.name:e(`tray.disabledProvider`,{name:n.name}),type:`checkbox`,checked:n.id===t.providerId})));r&&r!==t.providerId&&D.mutate({kind:t.kind,providerId:r},{onError:e=>o(d(e),`error`)})};return(0,_.jsx)(`div`,{className:`h-full`,children:(0,_.jsx)(h,{ref:O,className:`h-full`,prefs:b,state:x,data:E,tab:w,onTabChange:T,onCommand:A,onRefresh:k,onCopyAddress:()=>void j(),onSwitchClient:e=>void M(e)})})}export{y as TrayPanelPage};
1
+ import{Et as e,Qr as t,co as n,ct as r,la as i,lo as a,po as o,uo as s}from"./alert-BKRTQ9va.js";import{A as c,D as l,E as u,a as d,ct as f,j as p,o as m}from"./overlays-CizKmvVN.js";import{t as h}from"./TrayPanelView-C8TTq4KZ.js";var g=o(s(),1),_=a(),v=new Set([`astra.theme`,`astra.accent`,`astra.locale`]);function y(){let{t:a}=r(),o=n(),{toast:s}=m(),y=i(),[b]=c(),x=p(),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(`overview`),E=l(b,{enabled:x.running,background:!0,live:S}),D=t(),O=(0,g.useRef)(null);(0,g.useLayoutEffect)(()=>{let e=document.documentElement;e.dataset.view=`tray`,e.style.background=`transparent`,document.body.style.background=`transparent`},[]);let k=(0,g.useCallback)(()=>{o.invalidateQueries({queryKey:[`stats`]}),o.invalidateQueries({queryKey:e.providers}),o.invalidateQueries({queryKey:e.clients}),o.invalidateQueries({queryKey:[`provider-accounts`]})},[o]);(0,g.useEffect)(()=>y?.tray.onVisibilityChanged(e=>{C(e),e&&(T(`overview`),k())}),[y,k]),(0,g.useEffect)(()=>{x.running&&k()},[x.running,k]),(0,g.useEffect)(()=>{let e=e=>{e.key&&v.has(e.key)&&window.location.reload()};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&y?.tray.command(`hide`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[y]),(0,g.useLayoutEffect)(()=>{let e=O.current;if(!e||!y)return;let t=[`header`,`tabs`,`body`,`footer`].map(t=>e.querySelector(`[data-tray-part="${t}"]`)),n=()=>{let n=e.offsetHeight-e.clientHeight,r=t.reduce((e,t)=>e+(t?.offsetHeight??0),0)+n;y.tray.resize(r)},r=new ResizeObserver(n);for(let e of t)e&&r.observe(e);return n(),()=>r.disconnect()},[y]),u(b,x,E.summary,E.plans);let A=e=>void y?.tray.command(e),j=async()=>{E.settings&&await f.copy(`${E.settings.gatewayBaseUrl}/v1`)&&s(a(`common.copied`))},M=async e=>{let t=E.providers;if(t.length===0)return;let n=await f.contextMenu(t.map(t=>({id:t.id,label:t.enabled?t.name:a(`tray.disabledProvider`,{name:t.name}),type:`checkbox`,checked:t.id===e.providerId})));n&&n!==e.providerId&&D.mutate({kind:e.kind,providerId:n},{onError:e=>s(d(e),`error`)})};return(0,_.jsx)(`div`,{className:`h-full`,children:(0,_.jsx)(h,{ref:O,className:`h-full`,prefs:b,state:x,data:E,tab:w,onTabChange:T,onCommand:A,onRefresh:k,onCopyAddress:()=>void j(),onSwitchClient:e=>void M(e)})})}export{y as TrayPanelPage};
@@ -0,0 +1 @@
1
+ import{Y as e,ct as t,dt as n,ft as r,gt as i,lo as a,ot as o,po as s,q as c,s as l,uo as u,v as d,xt as f}from"./alert-BKRTQ9va.js";import{B as p,F as m,H as h,I as g,L as _,N as v,P as y,R as b,U as x,V as S,W as C,lt as w,tt as T,z as E}from"./overlays-CizKmvVN.js";import{t as D}from"./arrow-up-right-CgKLuRMO.js";import{t as O}from"./ellipsis-C09AxsS6.js";import{t as k}from"./rotate-ccw-BhDSBCvo.js";import{G as A,J as ee,_ as j,m as M,x as N,y as P,z as F}from"./index-Cj8lNw6g.js";var I={name:`arrow-down-right`,size:24,node:[[`path`,{d:`m7 7 10 10`,key:`1fmybs`}],[`path`,{d:`M17 7v10H7`,key:`6fjiku`}]]};I.node;var L=f(I),R={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};R.node;var z=f(R),B={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};B.node;var V=f(B),H=s(u(),1),U=a(),W={green:`var(--success)`,orange:`var(--warning)`,red:`var(--danger)`},G=(0,H.forwardRef)(function({prefs:e,state:a,data:s,onCommand:c,onRefresh:u,onCopyAddress:d,onSwitchClient:f,preview:p,tab:m,onTabChange:h,className:g},_){let{t:v}=t(),[y,b]=(0,H.useState)(`overview`),x=a.activity!==null,S=a.running&&!x,C=e=>c?.(e),T=[`overview`];e.sections.quota&&(s.plans.length>0||s.hasSubscriptions)&&T.push(`quota`),e.sections.clients&&s.clients.some(e=>e.enabled)&&T.push(`clients`);let E=m??y,A=T.includes(E)?E:`overview`,j=e=>{b(e),h?.(e)},M=(a.running||x)&&T.length>1,N=s.settings?.gatewayBaseUrl.replace(/^https?:\/\//,``)??(a.port?`127.0.0.1:${a.port}`:``),P=a.activity?v(`tray.status.${a.activity}`):a.running?v(`tray.status.running`):v(`tray.status.stopped`);return(0,U.jsxs)(`div`,{ref:_,className:o(`chrome flex max-h-full flex-col overflow-hidden rounded-[14px] border border-[var(--border-strong)] bg-[var(--surface-raised)] text-[13px] text-[var(--foreground)]`,g),children:[(0,U.jsxs)(`header`,{"data-tray-part":`header`,className:`shrink-0 border-b border-[var(--border)] px-4 pt-3.5 pb-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(l,{tone:x?`orange`:a.running?`green`:`red`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[14px] font-semibold`,children:P}),(0,U.jsx)(K,{label:v(`tray.copyAddress`),onClick:d,disabled:!N,children:(0,U.jsx)(i,{className:`size-4`})}),(0,U.jsx)(K,{label:v(`tray.settings`),onClick:()=>C(`open-settings`),children:(0,U.jsx)(w,{className:`size-4`})}),(0,U.jsx)(K,{label:v(`tray.more`),onClick:()=>C(`menu`),children:(0,U.jsx)(O,{className:`size-4`})}),!p&&(0,U.jsx)(K,{label:v(`common.close`),onClick:()=>C(`hide`),children:(0,U.jsx)(n,{className:`size-4`})})]}),N&&(0,U.jsx)(`div`,{className:`selectable mt-0.5 truncate pl-4 font-mono text-[12px] text-[var(--text-secondary)]`,children:N}),(a.apiVersionMismatch||a.updateAvailable)&&(0,U.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 pl-4`,children:[a.apiVersionMismatch&&(0,U.jsxs)(q,{tone:`orange`,children:[(0,U.jsx)(r,{className:`size-3`}),v(`tray.mismatch`)]}),a.updateAvailable&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>C(`check-updates`),className:`cursor-default`,children:(0,U.jsx)(q,{tone:`accent`,children:v(`tray.update`)})})]})]}),(0,U.jsx)(`div`,{"data-tray-part":`tabs`,className:`shrink-0`,children:M&&(0,U.jsx)(J,{tabs:T,active:A,onChange:j})}),(0,U.jsx)(`div`,{className:`scroll min-h-0 flex-1 overflow-y-auto`,children:(0,U.jsx)(`div`,{"data-tray-part":`body`,className:`flex flex-col gap-3 px-4 py-3.5`,children:!a.running&&!x?(0,U.jsx)(ne,{onStart:()=>C(`start`)}):(0,U.jsxs)(U.Fragment,{children:[A===`overview`&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(te,{prefs:e,data:s,onViewQuota:()=>j(`quota`)}),(0,U.jsx)(ie,{prefs:e,data:s,onRefresh:u}),e.sections.quota&&(0,U.jsx)(oe,{data:s,onViewAll:()=>j(`quota`)})]}),A===`quota`&&(0,U.jsx)(se,{data:s,plain:!0}),A===`clients`&&(0,U.jsx)(le,{data:s,disabled:!S,onSwitch:f,plain:!0})]})})}),(0,U.jsxs)(`footer`,{"data-tray-part":`footer`,className:`flex shrink-0 items-center gap-1 border-t border-[var(--border)] px-3 py-2.5`,children:[a.running?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{label:v(`tray.restart`),onClick:()=>C(`restart`),disabled:x,children:(0,U.jsx)(k,{className:`size-4`})}),(0,U.jsx)(K,{label:v(`tray.stop`),onClick:()=>C(`stop`),disabled:x,children:(0,U.jsx)(ee,{className:`size-4`})})]}):(0,U.jsx)(K,{label:v(`shell.startService`),onClick:()=>C(`start`),disabled:x,children:(0,U.jsx)(V,{className:`size-4`})}),(0,U.jsx)(`div`,{className:`flex-1`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>C(`quit`),className:`h-8 cursor-default rounded-[8px] px-2.5 text-[13px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)]`,children:v(`tray.quit`)}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>C(`open`),className:`inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] border border-[var(--border-strong)] px-3 text-[13px] font-medium transition-colors hover:bg-[var(--surface-muted)]`,children:[v(`tray.open`),(0,U.jsx)(D,{className:`size-3.5`})]})]})]})});function K({label:e,onClick:t,disabled:n,children:r}){return(0,U.jsx)(`button`,{type:`button`,title:e,"aria-label":e,disabled:n,onClick:t,className:`inline-flex size-8 shrink-0 cursor-default items-center justify-center rounded-[8px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)] disabled:opacity-40 disabled:hover:bg-transparent`,children:r})}function q({tone:e,children:t,title:n}){let r={red:`var(--danger)`,orange:`var(--warning)`,accent:`var(--accent)`,neutral:`var(--text-secondary)`}[e];return(0,U.jsx)(`span`,{title:n,className:`inline-flex max-w-full items-center gap-1 rounded-[6px] border px-1.5 py-px text-[11.5px] leading-[18px] whitespace-nowrap`,style:{color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},children:t})}function J({tabs:e,active:n,onChange:r}){let{t:i}=t(),a={overview:i(`tray.tab.overview`),quota:i(`tray.tab.quota`),clients:i(`tray.clients`)};return(0,U.jsx)(`div`,{role:`tablist`,className:`flex gap-1 px-3 pt-2.5`,children:e.map(e=>(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===n,onClick:()=>r(e),className:o(`h-7 cursor-default rounded-[7px] px-2.5 text-[12.5px] transition-colors`,e===n?`bg-[var(--surface-muted)] font-medium text-[var(--foreground)]`:`text-[var(--text-secondary)] hover:text-[var(--foreground)]`),children:a[e]},e))})}function Y({tone:e,onClick:t,children:n}){let i=e===`red`?`var(--danger)`:`var(--warning)`,a={color:i,borderColor:`color-mix(in oklab, ${i} 45%, transparent)`,background:`color-mix(in oklab, ${i} 10%, transparent)`},s=`flex w-full items-center gap-1.5 rounded-[8px] border px-2.5 py-1.5 text-left text-[12.5px]`,c=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n})]});return t?(0,U.jsxs)(`button`,{type:`button`,onClick:t,className:o(s,`cursor-default`),style:a,children:[c,(0,U.jsx)(A,{className:`size-3.5 shrink-0`})]}):(0,U.jsx)(`div`,{className:s,style:a,children:c})}function te({prefs:e,data:n,onViewQuota:r}){let{t:i,locale:a}=t(),o=n.summary,s=e.sections.overview&&o?y(o):0,l=e.sections.quota?E(n.plans):null,u=l&&l.row.remaining<30?l:null;return!o||s===0&&!u?null:(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s>0&&(0,U.jsx)(Y,{tone:`red`,children:i(`tray.alert.failures`,{count:s,share:c(s/o.requests)})}),u&&(0,U.jsx)(Y,{tone:u.row.remaining<10?`red`:`orange`,onClick:r,children:i(`tray.alert.quota`,{plan:u.plan.providerName,window:Q(u.row,i,a),remaining:`${Math.round(u.row.remaining)}%`})})]})}function ne({onStart:e}){let{t:n}=t();return(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6 text-center`,children:[(0,U.jsx)(`div`,{className:`text-[13px] font-medium`,children:n(`tray.status.stopped`)}),(0,U.jsx)(`div`,{className:`max-w-[260px] text-[12px] text-[var(--text-secondary)]`,children:n(`tray.stoppedHint`)}),(0,U.jsxs)(`button`,{type:`button`,onClick:e,className:`mt-1 inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] bg-[var(--accent)] px-3 text-[13px] font-medium text-[var(--on-accent)]`,children:[(0,U.jsx)(V,{className:`size-3.5`}),n(`shell.startService`)]})]})}function re(e=3e4){let[t,n]=(0,H.useState)(()=>Date.now());return(0,H.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function ie({prefs:n,data:r,onRefresh:i}){let{t:a,locale:o}=t(),s=re(),l=r.summary,u=n.sections,f=u.overview||u.cost,p=l?l.inputTokens+l.outputTokens:0,g=h(r.updatedAt,o,a(`tray.justNow`),s),_=u.topModel?S(r.top,p):null,y=u.cacheHitRate&&l?M(l.cacheReadTokens,l.inputTokens):null,b=u.compareYesterday&&l?v(p,C(r.daily,new Date(s))):null,x=u.topModel||u.cacheHitRate||u.compareYesterday;return!f&&!u.chart&&!x?null:(0,U.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-[13px] text-[var(--text-secondary)]`,children:a(`tray.today`)}),(0,U.jsx)(`div`,{className:`flex-1`}),g&&(0,U.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:a(`tray.updated`,{time:g})}),(0,U.jsx)(K,{label:a(`common.refresh`),onClick:i,children:(0,U.jsx)(F,{className:`size-3.5`})})]}),l?(0,U.jsxs)(U.Fragment,{children:[f&&(0,U.jsxs)(`div`,{className:`grid auto-cols-fr grid-flow-col gap-px overflow-hidden rounded-[10px] bg-[var(--border)]`,children:[u.overview&&(0,U.jsx)(X,{label:a(`tray.requests`),value:e(l.requests,!0)}),u.overview&&(0,U.jsx)(X,{label:a(`tray.tokens`),value:e(p,!0)}),u.cost&&(0,U.jsx)(X,{label:a(`tray.cost`),value:m(l.costUsd)})]}),u.chart&&(0,U.jsx)(ae,{data:r,now:s}),x&&(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[_&&(0,U.jsxs)(Z,{label:a(`tray.topModel`),title:_.model,children:[(0,U.jsx)(`span`,{className:`truncate`,children:_.model}),(0,U.jsxs)(`span`,{className:`shrink-0`,children:[`· `,c(_.share)]})]}),u.cacheHitRate&&(0,U.jsx)(Z,{label:a(`tray.cacheHit`),children:(0,U.jsx)(`span`,{children:y==null?`—`:c(y)})}),u.compareYesterday&&(0,U.jsx)(Z,{label:a(`tray.vsYesterday`),children:b==null?(0,U.jsx)(`span`,{children:`—`}):(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[b>=0?(0,U.jsx)(D,{className:`size-3`}):(0,U.jsx)(L,{className:`size-3`}),c(Math.abs(b))]})})]})]}):r.error?(0,U.jsx)(`div`,{className:`text-[12px] text-[var(--danger)]`,children:a(`tray.loadFailed`)}):(0,U.jsx)(d,{lines:2})]})}function X({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`min-w-0 bg-[var(--surface-muted)] px-3 py-2.5`,children:[(0,U.jsx)(`div`,{className:`truncate text-[12px] text-[var(--text-secondary)]`,children:e}),(0,U.jsx)(`div`,{className:`num mt-0.5 truncate text-[20px] leading-tight font-semibold`,title:t,children:t})]})}function Z({label:e,title:t,children:n}){return(0,U.jsxs)(`span`,{title:t,className:`inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-[var(--border)] px-2 py-0.5 text-[12px]`,children:[(0,U.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:e}),(0,U.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 font-medium`,children:n})]})}function ae({data:e,now:n}){let{t:r}=t(),i=g(e.hourly,new Date(n)),a=Math.max(1,...i.map(e=>e.value)),o=new Date(n).getHours();return(0,U.jsx)(`div`,{role:`img`,"aria-label":r(`tray.chartLabel`),className:`flex h-16 items-end gap-[3px]`,children:i.map((e,t)=>{let n=e.value>0?Math.max(4,Math.round(e.value/a*64)):2;return(0,U.jsx)(`span`,{title:r(`tray.hourBar`,{hour:`${String(t).padStart(2,`0`)}:00`,count:e.value}),className:`flex-1 rounded-[2px]`,style:{height:n,background:t===o?`var(--accent)`:e.value>0?`color-mix(in oklab, var(--foreground) 32%, transparent)`:`var(--border)`,opacity:t>o?.5:1}},e.bucket)})})}function oe({data:e,onViewAll:n}){let{t:r,locale:i}=t();if(e.plans.length===0)return e.hasSubscriptions?(0,U.jsx)(`div`,{className:`border-t border-[var(--border)] pt-3 text-[12px] text-[var(--text-muted)]`,children:r(`tray.quotaPending`)}):null;let a=p(e.plans,3),o=e.plans.reduce((e,t)=>e+t.rows.length,0);return(0,U.jsxs)(`section`,{className:`flex flex-col gap-2 border-t border-[var(--border)] pt-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center text-[12px] text-[var(--text-secondary)]`,children:[(0,U.jsx)(`span`,{className:`flex-1`,children:r(`tray.quotaTightest`)}),o>a.length&&(0,U.jsxs)(`button`,{type:`button`,onClick:n,className:`inline-flex cursor-default items-center gap-0.5 hover:text-[var(--foreground)]`,children:[r(`tray.viewAll`),(0,U.jsx)(A,{className:`size-3`})]})]}),a.map(({plan:e,row:t},n)=>(0,U.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_64px_40px_60px] items-center gap-2 text-[12.5px]`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(N,{name:e.providerName,icon:e.providerIcon,size:14}),(0,U.jsx)(`span`,{className:`truncate font-medium`,children:e.providerName}),(0,U.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:Q(t,r,i)})]}),(0,U.jsx)($,{row:t,locale:i})]},`${e.accountId}-${t.kind}-${n}`))]})}function se({data:e,plain:n}){let{t:r}=t();if(e.plans.length===0&&!e.hasSubscriptions)return null;let i=new Map;for(let t of e.plans)i.set(t.providerId,(i.get(t.providerId)??0)+1);return(0,U.jsxs)(`section`,{className:o(`flex flex-col gap-2`,!n&&`border-t border-[var(--border)] pt-3`),children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-[1fr_48px_72px] items-center gap-2 text-[12px] text-[var(--text-secondary)]`,children:[(0,U.jsx)(`span`,{children:r(`tray.quota`)}),(0,U.jsx)(`span`,{className:`text-right`,children:r(`tray.quotaRemaining`)}),(0,U.jsx)(`span`,{className:`text-right`,children:r(`tray.quotaReset`)})]}),e.plans.length===0?(0,U.jsx)(`div`,{className:`text-[12px] text-[var(--text-muted)]`,children:r(`tray.quotaPending`)}):e.plans.map(e=>(0,U.jsx)(ce,{plan:e,showAccount:(i.get(e.providerId)??0)>1},e.accountId))]})}function Q(e,t,n){return e.kind===`balance`?e.label??t(`tray.quotaBalance`):e.kind===`credits`||e.windowMinutes==null?t(`tray.quotaCredits`):x(e.windowMinutes,n)}function $({row:e,locale:t}){let n=e.remaining,r=n===null?void 0:W[_(n)];return(0,U.jsxs)(U.Fragment,{children:[n===null?(0,U.jsx)(`span`,{}):(0,U.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-[var(--surface-muted)]`,children:(0,U.jsx)(`span`,{className:`block h-full rounded-full`,style:{width:`${n}%`,background:r}})}),e.amount?(0,U.jsx)(`span`,{className:`num col-span-2 truncate text-right font-medium`,children:T(e.amount.value,e.amount.unit,t)}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`num text-right font-medium`,children:n===null?`—`:`${Math.round(n)}%`}),(0,U.jsx)(`span`,{className:`truncate text-right text-[var(--text-secondary)]`,children:b(e.resetsAt,t)??`—`})]})]})}function ce({plan:e,showAccount:n}){let{t:r,locale:i}=t();return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(N,{name:e.providerName,icon:e.providerIcon,size:16}),(0,U.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.providerName}),n&&(0,U.jsx)(`span`,{className:`truncate text-[12px] text-[var(--text-muted)]`,children:e.accountName})]}),e.rows.map((e,t)=>{let n=Q(e,r,i);return(0,U.jsxs)(`div`,{className:`grid grid-cols-[52px_1fr_48px_72px] items-center gap-2 pl-6 text-[12.5px]`,children:[(0,U.jsx)(`span`,{className:`truncate text-[var(--text-secondary)]`,title:n,children:n}),(0,U.jsx)($,{row:e,locale:i})]},`${e.kind}-${t}`)})]})}function le({data:e,disabled:n,onSwitch:r,plain:i}){let{t:a}=t(),s=e.clients.filter(e=>e.enabled);if(s.length===0)return null;let c=t=>e.providers.find(e=>e.id===t)?.name??a(`tray.unbound`);return(0,U.jsxs)(`section`,{className:o(`flex flex-col gap-1`,!i&&`border-t border-[var(--border)] pt-3`),children:[(0,U.jsx)(`div`,{className:`mb-0.5 text-[12px] text-[var(--text-secondary)]`,children:a(`tray.clients`)}),s.map(e=>(0,U.jsxs)(`button`,{type:`button`,disabled:n||!r,onClick:()=>r?.(e),"aria-label":a(`tray.switchProvider`,{client:e.name}),className:`-mx-2 flex h-8 cursor-default items-center gap-2 rounded-[8px] px-2 text-left transition-colors enabled:hover:bg-[var(--surface-muted)]`,children:[e.kind in j&&(0,U.jsx)(P,{kind:e.kind,size:16}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`max-w-[45%] truncate text-[12px] text-[var(--text-secondary)]`,children:c(e.providerId)}),r&&(0,U.jsx)(z,{className:`size-3.5 shrink-0 text-[var(--text-muted)]`})]},e.kind))]})}export{G as t};