tokentracker-cli 0.5.84 → 0.5.86

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 (22) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +401 -0
  3. package/dashboard/dist/assets/{Card-D9qs5F6a.js → Card-D4LPt5pl.js} +1 -1
  4. package/dashboard/dist/assets/DashboardPage-B-2PxAXT.js +12 -0
  5. package/dashboard/dist/assets/{FadeIn-58ii1scI.js → FadeIn-Bw7pQont.js} +1 -1
  6. package/dashboard/dist/assets/{IpCheckPage-D_oSEAJv.js → IpCheckPage-BN6f0ZOs.js} +1 -1
  7. package/dashboard/dist/assets/{LeaderboardPage-y-xpxCOw.js → LeaderboardPage-DazS-BOp.js} +2 -2
  8. package/dashboard/dist/assets/{LeaderboardProfilePage-D2Pg7C2E.js → LeaderboardProfilePage-DQMr9vjY.js} +1 -1
  9. package/dashboard/dist/assets/{LimitsPage-BGqjHAiJ.js → LimitsPage-BKaitxPe.js} +1 -1
  10. package/dashboard/dist/assets/{ProviderIcon-DZe_sc0f.js → ProviderIcon-CTwz2lc9.js} +1 -1
  11. package/dashboard/dist/assets/{SettingsPage-CKqGPzGp.js → SettingsPage-CYpMYSR7.js} +1 -1
  12. package/dashboard/dist/assets/{WidgetsPage-BKlifAwP.js → WidgetsPage-C-VjXvcB.js} +1 -1
  13. package/dashboard/dist/assets/{download-CIOju6TK.js → download-B8q-pUg6.js} +1 -1
  14. package/dashboard/dist/assets/{leaderboard-columns-C2HnsCRa.js → leaderboard-columns-BUl7-rVO.js} +1 -1
  15. package/dashboard/dist/assets/{main-v7jzPCYG.css → main-BP_tVIcC.css} +1 -1
  16. package/dashboard/dist/assets/{main-CT6BPeer.js → main-Ry0vayW2.js} +210 -189
  17. package/dashboard/dist/assets/{use-limits-display-prefs-BCGcgZmr.js → use-limits-display-prefs-mlXe4VuM.js} +1 -1
  18. package/dashboard/dist/assets/{use-usage-limits-DosliezS.js → use-usage-limits-CxmDpqkS.js} +1 -1
  19. package/dashboard/dist/index.html +2 -2
  20. package/dashboard/dist/share.html +2 -2
  21. package/package.json +1 -1
  22. package/dashboard/dist/assets/DashboardPage-D6rRASfb.js +0 -12
