tokentracker-cli 1.4.1 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.de.md +5 -4
  2. package/README.ja.md +5 -4
  3. package/README.ko.md +5 -4
  4. package/README.md +5 -4
  5. package/README.zh-CN.md +5 -4
  6. package/dashboard/dist/assets/{AchievementBadge-DWECUOAX.js → AchievementBadge-3IYidbrI.js} +1 -1
  7. package/dashboard/dist/assets/{AchievementsPage-Bakfwwn_.js → AchievementsPage-DmZ_ojyM.js} +2 -2
  8. package/dashboard/dist/assets/{AchievementsSection-DiEX2_5U.js → AchievementsSection-DIYrrzhw.js} +1 -1
  9. package/dashboard/dist/assets/{BadgeDetailModal-ClVMnxVW.js → BadgeDetailModal-DMMExCe4.js} +1 -1
  10. package/dashboard/dist/assets/{BotAnimated-D7eyrAPs.js → BotAnimated-y6vZNRvC.js} +1 -1
  11. package/dashboard/dist/assets/{Card-CsAQxZZ8.js → Card-LJX3G3zo.js} +1 -1
  12. package/dashboard/dist/assets/{CloudCheckoutPage-BAN-DtXB.js → CloudCheckoutPage-BGBgSXNE.js} +1 -1
  13. package/dashboard/dist/assets/{CloudPage-D9sNlUAy.js → CloudPage-Dij2GTXi.js} +2 -2
  14. package/dashboard/dist/assets/{CommandPalette-D9TNT6un.js → CommandPalette-BIky6Fk0.js} +1 -1
  15. package/dashboard/dist/assets/{CommunityStatsModal-CotRRQNH.js → CommunityStatsModal-DbM99i0s.js} +1 -1
  16. package/dashboard/dist/assets/{ConfirmModal-C_il5anp.js → ConfirmModal-C_NH8vgO.js} +1 -1
  17. package/dashboard/dist/assets/{Controls-Bd1kODP4.js → Controls-BEAj_kvr.js} +1 -1
  18. package/dashboard/dist/assets/{DashboardPage-De0EL8Hn.js → DashboardPage-DO7h2dfu.js} +1 -1
  19. package/dashboard/dist/assets/{DateRangePopover-quw6hpxy.js → DateRangePopover-PQXB8v0k.js} +1 -1
  20. package/dashboard/dist/assets/{DevicePage-CP20lVYv.js → DevicePage-0JZ3OIWZ.js} +1 -1
  21. package/dashboard/dist/assets/{DialogClose-BEUL9bD6.js → DialogClose-BpWoD5h9.js} +1 -1
  22. package/dashboard/dist/assets/DialogDescription-ne_rYSD7.js +1 -0
  23. package/dashboard/dist/assets/{DialogTitle-C--sXGjf.js → DialogTitle-DoQgdh5w.js} +1 -1
  24. package/dashboard/dist/assets/{ElectricLogo-DhP7S1Cu.js → ElectricLogo-0O87VjKv.js} +1 -1
  25. package/dashboard/dist/assets/{FadeIn-BPH15_jE.js → FadeIn-9ph1h_AG.js} +1 -1
  26. package/dashboard/dist/assets/{HeaderGithubStar-DziE8s6w.js → HeaderGithubStar-DCZ92xbH.js} +1 -1
  27. package/dashboard/dist/assets/{HoverTooltip-tQyY2CuV.js → HoverTooltip-CCKdmuOP.js} +1 -1
  28. package/dashboard/dist/assets/{IpCheckPage-BjoB05O7.js → IpCheckPage-CpyhpmdS.js} +1 -1
  29. package/dashboard/dist/assets/{LandingPage-Cav49COr.js → LandingPage-spvsPkYy.js} +2 -2
  30. package/dashboard/dist/assets/{LeaderboardPage-CHjFKLvs.js → LeaderboardPage-2nJ08ohw.js} +2 -2
  31. package/dashboard/dist/assets/{LeaderboardProBadge-D97MfK5W.js → LeaderboardProBadge-D6FSL3Qy.js} +1 -1
  32. package/dashboard/dist/assets/{LeaderboardProfileModal-NNTwtWSu.js → LeaderboardProfileModal-DD1jX-rD.js} +3 -3
  33. package/dashboard/dist/assets/{LeaderboardProfilePage-xI81GH3D.js → LeaderboardProfilePage-DYqRrntL.js} +1 -1
  34. package/dashboard/dist/assets/{LimitsPage-BPOo3FOW.js → LimitsPage-DXHikunk.js} +1 -1
  35. package/dashboard/dist/assets/{LocalOnlyNotice-j8Tijts2.js → LocalOnlyNotice-BURiQAtP.js} +1 -1
  36. package/dashboard/dist/assets/{LoginCard-C7_n6J7k.js → LoginCard-Cv2ijoJx.js} +1 -1
  37. package/dashboard/dist/assets/{LoginModal-DwlNscw5.js → LoginModal-DyOideDA.js} +1 -1
  38. package/dashboard/dist/assets/{LoginPage-BqhWatt2.js → LoginPage-BKNvqvYi.js} +1 -1
  39. package/dashboard/dist/assets/{PetPage-CJlC0V0i.js → PetPage-BBmozE0L.js} +2 -2
  40. package/dashboard/dist/assets/{PopoverPopup-wleZ4DTI.js → PopoverPopup-DDnISLKM.js} +1 -1
  41. package/dashboard/dist/assets/{ProviderIcon-biLVsOGr.js → ProviderIcon-Da90GDcM.js} +1 -1
  42. package/dashboard/dist/assets/{ResetPasswordPage-5Sl45OsN.js → ResetPasswordPage-DsETr50j.js} +1 -1
  43. package/dashboard/dist/assets/{Select-77l2QNqa.js → Select-pZDawyxt.js} +1 -1
  44. package/dashboard/dist/assets/{SelectItemText-BQbmtjd3.js → SelectItemText-D5wuuN7G.js} +1 -1
  45. package/dashboard/dist/assets/{SelfHostPage-C8hlgVu4.js → SelfHostPage-sm-PARYj.js} +1 -1
  46. package/dashboard/dist/assets/{ServiceStatusPage-DrY9Mef8.js → ServiceStatusPage-D4f8h0sL.js} +1 -1
  47. package/dashboard/dist/assets/{SessionsPage-BDTsH3Mk.js → SessionsPage-xVLsTN4m.js} +1 -1
  48. package/dashboard/dist/assets/{SettingsPage-C_id9Go3.js → SettingsPage-Dt9iFheY.js} +3 -3
  49. package/dashboard/dist/assets/{SkillsPage-kb6_5uUk.js → SkillsPage-BdWalPpd.js} +1 -1
  50. package/dashboard/dist/assets/{TokenGalaxy-BoS0yUFS.js → TokenGalaxy-d2_ml0tE.js} +1 -1
  51. package/dashboard/dist/assets/{TooltipPopup-LV1aWIRZ.js → TooltipPopup-B4masxDW.js} +1 -1
  52. package/dashboard/dist/assets/{TrendMonitor-DN-nwcSA.js → TrendMonitor-CceYpa2O.js} +1 -1
  53. package/dashboard/dist/assets/{WidgetsPage-C6lvwceS.js → WidgetsPage-CSN0829H.js} +1 -1
  54. package/dashboard/dist/assets/{WrappedPage-CfC39wWP.js → WrappedPage-gP4WfO_m.js} +1 -1
  55. package/dashboard/dist/assets/{__vite-browser-external-DpZbUcLL.js → __vite-browser-external-BtJVmciH.js} +2 -2
  56. package/dashboard/dist/assets/{agent-logos-CvcdCGj5.js → agent-logos-wxccxfWz.js} +1 -1
  57. package/dashboard/dist/assets/{arrow-left-BX4LX5TF.js → arrow-left-Bd5C77R2.js} +1 -1
  58. package/dashboard/dist/assets/{arrow-right-Aktjo2RL.js → arrow-right-C1RqrK4A.js} +1 -1
  59. package/dashboard/dist/assets/{arrow-up-right-kkQt6Du0.js → arrow-up-right-B_b2i8hn.js} +1 -1
  60. package/dashboard/dist/assets/{calendar-days-OvLTNZBH.js → calendar-days-C8eYygme.js} +1 -1
  61. package/dashboard/dist/assets/{check-v5Ie379p.js → check-BlBHefQ7.js} +1 -1
  62. package/dashboard/dist/assets/{chevron-down-CPlz1cYW.js → chevron-down-mjUspqZv.js} +1 -1
  63. package/dashboard/dist/assets/{cloud-checkout-C_Rhiwno.js → cloud-checkout-CEkMnWXf.js} +1 -1
  64. package/dashboard/dist/assets/{composite-DD_boZdD.js → composite-CzXFY9IC.js} +1 -1
  65. package/dashboard/dist/assets/{download-NqHXZ-zn.js → download-CQvg59w1.js} +1 -1
  66. package/dashboard/dist/assets/{external-link-B0D03J0f.js → external-link-CDYfIZ3Z.js} +1 -1
  67. package/dashboard/dist/assets/{flame-av87we58.js → flame-C9NXQRil.js} +1 -1
  68. package/dashboard/dist/assets/{format-tokens-B43Ehkbb.js → format-tokens-fKy_3qpW.js} +1 -1
  69. package/dashboard/dist/assets/{gift-CZus7M21.js → gift-WmV4SBGR.js} +1 -1
  70. package/dashboard/dist/assets/{host-mode-Dd9fzAdq.js → host-mode-C5MvZ7SV.js} +1 -1
  71. package/dashboard/dist/assets/{icons-CnScwnf_.js → icons-B1EtsaZs.js} +1 -1
  72. package/dashboard/dist/assets/{index-Cj9NdXOj.js → index-9EZ3o2RV.js} +1 -1
  73. package/dashboard/dist/assets/{index-D3XPaYEL.js → index-BEecBW06.js} +1 -1
  74. package/dashboard/dist/assets/{index-BZTIoCof.js → index-DXNwBFNi.js} +1 -1
  75. package/dashboard/dist/assets/{info-BUmCmjwd.js → info-CWDhggIW.js} +1 -1
  76. package/dashboard/dist/assets/{link-2-t-wSLB2a.js → link-2-DEWNkK7s.js} +1 -1
  77. package/dashboard/dist/assets/{loader-circle-DM-FdXeX.js → loader-circle-DotT5gVp.js} +1 -1
  78. package/dashboard/dist/assets/{modifiers.esm-D5AKZNa7.js → modifiers.esm-qZnGgJAz.js} +1 -1
  79. package/dashboard/dist/assets/{monitor-smartphone-CDHFLZS-.js → monitor-smartphone-DOP5eqBD.js} +1 -1
  80. package/dashboard/dist/assets/{play-BIQH--yZ.js → play-BUsybi9m.js} +1 -1
  81. package/dashboard/dist/assets/{plus-CztG5eum.js → plus-DAjojh_m.js} +1 -1
  82. package/dashboard/dist/assets/{provider-display-B2gZ38Oh.js → provider-display-BCQQYPWD.js} +2 -2
  83. package/dashboard/dist/assets/{react-D1u6HsZx.js → react-BgpqhoCj.js} +1 -1
  84. package/dashboard/dist/assets/{safePolygon-ClG4WM06.js → safePolygon-C-PFpZSA.js} +1 -1
  85. package/dashboard/dist/assets/{search-NNy_fIbJ.js → search-W1A-6ugo.js} +1 -1
  86. package/dashboard/dist/assets/{server-N94HJtJY.js → server-CE7pFjDr.js} +1 -1
  87. package/dashboard/dist/assets/{shield-check-BGfaKXG9.js → shield-check-KL5xc2FR.js} +1 -1
  88. package/dashboard/dist/assets/{skills-api-CWydQc4G.js → skills-api-DL_zLjKA.js} +1 -1
  89. package/dashboard/dist/assets/{sortable.esm-BF83ljWQ.js → sortable.esm-CehJQvFH.js} +1 -1
  90. package/dashboard/dist/assets/{store-l5WfCa7P.js → store-BHAXkHPR.js} +1 -1
  91. package/dashboard/dist/assets/{terminal-CRBThKUQ.js → terminal-Br5vyD6Q.js} +1 -1
  92. package/dashboard/dist/assets/{trash-BXN5tg81.js → trash-CzaCJP6G.js} +1 -1
  93. package/dashboard/dist/assets/{use-community-stats-dHketgyF.js → use-community-stats-DbJrecQw.js} +1 -1
  94. package/dashboard/dist/assets/{use-latest-request-guard-CdM1Pn_p.js → use-latest-request-guard-DGhwmlX8.js} +1 -1
  95. package/dashboard/dist/assets/{use-limits-display-prefs-dOm4SCFU.js → use-limits-display-prefs-T7KWAWZ6.js} +1 -1
  96. package/dashboard/dist/assets/{use-native-settings-GL9uAidm.js → use-native-settings-MZJhS328.js} +1 -1
  97. package/dashboard/dist/assets/{use-ordered-list-Btz_NSiA.js → use-ordered-list-BDN24weA.js} +1 -1
  98. package/dashboard/dist/assets/use-reduced-motion-CfCY-K-a.js +1 -0
  99. package/dashboard/dist/assets/{use-session-efficiency-pref-BPZel3HL.js → use-session-efficiency-pref-DUu16y8Z.js} +1 -1
  100. package/dashboard/dist/assets/{use-transform-D2xePGbE.js → use-transform-BczE46xm.js} +1 -1
  101. package/dashboard/dist/assets/{use-usage-limits-vEmyPwMY.js → use-usage-limits-CjyDfH-M.js} +1 -1
  102. package/dashboard/dist/assets/{useCurrency-DnhS0llv.js → useCurrency-BgZmWbkx.js} +1 -1
  103. package/dashboard/dist/assets/{usePositioner-7yozJJJ0.js → usePositioner-dWENyY8z.js} +1 -1
  104. package/dashboard/dist/assets/{useTokenFormat-DvjyXv8i.js → useTokenFormat-D7s1-Zuk.js} +1 -1
  105. package/dashboard/dist/assets/{zap-CElRpX2w.js → zap-Dr__bKlq.js} +1 -1
  106. package/dashboard/dist/index.html +13 -11
  107. package/dashboard/dist/ip-check.html +1 -1
  108. package/dashboard/dist/leaderboard.html +1 -1
  109. package/dashboard/dist/llms.txt +3 -2
  110. package/dashboard/dist/share.html +1 -1
  111. package/package.json +2 -2
  112. package/src/commands/doctor.js +15 -1
  113. package/src/commands/init.js +9 -0
  114. package/src/commands/status.js +20 -2
  115. package/src/commands/sync.js +25 -0
  116. package/src/lib/cloud-device-token.js +77 -10
  117. package/src/lib/diagnostics.js +4 -1
  118. package/src/lib/pricing/index.js +2 -1
  119. package/src/lib/pricing/seed-snapshot.json +1 -1
  120. package/src/lib/rollout.js +402 -0
  121. package/dashboard/dist/assets/DialogDescription-DpkD2qwW.js +0 -1
  122. package/dashboard/dist/assets/use-reduced-motion-D9n2I_eN.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-NNTwtWSu.js","assets/__vite-browser-external-DpZbUcLL.js","assets/__vite-browser-external-B0m8a6Te.css","assets/provider-display-B2gZ38Oh.js","assets/useCurrency-DnhS0llv.js","assets/useTokenFormat-DvjyXv8i.js","assets/terminal-CRBThKUQ.js","assets/play-BIQH--yZ.js","assets/info-BUmCmjwd.js","assets/LeaderboardProBadge-D97MfK5W.js","assets/TooltipPopup-LV1aWIRZ.js","assets/composite-DD_boZdD.js","assets/store-l5WfCa7P.js","assets/safePolygon-ClG4WM06.js","assets/usePositioner-7yozJJJ0.js","assets/ProviderIcon-biLVsOGr.js","assets/AchievementBadge-DWECUOAX.js","assets/zap-CElRpX2w.js","assets/flame-av87we58.js","assets/calendar-days-OvLTNZBH.js","assets/shield-check-BGfaKXG9.js","assets/AchievementsSection-DiEX2_5U.js","assets/react-D1u6HsZx.js","assets/format-tokens-B43Ehkbb.js","assets/use-reduced-motion-D9n2I_eN.js","assets/arrow-up-right-kkQt6Du0.js","assets/link-2-t-wSLB2a.js","assets/check-v5Ie379p.js","assets/DialogTitle-C--sXGjf.js","assets/CommunityStatsModal-CotRRQNH.js","assets/icons-CnScwnf_.js","assets/TrendMonitor-DN-nwcSA.js","assets/DateRangePopover-quw6hpxy.js","assets/use-latest-request-guard-CdM1Pn_p.js","assets/PopoverPopup-wleZ4DTI.js","assets/SelectItemText-BQbmtjd3.js","assets/DialogDescription-DpkD2qwW.js","assets/DialogClose-BEUL9bD6.js"])))=>i.map(i=>d[i]);