@@ -1 +1 @@
1
- import{r as l,b as Q,f as X,aO as L,D as n,e as k,ab as P,aA as f,B as s,ai as J,aE as ee,aP as te,aF as ne,aG as ae,aH as D,aQ as ie,aR as se,ah as oe,aj as re,C as le,an as ce,aS as ue,aT as de,aU as _,aV as ge,aW as he,aX as be,aY as me,aZ as pe,a_ as fe,a$ as G,b0 as xe,b1 as ye}from"./main-CT6BPeer.js";import{L as ve,a as E,u as ke}from"./use-limits-display-prefs-BCGcgZmr.js";import{C as je}from"./Card-D9qs5F6a.js";import{D as Ne}from"./download-CIOju6TK.js";const Se=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach(Se);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const we=l.createContext(null);function Ce(){const e=l.useRef(!1);return Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Le(){const e=Ce(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>X.postRender(i),[i]),t]}const T=e=>e===!0,Ge=e=>T(e===!0)||e==="id",Ee=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(we),[r,c]=Le(),u=l.useRef(null),g=i.id||o;u.current===null&&(Ge(a)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:T(a)&&i.group||I()});const b=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:b,children:e})};const Ie=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Oe=k("grip-vertical",Ie);const Ae=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],O=k("languages",Ae);const Pe=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],De=k("log-out",Pe);const _e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Te=k("pencil",_e);const Me=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ue=k("refresh-cw",Me),Re=new Set(["cursor","kiro","copilot"]);function He({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:f("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:f("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Be({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),b=d=>m=>{c(d),m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("text/plain",d)},h=d=>m=>{m.preventDefault(),m.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},x=()=>{c(null),g(null)},v=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Ee,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const m=a[d]!==!1,N=r===d;return n.jsxs(P.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:b(d),onDragOver:h(d),onDragEnd:x,onDrop:v,className:f("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[n.jsx(Oe,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),n.jsx("img",{src:ve[d],alt:"",width:18,height:18,className:f("h-[18px] w-[18px] shrink-0 pointer-events-none",Re.has(d)&&"dark:invert"),draggable:!1}),n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:E[d]}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx(He,{checked:m,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${E[d]}`})})]},d)})})})}function Fe(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function $e(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function ze(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function Ve(e,t,a){const[i,o]=l.useState(()=>ee()),r=t&&a&&te(),c=l.useCallback(async()=>{const u=!i;if(ne(u),o(u),!!u)try{await ae(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function Ze(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[b,h]=l.useState(null),[x,v]=l.useState(!1),[d,m]=l.useState(""),[N,S]=l.useState(!1),[B,C]=l.useState(""),[F,$]=l.useState(""),[z,V]=l.useState(!1),[Z,W]=l.useState(null),q=l.useMemo(()=>Fe(e),[e]),K=l.useMemo(()=>$e(e),[e]),Y=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:h,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:b,displayName:q,editingGithub:z,editingName:x,email:K,githubError:Z,githubInput:F,githubUrl:B,loadSetters:Y,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:h,setEditingGithub:V,setEditingName:v,setGithubError:W,setGithubInput:$,setGithubUrl:C,setNameInput:m,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:N}}function We(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await D({getAccessToken:e});if(!i||!o)return;const r=await ie({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function qe(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await D({getAccessToken:e});if(!c)return!1;const u=await se({accessToken:c,...a});return r?.(u),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function Ke(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function Ye(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function Qe(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function Xe(e,t){const a=l.useCallback(async()=>{const o=e.nameInput.trim().slice(0,50);o&&await t({display_name:o},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(o),e.setEditingName(!1)}})},[t,e]),i=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:a,startEditingName:i}}function Je(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=ze(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function et(){const e=J(),t=Ze(e.user),a=Ve(e.getAccessToken,e.enabled,e.signedIn);We(e.getAccessToken,e.signedIn,t.loadSetters);const i=qe(e.getAccessToken,t),o=Qe(t,i),r=Xe(t,i),c=Je(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,name:Ke(t,{...o,...r}),github:Ye(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function y({checked:e,onChange:t,disabled:a,ariaLabel:i}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:t,disabled:a,className:f("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:f("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function p({label:e,hint:t,control:a}){return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:e}),t?n.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),n.jsx("div",{className:"shrink-0",children:a})]})}function j({title:e,subtitle:t,action:a,children:i}){return n.jsxs(je,{children:[n.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:e}),t?n.jsx("p",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),a?n.jsx("div",{className:"shrink-0",children:a}):null]}),n.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:i})]})}function A({options:e,value:t,onChange:a}){return n.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 bg-oai-gray-50 p-0.5 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:e.map(({value:i,label:o,Icon:r})=>{const c=t===i;return n.jsxs("button",{type:"button",onClick:()=>a(i),"aria-pressed":c,className:f("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors",c?"bg-white text-oai-black shadow-sm dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[r?n.jsx(r,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,n.jsx("span",{children:o})]},i)})})}function M({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),n.jsx("button",{type:"button",onClick:t,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function tt({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),n.jsx(M,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function nt({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&a(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),n.jsx(M,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function U({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function R({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function at({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(U,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(y,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function it({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:b,setEditingName:h,setNameInput:x,startEditingName:v}=e,d=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(R,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(tt,{nameInput:u,setEditingName:h,setNameInput:x,profileSaving:b,handleSaveName:c}),actions:n.jsx(at,{name:e})})}function st({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:b,setGithubError:h,setGithubInput:x,showGithubOn:v,startEditingGithub:d}=e;return n.jsx(R,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(nt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:b,setGithubError:h,setGithubInput:x}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(U,{label:s("settings.account.edit"),onClick:d}),n.jsx(y,{checked:v,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function ot(){const{openLoginModal:e}=oe();return n.jsx(j,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function rt({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(it,{name:e}),n.jsx(st,{github:t})]})}function lt(){const e=et();return e.enabled?e.signedIn?n.jsxs(j,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(ct,{onSignOut:e.signOut}),children:[n.jsx(ut,{settings:e}),n.jsx(dt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(gt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(ot,{}):null}function ct({onSignOut:e}){return n.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[n.jsx(De,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function ut({settings:e}){return e.showLocalCloudSync?n.jsx(p,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(y,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function dt({checked:e,disabled:t,onChange:a}){return n.jsx(p,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(y,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function gt({visible:e,name:t,github:a}){return n.jsx(re,{initial:!1,children:e?n.jsx(P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:n.jsx(rt,{name:t,github:a})},"public-profile-fields"):null})}function ht(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:ue},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:de},{value:"system",label:s("settings.appearance.theme.system"),Icon:_}]}function bt(){return[{value:ge,label:s("settings.appearance.language.system"),Icon:_},{value:he,label:s("settings.appearance.language.english"),Icon:O},{value:be,label:s("settings.appearance.language.chinese"),Icon:O}]}function mt(){const{theme:e,setTheme:t}=le(),{locale:a,setLocale:i}=ce();return n.jsxs(j,{title:s("settings.section.appearance"),children:[n.jsx(p,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(A,{options:ht(),value:e,onChange:t})}),n.jsx(p,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(A,{options:bt(),value:a,onChange:i})})]})}function H(){const[e,t]=l.useState(null),a=me()&&pe();l.useEffect(()=>{if(!a)return;const c=fe(u=>t(u));return G(),c},[a]);const i=l.useCallback((c,u)=>{a&&(t(g=>g&&{...g,[c]:u}),xe(c,u))},[a]),o=l.useCallback(c=>{a&&ye(c)},[a]),r=l.useCallback(()=>{a&&G()},[a]);return{available:a,settings:e,setSetting:i,runAction:o,refresh:r}}function pt(){const{available:e,settings:t,setSetting:a,runAction:i}=H();if(!e)return null;const o=!!t?.showStats,r=t?.animatedIcon!==!1,c=!!t?.launchAtLogin,u=t?.launchAtLoginSupported!==!1,g=t?.updateStatus||null,b=!!t?.updateBusy,h=!!t?.isSyncing;return n.jsxs(j,{title:s("settings.section.menubar"),children:[n.jsx(p,{label:s("settings.menubar.showStats"),hint:s("settings.menubar.showStatsHint"),control:n.jsx(y,{checked:o,onChange:()=>a("showStats",!o),ariaLabel:s("settings.menubar.showStats")})}),n.jsx(p,{label:s("settings.menubar.animatedIcon"),hint:s("settings.menubar.animatedIconHint"),control:n.jsx(y,{checked:r,onChange:()=>a("animatedIcon",!r),ariaLabel:s("settings.menubar.animatedIcon")})}),u?n.jsx(p,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(y,{checked:c,onChange:()=>a("launchAtLogin",!c),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(p,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:h,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Ue,{className:f("h-3.5 w-3.5",h&&"animate-spin"),"aria-hidden":!0}),h?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(p,{label:s("settings.menubar.updates"),hint:g||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:b,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Ne,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function ft(){const{available:e,settings:t,runAction:a}=H();return!e||!t?.version?null:n.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[11px] text-oai-gray-500 dark:text-oai-gray-500",children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"})]})}function jt(){const e=ke();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(mt,{}),n.jsx(pt,{}),n.jsx(lt,{}),n.jsx(j,{title:s("settings.section.limits"),children:n.jsx(Be,{prefs:e})})]}),n.jsx(ft,{})]})})})}export{jt as SettingsPage};
1
+ import{r as l,b as Q,f as X,aO as L,D as n,e as k,ab as P,aA as f,B as s,ai as J,aE as ee,aP as te,aF as ne,aG as ae,aH as D,aQ as ie,aR as se,ah as oe,aj as re,C as le,an as ce,aS as ue,aT as de,aU as _,aV as ge,aW as he,aX as be,aY as me,aZ as pe,a_ as fe,a$ as G,b0 as xe,b1 as ye}from"./main-Ry0vayW2.js";import{L as ve,a as E,u as ke}from"./use-limits-display-prefs-mlXe4VuM.js";import{C as je}from"./Card-D4LPt5pl.js";import{D as Ne}from"./download-B8q-pUg6.js";const Se=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach(Se);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const we=l.createContext(null);function Ce(){const e=l.useRef(!1);return Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Le(){const e=Ce(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>X.postRender(i),[i]),t]}const T=e=>e===!0,Ge=e=>T(e===!0)||e==="id",Ee=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(we),[r,c]=Le(),u=l.useRef(null),g=i.id||o;u.current===null&&(Ge(a)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:T(a)&&i.group||I()});const b=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:b,children:e})};const Ie=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Oe=k("grip-vertical",Ie);const Ae=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],O=k("languages",Ae);const Pe=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],De=k("log-out",Pe);const _e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Te=k("pencil",_e);const Me=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ue=k("refresh-cw",Me),Re=new Set(["cursor","kiro","copilot"]);function He({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:f("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:f("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Be({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),b=d=>m=>{c(d),m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("text/plain",d)},h=d=>m=>{m.preventDefault(),m.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},x=()=>{c(null),g(null)},v=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Ee,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const m=a[d]!==!1,N=r===d;return n.jsxs(P.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:b(d),onDragOver:h(d),onDragEnd:x,onDrop:v,className:f("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[n.jsx(Oe,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),n.jsx("img",{src:ve[d],alt:"",width:18,height:18,className:f("h-[18px] w-[18px] shrink-0 pointer-events-none",Re.has(d)&&"dark:invert"),draggable:!1}),n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:E[d]}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx(He,{checked:m,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${E[d]}`})})]},d)})})})}function Fe(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function $e(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function ze(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function Ve(e,t,a){const[i,o]=l.useState(()=>ee()),r=t&&a&&te(),c=l.useCallback(async()=>{const u=!i;if(ne(u),o(u),!!u)try{await ae(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function Ze(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[b,h]=l.useState(null),[x,v]=l.useState(!1),[d,m]=l.useState(""),[N,S]=l.useState(!1),[B,C]=l.useState(""),[F,$]=l.useState(""),[z,V]=l.useState(!1),[Z,W]=l.useState(null),q=l.useMemo(()=>Fe(e),[e]),K=l.useMemo(()=>$e(e),[e]),Y=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:h,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:b,displayName:q,editingGithub:z,editingName:x,email:K,githubError:Z,githubInput:F,githubUrl:B,loadSetters:Y,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:h,setEditingGithub:V,setEditingName:v,setGithubError:W,setGithubInput:$,setGithubUrl:C,setNameInput:m,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:N}}function We(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await D({getAccessToken:e});if(!i||!o)return;const r=await ie({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function qe(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await D({getAccessToken:e});if(!c)return!1;const u=await se({accessToken:c,...a});return r?.(u),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function Ke(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function Ye(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function Qe(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function Xe(e,t){const a=l.useCallback(async()=>{const o=e.nameInput.trim().slice(0,50);o&&await t({display_name:o},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(o),e.setEditingName(!1)}})},[t,e]),i=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:a,startEditingName:i}}function Je(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=ze(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function et(){const e=J(),t=Ze(e.user),a=Ve(e.getAccessToken,e.enabled,e.signedIn);We(e.getAccessToken,e.signedIn,t.loadSetters);const i=qe(e.getAccessToken,t),o=Qe(t,i),r=Xe(t,i),c=Je(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,name:Ke(t,{...o,...r}),github:Ye(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function y({checked:e,onChange:t,disabled:a,ariaLabel:i}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:t,disabled:a,className:f("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:f("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function p({label:e,hint:t,control:a}){return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:e}),t?n.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),n.jsx("div",{className:"shrink-0",children:a})]})}function j({title:e,subtitle:t,action:a,children:i}){return n.jsxs(je,{children:[n.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:e}),t?n.jsx("p",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),a?n.jsx("div",{className:"shrink-0",children:a}):null]}),n.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:i})]})}function A({options:e,value:t,onChange:a}){return n.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 bg-oai-gray-50 p-0.5 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:e.map(({value:i,label:o,Icon:r})=>{const c=t===i;return n.jsxs("button",{type:"button",onClick:()=>a(i),"aria-pressed":c,className:f("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors",c?"bg-white text-oai-black shadow-sm dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[r?n.jsx(r,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,n.jsx("span",{children:o})]},i)})})}function M({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),n.jsx("button",{type:"button",onClick:t,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function tt({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),n.jsx(M,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function nt({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&a(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),n.jsx(M,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function U({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function R({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function at({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(U,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(y,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function it({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:b,setEditingName:h,setNameInput:x,startEditingName:v}=e,d=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(R,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(tt,{nameInput:u,setEditingName:h,setNameInput:x,profileSaving:b,handleSaveName:c}),actions:n.jsx(at,{name:e})})}function st({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:b,setGithubError:h,setGithubInput:x,showGithubOn:v,startEditingGithub:d}=e;return n.jsx(R,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(nt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:b,setGithubError:h,setGithubInput:x}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(U,{label:s("settings.account.edit"),onClick:d}),n.jsx(y,{checked:v,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function ot(){const{openLoginModal:e}=oe();return n.jsx(j,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function rt({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(it,{name:e}),n.jsx(st,{github:t})]})}function lt(){const e=et();return e.enabled?e.signedIn?n.jsxs(j,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(ct,{onSignOut:e.signOut}),children:[n.jsx(ut,{settings:e}),n.jsx(dt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(gt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(ot,{}):null}function ct({onSignOut:e}){return n.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[n.jsx(De,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function ut({settings:e}){return e.showLocalCloudSync?n.jsx(p,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(y,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function dt({checked:e,disabled:t,onChange:a}){return n.jsx(p,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(y,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function gt({visible:e,name:t,github:a}){return n.jsx(re,{initial:!1,children:e?n.jsx(P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:n.jsx(rt,{name:t,github:a})},"public-profile-fields"):null})}function ht(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:ue},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:de},{value:"system",label:s("settings.appearance.theme.system"),Icon:_}]}function bt(){return[{value:ge,label:s("settings.appearance.language.system"),Icon:_},{value:he,label:s("settings.appearance.language.english"),Icon:O},{value:be,label:s("settings.appearance.language.chinese"),Icon:O}]}function mt(){const{theme:e,setTheme:t}=le(),{locale:a,setLocale:i}=ce();return n.jsxs(j,{title:s("settings.section.appearance"),children:[n.jsx(p,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(A,{options:ht(),value:e,onChange:t})}),n.jsx(p,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(A,{options:bt(),value:a,onChange:i})})]})}function H(){const[e,t]=l.useState(null),a=me()&&pe();l.useEffect(()=>{if(!a)return;const c=fe(u=>t(u));return G(),c},[a]);const i=l.useCallback((c,u)=>{a&&(t(g=>g&&{...g,[c]:u}),xe(c,u))},[a]),o=l.useCallback(c=>{a&&ye(c)},[a]),r=l.useCallback(()=>{a&&G()},[a]);return{available:a,settings:e,setSetting:i,runAction:o,refresh:r}}function pt(){const{available:e,settings:t,setSetting:a,runAction:i}=H();if(!e)return null;const o=!!t?.showStats,r=t?.animatedIcon!==!1,c=!!t?.launchAtLogin,u=t?.launchAtLoginSupported!==!1,g=t?.updateStatus||null,b=!!t?.updateBusy,h=!!t?.isSyncing;return n.jsxs(j,{title:s("settings.section.menubar"),children:[n.jsx(p,{label:s("settings.menubar.showStats"),hint:s("settings.menubar.showStatsHint"),control:n.jsx(y,{checked:o,onChange:()=>a("showStats",!o),ariaLabel:s("settings.menubar.showStats")})}),n.jsx(p,{label:s("settings.menubar.animatedIcon"),hint:s("settings.menubar.animatedIconHint"),control:n.jsx(y,{checked:r,onChange:()=>a("animatedIcon",!r),ariaLabel:s("settings.menubar.animatedIcon")})}),u?n.jsx(p,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(y,{checked:c,onChange:()=>a("launchAtLogin",!c),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(p,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:h,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Ue,{className:f("h-3.5 w-3.5",h&&"animate-spin"),"aria-hidden":!0}),h?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(p,{label:s("settings.menubar.updates"),hint:g||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:b,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Ne,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function ft(){const{available:e,settings:t,runAction:a}=H();return!e||!t?.version?null:n.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[11px] text-oai-gray-500 dark:text-oai-gray-500",children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"})]})}function jt(){const e=ke();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(mt,{}),n.jsx(pt,{}),n.jsx(lt,{}),n.jsx(j,{title:s("settings.section.limits"),children:n.jsx(Be,{prefs:e})})]}),n.jsx(ft,{})]})})})}export{jt as SettingsPage};
@@ -1 +1 @@
1
- import{e as w,D as e,B as n,b1 as b,aU as j,r as h,b2 as k,aA as v}from"./main-CT6BPeer.js";import{F as f,S as N,a as W}from"./FadeIn-58ii1scI.js";import{D as S}from"./download-CIOju6TK.js";const F=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],C=w("arrow-up-right",F),M=264,A=124,c="ui-rounded, -apple-system, system-ui",m=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],D={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function _(a){return a>=.9?"#E64D4D":a>=.7?"#D9A633":"#33B866"}function g({size:a="sm",children:r}){const s=a==="lg",i=s?560:264,l=s?32:22;return e.jsx("div",{className:v("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",s?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:i,aspectRatio:`${M} / ${A}`,borderRadius:l},children:r})})}function E({size:a="sm"}){const r="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",s=`${r} L264,124 L0,124 Z`,i=`sparkArea-${a}`;return e.jsx(g,{size:a,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:c,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:c,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:"$673.61"}),e.jsx("path",{d:s,fill:`url(#${i})`,stroke:"none"}),e.jsx("path",{d:r,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const u=(()=>{const s=[];for(let i=0;i<26;i++)for(let l=0;l<7;l++){const t=Math.sin((i+1)*12.9898+(l+1)*78.233+17)*43758.5453,d=Math.floor(Math.abs(t-Math.floor(t))*100);s.push({w:i,d:l,v:d})}return s})();function p(a,r){return a<18?r?"#262626":"#e5e5e5":a<38?"rgba(10, 132, 255, 0.28)":a<58?"rgba(10, 132, 255, 0.50)":a<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function z(){return e.jsx(g,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:u.map(t=>e.jsx("rect",{x:t.w*(7.5+1.2),y:t.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:p(t.v,!0)},`d-${t.w}-${t.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:u.map(t=>e.jsx("rect",{x:t.w*(7.5+1.2),y:t.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:p(t.v,!1)},`l-${t.w}-${t.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:c,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function $(){const a=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],r=22,s=28,i=14,l=236;return e.jsx(g,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:a.map((t,d)=>{const o=s+d*r,x=m[d%m.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:x}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:t.name}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:c,children:t.value}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:c,children:[t.pct,"%"]}),e.jsx("rect",{x:i,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:o+4,width:Math.max(l*(t.pct/100),4),height:"2.8",rx:"1.4",fill:x})]},t.name)})})})}function L(){const a=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],r=22,s=28,i=14,l=236;return e.jsx(g,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:a.map((t,d)=>{const o=s+d*r,x=D[t.source],y=_(t.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:x}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:t.label}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:t.reset}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:c,children:[t.pct,"%"]}),e.jsx("rect",{x:i,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:o+4,width:Math.max(l*(t.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},t.label)})})})}function P(){const[a,r]=h.useState("loading");return h.useEffect(()=>{if(typeof window>"u")return;if(k()){r("native");return}const s=(navigator.userAgent||"").toLowerCase(),i=/mac/.test(s)&&!/iphone|ipad/.test(s);r(i?"mac-web":"other")},[]),a}function O(){const a=P();return a==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):a==="native"?e.jsxs("button",{type:"button",onClick:()=>b("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[n("widgets.cta.open_gallery"),e.jsx(C,{className:"h-4 w-4","aria-hidden":"true"})]}):a==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(S,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(j,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.macos_only")]})}const H=[{id:"heatmap",Preview:z,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:$,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:L,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function G(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(f,{y:12,children:e.jsxs("header",{className:"mb-10 flex flex-col gap-6 sm:mb-14 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:n("widgets.page.title")}),e.jsx("p",{className:"max-w-xl text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:n("widgets.page.subtitle")})]}),e.jsx("div",{className:"shrink-0",children:e.jsx(O,{})})]})}),e.jsx(f,{y:16,delay:.08,children:e.jsxs("section",{className:"mb-14 sm:mb-16","aria-label":n("widgets.hero.aria"),children:[e.jsx(E,{size:"lg"}),e.jsx("p",{className:"mt-5 text-center text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("widgets.hero.annotation")})]})}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-5 text-xs font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:n("widgets.section.more")}),e.jsx(N,{staggerDelay:.08,initialDelay:.12,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 sm:gap-5",children:H.map(({id:a,Preview:r,nameKey:s,descKey:i})=>e.jsx(W,{children:e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(r,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:n(s)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:n(i)})]})]})},a))})})]})]})})})}export{G as WidgetsPage};
1
+ import{e as w,D as e,B as n,b1 as b,aU as j,r as h,b2 as k,aA as v}from"./main-Ry0vayW2.js";import{F as f,S as N,a as W}from"./FadeIn-Bw7pQont.js";import{D as S}from"./download-B8q-pUg6.js";const F=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],C=w("arrow-up-right",F),M=264,A=124,c="ui-rounded, -apple-system, system-ui",m=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],D={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function _(a){return a>=.9?"#E64D4D":a>=.7?"#D9A633":"#33B866"}function g({size:a="sm",children:r}){const s=a==="lg",i=s?560:264,l=s?32:22;return e.jsx("div",{className:v("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",s?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:i,aspectRatio:`${M} / ${A}`,borderRadius:l},children:r})})}function E({size:a="sm"}){const r="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",s=`${r} L264,124 L0,124 Z`,i=`sparkArea-${a}`;return e.jsx(g,{size:a,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:c,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:c,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:"$673.61"}),e.jsx("path",{d:s,fill:`url(#${i})`,stroke:"none"}),e.jsx("path",{d:r,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const u=(()=>{const s=[];for(let i=0;i<26;i++)for(let l=0;l<7;l++){const t=Math.sin((i+1)*12.9898+(l+1)*78.233+17)*43758.5453,d=Math.floor(Math.abs(t-Math.floor(t))*100);s.push({w:i,d:l,v:d})}return s})();function p(a,r){return a<18?r?"#262626":"#e5e5e5":a<38?"rgba(10, 132, 255, 0.28)":a<58?"rgba(10, 132, 255, 0.50)":a<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function z(){return e.jsx(g,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:u.map(t=>e.jsx("rect",{x:t.w*(7.5+1.2),y:t.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:p(t.v,!0)},`d-${t.w}-${t.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:u.map(t=>e.jsx("rect",{x:t.w*(7.5+1.2),y:t.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:p(t.v,!1)},`l-${t.w}-${t.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:c,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function $(){const a=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],r=22,s=28,i=14,l=236;return e.jsx(g,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:a.map((t,d)=>{const o=s+d*r,x=m[d%m.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:x}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:t.name}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:c,children:t.value}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:c,children:[t.pct,"%"]}),e.jsx("rect",{x:i,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:o+4,width:Math.max(l*(t.pct/100),4),height:"2.8",rx:"1.4",fill:x})]},t.name)})})})}function L(){const a=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],r=22,s=28,i=14,l=236;return e.jsx(g,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:a.map((t,d)=>{const o=s+d*r,x=D[t.source],y=_(t.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:x}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:t.label}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:c,children:t.reset}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:c,children:[t.pct,"%"]}),e.jsx("rect",{x:i,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:o+4,width:Math.max(l*(t.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},t.label)})})})}function P(){const[a,r]=h.useState("loading");return h.useEffect(()=>{if(typeof window>"u")return;if(k()){r("native");return}const s=(navigator.userAgent||"").toLowerCase(),i=/mac/.test(s)&&!/iphone|ipad/.test(s);r(i?"mac-web":"other")},[]),a}function O(){const a=P();return a==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):a==="native"?e.jsxs("button",{type:"button",onClick:()=>b("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[n("widgets.cta.open_gallery"),e.jsx(C,{className:"h-4 w-4","aria-hidden":"true"})]}):a==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(S,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(j,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.macos_only")]})}const H=[{id:"heatmap",Preview:z,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:$,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:L,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function G(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(f,{y:12,children:e.jsxs("header",{className:"mb-10 flex flex-col gap-6 sm:mb-14 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:n("widgets.page.title")}),e.jsx("p",{className:"max-w-xl text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:n("widgets.page.subtitle")})]}),e.jsx("div",{className:"shrink-0",children:e.jsx(O,{})})]})}),e.jsx(f,{y:16,delay:.08,children:e.jsxs("section",{className:"mb-14 sm:mb-16","aria-label":n("widgets.hero.aria"),children:[e.jsx(E,{size:"lg"}),e.jsx("p",{className:"mt-5 text-center text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("widgets.hero.annotation")})]})}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-5 text-xs font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:n("widgets.section.more")}),e.jsx(N,{staggerDelay:.08,initialDelay:.12,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3 sm:gap-5",children:H.map(({id:a,Preview:r,nameKey:s,descKey:i})=>e.jsx(W,{children:e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(r,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:n(s)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:n(i)})]})]})},a))})})]})]})})})}export{G as WidgetsPage};
@@ -1 +1 @@
1
- import{e as o}from"./main-CT6BPeer.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],d=o("download",a);export{d as D};
1
+ import{e as o}from"./main-Ry0vayW2.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],d=o("download",a);export{d as D};
@@ -1 +1 @@
1
- import{ad as l,D as n,aA as i}from"./main-CT6BPeer.js";function y(r){let e=0;const o=String(r??"");for(let a=0;a<o.length;a+=1)e=Math.imul(31,e)+o.charCodeAt(a)|0;return Math.abs(e)%360}function m(r){const e=String(r??"").trim();if(!e)return"?";const o=e.split(/\s+/).filter(Boolean);if(o.length>=2){const a=o[0][0]||"",t=o[1][0]||"";return`${a}${t}`.toUpperCase()}return e.slice(0,2).toUpperCase()}const g={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base"};function h({avatarUrl:r,displayName:e,seed:o,size:a="md",className:t}){const d=g[a]||g.md,b=y(o??e??""),s=typeof r=="string"?r.trim():"",[p,c]=l.useState(!1);return l.useEffect(()=>{c(!1)},[s]),s&&!p?n.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>c(!0),className:i("rounded-full object-cover ring-1 ring-white/10",d,t)}):n.jsx("div",{className:i("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",d,t),style:{backgroundColor:`hsl(${b} 42% 34%)`},"aria-hidden":!0,children:m(e)})}const k=new Set(["/brand-logos/cursor.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function w({iconSrc:r,label:e}){return n.jsxs("span",{className:"inline-flex items-center gap-3",children:[r?n.jsx("img",{src:r,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${k.has(r)?"dark:invert":""}`}):null,n.jsx("span",{className:"whitespace-nowrap",children:e})]})}const x=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:null},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],f="sticky left-0 z-40 w-[72px] min-w-[72px] max-w-[72px] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",_="sticky left-[72px] z-40 min-w-[200px] max-w-[min(260px,45vw)] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",v="sticky left-[72px] z-40 min-w-[6rem] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4";function K(r){return i("sticky left-0 z-30 w-[72px] min-w-[72px] max-w-[72px] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 whitespace-nowrap",r?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function T(r){return i("sticky left-[72px] z-30 min-w-[200px] max-w-[min(260px,45vw)] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 min-w-0",r?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function S(r){return i("sticky left-[72px] z-30 min-w-[6rem] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 whitespace-nowrap","bg-white dark:bg-oai-gray-950")}export{f as L,_ as a,x as b,T as c,w as d,h as e,S as f,v as g,K as l};
1
+ import{ad as l,D as n,aA as i}from"./main-Ry0vayW2.js";function y(r){let e=0;const o=String(r??"");for(let a=0;a<o.length;a+=1)e=Math.imul(31,e)+o.charCodeAt(a)|0;return Math.abs(e)%360}function m(r){const e=String(r??"").trim();if(!e)return"?";const o=e.split(/\s+/).filter(Boolean);if(o.length>=2){const a=o[0][0]||"",t=o[1][0]||"";return`${a}${t}`.toUpperCase()}return e.slice(0,2).toUpperCase()}const g={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base"};function h({avatarUrl:r,displayName:e,seed:o,size:a="md",className:t}){const d=g[a]||g.md,b=y(o??e??""),s=typeof r=="string"?r.trim():"",[p,c]=l.useState(!1);return l.useEffect(()=>{c(!1)},[s]),s&&!p?n.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>c(!0),className:i("rounded-full object-cover ring-1 ring-white/10",d,t)}):n.jsx("div",{className:i("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",d,t),style:{backgroundColor:`hsl(${b} 42% 34%)`},"aria-hidden":!0,children:m(e)})}const k=new Set(["/brand-logos/cursor.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function w({iconSrc:r,label:e}){return n.jsxs("span",{className:"inline-flex items-center gap-3",children:[r?n.jsx("img",{src:r,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${k.has(r)?"dark:invert":""}`}):null,n.jsx("span",{className:"whitespace-nowrap",children:e})]})}const x=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:null},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],f="sticky left-0 z-40 w-[72px] min-w-[72px] max-w-[72px] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",_="sticky left-[72px] z-40 min-w-[200px] max-w-[min(260px,45vw)] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",v="sticky left-[72px] z-40 min-w-[6rem] border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4";function K(r){return i("sticky left-0 z-30 w-[72px] min-w-[72px] max-w-[72px] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 whitespace-nowrap",r?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function T(r){return i("sticky left-[72px] z-30 hover:z-50 min-w-[200px] max-w-[min(260px,45vw)] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 min-w-0",r?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function S(r){return i("sticky left-[72px] z-30 min-w-[6rem] border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 whitespace-nowrap","bg-white dark:bg-oai-gray-950")}export{f as L,_ as a,x as b,T as c,w as d,h as e,S as f,v as g,K as l};