2
- import{j as e,V as xa,c as s,r as l,y as c,as as ba,d as pa,u as ha,a as fa,bc as ya,W as ka,aA as wa,a7 as va,bd as Be,be as ja,bf as ie,g as Na,bg as _a,L as Sa,bh as Ca,i as La,bi as Aa,bj as Ea,aP as Ta,_ as Ge,h as Ma,z as Pa}from"./__vite-browser-external-DpZbUcLL.js";import{S as Ra}from"./Select-77l2QNqa.js";import{m as Ka}from"./react-D1u6HsZx.js";import{u as za,C as Ia,a as Ba,b as De,D as Da,c as Oa,S as $a,h as Ua,s as Fa,K as Ga,P as Wa}from"./sortable.esm-BF83ljWQ.js";import{r as Ha}from"./modifiers.esm-D5AKZNa7.js";import{P as fe}from"./ProviderIcon-biLVsOGr.js";import{u as Ya}from"./useCurrency-DnhS0llv.js";import{u as Q}from"./useTokenFormat-DvjyXv8i.js";import{L as X,a as ne}from"./LeaderboardProBadge-D97MfK5W.js";import{s as Va,c as Ja,A as Za,t as Xa,b as qa}from"./AchievementBadge-DWECUOAX.js";import{u as Qa}from"./use-ordered-list-Btz_NSiA.js";import{A as er}from"./arrow-right-Aktjo2RL.js";import{u as ar}from"./use-community-stats-dHketgyF.js";import"./chevron-down-CPlz1cYW.js";import"./check-v5Ie379p.js";import"./SelectItemText-BQbmtjd3.js";import"./composite-DD_boZdD.js";import"./usePositioner-7yozJJJ0.js";import"./TooltipPopup-LV1aWIRZ.js";import"./store-l5WfCa7P.js";import"./safePolygon-ClG4WM06.js";import"./zap-CElRpX2w.js";import"./flame-av87we58.js";import"./calendar-days-OvLTNZBH.js";import"./shield-check-BGfaKXG9.js";function W(a,{min:r,max:o,fallback:i}){const d=Number(a);if(!Number.isFinite(d))return i;const n=Math.floor(d);return n<r?r:n>o?o:n}function rr(a,r){const o=W(r,{min:0,max:1e6,fallback:0}),i=W(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const d=new Set([1,o,i-2,i-1,i,i+1,i+2]),n=Array.from(d).filter(u=>Number.isInteger(u)&&u>=1&&u<=o).sort((u,p)=>u-p),g=[];let m=null;for(const u of n)m!=null&&u-m>1&&g.push(null),g.push(u),m=u;return g}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,i=o?W(r,{min:0,max:1e6,fallback:0}):null,d=W(a,{min:1,max:o?Math.max(1,i||1):1e6,fallback:1}),n=d>1,g=o?d<i:!0;return{canPrev:n,canNext:g,safePage:d,safeTotal:i}}function or({entries:a,me:r,meLabel:o}){const i=Array.isArray(a)?a:[],d=r&&typeof r.rank=="number"?r.rank:null;return!d||i.some(g=>!!g?.is_me)?i:[{rank:d,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,pro_active:r?.pro_active===!0,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null,badges:Array.isArray(r?.badges)?r.badges:[]},...i]}function sr(a,r){const o=Number(a),i=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(i)||i<1?null:Math.ceil(o/i)}const ir=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function nr({iconSrc:a,label:r}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${ir.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const le=xa.memo(function({badges:r,max:o=3,className:i=""}){const d=Va((r||[]).filter(n=>n&&Ja.has(n.id)&&(n.tier||0)>=1)).slice(0,o);return d.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${i}`,children:d.map((n,g)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(qa(n.id,"name")),tier:s(`achievements.tier.${Xa(n.tier)}`)}),style:{zIndex:d.length-g},className:`pointer-events-auto relative inline-flex ${g>0?"-ml-1.5":""}`,children:e.jsx(Za,{badgeId:n.id,tier:n.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},n.id))})});function We({children:a}){const r=l.useRef(null),o=l.useRef(null),[i,d]=l.useState(0),[n,g]=l.useState(!1);return l.useLayoutEffect(()=>{const m=o.current,u=()=>{d(m.scrollWidth),g(m.scrollWidth>m.clientWidth)};u();const p=typeof ResizeObserver=="function"?new ResizeObserver(u):null;return p?.observe(m),p?.observe(m.firstElementChild),()=>p?.disconnect()},[]),l.useLayoutEffect(()=>{r.current.scrollLeft=o.current.scrollLeft},[i]),e.jsxs("div",{className:"hidden w-full sm:block",children:[e.jsx("div",{ref:r,hidden:!n,role:"region","aria-label":s("leaderboard.horizontal_scroll"),tabIndex:0,className:"oai-scrollbar h-4 w-full overflow-x-auto overflow-y-hidden border-b border-oai-gray-200 dark:border-oai-gray-800 [scrollbar-gutter:auto]",onScroll:m=>{o.current.scrollLeft=m.currentTarget.scrollLeft},children:e.jsx("div",{style:{width:i,height:1}})}),e.jsx("div",{ref:o,className:"oai-scrollbar w-full overflow-x-auto [scrollbar-gutter:auto]",onScroll:m=>{r.current.scrollLeft=m.currentTarget.scrollLeft},children:a})]})}const q=[{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:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],He="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",Ye="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function de(a){return c("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function ce(a){return c("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function y({className:a}){return e.jsx("div",{className:c("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function lr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",i=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:c(de(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:c(ce(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:c("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:c("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),q.map(d=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:c("h-4",i)})},d.key))]})}function dr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:c("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(i,d)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},d))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx(We,{children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:c(He,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-6"})}),e.jsx("th",{className:c(Ye,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-14"})}),q.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(lr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(dr,{index:o},o))})]})}function mr({id:a,thClassName:r,children:o}){const{attributes:i,listeners:d,setNodeRef:n,transform:g,transition:m,isDragging:u}=za({id:a}),p=Ia.Transform.toString(g)||"";l.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${a}"]`),h="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(b=>{b.style.transform=p,b.style.transition=m||"",b.style.zIndex=u?"20":"",b.style.position=p?"relative":"",b.style.boxShadow=u?h:""}),()=>{f.forEach(b=>{b.style.transform="",b.style.transition="",b.style.zIndex="",b.style.position="",b.style.boxShadow=""})}},[a,p,m,u]);const v={transform:p,transition:m,position:p?"relative":void 0,zIndex:u?20:void 0,boxShadow:u?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:n,style:v,className:c(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...i,...d,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:c("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",u&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const gr="tokentracker.leaderboard.columnOrder.v1";function ur(a){return Qa(gr,a)}const xr=50;function br(a,r){const o=Number(a),i=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(i)||i<1?null:Math.min(100,Math.max(1,Math.ceil(o/i*100)))}function Ve(a){return typeof a=="string"?a.trim():""}function pr(a){const r=Ve(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:i,onJumpToMe:d,canJump:n,className:g}){const m=a&&typeof a.rank=="number"?a.rank:null;if(!m)return null;const u=Number(r)||0,p=br(m,u),v=Ve(a?.display_name),f=!v||pr(v)?o||"You":v,h=a?.user_id||f,b=i||(n?d:null),E=typeof b=="function",C=E?"button":"div",ee=E?{type:"button",onClick:b,"aria-label":s(i?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,className:c("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",E?"border-oai-gray-200 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:hover:border-oai-gray-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-gray-100/40 dark:hover:bg-oai-gray-900/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",g),children:[e.jsx(X,{size:"sm",avatarUrl:a?.avatar_url,displayName:f,seed:h,proActive:a?.pro_active===!0}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-gray-800 dark:group-hover:text-oai-gray-100 transition-colors",children:f}),a?.pro_active===!0&&e.jsx("span",{className:"leaderboard-pro-badge",role:"img","aria-label":s("leaderboard.pro.badge_aria"),"aria-description":s("leaderboard.pro.tooltip"),children:s("leaderboard.pro.badge")}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",m.toLocaleString()]}),p!=null&&p<=xr&&e.jsx("span",{className:"hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1 bg-oai-gray-100 text-oai-gray-700 dark:bg-oai-gray-800 dark:text-oai-gray-300 ring-oai-gray-300/30 dark:ring-oai-gray-600/30",children:s("leaderboard.summary.percentile",{p:String(p)})}),E?e.jsx(er,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-gray-600 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-oai-gray-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"})]})]})}const fr=l.lazy(()=>Ge(()=>import("./LeaderboardProfileModal-NNTwtWSu.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28])).then(a=>({default:a.LeaderboardProfileModal}))),yr=l.lazy(()=>Ge(()=>import("./CommunityStatsModal-CotRRQNH.js"),__vite__mapDeps([29,1,2,22,30,5,15,31,4,32,33,6,34,12,11,35,14,13,24,16,17,18,19,20,28,36,37])).then(a=>({default:a.CommunityStatsModal}))),me=[10,20,50,100],ge=20,Je="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return ge;try{const a=window.localStorage.getItem(Je),r=Number(a);if(me.includes(r))return r}catch{}return ge}function ue(a,r,o){const i=Number(a);if(!Number.isFinite(i)||i<=0)return"-";const d=Ca(r),n=r===Pa?i:i*o;return n>=1e3?`${d}${Math.round(n).toLocaleString()}`:n>=10?`${d}${Math.round(n)}`:`${d}${n.toFixed(2)}`}function wr(a){if(typeof a!="string"||!a.trim())return null;const r=new Date(a);if(!Number.isFinite(r.getTime()))return null;const o=Ma();return{dateTime:r.toISOString(),display:new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(r),exact:new Intl.DateTimeFormat(o,{dateStyle:"full",timeStyle:"long"}).format(r)}}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=Q();return e.jsx("span",{title:o(a),children:r(a)})}function vr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:i}=Q();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-gray-400 hover:bg-oai-gray-100/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-gray-500/80 dark:hover:bg-oai-gray-900/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:s("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-oai-gray-400/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:e.jsx("span",{title:i(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children:La(a.totalEntries)}),e.jsx("span",{className:"hidden sm:inline",children:(Number(a.totalEntries)||0).toLocaleString("en-US")})]}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.devs_chip")})]})]})}function Oe({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:i,formatTokensTooltip:d}=Q(),n=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",g=r?"bg-oai-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900";return o.map(m=>e.jsx("td",{"data-column-key":m.key,title:d(a?.[m.key]),className:c("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",n,g),children:i(a?.[m.key])},m.key))}function jr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const Nr={1:"ring-2 ring-amber-400 dark:ring-amber-500/80 shadow-[0_0_8px_rgba(245,158,11,0.25)]",2:"ring-2 ring-slate-350 dark:ring-slate-450 shadow-[0_0_8px_rgba(148,163,184,0.2)]",3:"ring-2 ring-orange-400 dark:ring-orange-500/70 shadow-[0_0_8px_rgba(249,115,22,0.25)]"};function _r({rank:a,placeholder:r}){return a===1?e.jsx("span",{className:"text-base font-extrabold italic text-amber-500 dark:text-amber-400 tracking-tighter",children:"1"}):a===2?e.jsx("span",{className:"text-base font-extrabold italic text-slate-400 dark:text-slate-350 tracking-tighter",children:"2"}):a===3?e.jsx("span",{className:"text-base font-extrabold italic text-orange-500 dark:text-orange-400 tracking-tighter",children:"3"}):e.jsx("span",{className:"text-[13px] font-bold tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:a==null?r:`#${a}`})}function Sr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(fe,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:i}=Q(),d=r.filter(n=>{const g=Number(a?.[n.key]);return Number.isFinite(g)&&g>0});return d.length===0?null:e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-x-1.5 gap-y-2 border-t border-oai-gray-100/70 pt-3 dark:border-oai-gray-800/60",children:d.map(n=>{const g=s(n.copyKey);return e.jsxs("span",{title:g,"aria-label":`${g}: ${i(a?.[n.key])}`,className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-oai-gray-50/80 dark:bg-oai-gray-900/60 px-2 py-0.5 border border-oai-gray-100/80 dark:border-oai-gray-800/40 text-[10px] font-medium text-oai-gray-600 dark:text-oai-gray-300 transition-colors",children:[e.jsx(fe,{provider:jr(n),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[n.key])})]},n.key)})})}function Lr({entry:a,entryIdx:r,name:o,meLabel:i,currency:d,rate:n,orderedColumns:g,placeholder:m,onOpenProfile:u}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,v=!p&&pe(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,b=p?i:o,E=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),u(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>u(f):void 0,onKeyDown:h?E:void 0,"aria-label":h?s("leaderboard.profile_modal.row_aria",{name:b}):void 0,className:c("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",p?"bg-oai-gray-50 dark:bg-oai-gray-900 border-oai-gray-300/60 dark:border-oai-gray-500/25":v?"bg-white/90 dark:bg-oai-gray-950/90 border-oai-gray-100/70 dark:border-oai-gray-800/40":"bg-white dark:bg-oai-gray-950 border-oai-gray-100 dark:border-oai-gray-800/60",h&&"cursor-pointer hover:border-oai-gray-200 dark:hover:border-oai-gray-700/80 active:scale-[0.985] active:bg-oai-gray-50/60 dark:active:bg-oai-gray-900/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-oai-gray-500/60"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex w-5 shrink-0 items-center justify-center",children:e.jsx(_r,{rank:a?.rank,placeholder:m})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:c("inline-flex rounded-full p-0.5 transition-all duration-300",a?.pro_active!==!0&&(Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80"),v&&"opacity-60 grayscale-[15%]"),children:e.jsx(X,{size:"md",avatarUrl:a?.avatar_url,displayName:b,seed:he(a,b),proActive:a?.pro_active===!0})}),a?.github_url&&e.jsx(Sr,{githubUrl:a.github_url})]}),e.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:c("min-w-0 truncate text-sm tracking-tight",p?"font-semibold text-oai-black dark:text-oai-white":v?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:b}),e.jsx(ne,{proActive:a?.pro_active===!0}),e.jsx(le,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:s("leaderboard.column.est_cost")}),e.jsx("span",{className:c("ml-1 tabular-nums font-medium",v?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:ue(a?.estimated_cost_usd,d,n)})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.08em] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.column.total")}),e.jsx("div",{className:c("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",p?"text-oai-black dark:text-oai-white":v?"text-oai-gray-400 dark:text-oai-gray-500":"text-oai-gray-800 dark:text-oai-gray-200"),children:e.jsx(xe,{value:a?.total_tokens})})]})]}),e.jsx(Cr,{entry:a,orderedColumns:g})]},`mobile-row-${a?.rank}-${b}`)}const Ar={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function $e({rank:a,placeholder:r}){const o=Ar[a];return o?e.jsx("span",{className:c("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Ue(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Er(a){if(!a)return s("shared.error.prefix",{error:s("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||s("leaderboard.error.unknown");return s("shared.error.prefix",{error:o})}function be(a){return typeof a!="string"?"":a.trim()}function pe(a){const r=be(a);return r?r.toLowerCase()==="anonymous":!0}function he(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Fe({githubUrl:a}){return e.jsxs("span",{className:"absolute left-1/2 top-full -translate-x-1/2 -translate-y-1/2 inline-flex group/gh",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":s("leaderboard.github.aria"),className:"flex h-4 w-4 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 transition-transform hover:scale-110",children:e.jsx(fe,{provider:"GITHUB",size:14})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:s("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[s("leaderboard.github.tooltipPrefix")," ",e.jsx(Sa,{to:"/settings",onClick:r=>r.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:s("leaderboard.github.tooltipSettingsLink")})," ",s("leaderboard.github.tooltipSuffix")]})]})]})}function ot({auth:a,signedIn:r,sessionSoftExpired:o}){const i=ba(),d=pa(),{openLoginModal:n}=ha(),{signedIn:g,loading:m,user:u}=fa(),{currency:p,rate:v}=Ya(),f=l.useMemo(()=>ya(),[]),h=ka(),b=r&&!o,E=l.useMemo(()=>b&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,b]),C=b?E:null,ee=b&&wa(C),ae=s("shared.placeholder.short"),Ze=l.useMemo(()=>q.map(t=>t.key),[]),{order:re,reorder:ye}=ur(Ze),ke=l.useMemo(()=>{const t=new Map;for(const x of q)t.set(x.key,x);return t},[]),B=l.useMemo(()=>re.map(t=>ke.get(t)).filter(Boolean),[re,ke]),Xe=Ba(De(Wa,{activationConstraint:{distance:6}}),De(Ga,{coordinateGetter:Fa})),qe=l.useCallback(t=>{const{active:x,over:w}=t;!w||x.id===w.id||ye(String(x.id),String(w.id))},[ye]),[te,M]=l.useState(1),[_,Qe]=l.useState(kr),[we,ve]=l.useState(null),[ea,je]=l.useState(!1),H=l.useCallback(t=>{typeof t=="string"&&t.trim()&&ve(t.trim())},[]),aa=l.useCallback(()=>ve(null),[]),ra=l.useCallback(t=>{const x=me.includes(t)?t:ge;Qe(x),M(1);try{window.localStorage.setItem(Je,String(x))}catch{}},[]),[Ne,ta]=l.useState(0),[oa,sa]=l.useState(()=>va()),[_e,Se]=l.useState(!1);l.useEffect(()=>{if(typeof window>"u")return;const t=()=>{ta(x=>x+1)};return window.addEventListener(Be,t),()=>{window.removeEventListener(Be,t)}},[]);const N=l.useMemo(()=>{const t=new URLSearchParams(i?.search||"");return Ue(t.get("period"))||"total"},[i?.search]),ia=t=>{const x=Ue(t);if(!x||x===N)return;const w=new URLSearchParams(i?.search||"");w.set("period",x),M(1),d(`${i?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};l.useEffect(()=>{m||h||g||n()},[g,m,h,n]),l.useEffect(()=>{M(1)},[N]);const Y=l.useMemo(()=>(W(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),K=l.useMemo(()=>h?"mock":m?"unavailable":g?"cloud":r?"local":f?"public":"unavailable",[m,g,f,h,r]),k=l.useMemo(()=>ja({accessMode:K,baseUrl:f,mockEnabled:h,userId:u?.id||null,period:N,pageSize:_,offset:Y}),[u?.id,K,f,Y,h,_,N]),[D,O]=l.useState(()=>{const t=ie(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});l.useEffect(()=>{if(!f&&!h||!h&&K==="unavailable"){O({loading:!1,error:null,data:null,contextKey:null});return}const t=ie(k);let x=!0;return O(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await Na({userId:u?.id||null,period:N,limit:_,offset:Y});x&&(_a(w,{activeContextKey:k,contextKey:k,source:Ne>0?"manual-refresh":"page-load"}),O({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!x)return;const T=Er(w);O(F=>F.contextKey===k?{...F,loading:!1,error:T}:{loading:!1,error:T,data:null,contextKey:k})}),()=>{x=!1}},[f,K,u?.id,k,Y,Ne,h,N,_]);const oe=l.useMemo(()=>D.contextKey===k?null:ie(k),[k,D.contextKey]),j=l.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(f||h)&&K!=="unavailable",error:null,data:null,contextKey:k},[K,f,k,D,h,oe]),S=j.data,$=S?.total_pages??null,na=S?.total_entries??0,P=S?.page??te,la=l.useMemo(()=>rr(P,$),[P,$]),Ce=S?.from||null,Le=S?.to||null,da=S?.generated_at||null,V=wr(da),Ae=ar(),R=S?.me||null,z=s("leaderboard.me_label"),Ee=s("leaderboard.anon_label"),Te=s("leaderboard.period.week"),Me=s("leaderboard.period.month"),Pe=s("leaderboard.period.total"),Re=N==="month"?Me:N==="total"?Pe:Te,J=l.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:R,meLabel:z})},[S?.entries,R,z]),I=l.useMemo(()=>sr(R?.rank,_),[R?.rank,_]),ca=I!=null&&I===P,ma=l.useCallback(()=>{I!=null&&M(I)},[I]),ga=async()=>{Se(!0);try{Aa(!0),sa(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{Se(!1)}},{canPrev:Ke,canNext:ze}=tr({page:P,totalPages:$}),Z=Array.isArray(J)&&J.length!==0;let U=null;j.loading&&!Z?U=e.jsx(cr,{rows:_}):j.error&&!Z?U=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:j.error})}):Z?U=e.jsxs(Da,{sensors:Xe,collisionDetection:Oa,modifiers:[Ha],onDragEnd:qe,children:[e.jsx(We,{children:e.jsxs("table",{className:"min-w-full w-full text-left text-sm sm:min-w-max",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:c(He,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.rank")}),e.jsx("th",{className:c(Ye,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:s("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:s("leaderboard.column.est_cost")}),e.jsx($a,{items:re,strategy:Ua,children:B.map(t=>e.jsx(mr,{id:t.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(nr,{iconSrc:t.icon,label:s(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:J.map((t,x)=>{if(t?.is_ellipsis){const A=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:A,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${x}`)}const w=!!t?.is_me,T=typeof t?.user_id=="string"?t.user_id:null,F=be(t?.display_name),ua=pe(F)?Ee:F,L=w?z:ua,G=!!T,Ie=G?{role:"button",tabIndex:0,onClick:G?()=>H(T):void 0,onKeyDown:G?A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),H(T))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const A=!!t?.is_pinned;return e.jsxs("tr",{...Ie,className:c("bg-oai-gray-50 dark:bg-oai-gray-900 transition-colors",A?"border-t border-b border-oai-gray-300/40 dark:border-oai-gray-500/20":"border-y border-oai-gray-300/40 dark:border-oai-gray-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-500/60"),children:[e.jsx("td",{className:c(de(!0),"font-semibold text-oai-gray-700 dark:text-oai-gray-300",A&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-gray-500 dark:before:bg-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:ce(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:c("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&t?.pro_active!==!0&&"gh-avatar-frame"),children:[e.jsx("span",{className:c("inline-flex rounded-full p-px",t?.github_url&&t?.pro_active!==!0&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(X,{avatarUrl:t?.avatar_url,displayName:L,seed:he(t,L),proActive:t?.pro_active===!0})}),t?.github_url&&e.jsx(Fe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ne,{proActive:t?.pro_active===!0}),e.jsx(le,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-gray-50 dark:bg-oai-gray-900",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap text-right tabular-nums bg-oai-gray-50 dark:bg-oai-gray-900",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,v)}),e.jsx(Oe,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${A?"-pin":""}`)}return e.jsxs("tr",{...Ie,className:c("group transition-colors",G&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-500/60"),children:[e.jsx("td",{className:c(de(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:ce(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:c("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&t?.pro_active!==!0&&"gh-avatar-frame"),children:[e.jsx("span",{className:c("inline-flex rounded-full p-px",t?.github_url&&t?.pro_active!==!0&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(X,{avatarUrl:t?.avatar_url,displayName:L,seed:he(t,L),proActive:t?.pro_active===!0})}),t?.github_url&&e.jsx(Fe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:L}),e.jsx(ne,{proActive:t?.pro_active===!0}),e.jsx(le,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,v)}),e.jsx(Oe,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:J.map((t,x)=>{const w=be(t?.display_name),T=pe(w)?Ee:w;return e.jsx(Lr,{entry:t,entryIdx:x,name:t?.is_me?z:T,meLabel:z,currency:p,rate:v,orderedColumns:B,placeholder:ae,onOpenProfile:H},`mobile-${t?.rank??"ellipsis"}-${x}`)})})]}):U=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.empty")})});let se=null;return typeof $=="number"?se=la.map((t,x)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.pagination.ellipsis")},`ellipsis-${x}`):e.jsx("button",{className:c("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===P?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>M(t),disabled:j.loading,children:String(t)},`page-${t}`)):se=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.pagination.page_unknown",{page:String(P)})}),e.jsxs("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-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-3.5 sm:mb-8 sm:grid-cols-[minmax(0,1fr)_auto] sm:gap-4",children:[e.jsx("h1",{className:"col-start-1 row-start-1 min-w-0 whitespace-nowrap text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:col-span-2 sm:row-start-1 sm:text-4xl",children:s("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?s("leaderboard.range.total"):Ce&&Le?s("leaderboard.range",{period:Re,from:Ce,to:Le}):s("leaderboard.range_loading",{period:Re}),V&&e.jsx("time",{dateTime:V.dateTime,title:s("leaderboard.generated_at",{ts:V.exact}),className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400 sm:inline-block",children:s("leaderboard.generated_at",{ts:V.display})})]}),e.jsx("div",{className:"col-start-2 row-start-1 inline-flex h-9 shrink-0 items-center rounded-full border border-oai-gray-200 p-1 dark:border-oai-gray-800 sm:col-start-1 sm:row-start-3 sm:justify-self-start",children:["week","month","total"].map(t=>{const x=N===t;return e.jsxs("button",{onClick:()=>ia(t),disabled:j.loading,className:c("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",x?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[e.jsx("span",{className:"relative z-10",children:t==="week"?Te:t==="month"?Me:Pe}),x&&e.jsx(Ka.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},t)})}),e.jsxs("div",{className:"col-span-2 row-start-2 mb-0 flex w-full min-w-0 items-center justify-between sm:justify-end gap-2.5 sm:col-span-1 sm:col-start-2 sm:row-start-3 sm:mb-0 sm:w-auto sm:shrink-0",children:[e.jsx(vr,{communityStats:Ae,onClick:()=>je(!0)}),e.jsx(hr,{me:R,totalEntries:na,meLabel:z,onOpenProfile:R?.user_id?()=>H(R.user_id):void 0,onJumpToMe:ma,canJump:I!=null&&!ca&&!j.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.signin_prompt")}),e.jsx("button",{onClick:n,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:s("leaderboard.signin_button")})]}),b&&ee&&!oa&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ga,disabled:_e,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:_e?s("leaderboard.sync_button.busy"):s("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[j.error&&Z?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:j.error})}):null,U,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:s("leaderboard.pagination.page_size_label")}),e.jsx(Ra,{id:"leaderboard-page-size",value:_,onValueChange:t=>ra(Number(t)),disabled:j.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:me.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:c("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Ke&&!j.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>Math.max(1,t-1)),disabled:!Ke||j.loading,children:s("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",$||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:se}),e.jsx("button",{className:c("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",ze&&!j.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>t+1),disabled:!ze||j.loading,children:s("leaderboard.pagination.next")})]})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:s("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/xiufengsun/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:s("landing.v2.nav.github")})]})}),e.jsxs(l.Suspense,{fallback:null,children:[e.jsx(fr,{isOpen:!!we,userId:we,period:N,accessToken:C,onClose:aa}),e.jsx(yr,{isOpen:ea,onClose:()=>je(!1),communityStats:Ae})]})]})}export{ot as LeaderboardPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-DD1jX-rD.js","assets/__vite-browser-external-BtJVmciH.js","assets/__vite-browser-external-B0m8a6Te.css","assets/provider-display-BCQQYPWD.js","assets/useCurrency-BgZmWbkx.js","assets/useTokenFormat-D7s1-Zuk.js","assets/terminal-Br5vyD6Q.js","assets/play-BUsybi9m.js","assets/info-CWDhggIW.js","assets/LeaderboardProBadge-D6FSL3Qy.js","assets/TooltipPopup-B4masxDW.js","assets/composite-CzXFY9IC.js","assets/store-BHAXkHPR.js","assets/safePolygon-C-PFpZSA.js","assets/usePositioner-dWENyY8z.js","assets/ProviderIcon-Da90GDcM.js","assets/AchievementBadge-3IYidbrI.js","assets/zap-Dr__bKlq.js","assets/flame-C9NXQRil.js","assets/calendar-days-C8eYygme.js","assets/shield-check-KL5xc2FR.js","assets/AchievementsSection-DIYrrzhw.js","assets/react-BgpqhoCj.js","assets/format-tokens-fKy_3qpW.js","assets/use-reduced-motion-CfCY-K-a.js","assets/arrow-up-right-B_b2i8hn.js","assets/link-2-DEWNkK7s.js","assets/check-BlBHefQ7.js","assets/DialogTitle-DoQgdh5w.js","assets/CommunityStatsModal-DbM99i0s.js","assets/icons-B1EtsaZs.js","assets/TrendMonitor-CceYpa2O.js","assets/DateRangePopover-PQXB8v0k.js","assets/use-latest-request-guard-DGhwmlX8.js","assets/PopoverPopup-DDnISLKM.js","assets/SelectItemText-D5wuuN7G.js","assets/DialogDescription-ne_rYSD7.js","assets/DialogClose-BpWoD5h9.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,V as xa,c as s,r as l,y as c,as as ba,d as pa,u as ha,a as fa,bc as ya,W as ka,aA as wa,a7 as va,bd as Be,be as ja,bf as ie,g as Na,bg as _a,L as Sa,bh as Ca,i as La,bi as Aa,bj as Ea,aP as Ta,_ as Ge,h as Ma,z as Pa}from"./__vite-browser-external-BtJVmciH.js";import{S as Ra}from"./Select-pZDawyxt.js";import{m as Ka}from"./react-BgpqhoCj.js";import{u as za,C as Ia,a as Ba,b as De,D as Da,c as Oa,S as $a,h as Ua,s as Fa,K as Ga,P as Wa}from"./sortable.esm-CehJQvFH.js";import{r as Ha}from"./modifiers.esm-qZnGgJAz.js";import{P as fe}from"./ProviderIcon-Da90GDcM.js";import{u as Ya}from"./useCurrency-BgZmWbkx.js";import{u as Q}from"./useTokenFormat-D7s1-Zuk.js";import{L as X,a as ne}from"./LeaderboardProBadge-D6FSL3Qy.js";import{s as Va,c as Ja,A as Za,t as Xa,b as qa}from"./AchievementBadge-3IYidbrI.js";import{u as Qa}from"./use-ordered-list-BDN24weA.js";import{A as er}from"./arrow-right-C1RqrK4A.js";import{u as ar}from"./use-community-stats-DbJrecQw.js";import"./chevron-down-mjUspqZv.js";import"./check-BlBHefQ7.js";import"./SelectItemText-D5wuuN7G.js";import"./composite-CzXFY9IC.js";import"./usePositioner-dWENyY8z.js";import"./TooltipPopup-B4masxDW.js";import"./store-BHAXkHPR.js";import"./safePolygon-C-PFpZSA.js";import"./zap-Dr__bKlq.js";import"./flame-C9NXQRil.js";import"./calendar-days-C8eYygme.js";import"./shield-check-KL5xc2FR.js";function W(a,{min:r,max:o,fallback:i}){const d=Number(a);if(!Number.isFinite(d))return i;const n=Math.floor(d);return n<r?r:n>o?o:n}function rr(a,r){const o=W(r,{min:0,max:1e6,fallback:0}),i=W(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const d=new Set([1,o,i-2,i-1,i,i+1,i+2]),n=Array.from(d).filter(u=>Number.isInteger(u)&&u>=1&&u<=o).sort((u,p)=>u-p),g=[];let m=null;for(const u of n)m!=null&&u-m>1&&g.push(null),g.push(u),m=u;return g}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,i=o?W(r,{min:0,max:1e6,fallback:0}):null,d=W(a,{min:1,max:o?Math.max(1,i||1):1e6,fallback:1}),n=d>1,g=o?d<i:!0;return{canPrev:n,canNext:g,safePage:d,safeTotal:i}}function or({entries:a,me:r,meLabel:o}){const i=Array.isArray(a)?a:[],d=r&&typeof r.rank=="number"?r.rank:null;return!d||i.some(g=>!!g?.is_me)?i:[{rank:d,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,pro_active:r?.pro_active===!0,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null,badges:Array.isArray(r?.badges)?r.badges:[]},...i]}function sr(a,r){const o=Number(a),i=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(i)||i<1?null:Math.ceil(o/i)}const ir=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function nr({iconSrc:a,label:r}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${ir.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const le=xa.memo(function({badges:r,max:o=3,className:i=""}){const d=Va((r||[]).filter(n=>n&&Ja.has(n.id)&&(n.tier||0)>=1)).slice(0,o);return d.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${i}`,children:d.map((n,g)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(qa(n.id,"name")),tier:s(`achievements.tier.${Xa(n.tier)}`)}),style:{zIndex:d.length-g},className:`pointer-events-auto relative inline-flex ${g>0?"-ml-1.5":""}`,children:e.jsx(Za,{badgeId:n.id,tier:n.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},n.id))})});function We({children:a}){const r=l.useRef(null),o=l.useRef(null),[i,d]=l.useState(0),[n,g]=l.useState(!1);return l.useLayoutEffect(()=>{const m=o.current,u=()=>{d(m.scrollWidth),g(m.scrollWidth>m.clientWidth)};u();const p=typeof ResizeObserver=="function"?new ResizeObserver(u):null;return p?.observe(m),p?.observe(m.firstElementChild),()=>p?.disconnect()},[]),l.useLayoutEffect(()=>{r.current.scrollLeft=o.current.scrollLeft},[i]),e.jsxs("div",{className:"hidden w-full sm:block",children:[e.jsx("div",{ref:r,hidden:!n,role:"region","aria-label":s("leaderboard.horizontal_scroll"),tabIndex:0,className:"oai-scrollbar h-4 w-full overflow-x-auto overflow-y-hidden border-b border-oai-gray-200 dark:border-oai-gray-800 [scrollbar-gutter:auto]",onScroll:m=>{o.current.scrollLeft=m.currentTarget.scrollLeft},children:e.jsx("div",{style:{width:i,height:1}})}),e.jsx("div",{ref:o,className:"oai-scrollbar w-full overflow-x-auto [scrollbar-gutter:auto]",onScroll:m=>{r.current.scrollLeft=m.currentTarget.scrollLeft},children:a})]})}const q=[{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:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],He="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",Ye="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function de(a){return c("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function ce(a){return c("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function y({className:a}){return e.jsx("div",{className:c("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function lr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",i=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:c(de(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:c(ce(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:c("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:c("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),q.map(d=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:c("h-4",i)})},d.key))]})}function dr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:c("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(i,d)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},d))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx(We,{children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:c(He,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-6"})}),e.jsx("th",{className:c(Ye,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-14"})}),q.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(lr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(dr,{index:o},o))})]})}function mr({id:a,thClassName:r,children:o}){const{attributes:i,listeners:d,setNodeRef:n,transform:g,transition:m,isDragging:u}=za({id:a}),p=Ia.Transform.toString(g)||"";l.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${a}"]`),h="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(b=>{b.style.transform=p,b.style.transition=m||"",b.style.zIndex=u?"20":"",b.style.position=p?"relative":"",b.style.boxShadow=u?h:""}),()=>{f.forEach(b=>{b.style.transform="",b.style.transition="",b.style.zIndex="",b.style.position="",b.style.boxShadow=""})}},[a,p,m,u]);const v={transform:p,transition:m,position:p?"relative":void 0,zIndex:u?20:void 0,boxShadow:u?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:n,style:v,className:c(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...i,...d,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:c("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",u&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const gr="tokentracker.leaderboard.columnOrder.v1";function ur(a){return Qa(gr,a)}const xr=50;function br(a,r){const o=Number(a),i=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(i)||i<1?null:Math.min(100,Math.max(1,Math.ceil(o/i*100)))}function Ve(a){return typeof a=="string"?a.trim():""}function pr(a){const r=Ve(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:i,onJumpToMe:d,canJump:n,className:g}){const m=a&&typeof a.rank=="number"?a.rank:null;if(!m)return null;const u=Number(r)||0,p=br(m,u),v=Ve(a?.display_name),f=!v||pr(v)?o||"You":v,h=a?.user_id||f,b=i||(n?d:null),E=typeof b=="function",C=E?"button":"div",ee=E?{type:"button",onClick:b,"aria-label":s(i?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,className:c("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",E?"border-oai-gray-200 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:hover:border-oai-gray-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-gray-100/40 dark:hover:bg-oai-gray-900/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",g),children:[e.jsx(X,{size:"sm",avatarUrl:a?.avatar_url,displayName:f,seed:h,proActive:a?.pro_active===!0}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-gray-800 dark:group-hover:text-oai-gray-100 transition-colors",children:f}),a?.pro_active===!0&&e.jsx("span",{className:"leaderboard-pro-badge",role:"img","aria-label":s("leaderboard.pro.badge_aria"),"aria-description":s("leaderboard.pro.tooltip"),children:s("leaderboard.pro.badge")}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",m.toLocaleString()]}),p!=null&&p<=xr&&e.jsx("span",{className:"hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1 bg-oai-gray-100 text-oai-gray-700 dark:bg-oai-gray-800 dark:text-oai-gray-300 ring-oai-gray-300/30 dark:ring-oai-gray-600/30",children:s("leaderboard.summary.percentile",{p:String(p)})}),E?e.jsx(er,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-gray-600 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-oai-gray-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"})]})]})}const fr=l.lazy(()=>Ge(()=>import("./LeaderboardProfileModal-DD1jX-rD.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28])).then(a=>({default:a.LeaderboardProfileModal}))),yr=l.lazy(()=>Ge(()=>import("./CommunityStatsModal-DbM99i0s.js"),__vite__mapDeps([29,1,2,22,30,5,15,31,4,32,33,6,34,12,11,35,14,13,24,16,17,18,19,20,28,36,37])).then(a=>({default:a.CommunityStatsModal}))),me=[10,20,50,100],ge=20,Je="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return ge;try{const a=window.localStorage.getItem(Je),r=Number(a);if(me.includes(r))return r}catch{}return ge}function ue(a,r,o){const i=Number(a);if(!Number.isFinite(i)||i<=0)return"-";const d=Ca(r),n=r===Pa?i:i*o;return n>=1e3?`${d}${Math.round(n).toLocaleString()}`:n>=10?`${d}${Math.round(n)}`:`${d}${n.toFixed(2)}`}function wr(a){if(typeof a!="string"||!a.trim())return null;const r=new Date(a);if(!Number.isFinite(r.getTime()))return null;const o=Ma();return{dateTime:r.toISOString(),display:new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(r),exact:new Intl.DateTimeFormat(o,{dateStyle:"full",timeStyle:"long"}).format(r)}}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=Q();return e.jsx("span",{title:o(a),children:r(a)})}function vr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:i}=Q();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-gray-400 hover:bg-oai-gray-100/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-gray-500/80 dark:hover:bg-oai-gray-900/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:s("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-oai-gray-400/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:e.jsx("span",{title:i(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children:La(a.totalEntries)}),e.jsx("span",{className:"hidden sm:inline",children:(Number(a.totalEntries)||0).toLocaleString("en-US")})]}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.devs_chip")})]})]})}function Oe({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:i,formatTokensTooltip:d}=Q(),n=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",g=r?"bg-oai-gray-50 dark:bg-oai-gray-900":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900";return o.map(m=>e.jsx("td",{"data-column-key":m.key,title:d(a?.[m.key]),className:c("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",n,g),children:i(a?.[m.key])},m.key))}function jr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const Nr={1:"ring-2 ring-amber-400 dark:ring-amber-500/80 shadow-[0_0_8px_rgba(245,158,11,0.25)]",2:"ring-2 ring-slate-350 dark:ring-slate-450 shadow-[0_0_8px_rgba(148,163,184,0.2)]",3:"ring-2 ring-orange-400 dark:ring-orange-500/70 shadow-[0_0_8px_rgba(249,115,22,0.25)]"};function _r({rank:a,placeholder:r}){return a===1?e.jsx("span",{className:"text-base font-extrabold italic text-amber-500 dark:text-amber-400 tracking-tighter",children:"1"}):a===2?e.jsx("span",{className:"text-base font-extrabold italic text-slate-400 dark:text-slate-350 tracking-tighter",children:"2"}):a===3?e.jsx("span",{className:"text-base font-extrabold italic text-orange-500 dark:text-orange-400 tracking-tighter",children:"3"}):e.jsx("span",{className:"text-[13px] font-bold tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:a==null?r:`#${a}`})}function Sr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(fe,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:i}=Q(),d=r.filter(n=>{const g=Number(a?.[n.key]);return Number.isFinite(g)&&g>0});return d.length===0?null:e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-x-1.5 gap-y-2 border-t border-oai-gray-100/70 pt-3 dark:border-oai-gray-800/60",children:d.map(n=>{const g=s(n.copyKey);return e.jsxs("span",{title:g,"aria-label":`${g}: ${i(a?.[n.key])}`,className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-oai-gray-50/80 dark:bg-oai-gray-900/60 px-2 py-0.5 border border-oai-gray-100/80 dark:border-oai-gray-800/40 text-[10px] font-medium text-oai-gray-600 dark:text-oai-gray-300 transition-colors",children:[e.jsx(fe,{provider:jr(n),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[n.key])})]},n.key)})})}function Lr({entry:a,entryIdx:r,name:o,meLabel:i,currency:d,rate:n,orderedColumns:g,placeholder:m,onOpenProfile:u}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,v=!p&&pe(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,b=p?i:o,E=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),u(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>u(f):void 0,onKeyDown:h?E:void 0,"aria-label":h?s("leaderboard.profile_modal.row_aria",{name:b}):void 0,className:c("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",p?"bg-oai-gray-50 dark:bg-oai-gray-900 border-oai-gray-300/60 dark:border-oai-gray-500/25":v?"bg-white/90 dark:bg-oai-gray-950/90 border-oai-gray-100/70 dark:border-oai-gray-800/40":"bg-white dark:bg-oai-gray-950 border-oai-gray-100 dark:border-oai-gray-800/60",h&&"cursor-pointer hover:border-oai-gray-200 dark:hover:border-oai-gray-700/80 active:scale-[0.985] active:bg-oai-gray-50/60 dark:active:bg-oai-gray-900/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-oai-gray-500/60"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex w-5 shrink-0 items-center justify-center",children:e.jsx(_r,{rank:a?.rank,placeholder:m})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:c("inline-flex rounded-full p-0.5 transition-all duration-300",a?.pro_active!==!0&&(Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80"),v&&"opacity-60 grayscale-[15%]"),children:e.jsx(X,{size:"md",avatarUrl:a?.avatar_url,displayName:b,seed:he(a,b),proActive:a?.pro_active===!0})}),a?.github_url&&e.jsx(Sr,{githubUrl:a.github_url})]}),e.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:c("min-w-0 truncate text-sm tracking-tight",p?"font-semibold text-oai-black dark:text-oai-white":v?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:b}),e.jsx(ne,{proActive:a?.pro_active===!0}),e.jsx(le,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:s("leaderboard.column.est_cost")}),e.jsx("span",{className:c("ml-1 tabular-nums font-medium",v?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:ue(a?.estimated_cost_usd,d,n)})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.08em] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.column.total")}),e.jsx("div",{className:c("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",p?"text-oai-black dark:text-oai-white":v?"text-oai-gray-400 dark:text-oai-gray-500":"text-oai-gray-800 dark:text-oai-gray-200"),children:e.jsx(xe,{value:a?.total_tokens})})]})]}),e.jsx(Cr,{entry:a,orderedColumns:g})]},`mobile-row-${a?.rank}-${b}`)}const Ar={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function $e({rank:a,placeholder:r}){const o=Ar[a];return o?e.jsx("span",{className:c("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Ue(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Er(a){if(!a)return s("shared.error.prefix",{error:s("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||s("leaderboard.error.unknown");return s("shared.error.prefix",{error:o})}function be(a){return typeof a!="string"?"":a.trim()}function pe(a){const r=be(a);return r?r.toLowerCase()==="anonymous":!0}function he(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Fe({githubUrl:a}){return e.jsxs("span",{className:"absolute left-1/2 top-full -translate-x-1/2 -translate-y-1/2 inline-flex group/gh",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":s("leaderboard.github.aria"),className:"flex h-4 w-4 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 transition-transform hover:scale-110",children:e.jsx(fe,{provider:"GITHUB",size:14})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:s("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[s("leaderboard.github.tooltipPrefix")," ",e.jsx(Sa,{to:"/settings",onClick:r=>r.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:s("leaderboard.github.tooltipSettingsLink")})," ",s("leaderboard.github.tooltipSuffix")]})]})]})}function ot({auth:a,signedIn:r,sessionSoftExpired:o}){const i=ba(),d=pa(),{openLoginModal:n}=ha(),{signedIn:g,loading:m,user:u}=fa(),{currency:p,rate:v}=Ya(),f=l.useMemo(()=>ya(),[]),h=ka(),b=r&&!o,E=l.useMemo(()=>b&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,b]),C=b?E:null,ee=b&&wa(C),ae=s("shared.placeholder.short"),Ze=l.useMemo(()=>q.map(t=>t.key),[]),{order:re,reorder:ye}=ur(Ze),ke=l.useMemo(()=>{const t=new Map;for(const x of q)t.set(x.key,x);return t},[]),B=l.useMemo(()=>re.map(t=>ke.get(t)).filter(Boolean),[re,ke]),Xe=Ba(De(Wa,{activationConstraint:{distance:6}}),De(Ga,{coordinateGetter:Fa})),qe=l.useCallback(t=>{const{active:x,over:w}=t;!w||x.id===w.id||ye(String(x.id),String(w.id))},[ye]),[te,M]=l.useState(1),[_,Qe]=l.useState(kr),[we,ve]=l.useState(null),[ea,je]=l.useState(!1),H=l.useCallback(t=>{typeof t=="string"&&t.trim()&&ve(t.trim())},[]),aa=l.useCallback(()=>ve(null),[]),ra=l.useCallback(t=>{const x=me.includes(t)?t:ge;Qe(x),M(1);try{window.localStorage.setItem(Je,String(x))}catch{}},[]),[Ne,ta]=l.useState(0),[oa,sa]=l.useState(()=>va()),[_e,Se]=l.useState(!1);l.useEffect(()=>{if(typeof window>"u")return;const t=()=>{ta(x=>x+1)};return window.addEventListener(Be,t),()=>{window.removeEventListener(Be,t)}},[]);const N=l.useMemo(()=>{const t=new URLSearchParams(i?.search||"");return Ue(t.get("period"))||"total"},[i?.search]),ia=t=>{const x=Ue(t);if(!x||x===N)return;const w=new URLSearchParams(i?.search||"");w.set("period",x),M(1),d(`${i?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};l.useEffect(()=>{m||h||g||n()},[g,m,h,n]),l.useEffect(()=>{M(1)},[N]);const Y=l.useMemo(()=>(W(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),K=l.useMemo(()=>h?"mock":m?"unavailable":g?"cloud":r?"local":f?"public":"unavailable",[m,g,f,h,r]),k=l.useMemo(()=>ja({accessMode:K,baseUrl:f,mockEnabled:h,userId:u?.id||null,period:N,pageSize:_,offset:Y}),[u?.id,K,f,Y,h,_,N]),[D,O]=l.useState(()=>{const t=ie(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});l.useEffect(()=>{if(!f&&!h||!h&&K==="unavailable"){O({loading:!1,error:null,data:null,contextKey:null});return}const t=ie(k);let x=!0;return O(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await Na({userId:u?.id||null,period:N,limit:_,offset:Y});x&&(_a(w,{activeContextKey:k,contextKey:k,source:Ne>0?"manual-refresh":"page-load"}),O({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!x)return;const T=Er(w);O(F=>F.contextKey===k?{...F,loading:!1,error:T}:{loading:!1,error:T,data:null,contextKey:k})}),()=>{x=!1}},[f,K,u?.id,k,Y,Ne,h,N,_]);const oe=l.useMemo(()=>D.contextKey===k?null:ie(k),[k,D.contextKey]),j=l.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(f||h)&&K!=="unavailable",error:null,data:null,contextKey:k},[K,f,k,D,h,oe]),S=j.data,$=S?.total_pages??null,na=S?.total_entries??0,P=S?.page??te,la=l.useMemo(()=>rr(P,$),[P,$]),Ce=S?.from||null,Le=S?.to||null,da=S?.generated_at||null,V=wr(da),Ae=ar(),R=S?.me||null,z=s("leaderboard.me_label"),Ee=s("leaderboard.anon_label"),Te=s("leaderboard.period.week"),Me=s("leaderboard.period.month"),Pe=s("leaderboard.period.total"),Re=N==="month"?Me:N==="total"?Pe:Te,J=l.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:R,meLabel:z})},[S?.entries,R,z]),I=l.useMemo(()=>sr(R?.rank,_),[R?.rank,_]),ca=I!=null&&I===P,ma=l.useCallback(()=>{I!=null&&M(I)},[I]),ga=async()=>{Se(!0);try{Aa(!0),sa(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{Se(!1)}},{canPrev:Ke,canNext:ze}=tr({page:P,totalPages:$}),Z=Array.isArray(J)&&J.length!==0;let U=null;j.loading&&!Z?U=e.jsx(cr,{rows:_}):j.error&&!Z?U=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:j.error})}):Z?U=e.jsxs(Da,{sensors:Xe,collisionDetection:Oa,modifiers:[Ha],onDragEnd:qe,children:[e.jsx(We,{children:e.jsxs("table",{className:"min-w-full w-full text-left text-sm sm:min-w-max",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:c(He,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.rank")}),e.jsx("th",{className:c(Ye,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:s("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:s("leaderboard.column.est_cost")}),e.jsx($a,{items:re,strategy:Ua,children:B.map(t=>e.jsx(mr,{id:t.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(nr,{iconSrc:t.icon,label:s(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:J.map((t,x)=>{if(t?.is_ellipsis){const A=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:A,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${x}`)}const w=!!t?.is_me,T=typeof t?.user_id=="string"?t.user_id:null,F=be(t?.display_name),ua=pe(F)?Ee:F,L=w?z:ua,G=!!T,Ie=G?{role:"button",tabIndex:0,onClick:G?()=>H(T):void 0,onKeyDown:G?A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),H(T))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const A=!!t?.is_pinned;return e.jsxs("tr",{...Ie,className:c("bg-oai-gray-50 dark:bg-oai-gray-900 transition-colors",A?"border-t border-b border-oai-gray-300/40 dark:border-oai-gray-500/20":"border-y border-oai-gray-300/40 dark:border-oai-gray-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-500/60"),children:[e.jsx("td",{className:c(de(!0),"font-semibold text-oai-gray-700 dark:text-oai-gray-300",A&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-gray-500 dark:before:bg-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:ce(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:c("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&t?.pro_active!==!0&&"gh-avatar-frame"),children:[e.jsx("span",{className:c("inline-flex rounded-full p-px",t?.github_url&&t?.pro_active!==!0&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(X,{avatarUrl:t?.avatar_url,displayName:L,seed:he(t,L),proActive:t?.pro_active===!0})}),t?.github_url&&e.jsx(Fe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ne,{proActive:t?.pro_active===!0}),e.jsx(le,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-gray-50 dark:bg-oai-gray-900",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap text-right tabular-nums bg-oai-gray-50 dark:bg-oai-gray-900",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,v)}),e.jsx(Oe,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${A?"-pin":""}`)}return e.jsxs("tr",{...Ie,className:c("group transition-colors",G&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-500/60"),children:[e.jsx("td",{className:c(de(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:ce(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:c("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&t?.pro_active!==!0&&"gh-avatar-frame"),children:[e.jsx("span",{className:c("inline-flex rounded-full p-px",t?.github_url&&t?.pro_active!==!0&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(X,{avatarUrl:t?.avatar_url,displayName:L,seed:he(t,L),proActive:t?.pro_active===!0})}),t?.github_url&&e.jsx(Fe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:L}),e.jsx(ne,{proActive:t?.pro_active===!0}),e.jsx(le,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,v)}),e.jsx(Oe,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:J.map((t,x)=>{const w=be(t?.display_name),T=pe(w)?Ee:w;return e.jsx(Lr,{entry:t,entryIdx:x,name:t?.is_me?z:T,meLabel:z,currency:p,rate:v,orderedColumns:B,placeholder:ae,onOpenProfile:H},`mobile-${t?.rank??"ellipsis"}-${x}`)})})]}):U=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.empty")})});let se=null;return typeof $=="number"?se=la.map((t,x)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.pagination.ellipsis")},`ellipsis-${x}`):e.jsx("button",{className:c("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===P?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>M(t),disabled:j.loading,children:String(t)},`page-${t}`)):se=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.pagination.page_unknown",{page:String(P)})}),e.jsxs("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-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-3.5 sm:mb-8 sm:grid-cols-[minmax(0,1fr)_auto] sm:gap-4",children:[e.jsx("h1",{className:"col-start-1 row-start-1 min-w-0 whitespace-nowrap text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:col-span-2 sm:row-start-1 sm:text-4xl",children:s("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?s("leaderboard.range.total"):Ce&&Le?s("leaderboard.range",{period:Re,from:Ce,to:Le}):s("leaderboard.range_loading",{period:Re}),V&&e.jsx("time",{dateTime:V.dateTime,title:s("leaderboard.generated_at",{ts:V.exact}),className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400 sm:inline-block",children:s("leaderboard.generated_at",{ts:V.display})})]}),e.jsx("div",{className:"col-start-2 row-start-1 inline-flex h-9 shrink-0 items-center rounded-full border border-oai-gray-200 p-1 dark:border-oai-gray-800 sm:col-start-1 sm:row-start-3 sm:justify-self-start",children:["week","month","total"].map(t=>{const x=N===t;return e.jsxs("button",{onClick:()=>ia(t),disabled:j.loading,className:c("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",x?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[e.jsx("span",{className:"relative z-10",children:t==="week"?Te:t==="month"?Me:Pe}),x&&e.jsx(Ka.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},t)})}),e.jsxs("div",{className:"col-span-2 row-start-2 mb-0 flex w-full min-w-0 items-center justify-between sm:justify-end gap-2.5 sm:col-span-1 sm:col-start-2 sm:row-start-3 sm:mb-0 sm:w-auto sm:shrink-0",children:[e.jsx(vr,{communityStats:Ae,onClick:()=>je(!0)}),e.jsx(hr,{me:R,totalEntries:na,meLabel:z,onOpenProfile:R?.user_id?()=>H(R.user_id):void 0,onJumpToMe:ma,canJump:I!=null&&!ca&&!j.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.signin_prompt")}),e.jsx("button",{onClick:n,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:s("leaderboard.signin_button")})]}),b&&ee&&!oa&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ga,disabled:_e,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:_e?s("leaderboard.sync_button.busy"):s("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[j.error&&Z?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:j.error})}):null,U,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:s("leaderboard.pagination.page_size_label")}),e.jsx(Ra,{id:"leaderboard-page-size",value:_,onValueChange:t=>ra(Number(t)),disabled:j.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:me.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:c("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Ke&&!j.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>Math.max(1,t-1)),disabled:!Ke||j.loading,children:s("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",$||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:se}),e.jsx("button",{className:c("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",ze&&!j.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>t+1),disabled:!ze||j.loading,children:s("leaderboard.pagination.next")})]})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:s("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/xiufengsun/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:s("landing.v2.nav.github")})]})}),e.jsxs(l.Suspense,{fallback:null,children:[e.jsx(fr,{isOpen:!!we,userId:we,period:N,accessToken:C,onClose:aa}),e.jsx(yr,{isOpen:ea,onClose:()=>je(!1),communityStats:Ae})]})]})}export{ot as LeaderboardPage};
@@ -1 +1 @@
1
- import{V as u,j as o,y as m,r as b,c as n}from"./__vite-browser-external-DpZbUcLL.js";import{T as g,F as j,a as y,b as w,c as P,d as T,e as v}from"./TooltipPopup-LV1aWIRZ.js";function C(a){let e=0;const r=String(a??"");for(let t=0;t<r.length;t+=1)e=Math.imul(31,e)+r.charCodeAt(t)|0;return Math.abs(e)%360}function E(a){const e=String(a??"").trim();if(!e)return"?";const r=e.split(/\s+/).filter(Boolean);if(r.length>=2){const t=r[0][0]||"",i=r[1][0]||"";return`${t}${i}`.toUpperCase()}return e.slice(0,2).toUpperCase()}const h={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",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function L({avatarUrl:a,displayName:e,seed:r,size:t="md",proActive:i=!1,className:s}){const d=h[t]||h.md,f=C(r??e??""),l=typeof a=="string"?a.trim():"",[x,c]=u.useState(!1),p=i===!0?"leaderboard-pro-avatar":null;return u.useEffect(()=>{c(!1)},[l]),l&&!x?o.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",onError:()=>c(!0),className:m("rounded-full object-cover ring-1 ring-white/10",d,s,p)}):o.jsx("div",{className:m("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",d,s,p),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:E(e)})}const S=function(e){const{delay:r,closeDelay:t,timeout:i=400}=e,s=b.useMemo(()=>({open:r,close:t}),[r,t]);return o.jsx(g.Provider,{value:r,children:o.jsx(j,{delay:s,timeoutMs:i,children:e.children})})};function M({proActive:a=!1}){return a!==!0?null:o.jsx(S,{delay:350,children:o.jsxs(y,{children:[o.jsx(w,{render:o.jsx("span",{role:"img",tabIndex:0}),className:"leaderboard-pro-badge","aria-label":n("leaderboard.pro.badge_aria"),"aria-description":n("leaderboard.pro.tooltip"),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.stopPropagation()},children:n("leaderboard.pro.badge")}),o.jsx(P,{children:o.jsx(T,{side:"top",sideOffset:6,className:"leaderboard-pro-tooltip-layer",children:o.jsx(v,{className:"leaderboard-pro-tooltip",children:n("leaderboard.pro.tooltip")})})})]})})}export{L,M as a};
1
+ import{V as u,j as o,y as m,r as b,c as n}from"./__vite-browser-external-BtJVmciH.js";import{T as g,F as j,a as y,b as w,c as P,d as T,e as v}from"./TooltipPopup-B4masxDW.js";function C(a){let e=0;const r=String(a??"");for(let t=0;t<r.length;t+=1)e=Math.imul(31,e)+r.charCodeAt(t)|0;return Math.abs(e)%360}function E(a){const e=String(a??"").trim();if(!e)return"?";const r=e.split(/\s+/).filter(Boolean);if(r.length>=2){const t=r[0][0]||"",i=r[1][0]||"";return`${t}${i}`.toUpperCase()}return e.slice(0,2).toUpperCase()}const h={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",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function L({avatarUrl:a,displayName:e,seed:r,size:t="md",proActive:i=!1,className:s}){const d=h[t]||h.md,f=C(r??e??""),l=typeof a=="string"?a.trim():"",[x,c]=u.useState(!1),p=i===!0?"leaderboard-pro-avatar":null;return u.useEffect(()=>{c(!1)},[l]),l&&!x?o.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",onError:()=>c(!0),className:m("rounded-full object-cover ring-1 ring-white/10",d,s,p)}):o.jsx("div",{className:m("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",d,s,p),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:E(e)})}const S=function(e){const{delay:r,closeDelay:t,timeout:i=400}=e,s=b.useMemo(()=>({open:r,close:t}),[r,t]);return o.jsx(g.Provider,{value:r,children:o.jsx(j,{delay:s,timeoutMs:i,children:e.children})})};function M({proActive:a=!1}){return a!==!0?null:o.jsx(S,{delay:350,children:o.jsxs(y,{children:[o.jsx(w,{render:o.jsx("span",{role:"img",tabIndex:0}),className:"leaderboard-pro-badge","aria-label":n("leaderboard.pro.badge_aria"),"aria-description":n("leaderboard.pro.tooltip"),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.stopPropagation()},children:n("leaderboard.pro.badge")}),o.jsx(P,{children:o.jsx(T,{side:"top",sideOffset:6,className:"leaderboard-pro-tooltip-layer",children:o.jsx(v,{className:"leaderboard-pro-tooltip",children:n("leaderboard.pro.tooltip")})})})]})})}export{L,M as a};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-ClVMnxVW.js","assets/__vite-browser-external-DpZbUcLL.js","assets/__vite-browser-external-B0m8a6Te.css","assets/react-D1u6HsZx.js","assets/AchievementBadge-DWECUOAX.js","assets/zap-CElRpX2w.js","assets/flame-av87we58.js","assets/calendar-days-OvLTNZBH.js","assets/shield-check-BGfaKXG9.js","assets/use-transform-D2xePGbE.js","assets/use-reduced-motion-D9n2I_eN.js","assets/AchievementsSection-DiEX2_5U.js","assets/format-tokens-B43Ehkbb.js","assets/DialogTitle-C--sXGjf.js","assets/composite-DD_boZdD.js","assets/store-l5WfCa7P.js"])))=>i.map(i=>d[i]);
2
- import{o as ie,a as W,r as h,aN as ne,j as e,c as i,aO as le,Q as de,U as ce,aP as me,aQ as xe,y as c,x as ge,az as Z,A as pe,L as he,V as G,an as ue,l as fe,ay as be,X as ye,i as ke,_ as je,aR as ve}from"./__vite-browser-external-DpZbUcLL.js";import{A as _e,f as Ne}from"./provider-display-B2gZ38Oh.js";import{u as we}from"./useCurrency-DnhS0llv.js";import{u as X}from"./useTokenFormat-DvjyXv8i.js";import{L as Y,a as K}from"./LeaderboardProBadge-D97MfK5W.js";import{P as $}from"./ProviderIcon-biLVsOGr.js";import{H as Ae,A as V,s as Se,c as Me,b as ze,t as Pe,h as Ce}from"./AchievementBadge-DWECUOAX.js";import{A as Ie}from"./AchievementsSection-DiEX2_5U.js";import{A as U}from"./arrow-up-right-kkQt6Du0.js";import{L as De}from"./link-2-t-wSLB2a.js";import{C as Te}from"./check-v5Ie379p.js";import{D as Be,a as Le,b as $e,c as Ue,d as Re,e as Fe}from"./DialogTitle-C--sXGjf.js";import"./terminal-CRBThKUQ.js";import"./play-BIQH--yZ.js";import"./info-BUmCmjwd.js";import"./TooltipPopup-LV1aWIRZ.js";import"./composite-DD_boZdD.js";import"./store-l5WfCa7P.js";import"./safePolygon-ClG4WM06.js";import"./usePositioner-7yozJJJ0.js";import"./zap-CElRpX2w.js";import"./flame-av87we58.js";import"./calendar-days-OvLTNZBH.js";import"./shield-check-BGfaKXG9.js";import"./react-D1u6HsZx.js";import"./format-tokens-B43Ehkbb.js";import"./use-reduced-motion-D9n2I_eN.js";const q={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};q.node;const Oe=ie(q),R="tokentracker_anon_id";let M=null;function F(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)})}function O(){if(M)return M;try{let a=localStorage.getItem(R);return a||(a=F(),localStorage.setItem(R,a)),M=a,a}catch{return M=F(),M}}function Q({userId:a}){const{signedIn:r,getAccessToken:o}=W(),[t,s]=h.useState(!1),[n,g]=h.useState(0),[l,x]=h.useState(!1),[u,b]=h.useState(!1),[j,z]=h.useState(!1),[P,T]=h.useState([]),[N,w]=h.useState(!1),C=h.useRef(0),v=h.useCallback(async()=>{if(r)try{const d=await o();if(d)return{accessToken:d,anonId:O()}}catch{}return{anonId:O()}},[r,o]);h.useEffect(()=>{let d=!1;return a?(x(!1),(async()=>{const m=await v();try{const p=await ne({userId:a,...m});if(d)return;g(Number(p?.count)||0),s(!!p?.liked),x(!0)}catch{if(d)return;g(0),s(!1),x(!0)}})(),()=>{d=!0}):(x(!1),()=>{d=!0})},[a,v]);const _=()=>{z(!0),setTimeout(()=>z(!1),450),w(!0),setTimeout(()=>w(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let y=0;y<12;y++){const f=(y*30+Math.random()*20-10)*(Math.PI/180),k=45+Math.random()*45,B=Math.cos(f)*k,ee=Math.sin(f)*k-(10+Math.random()*15),ae=Math.random()*360-180,re=6+Math.random()*8,te=d[Math.floor(Math.random()*d.length)],se=m[Math.floor(Math.random()*m.length)],oe=++C.current;p.push({id:oe,tx:B,ty:ee,rot:ae,size:re,color:te,shape:se})}T(y=>[...y,...p]),setTimeout(()=>{T(y=>y.filter(f=>!p.find(k=>k.id===f.id)))},850)},A=async d=>{b(!0);try{const m=await v(),p=await le({userId:a,action:d,...m});p&&Number.isFinite(Number(p.count))&&g(Number(p.count)),p&&typeof p.liked=="boolean"&&s(p.liked)}catch{s(m=>!m),g(m=>d==="like"?Math.max(0,m-1):m+1)}finally{b(!1)}},S=d=>{d.stopPropagation(),!(!a||!l||u)&&(t?(s(!1),g(m=>Math.max(0,m-1)),A("unlike")):(s(!0),g(m=>m+1),_(),A("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-DMMExCe4.js","assets/__vite-browser-external-BtJVmciH.js","assets/__vite-browser-external-B0m8a6Te.css","assets/react-BgpqhoCj.js","assets/AchievementBadge-3IYidbrI.js","assets/zap-Dr__bKlq.js","assets/flame-C9NXQRil.js","assets/calendar-days-C8eYygme.js","assets/shield-check-KL5xc2FR.js","assets/use-transform-BczE46xm.js","assets/use-reduced-motion-CfCY-K-a.js","assets/AchievementsSection-DIYrrzhw.js","assets/format-tokens-fKy_3qpW.js","assets/DialogTitle-DoQgdh5w.js","assets/composite-CzXFY9IC.js","assets/store-BHAXkHPR.js"])))=>i.map(i=>d[i]);
2
+ import{o as ie,a as W,r as h,aN as ne,j as e,c as i,aO as le,Q as de,U as ce,aP as me,aQ as xe,y as c,x as ge,az as Z,A as pe,L as he,V as G,an as ue,l as fe,ay as be,X as ye,i as ke,_ as je,aR as ve}from"./__vite-browser-external-BtJVmciH.js";import{A as _e,f as Ne}from"./provider-display-BCQQYPWD.js";import{u as we}from"./useCurrency-BgZmWbkx.js";import{u as X}from"./useTokenFormat-D7s1-Zuk.js";import{L as Y,a as K}from"./LeaderboardProBadge-D6FSL3Qy.js";import{P as $}from"./ProviderIcon-Da90GDcM.js";import{H as Ae,A as V,s as Se,c as Me,b as ze,t as Pe,h as Ce}from"./AchievementBadge-3IYidbrI.js";import{A as Ie}from"./AchievementsSection-DIYrrzhw.js";import{A as U}from"./arrow-up-right-B_b2i8hn.js";import{L as De}from"./link-2-DEWNkK7s.js";import{C as Te}from"./check-BlBHefQ7.js";import{D as Be,a as Le,b as $e,c as Ue,d as Re,e as Fe}from"./DialogTitle-DoQgdh5w.js";import"./terminal-Br5vyD6Q.js";import"./play-BUsybi9m.js";import"./info-CWDhggIW.js";import"./TooltipPopup-B4masxDW.js";import"./composite-CzXFY9IC.js";import"./store-BHAXkHPR.js";import"./safePolygon-C-PFpZSA.js";import"./usePositioner-dWENyY8z.js";import"./zap-Dr__bKlq.js";import"./flame-C9NXQRil.js";import"./calendar-days-C8eYygme.js";import"./shield-check-KL5xc2FR.js";import"./react-BgpqhoCj.js";import"./format-tokens-fKy_3qpW.js";import"./use-reduced-motion-CfCY-K-a.js";const q={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};q.node;const Oe=ie(q),R="tokentracker_anon_id";let M=null;function F(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)})}function O(){if(M)return M;try{let a=localStorage.getItem(R);return a||(a=F(),localStorage.setItem(R,a)),M=a,a}catch{return M=F(),M}}function Q({userId:a}){const{signedIn:r,getAccessToken:o}=W(),[t,s]=h.useState(!1),[n,g]=h.useState(0),[l,x]=h.useState(!1),[u,b]=h.useState(!1),[j,z]=h.useState(!1),[P,T]=h.useState([]),[N,w]=h.useState(!1),C=h.useRef(0),v=h.useCallback(async()=>{if(r)try{const d=await o();if(d)return{accessToken:d,anonId:O()}}catch{}return{anonId:O()}},[r,o]);h.useEffect(()=>{let d=!1;return a?(x(!1),(async()=>{const m=await v();try{const p=await ne({userId:a,...m});if(d)return;g(Number(p?.count)||0),s(!!p?.liked),x(!0)}catch{if(d)return;g(0),s(!1),x(!0)}})(),()=>{d=!0}):(x(!1),()=>{d=!0})},[a,v]);const _=()=>{z(!0),setTimeout(()=>z(!1),450),w(!0),setTimeout(()=>w(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let y=0;y<12;y++){const f=(y*30+Math.random()*20-10)*(Math.PI/180),k=45+Math.random()*45,B=Math.cos(f)*k,ee=Math.sin(f)*k-(10+Math.random()*15),ae=Math.random()*360-180,re=6+Math.random()*8,te=d[Math.floor(Math.random()*d.length)],se=m[Math.floor(Math.random()*m.length)],oe=++C.current;p.push({id:oe,tx:B,ty:ee,rot:ae,size:re,color:te,shape:se})}T(y=>[...y,...p]),setTimeout(()=>{T(y=>y.filter(f=>!p.find(k=>k.id===f.id)))},850)},A=async d=>{b(!0);try{const m=await v(),p=await le({userId:a,action:d,...m});p&&Number.isFinite(Number(p.count))&&g(Number(p.count)),p&&typeof p.liked=="boolean"&&s(p.liked)}catch{s(m=>!m),g(m=>d==="like"?Math.max(0,m-1):m+1)}finally{b(!1)}},S=d=>{d.stopPropagation(),!(!a||!l||u)&&(t?(s(!1),g(m=>Math.max(0,m-1)),A("unlike")):(s(!0),g(m=>m+1),_(),A("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
3
3
  @keyframes tt-like-pop {
4
4
  0% { transform: scale(1); }
5
5
  25% { transform: scale(0.75); }
@@ -39,7 +39,7 @@ import{o as ie,a as W,r as h,aN as ne,j as e,c as i,aO as le,Q as de,U as ce,aP
39
39
  .tt-num-anim {
40
40
  animation: tt-num-scroll 0.25s ease-out forwards;
41
41
  }
42
- `}}),P.map(d=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${d.tx}px`,"--ty":`${d.ty}px`,"--rot":`${d.rot}deg`,width:`${d.size}px`,height:`${d.size}px`,backgroundColor:d.shape==="circle"?d.color:"transparent",borderRadius:d.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:d.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:d.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},d.id)),e.jsxs("button",{type:"button",onClick:S,disabled:!l||u,"aria-label":t?i("leaderboard.profile.like.aria_unlike"):i("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:j?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(Ae,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${N?"tt-num-anim":""}`,children:l?n:"·"})]})]})}function He({badge:a,badgeLabel:r,className:o="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${o}`,children:[e.jsx(Y,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(V,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Ee({badges:a,isOwn:r=!1,onSelect:o,className:t=""}){const s=Se((Array.isArray(a)?a:[]).filter(n=>n&&Me.has(n.id))).filter(n=>r||(n.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((n,g)=>{const l=(n.tier||0)>=1,x=i(ze(n.id,"name")),u=l?i(`achievements.tier.${Pe(n.tier)}`):i("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:o?()=>o(n):void 0,title:`${x} · ${u}`,"aria-label":i("achievements.badge.aria",{name:x,tier:u}),style:{zIndex:s.length-g},className:"group relative shrink-0 -mr-2.5 rounded-full transition-transform duration-200 ease-out hover:z-30 hover:-translate-y-1 active:scale-95 focus-visible:z-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60",children:e.jsx(V,{badgeId:n.id,tier:n.tier,locked:!l,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},n.id)})})}const We=G.lazy(()=>je(()=>import("./BadgeDetailModal-ClVMnxVW.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])));function Ze(a,r,o){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:Z(t,{decimals:2,currency:r,rate:o})}function H(a,r,o){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Ze(t,r,o);const s=r==="USD"?t:t*(o||1);return`${r==="USD"?"$":""}${ke(s,{decimals:1})}`}function Ge(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const o=r.map(s=>({day:s.date,total_tokens:s.total_tokens,models:s.models||null})),t=r[r.length-1]?.date;return be({dailyRows:o,weeks:52,to:t})}const Xe=`
42
+ `}}),P.map(d=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${d.tx}px`,"--ty":`${d.ty}px`,"--rot":`${d.rot}deg`,width:`${d.size}px`,height:`${d.size}px`,backgroundColor:d.shape==="circle"?d.color:"transparent",borderRadius:d.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:d.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:d.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},d.id)),e.jsxs("button",{type:"button",onClick:S,disabled:!l||u,"aria-label":t?i("leaderboard.profile.like.aria_unlike"):i("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:j?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(Ae,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${N?"tt-num-anim":""}`,children:l?n:"·"})]})]})}function He({badge:a,badgeLabel:r,className:o="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${o}`,children:[e.jsx(Y,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(V,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Ee({badges:a,isOwn:r=!1,onSelect:o,className:t=""}){const s=Se((Array.isArray(a)?a:[]).filter(n=>n&&Me.has(n.id))).filter(n=>r||(n.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((n,g)=>{const l=(n.tier||0)>=1,x=i(ze(n.id,"name")),u=l?i(`achievements.tier.${Pe(n.tier)}`):i("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:o?()=>o(n):void 0,title:`${x} · ${u}`,"aria-label":i("achievements.badge.aria",{name:x,tier:u}),style:{zIndex:s.length-g},className:"group relative shrink-0 -mr-2.5 rounded-full transition-transform duration-200 ease-out hover:z-30 hover:-translate-y-1 active:scale-95 focus-visible:z-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60",children:e.jsx(V,{badgeId:n.id,tier:n.tier,locked:!l,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},n.id)})})}const We=G.lazy(()=>je(()=>import("./BadgeDetailModal-DMMExCe4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])));function Ze(a,r,o){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:Z(t,{decimals:2,currency:r,rate:o})}function H(a,r,o){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Ze(t,r,o);const s=r==="USD"?t:t*(o||1);return`${r==="USD"?"$":""}${ke(s,{decimals:1})}`}function Ge(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const o=r.map(s=>({day:s.date,total_tokens:s.total_tokens,models:s.models||null})),t=r[r.length-1]?.date;return be({dailyRows:o,weeks:52,to:t})}const Xe=`
43
43
  @keyframes tt-shimmer {
44
44
  100% { transform: translateX(100%); }
45
45
  }
@@ -1,4 +1,4 @@
1
- import{r as _,j as p,ao as xe,u as ge,a as ve,A as be,L as Tt,ap as we,c as Y,aq as ye}from"./__vite-browser-external-DpZbUcLL.js";import{u as ke}from"./useCurrency-DnhS0llv.js";import{H as Me}from"./HeaderGithubStar-DziE8s6w.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-NNTwtWSu.js";import{D as Te}from"./download-NqHXZ-zn.js";import"./provider-display-B2gZ38Oh.js";import"./useTokenFormat-DvjyXv8i.js";import"./terminal-CRBThKUQ.js";import"./play-BIQH--yZ.js";import"./info-BUmCmjwd.js";import"./LeaderboardProBadge-D97MfK5W.js";import"./TooltipPopup-LV1aWIRZ.js";import"./composite-DD_boZdD.js";import"./store-l5WfCa7P.js";import"./safePolygon-ClG4WM06.js";import"./usePositioner-7yozJJJ0.js";import"./ProviderIcon-biLVsOGr.js";import"./AchievementBadge-DWECUOAX.js";import"./zap-CElRpX2w.js";import"./flame-av87we58.js";import"./calendar-days-OvLTNZBH.js";import"./shield-check-BGfaKXG9.js";import"./AchievementsSection-DiEX2_5U.js";import"./react-D1u6HsZx.js";import"./format-tokens-B43Ehkbb.js";import"./use-reduced-motion-D9n2I_eN.js";import"./arrow-up-right-kkQt6Du0.js";import"./link-2-t-wSLB2a.js";import"./check-v5Ie379p.js";import"./DialogTitle-C--sXGjf.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
1
+ import{r as _,j as p,ao as xe,u as ge,a as ve,A as be,L as Tt,ap as we,c as Y,aq as ye}from"./__vite-browser-external-BtJVmciH.js";import{u as ke}from"./useCurrency-BgZmWbkx.js";import{H as Me}from"./HeaderGithubStar-DCZ92xbH.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-DD1jX-rD.js";import{D as Te}from"./download-CQvg59w1.js";import"./provider-display-BCQQYPWD.js";import"./useTokenFormat-D7s1-Zuk.js";import"./terminal-Br5vyD6Q.js";import"./play-BUsybi9m.js";import"./info-CWDhggIW.js";import"./LeaderboardProBadge-D6FSL3Qy.js";import"./TooltipPopup-B4masxDW.js";import"./composite-CzXFY9IC.js";import"./store-BHAXkHPR.js";import"./safePolygon-C-PFpZSA.js";import"./usePositioner-dWENyY8z.js";import"./ProviderIcon-Da90GDcM.js";import"./AchievementBadge-3IYidbrI.js";import"./zap-Dr__bKlq.js";import"./flame-C9NXQRil.js";import"./calendar-days-C8eYygme.js";import"./shield-check-KL5xc2FR.js";import"./AchievementsSection-DIYrrzhw.js";import"./react-BgpqhoCj.js";import"./format-tokens-fKy_3qpW.js";import"./use-reduced-motion-CfCY-K-a.js";import"./arrow-up-right-B_b2i8hn.js";import"./link-2-DEWNkK7s.js";import"./check-BlBHefQ7.js";import"./DialogTitle-DoQgdh5w.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
2
2
  attribute vec2 a_position;
3
3
  void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
4
4
  `,Ge=`
@@ -1,4 +1,4 @@
1
- import{o as Z,j as e,y as Re,c as r,h as U,r as p,al as xt,B as Y,bl as pt,V as j,e as gt,W as ve,R as ht,L as ft,bm as bt,t as yt,w as kt}from"./__vite-browser-external-DpZbUcLL.js";import{m as je}from"./react-D1u6HsZx.js";import{P as re,c as vt,r as le,a as jt,u as wt,b as Nt,s as _t}from"./use-usage-limits-vEmyPwMY.js";import{b as w,c as He,l as ie,d as Ie,u as Ct}from"./use-limits-display-prefs-dOm4SCFU.js";import{C as Ae}from"./Card-CsAQxZZ8.js";import{F as St}from"./FadeIn-BPH15_jE.js";import{P as Oe}from"./ProviderIcon-biLVsOGr.js";import{H as Pt}from"./HoverTooltip-tQyY2CuV.js";import{C as Fe}from"./chevron-down-CPlz1cYW.js";import{G as Mt}from"./gift-CZus7M21.js";import{C as Dt}from"./ConfirmModal-C_il5anp.js";import{I as we,L as Tt}from"./LocalOnlyNotice-j8Tijts2.js";import{S as xe}from"./Select-77l2QNqa.js";import{P as Et}from"./plus-CztG5eum.js";import{P as Rt,a as Ht,b as It,c as At,d as Ot}from"./PopoverPopup-wleZ4DTI.js";import{u as Ft}from"./use-reduced-motion-D9n2I_eN.js";import"./use-latest-request-guard-CdM1Pn_p.js";import"./DialogTitle-C--sXGjf.js";import"./composite-DD_boZdD.js";import"./store-l5WfCa7P.js";import"./DialogDescription-DpkD2qwW.js";import"./arrow-up-right-kkQt6Du0.js";import"./download-NqHXZ-zn.js";import"./check-v5Ie379p.js";import"./SelectItemText-BQbmtjd3.js";import"./usePositioner-7yozJJJ0.js";import"./safePolygon-ClG4WM06.js";const Le={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};Le.node;const Lt=Z(Le);const $e={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};$e.node;const $t=Z($e);const Ue={name:"calendar-clock",size:24,node:[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338",key:"7hb8p4"}],["path",{d:"M3 9h5.859",key:"numkqi"}],["path",{d:"M8 2v3",key:"1ioesn"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]};Ue.node;const Be=Z(Ue);const ze={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};ze.node;const Ge=Z(ze);const We={name:"infinity",size:24,node:[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]};We.node;const qe=Z(We),Ut=[3,2,3,3,2,2,3];function L({className:t}){return e.jsx("div",{className:Re("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function Bt(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-3 w-12 shrink-0"}),e.jsx(L,{className:"flex-1 h-1.5 rounded-full min-w-0"}),e.jsx(L,{className:"h-3 w-[30px] shrink-0"}),e.jsx(L,{className:"h-3 w-6 shrink-0"})]})}function zt({bars:t,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(L,{className:"h-[14px] w-[14px] rounded shrink-0"}),e.jsx(L,{className:Re("h-4",i)})]}),Array.from({length:t},(s,n)=>e.jsx(Bt,{},n))]})}function Gt(){return e.jsx(Ae,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(L,{className:"h-3.5 w-28"}),Ut.map((t,a)=>e.jsx(zt,{bars:t,index:a},a))]})})}const fe=100;function Ne(t){const a=Date.parse(t);return Number.isFinite(a)?a:null}function Wt(t){return Math.max(0,Math.min(fe,Math.round(t)))}function qt(t){return new Intl.DateTimeFormat(U(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t))}function Vt(t,a,i){if(t==null||t>=a)return fe;const s=a-t,n=a-i;return Wt(n/s*fe)}function Yt(t){const a=t.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function Kt(t,{now:a}={}){if(!t||typeof t!="object")return null;const i=Yt(t);if(i===void 0)return null;const s=Array.isArray(t.credits)?t.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),o=[];for(const l of s){const c=Ne(l?.expires_at);if(c==null)continue;const d=o.length+1;o.push({key:`reset-${d}`,label:r("limits.codex_reset_bank.row_label",{index:d}),expiresAt:qt(c),expiresMs:c,percent:Vt(Ne(l?.granted_at),c,n)})}return i===0?null:o.length>0?{kind:"rows",availableCount:i??o.length,rows:o}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const X=864e5;function $(t,a){const i=new Date(t),s=i.getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()+a,1,i.getUTCHours(),i.getUTCMinutes())),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(s,o)),n.getTime()}function Ve(t,a){if(a==="weekly")return t-7*X;if(a==="yearly")return $(t,-12);const i=new Date(t),s=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),0)).getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()-1,1,i.getUTCHours(),i.getUTCMinutes()));return n.setUTCDate(Math.min(i.getUTCDate(),s)),n.getTime()}function Ye(t,a){return a==="weekly"?t+7*X:a==="yearly"?$(t,12):$(t,1)}function Xt(t){if(t.startedAt!=null){const a=new Date(t.startedAt).getTime();if(Number.isFinite(a))return a}return Ve(new Date(t.nextBillingAt).getTime(),t.cycle)}function Zt(t,a,i){if(t.startedAt!=null){const s=new Date(t.startedAt).getTime();if(Number.isFinite(s))return s}return Ve(i,a)}function Jt(t,a,i){if(a==="weekly"){const c=7*X,d=i<=t?0:Math.floor((i-t)/c);return{startMs:t+d*c,endMs:t+(d+1)*c}}const s=a==="yearly"?12:1,n=s*30.436875*X;let o=i<=t?0:Math.floor((i-t)/n);for(;o>0&&$(t,o*s)>i;)o-=1;let l=0;for(;$(t,(o+1)*s)<=i&&l<12e3;)o+=1,l+=1;return{startMs:$(t,o*s),endMs:$(t,(o+1)*s)}}function ne(t,a){const i=new Date(t.nextBillingAt).getTime();if(!Number.isFinite(i))return null;const s=["weekly","monthly","yearly"].includes(t.cycle)?t.cycle:"monthly",n=Zt(t,s,i);if(!Number.isFinite(n))return null;let o,l,c=!1;t.autoRenew?{startMs:o,endMs:l}=Jt(n,s,a):t.startedAt!=null?(o=n,l=Ye(n,s),c=l<=a):(o=n,l=i,c=l<=a);const d=Math.max(1,l-o),u=c?1:Math.max(0,Math.min(1,(a-o)/d));return{endMs:l,startMs:o,progress:u,cycleDays:Math.max(1,Math.round(d/X)),expired:c}}function Ke(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.ceil(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function be(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.floor(i/6e4),n=Math.floor(s/1440),o=Math.floor(s%1440/60),l=s%60;return r("subscriptions.countdown",{days:n,hours:o,minutes:l})}const Qt="shrink-0 text-oai-black dark:text-oai-white";function Xe(){const t=typeof navigator>"u"?"":navigator.userAgent||"";return/Windows/i.test(t)?"windows":/Linux/i.test(t)?"linux":"macos"}function Ze(){return Xe()==="windows"?r("limits.commandCode.setupHint.snippet_login_windows"):r("limits.commandCode.setupHint.snippet_login")}function Je(){return r("limits.devin.setupHint.snippet_login")}function ea(t){const a=le(t);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const s=Math.floor(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function ta(t,a){const i=a===w.REMAINING?100-t:t;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function se(t,a="used_percent"){return t?a==="utilization"?t.utilization:t.used_percent:null}function ce(t,a="reset_at"){return t?a==="resets_at"?t.resets_at:t.reset_at:null}function pe(t){const a=Math.max(0,Math.min(100,Number(t)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function ae(t,{useGrouping:a=!0,maximumFractionDigits:i}={}){const s=Number(t);return Number.isFinite(s)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:i??(s>=100?0:2),useGrouping:a}).format(s):null}function aa(t){if(!t||typeof t!="object"||!(Number(t.limit_credits)>0))return null;const a={useGrouping:t.unit!=="calls"},i=ae(t.used_credits,a),s=ae(t.limit_credits,a),n=ae(t.remaining_credits,a);if(!i||!s||!n)return null;const o=t.unit==="calls"?"limits.qoder_calls.detail":"limits.codex_credits.detail";return r(o,{used:i,limit:s,remaining:n})}function Qe(t,a,i){return vt({usedPercent:se(t.window,t.pctField),windowSeconds:jt(t,t.window),resetMs:le(ce(t.window,t.resetField)),mode:a,now:i})}function oe(t){return Number.isFinite(t)?new Intl.DateTimeFormat(U(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):null}function ra(t,a,i){const s=[tt(t,a,i)],n=le(ce(t.window,t.resetField)),o=oe(n);o&&s.push(r(t.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:o}));const l=aa(t.window);return l&&s.push(l),s.join(`
1
+ import{o as Z,j as e,y as Re,c as r,h as U,r as p,al as xt,B as Y,bl as pt,V as j,e as gt,W as ve,R as ht,L as ft,bm as bt,t as yt,w as kt}from"./__vite-browser-external-BtJVmciH.js";import{m as je}from"./react-BgpqhoCj.js";import{P as re,c as vt,r as le,a as jt,u as wt,b as Nt,s as _t}from"./use-usage-limits-CjyDfH-M.js";import{b as w,c as He,l as ie,d as Ie,u as Ct}from"./use-limits-display-prefs-T7KWAWZ6.js";import{C as Ae}from"./Card-LJX3G3zo.js";import{F as St}from"./FadeIn-9ph1h_AG.js";import{P as Oe}from"./ProviderIcon-Da90GDcM.js";import{H as Pt}from"./HoverTooltip-CCKdmuOP.js";import{C as Fe}from"./chevron-down-mjUspqZv.js";import{G as Mt}from"./gift-WmV4SBGR.js";import{C as Dt}from"./ConfirmModal-C_NH8vgO.js";import{I as we,L as Tt}from"./LocalOnlyNotice-BURiQAtP.js";import{S as xe}from"./Select-pZDawyxt.js";import{P as Et}from"./plus-DAjojh_m.js";import{P as Rt,a as Ht,b as It,c as At,d as Ot}from"./PopoverPopup-DDnISLKM.js";import{u as Ft}from"./use-reduced-motion-CfCY-K-a.js";import"./use-latest-request-guard-DGhwmlX8.js";import"./DialogTitle-DoQgdh5w.js";import"./composite-CzXFY9IC.js";import"./store-BHAXkHPR.js";import"./DialogDescription-ne_rYSD7.js";import"./arrow-up-right-B_b2i8hn.js";import"./download-CQvg59w1.js";import"./check-BlBHefQ7.js";import"./SelectItemText-D5wuuN7G.js";import"./usePositioner-dWENyY8z.js";import"./safePolygon-C-PFpZSA.js";const Le={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};Le.node;const Lt=Z(Le);const $e={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};$e.node;const $t=Z($e);const Ue={name:"calendar-clock",size:24,node:[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338",key:"7hb8p4"}],["path",{d:"M3 9h5.859",key:"numkqi"}],["path",{d:"M8 2v3",key:"1ioesn"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]};Ue.node;const Be=Z(Ue);const ze={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};ze.node;const Ge=Z(ze);const We={name:"infinity",size:24,node:[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]};We.node;const qe=Z(We),Ut=[3,2,3,3,2,2,3];function L({className:t}){return e.jsx("div",{className:Re("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function Bt(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-3 w-12 shrink-0"}),e.jsx(L,{className:"flex-1 h-1.5 rounded-full min-w-0"}),e.jsx(L,{className:"h-3 w-[30px] shrink-0"}),e.jsx(L,{className:"h-3 w-6 shrink-0"})]})}function zt({bars:t,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(L,{className:"h-[14px] w-[14px] rounded shrink-0"}),e.jsx(L,{className:Re("h-4",i)})]}),Array.from({length:t},(s,n)=>e.jsx(Bt,{},n))]})}function Gt(){return e.jsx(Ae,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(L,{className:"h-3.5 w-28"}),Ut.map((t,a)=>e.jsx(zt,{bars:t,index:a},a))]})})}const fe=100;function Ne(t){const a=Date.parse(t);return Number.isFinite(a)?a:null}function Wt(t){return Math.max(0,Math.min(fe,Math.round(t)))}function qt(t){return new Intl.DateTimeFormat(U(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t))}function Vt(t,a,i){if(t==null||t>=a)return fe;const s=a-t,n=a-i;return Wt(n/s*fe)}function Yt(t){const a=t.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function Kt(t,{now:a}={}){if(!t||typeof t!="object")return null;const i=Yt(t);if(i===void 0)return null;const s=Array.isArray(t.credits)?t.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),o=[];for(const l of s){const c=Ne(l?.expires_at);if(c==null)continue;const d=o.length+1;o.push({key:`reset-${d}`,label:r("limits.codex_reset_bank.row_label",{index:d}),expiresAt:qt(c),expiresMs:c,percent:Vt(Ne(l?.granted_at),c,n)})}return i===0?null:o.length>0?{kind:"rows",availableCount:i??o.length,rows:o}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const X=864e5;function $(t,a){const i=new Date(t),s=i.getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()+a,1,i.getUTCHours(),i.getUTCMinutes())),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(s,o)),n.getTime()}function Ve(t,a){if(a==="weekly")return t-7*X;if(a==="yearly")return $(t,-12);const i=new Date(t),s=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),0)).getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()-1,1,i.getUTCHours(),i.getUTCMinutes()));return n.setUTCDate(Math.min(i.getUTCDate(),s)),n.getTime()}function Ye(t,a){return a==="weekly"?t+7*X:a==="yearly"?$(t,12):$(t,1)}function Xt(t){if(t.startedAt!=null){const a=new Date(t.startedAt).getTime();if(Number.isFinite(a))return a}return Ve(new Date(t.nextBillingAt).getTime(),t.cycle)}function Zt(t,a,i){if(t.startedAt!=null){const s=new Date(t.startedAt).getTime();if(Number.isFinite(s))return s}return Ve(i,a)}function Jt(t,a,i){if(a==="weekly"){const c=7*X,d=i<=t?0:Math.floor((i-t)/c);return{startMs:t+d*c,endMs:t+(d+1)*c}}const s=a==="yearly"?12:1,n=s*30.436875*X;let o=i<=t?0:Math.floor((i-t)/n);for(;o>0&&$(t,o*s)>i;)o-=1;let l=0;for(;$(t,(o+1)*s)<=i&&l<12e3;)o+=1,l+=1;return{startMs:$(t,o*s),endMs:$(t,(o+1)*s)}}function ne(t,a){const i=new Date(t.nextBillingAt).getTime();if(!Number.isFinite(i))return null;const s=["weekly","monthly","yearly"].includes(t.cycle)?t.cycle:"monthly",n=Zt(t,s,i);if(!Number.isFinite(n))return null;let o,l,c=!1;t.autoRenew?{startMs:o,endMs:l}=Jt(n,s,a):t.startedAt!=null?(o=n,l=Ye(n,s),c=l<=a):(o=n,l=i,c=l<=a);const d=Math.max(1,l-o),u=c?1:Math.max(0,Math.min(1,(a-o)/d));return{endMs:l,startMs:o,progress:u,cycleDays:Math.max(1,Math.round(d/X)),expired:c}}function Ke(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.ceil(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function be(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.floor(i/6e4),n=Math.floor(s/1440),o=Math.floor(s%1440/60),l=s%60;return r("subscriptions.countdown",{days:n,hours:o,minutes:l})}const Qt="shrink-0 text-oai-black dark:text-oai-white";function Xe(){const t=typeof navigator>"u"?"":navigator.userAgent||"";return/Windows/i.test(t)?"windows":/Linux/i.test(t)?"linux":"macos"}function Ze(){return Xe()==="windows"?r("limits.commandCode.setupHint.snippet_login_windows"):r("limits.commandCode.setupHint.snippet_login")}function Je(){return r("limits.devin.setupHint.snippet_login")}function ea(t){const a=le(t);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const s=Math.floor(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function ta(t,a){const i=a===w.REMAINING?100-t:t;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function se(t,a="used_percent"){return t?a==="utilization"?t.utilization:t.used_percent:null}function ce(t,a="reset_at"){return t?a==="resets_at"?t.resets_at:t.reset_at:null}function pe(t){const a=Math.max(0,Math.min(100,Number(t)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function ae(t,{useGrouping:a=!0,maximumFractionDigits:i}={}){const s=Number(t);return Number.isFinite(s)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:i??(s>=100?0:2),useGrouping:a}).format(s):null}function aa(t){if(!t||typeof t!="object"||!(Number(t.limit_credits)>0))return null;const a={useGrouping:t.unit!=="calls"},i=ae(t.used_credits,a),s=ae(t.limit_credits,a),n=ae(t.remaining_credits,a);if(!i||!s||!n)return null;const o=t.unit==="calls"?"limits.qoder_calls.detail":"limits.codex_credits.detail";return r(o,{used:i,limit:s,remaining:n})}function Qe(t,a,i){return vt({usedPercent:se(t.window,t.pctField),windowSeconds:jt(t,t.window),resetMs:le(ce(t.window,t.resetField)),mode:a,now:i})}function oe(t){return Number.isFinite(t)?new Intl.DateTimeFormat(U(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):null}function ra(t,a,i){const s=[tt(t,a,i)],n=le(ce(t.window,t.resetField)),o=oe(n);o&&s.push(r(t.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:o}));const l=aa(t.window);return l&&s.push(l),s.join(`
2
2
  `)}const et=Pt;function ia({label:t,pct:a,reset:i,mode:s=w.USED,pacePercent:n=null,paceOver:o=!1,title:l=null}){const c=Math.max(0,Math.min(100,Number(a)||0)),d=s===w.REMAINING?100-c:c,u=Math.round(d),x=d>0&&u===0?Math.max(d,.35):d;let g=String(u);d>0&&u===0&&(g=r("limits.bar.sub_one_percent"));const b=n==null?null:Math.max(0,Math.min(100,n));return e.jsxs("div",{className:"group relative flex items-center gap-2",children:[e.jsx(et,{text:l}),e.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t}),e.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[e.jsx("div",{className:`${ta(d,s)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${x}%`,minWidth:d>0?"3px":0}}),b!=null&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${b}% - 3px)`,width:"6px"}}),e.jsx("div",{className:`absolute top-0 h-full ${o?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${b}% - 1px)`,width:"2px"}})]})]}),e.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[g,"%"]}),i&&e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i})]})}function tt(t,a,i){const s=t.label??r(t.labelKey),n=i===w.REMAINING,o=d=>n?100-d:d;if(a.expectedPercent==null){const d=Math.max(0,Math.min(100,Number(se(t.window,t.pctField))||0)),u=pe(o(d));return n?r("limits.explain.remaining",{label:s,used:u}):r("limits.explain.used",{label:s,used:u})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:s,eta:a.runsOutEta});const d=pe(o(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:s,pct:d})}const l=Math.max(0,Math.min(100,Number(se(t.window,t.pctField))||0)),c=pe(o(a.projectedEnd??l));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:s,pct:c})}function na({pace:t}){return t.pacePercent!=null}function at({rows:t,mode:a,now:i=Date.now()}){if(t.length===0)return null;const s=a===w.REMAINING,n=t.some(na);return e.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[t.map(({spec:o,pace:l})=>{const c=oe(le(ce(o.window,o.resetField)));return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[tt(o,l,a),c?e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r(o.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:c})]}):null]},o.key)}),n?e.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:r(s?"limits.explain.body_remaining":"limits.explain.body")}):null]})}function K(t){if(!t)return null;const a=Date.now()-new Date(t).getTime();if(a<0)return null;const i=Math.floor(a/6e4);if(i<1)return r("shared.time.now");if(i<60)return r("shared.time.m_ago",{n:i});const s=Math.floor(i/60);if(s<24)return r("shared.time.h_ago",{n:s});const n=Math.floor(s/24);return r("shared.time.d_ago",{n})}const _e={live:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-emerald-500",pulse:"bg-emerald-400"},stale:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"},cached:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"}},sa={claude:"claude",codex:"codex",antigravity:"agy"};function G({label:t,age:a=null,tone:i="live",tooltip:s=null}){const n=_e[i]||_e.live,o=i==="live";return e.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:l=>l.stopPropagation(),children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider border leading-normal ${n.surface}`,children:[o?e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),e.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),t,a?e.jsxs(e.Fragment,{children:[" · ",a]}):null]}),s?e.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[s,e.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]}):null]})}function rt({name:t,providerId:a,children:i,expandable:s=!1,expanded:n=!1,onToggle:o,badge:l=null,rightAdornment:c=null,toggleOnHeader:d=!1}){const u=Ie(a),x=e.jsxs("div",{className:"flex items-center gap-1.5",children:[u?e.jsx(Oe,{provider:u,size:14,className:Qt}):null,e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:t}),c?e.jsx("span",{className:"shrink-0",children:c}):null,l]});return s?d?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("button",{type:"button","aria-expanded":n,onClick:o,className:"flex w-full items-center justify-between rounded text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[x,e.jsx(Fe,{size:13,"aria-hidden":!0,className:`text-oai-gray-400 transition-transform ${n?"rotate-180":""}`})]}),i]}):e.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:o,onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),o?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[x,i]}):e.jsxs("div",{className:"flex flex-col gap-1.5",children:[x,i]})}function it({subscription:t}){const a=t.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),i=t.autoRenew?qe:Ge;return e.jsx("span",{role:"img","aria-label":a,title:a,className:`inline-flex translate-y-px ${t.autoRenew?"text-oai-brand-600 dark:text-oai-brand-400":"text-blue-600 dark:text-blue-400"}`,children:e.jsx(i,{size:14,strokeWidth:2,"aria-hidden":!0})})}function nt({subscription:t,now:a,mode:i=w.USED}){const s=ne(t,a);if(!s)return null;const{endMs:n,expired:o}=s,l=!o&&n-a<=3*864e5,c=o?100:s.progress*100,d=i===w.REMAINING?100-c:c,u=o?100:Math.max(0,Math.min(100,d)),x=Math.round(u),g=u>0&&x===0?r("limits.bar.sub_one_percent"):`${x}%`;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:r("subscriptions.inline.label")}),e.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:`${o?"bg-red-500":l?"bg-amber-500":"bg-blue-500"} rounded-full h-full block motion-safe:transition-[width] motion-safe:duration-500 ease-out motion-reduce:transition-none`,style:{width:`${u}%`,minWidth:u>0?"3px":0}})}),e.jsx("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:g}),e.jsx("span",{className:`text-[10px] tabular-nums shrink-0 whitespace-nowrap w-6 text-right ${o?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:Ke(n,a)})]})}function st({subscription:t,now:a}){const i=ne(t,a);if(!i)return null;const s=new Intl.DateTimeFormat(U(),{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:r("subscriptions.inline.label")}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:":"}),e.jsx("span",{children:t.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")}),e.jsx("span",{children:" "}),e.jsx("span",{className:"font-mono tabular-nums",children:s.format(new Date(i.endMs))}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{className:i.expired?"text-oai-error":void 0,children:be(i.endMs,a)}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{children:t.autoRenew?r("subscriptions.status.auto_renew"):r("subscriptions.status.manual")})]})}const oa=He;function R({children:t,tone:a="neutral"}){const i=a==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return e.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:t})}function ot({rows:t,mode:a,extra:i=null}){const s=t.length===0&&!i;return e.jsxs(e.Fragment,{children:[t.map(({spec:n,pace:o})=>e.jsx(ia,{label:n.label??r(n.labelKey),pct:se(n.window,n.pctField),reset:ea(ce(n.window,n.resetField)),mode:a,pacePercent:o.pacePercent,paceOver:o.paceOver,title:ra(n,o,a)},n.key)),s?e.jsx(R,{children:r("limits.status.no_data")}):null,i]})}function la(t){if(!Number.isFinite(t.expiresMs))return null;const a=Math.floor((t.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:t.expiresAt}):r("limits.reset_bank.hover_detail",{date:t.expiresAt,days:a})}function ca({row:t}){const a=Math.max(0,Math.min(100,Number(t.percent)||0));return e.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[e.jsx(et,{text:la(t)}),e.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t.label}),e.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${a}%`,minWidth:a>0?"3px":0}})}),e.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:t.expiresAt})]})}function da({model:t}){const a=t.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:t.availableCount}):null;return e.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":t.kind,children:[e.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codex_reset_bank.title")}),a?e.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):t.rows.map(i=>e.jsx(ca,{row:i},i.key))]})}function ua({data:t}){const a=Date.now(),i=[{key:"five_hour",label:r("limits.label.zcode_5h")},{key:"weekly",label:r("limits.label.zcode_weekly")}].map(s=>({...s,cards:(t[s.key]||[]).filter(n=>Date.parse(n.expires_at)>a).slice().sort((n,o)=>Date.parse(n.expires_at)-Date.parse(o.expires_at))}));return e.jsxs("div",{className:"mt-1 flex flex-col gap-1.5",children:[e.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.zcode.reset_bank.title")}),t.error?e.jsx(R,{tone:"error",children:r("shared.error.prefix",{error:t.error})}):i.map(s=>e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{"data-limit-label":"",className:"shrink-0 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",style:{width:"var(--tt-limits-label-w)"},children:s.label}),e.jsx("span",{className:"rounded-full bg-oai-gray-100 px-2 py-0.5 tabular-nums text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:r("limits.zcode.reset_bank.count",{count:s.cards.length})}),s.cards.length?e.jsx("span",{className:"ml-auto text-right text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500",title:s.cards.map(n=>oe(Date.parse(n.expires_at))).join(`
3
3
  `),children:r("limits.zcode.reset_bank.earliest",{time:oe(Date.parse(s.cards[0].expires_at))})}):null]},s.key))]})}function lt(t,a){if(t==="zcode_reset_bank")return a.reset_credits?e.jsx(ua,{data:a.reset_credits}):null;if(t==="codex_meta"){const i=Kt(a.reset_credits);return i?e.jsx(da,{model:i}):null}if(t==="kimi_parallel"&&a.parallel_limit)return e.jsx(R,{children:r("limits.label.kimi_parallel",{count:a.parallel_limit})});if(t==="kiro_credits"&&Number.isFinite(Number(a.tracked_credits))&&Number(a.tracked_credit_records)>0){const i=ae(a.tracked_credits,{maximumFractionDigits:2});return e.jsx(R,{children:r("limits.label.kiro_tracked_credits",{credits:i,count:Number(a.tracked_credit_records)})})}return t==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?e.jsx(ga,{defaultDir:a.otel_default_dir}):null}function ma({data:t,mode:a,now:i}){const[s,n]=p.useState(!1),o=p.useRef(null),l=ct(o),c=[...new Set((t.buckets||[]).map(x=>x.plan_name).filter(Boolean))],d=c.length?c.join(" · "):r("limits.zcode.start_grants"),u=re.zcode.windows(t).filter(x=>x.window).map(x=>({spec:x,pace:Qe(x,a,i)}));return e.jsxs("div",{className:"mt-2 border-t border-oai-gray-200/60 pt-2 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button","aria-expanded":s,onClick:x=>{x.stopPropagation(),n(g=>!g)},onKeyDown:x=>x.stopPropagation(),className:"flex w-full items-center gap-1.5 rounded text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsx(Mt,{size:13,"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate",title:d,children:d}),e.jsx(Fe,{size:13,"aria-hidden":!0,className:`ml-auto transition-transform ${s?"rotate-180":""}`})]}),s?e.jsx("div",{ref:o,"data-limit-label-group":"",className:"mt-2 flex flex-col gap-1.5",style:l>0?{"--tt-limits-label-w":`${l}px`}:void 0,children:t.error?e.jsx(R,{tone:"error",children:r("shared.error.prefix",{error:t.error})}):e.jsxs(e.Fragment,{children:[e.jsx(ot,{rows:u,mode:a}),e.jsx(at,{rows:u,mode:a,now:i}),(t.buckets||[]).filter(x=>Number.isFinite(x.remaining_units)&&Number.isFinite(x.total_units)).map((x,g)=>e.jsx("div",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.zcode.grant_amount",{remaining:x.remaining_units.toLocaleString(U()),total:x.total_units.toLocaleString(U())})},x.entitlement_id||g))]})}):null]})}function xa(t,a,i,s,n,o,l=null,c=null,d=Date.now()){const u=re[t];if(!u)return null;const x=u.windows(a).filter(b=>b.window).map(b=>({spec:b,pace:Qe(b,s,d)})),g=lt(u.extra,a);return e.jsxs(rt,{name:i,providerId:t,expandable:x.length>0||!!c,expanded:n,onToggle:o,badge:l,rightAdornment:c?e.jsx(it,{subscription:c}):null,toggleOnHeader:t==="zcode",children:[e.jsx(ot,{mode:s,rows:x,extra:g}),c?e.jsx(nt,{subscription:c,now:d,mode:s}):null,n?e.jsx(at,{rows:x,mode:s,now:d}):null,n&&c?e.jsx(st,{subscription:c,now:d}):null,t==="zcode"&&a.start_plan?.configured?e.jsx(ma,{data:a.start_plan,mode:s,now:d}):null]},t)}function ge(t,a,i,s,n=null,o=Date.now(),l=w.USED){const c=!!n;return e.jsxs(rt,{name:ie(t),providerId:t,expandable:c,expanded:i,onToggle:s,rightAdornment:c?e.jsx(it,{subscription:n}):null,children:[a,c?e.jsx(nt,{subscription:n,now:o,mode:l}):null,c&&i?e.jsx("div",{className:"mt-1",children:e.jsx(st,{subscription:n,now:o})}):null]},t)}function pa(t,a,i,s,n,o=null,l=Date.now()){if(!re[t])return null;if(!a?.configured)return ge(t,e.jsxs(e.Fragment,{children:[e.jsx(R,{children:r("limits.status.not_connected")}),t==="opencodeGo"?e.jsx(Ce,{}):null,t==="commandCode"?e.jsx(Se,{}):null,t==="codingPlan"?e.jsx(Me,{}):null,t==="agentPlan"?e.jsx(De,{}):null,t==="devin"?e.jsx(Pe,{}):null]}),s,n,o,l,i);if(t==="opencodeGo"&&a.subscription_status==="inactive")return ge(t,e.jsx(R,{children:r("limits.opencodeGo.status.inactive")}),s,n,o,l,i);if(a.error)return ge(t,e.jsxs(e.Fragment,{children:[e.jsx(R,{tone:"error",children:r("shared.error.prefix",{error:a.error})}),t==="kiro"?lt(re.kiro.extra,a):null,t==="opencodeGo"?e.jsx(Ce,{}):null,t==="commandCode"?e.jsx(Se,{}):null,t==="codingPlan"?e.jsx(Me,{}):null,t==="agentPlan"?e.jsx(De,{}):null,t==="devin"?e.jsx(Pe,{}):null]}),s,n,o,l,i);const c=ie(t),d=a.plan_label?`${c} ${a.plan_label}`:c;let u=null;if(a.auth_action_required==="reauth"){const g=t==="commandCode"?Ze():t==="devin"?Je():sa[t];u=e.jsx(G,{label:r("limits.reauth.badge"),age:K(a.cached_at),tone:"stale",tooltip:g?r("limits.reauth.tooltip",{command:g}):null})}if(!u&&t==="antigravity")if(a.cached){const g=K(a.cached_at);u=e.jsx(G,{label:r("limits.label.antigravity_cached"),age:g,tone:"cached",tooltip:r("limits.tooltip.antigravity_cached")})}else u=e.jsx(G,{label:r("limits.label.antigravity_live"),tone:"live",tooltip:r("limits.tooltip.antigravity_live")});!u&&(t==="qoder"||t==="qoderCn")&&a.cached&&(u=e.jsx(G,{label:r("limits.label.antigravity_cached"),age:K(a.cached_at),tone:"cached",tooltip:r("limits.tooltip.qoder_cached")})),!u&&(t==="codingPlan"||t==="agentPlan")&&a.cached&&(u=e.jsx(G,{label:r("limits.label.antigravity_cached"),age:K(a.cached_at),tone:"cached",tooltip:r("limits.tooltip.ark_cached")}));const x=a.provenance;return x?.stale&&!u&&(u=e.jsx(G,{label:r("limits.provenance.stale"),age:K(x.captured_at),tone:"stale",tooltip:r("limits.provenance.tooltip",{source:x.source,confidence:x.confidence})})),xa(t,a,d,i,s,n,u,o,l)}function ga({defaultDir:t}){const[a,i]=p.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${t||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
4
4
  `),o=async l=>{l.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),e.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:n}),e.jsx("button",{type:"button",onClick:o,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function N({n:t,children:a}){return e.jsxs("li",{className:"flex gap-2.5",children:[e.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:t}),e.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function ye(){return e.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function Ce(){const[t,a]=p.useState(!1),i=["read -r -s OPENCODE_GO_API_KEY","export OPENCODE_GO_API_KEY",'launchctl setenv OPENCODE_GO_API_KEY "$OPENCODE_GO_API_KEY"'].join(`
@@ -1 +1 @@
1
- import{r as h,j as e,c as r}from"./__vite-browser-external-DpZbUcLL.js";import{A as p}from"./arrow-up-right-kkQt6Du0.js";import{D as b}from"./download-NqHXZ-zn.js";function I({id:t,value:l,onChange:d,placeholder:c,disabled:i=!1,type:x="text",label:s,error:a,className:g="",...m}){const y=h.useId(),o=t||y,n=a?`${o}-error`:void 0,u=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${i?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${a?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${g}`;return e.jsxs("div",{className:"w-full",children:[s&&e.jsx("label",{htmlFor:o,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:s}),e.jsx("input",{id:o,type:x,value:l,onChange:d,placeholder:c,disabled:i,"aria-invalid":a?!0:void 0,"aria-describedby":n,className:u,...m}),a&&e.jsx("p",{id:n,className:"mt-1.5 text-sm text-oai-error",children:a})]})}const f="https://github.com/xiufengsun/TokenTracker/releases/latest";function _(){const t=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:r("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:t,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:r("local_only.open_app")}),e.jsx(p,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(b,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("local_only.download")})]})]})]})})}export{I,_ as L};
1
+ import{r as h,j as e,c as r}from"./__vite-browser-external-BtJVmciH.js";import{A as p}from"./arrow-up-right-B_b2i8hn.js";import{D as b}from"./download-CQvg59w1.js";function I({id:t,value:l,onChange:d,placeholder:c,disabled:i=!1,type:x="text",label:s,error:a,className:g="",...m}){const y=h.useId(),o=t||y,n=a?`${o}-error`:void 0,u=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${i?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${a?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${g}`;return e.jsxs("div",{className:"w-full",children:[s&&e.jsx("label",{htmlFor:o,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:s}),e.jsx("input",{id:o,type:x,value:l,onChange:d,placeholder:c,disabled:i,"aria-invalid":a?!0:void 0,"aria-describedby":n,className:u,...m}),a&&e.jsx("p",{id:n,className:"mt-1.5 text-sm text-oai-error",children:a})]})}const f="https://github.com/xiufengsun/TokenTracker/releases/latest";function _(){const t=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:r("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:t,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:r("local_only.open_app")}),e.jsx(p,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(b,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("local_only.download")})]})]})]})})}export{I,_ as L};