tokentracker-cli 1.4.4 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +1 -0
- package/README.ja.md +1 -0
- package/README.ko.md +1 -0
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dashboard/dist/assets/{AchievementBadge-slL-XBCu.js → AchievementBadge-BmWRsZMx.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-BeFkGc5M.js → AchievementsPage-CyIP2nck.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-BrGUIipD.js → AchievementsSection-BeNyJ0LW.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-avmK1ODc.js → BadgeDetailModal-DIFnFzkv.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-DaEPdEZi.js → BotAnimated-CKVeJHit.js} +1 -1
- package/dashboard/dist/assets/{Card-CIZCccTA.js → Card-lQmyKbh4.js} +1 -1
- package/dashboard/dist/assets/{CloudCheckoutPage-BhRj0SYO.js → CloudCheckoutPage-B_8y6dyX.js} +1 -1
- package/dashboard/dist/assets/{CloudPage-CvaN8a54.js → CloudPage-BOQjUGAt.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-BUNuXmYF.js → CommandPalette-BV9LqokI.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-BCI0WHPr.js → CommunityStatsModal-WELxKEFc.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-CT7IwtLR.js → ConfirmModal-B8H5o8c_.js} +1 -1
- package/dashboard/dist/assets/{Controls-CtnMyxNH.js → Controls-9ynPx9rF.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-BuzyITeL.js → DashboardPage-B8z-U63p.js} +1 -1
- package/dashboard/dist/assets/{DateRangePopover-1Ps1-1dw.js → DateRangePopover-DEqWsV_8.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-Dt-dVQAG.js → DevicePage-CUOlUySM.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-D-DRTF1u.js → DialogClose-Dlg52bL6.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-vuQFBlM_.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-CiiRTn3_.js → DialogTitle-CduwXjqH.js} +1 -1
- package/dashboard/dist/assets/{ElectricLogo-k6RFJ2qC.js → ElectricLogo-DFt7_F2f.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CNHg83aK.js → FadeIn-DlyusE6n.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-CIYW5dc3.js → HeaderGithubStar-tUtJoFHh.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-Dn80DyPM.js → HoverTooltip-v-zkCqsX.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-B29dYfoI.js → IpCheckPage-C5Y1uVEr.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-Dzc8_QyW.js → LandingPage-DzOJOAj7.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardPage-DXPcIhyQ.js → LeaderboardPage-BBZ_6tCw.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProBadge-DxEdj2Zq.js → LeaderboardProBadge-DakoXIQn.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfileModal-DnKY2223.js → LeaderboardProfileModal-CINpES_x.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-CY94ngqy.js → LeaderboardProfilePage-B6ISf-1l.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-AlvnAPCD.js → LimitsPage-UVX730CQ.js} +8 -8
- package/dashboard/dist/assets/{LocalOnlyNotice-EHw7BeYS.js → LocalOnlyNotice-BJSsmXF1.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-E5E3i2kj.js → LoginCard-Dggv2aGv.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-DxhQI9kh.js → LoginModal-B8qDd2kY.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-DRwJn-Fw.js → LoginPage-Dv66U8yJ.js} +1 -1
- package/dashboard/dist/assets/{PetPage-DIpVTdiC.js → PetPage-CNwrQdKM.js} +2 -2
- package/dashboard/dist/assets/{PopoverPopup-Bjs7E91g.js → PopoverPopup-CqmvpYOi.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-DqXIjym-.js → ProviderIcon-BF2Ch7wi.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-DxSRYQgP.js → ResetPasswordPage-B0R8VUU3.js} +1 -1
- package/dashboard/dist/assets/{Select-BfjrcaiM.js → Select-idAiBnJG.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-Dpdlb0cU.js → SelectItemText-DPmmPY_D.js} +1 -1
- package/dashboard/dist/assets/{SelfHostPage-Cnp_PMaD.js → SelfHostPage-oR9cPK02.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-fBwG-qXq.js → ServiceStatusPage-CdV9gfGF.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-BEk7AHdq.js → SessionsPage-BkD34VlL.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-BgML2jQR.js → SettingsPage-DsthWCyM.js} +3 -3
- package/dashboard/dist/assets/{SkillsPage-DcvVZ3Wn.js → SkillsPage-CzMk9s3x.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-D29yX2Hb.js → TokenGalaxy-DQ6o8YBp.js} +1 -1
- package/dashboard/dist/assets/{TooltipPopup-CjzmNK2l.js → TooltipPopup-CMQjA-HE.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-DfnQrsrx.js → TrendMonitor-DrV1m8E7.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-CRYomYfk.js → WidgetsPage-Cc16WM0Y.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-CvQI5zUw.js → WrappedPage-pMwbM4R7.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-BZ-i40Kf.js → __vite-browser-external-DCy_YLfe.js} +3 -3
- package/dashboard/dist/assets/{agent-logos-CvOX7WXW.js → agent-logos-Zw7LNkMO.js} +1 -1
- package/dashboard/dist/assets/{arrow-left-BrQrZJtW.js → arrow-left-DycYjE-k.js} +1 -1
- package/dashboard/dist/assets/{arrow-right-fC11gmFY.js → arrow-right-uNxLHoJ0.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-CCMEqQQp.js → arrow-up-right-CmdJ7gd7.js} +1 -1
- package/dashboard/dist/assets/{calendar-days-OaIQ06qD.js → calendar-days-CJ33_t5O.js} +1 -1
- package/dashboard/dist/assets/{check-D888uFpx.js → check-Dbubk4Il.js} +1 -1
- package/dashboard/dist/assets/{chevron-down-BJ0BpS_w.js → chevron-down-BwvBVAOs.js} +1 -1
- package/dashboard/dist/assets/{cloud-checkout-BeOpEJTZ.js → cloud-checkout-IG-IOpeP.js} +1 -1
- package/dashboard/dist/assets/{composite-CUuXvKos.js → composite-IIgJPPIw.js} +1 -1
- package/dashboard/dist/assets/{download-BJ7CKwx5.js → download-DxtH7w6a.js} +1 -1
- package/dashboard/dist/assets/{external-link-CDaZwJVN.js → external-link-evKf3mnD.js} +1 -1
- package/dashboard/dist/assets/{flame-ChyUKs-9.js → flame-D2qOE_W4.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-B6WX7zcH.js → format-tokens-CqDmm-sK.js} +1 -1
- package/dashboard/dist/assets/{gift-CQlAZUJ5.js → gift-Ge11HK1x.js} +1 -1
- package/dashboard/dist/assets/{host-mode-Gw6KD5OJ.js → host-mode-8_TNh7yE.js} +1 -1
- package/dashboard/dist/assets/{icons-C7gGTMuQ.js → icons-OmfWvE5K.js} +1 -1
- package/dashboard/dist/assets/{index-Bm2dDAVL.js → index-BYuEzP9p.js} +1 -1
- package/dashboard/dist/assets/{index-CLb64Tlj.js → index-BsYtyo4U.js} +1 -1
- package/dashboard/dist/assets/{index-C0pbymQa.js → index-tbe1aERA.js} +1 -1
- package/dashboard/dist/assets/{info-CvOmd88O.js → info-xhrso9aO.js} +1 -1
- package/dashboard/dist/assets/{link-2-BNEPxvlF.js → link-2-BgNpTaO4.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-bRHxCgY3.js → loader-circle-DRooZ0e5.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-D-X0-uvt.js → modifiers.esm-D-QAEpOZ.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone-Bo7d-q73.js → monitor-smartphone-Bwu7__2B.js} +1 -1
- package/dashboard/dist/assets/{play-DqpGELN5.js → play-CBPvTiWM.js} +1 -1
- package/dashboard/dist/assets/{plus-2fA1tz7S.js → plus-B4lFIyP8.js} +1 -1
- package/dashboard/dist/assets/{provider-display-B1KigDYZ.js → provider-display-CQlWusXH.js} +1 -1
- package/dashboard/dist/assets/{react-DYja9tZG.js → react-DDOtS4Bd.js} +1 -1
- package/dashboard/dist/assets/{safePolygon-BerB8y-A.js → safePolygon-BGfBVKoy.js} +1 -1
- package/dashboard/dist/assets/{search-CU6UVI1L.js → search-DVyNq72J.js} +1 -1
- package/dashboard/dist/assets/{server-CZR4PTdb.js → server-EpUTEsOf.js} +1 -1
- package/dashboard/dist/assets/{shield-check-BGbNmrMP.js → shield-check-DRg8cPKV.js} +1 -1
- package/dashboard/dist/assets/{skills-api-CJLEzxDf.js → skills-api-y42dEF96.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-CJ1NZWER.js → sortable.esm-D2S1gXCK.js} +1 -1
- package/dashboard/dist/assets/{store-CJFdru_6.js → store-DfGPS2IR.js} +1 -1
- package/dashboard/dist/assets/{terminal-ClyQ8tvQ.js → terminal-hXIrrL2b.js} +1 -1
- package/dashboard/dist/assets/{trash-Dg2PWl5-.js → trash-cjaASRQl.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-Ca995kap.js → use-community-stats-B-nipjWt.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-BKbMGVji.js → use-latest-request-guard-DIEYrSzn.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-CGyd8lvc.js → use-limits-display-prefs-BdHDwBBC.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-Dqeuqm9O.js → use-native-settings-7w71_h44.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-Nj7R1iUu.js → use-ordered-list-CSMpK4ar.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-HUGf223R.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-C_H5BaGV.js → use-session-efficiency-pref-BagBVWW6.js} +1 -1
- package/dashboard/dist/assets/{use-transform-CC90hurD.js → use-transform-sjGGXCNn.js} +1 -1
- package/dashboard/dist/assets/use-usage-limits-Nml-wUB-.js +1 -0
- package/dashboard/dist/assets/{useCurrency-CMHIL39_.js → useCurrency-DAKIY1nR.js} +1 -1
- package/dashboard/dist/assets/{usePositioner-CRSfrGQq.js → usePositioner-B7vVQ7th.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-B5jhM_Kb.js → useTokenFormat-gtgw8k2Z.js} +1 -1
- package/dashboard/dist/assets/{zap-CKx8ySZs.js → zap-DFWOiTJ1.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/commands/sync.js +546 -31
- package/src/lib/async-queue-reader.js +37 -16
- package/src/lib/codex-context-breakdown.js +8 -1
- package/src/lib/codex-rollout-parser.js +65 -5
- package/src/lib/grok-limits.js +56 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +356 -8
- package/src/lib/session-analytics.js +1 -1
- package/src/lib/usage-limits.js +33 -1
- package/dashboard/dist/assets/DialogDescription-BOYDS1mM.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-CGMbDpHQ.js +0 -1
- package/dashboard/dist/assets/use-usage-limits-DtaaE7D8.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-
|
|
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-BZ-i40Kf.js";import{S as Ra}from"./Select-BfjrcaiM.js";import{m as Ka}from"./react-DYja9tZG.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-CJ1NZWER.js";import{r as Ha}from"./modifiers.esm-D-X0-uvt.js";import{P as fe}from"./ProviderIcon-DqXIjym-.js";import{u as Ya}from"./useCurrency-CMHIL39_.js";import{u as Q}from"./useTokenFormat-B5jhM_Kb.js";import{L as X,a as ne}from"./LeaderboardProBadge-DxEdj2Zq.js";import{s as Va,c as Ja,A as Za,t as Xa,b as qa}from"./AchievementBadge-slL-XBCu.js";import{u as Qa}from"./use-ordered-list-Nj7R1iUu.js";import{A as er}from"./arrow-right-fC11gmFY.js";import{u as ar}from"./use-community-stats-Ca995kap.js";import"./chevron-down-BJ0BpS_w.js";import"./check-D888uFpx.js";import"./SelectItemText-Dpdlb0cU.js";import"./composite-CUuXvKos.js";import"./usePositioner-CRSfrGQq.js";import"./TooltipPopup-CjzmNK2l.js";import"./store-CJFdru_6.js";import"./safePolygon-BerB8y-A.js";import"./zap-CKx8ySZs.js";import"./flame-ChyUKs-9.js";import"./calendar-days-OaIQ06qD.js";import"./shield-check-BGbNmrMP.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-DnKY2223.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-BCI0WHPr.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-CINpES_x.js","assets/__vite-browser-external-DCy_YLfe.js","assets/__vite-browser-external-B0m8a6Te.css","assets/provider-display-CQlWusXH.js","assets/useCurrency-DAKIY1nR.js","assets/useTokenFormat-gtgw8k2Z.js","assets/terminal-hXIrrL2b.js","assets/play-CBPvTiWM.js","assets/info-xhrso9aO.js","assets/LeaderboardProBadge-DakoXIQn.js","assets/TooltipPopup-CMQjA-HE.js","assets/composite-IIgJPPIw.js","assets/store-DfGPS2IR.js","assets/safePolygon-BGfBVKoy.js","assets/usePositioner-B7vVQ7th.js","assets/ProviderIcon-BF2Ch7wi.js","assets/AchievementBadge-BmWRsZMx.js","assets/zap-DFWOiTJ1.js","assets/flame-D2qOE_W4.js","assets/calendar-days-CJ33_t5O.js","assets/shield-check-DRg8cPKV.js","assets/AchievementsSection-BeNyJ0LW.js","assets/react-DDOtS4Bd.js","assets/format-tokens-CqDmm-sK.js","assets/use-reduced-motion-HUGf223R.js","assets/arrow-up-right-CmdJ7gd7.js","assets/link-2-BgNpTaO4.js","assets/check-Dbubk4Il.js","assets/DialogTitle-CduwXjqH.js","assets/CommunityStatsModal-WELxKEFc.js","assets/icons-OmfWvE5K.js","assets/TrendMonitor-DrV1m8E7.js","assets/DateRangePopover-DEqWsV_8.js","assets/use-latest-request-guard-DIEYrSzn.js","assets/PopoverPopup-CqmvpYOi.js","assets/SelectItemText-DPmmPY_D.js","assets/DialogDescription-vuQFBlM_.js","assets/DialogClose-Dlg52bL6.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-DCy_YLfe.js";import{S as Ra}from"./Select-idAiBnJG.js";import{m as Ka}from"./react-DDOtS4Bd.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-D2S1gXCK.js";import{r as Ha}from"./modifiers.esm-D-QAEpOZ.js";import{P as fe}from"./ProviderIcon-BF2Ch7wi.js";import{u as Ya}from"./useCurrency-DAKIY1nR.js";import{u as Q}from"./useTokenFormat-gtgw8k2Z.js";import{L as X,a as ne}from"./LeaderboardProBadge-DakoXIQn.js";import{s as Va,c as Ja,A as Za,t as Xa,b as qa}from"./AchievementBadge-BmWRsZMx.js";import{u as Qa}from"./use-ordered-list-CSMpK4ar.js";import{A as er}from"./arrow-right-uNxLHoJ0.js";import{u as ar}from"./use-community-stats-B-nipjWt.js";import"./chevron-down-BwvBVAOs.js";import"./check-Dbubk4Il.js";import"./SelectItemText-DPmmPY_D.js";import"./composite-IIgJPPIw.js";import"./usePositioner-B7vVQ7th.js";import"./TooltipPopup-CMQjA-HE.js";import"./store-DfGPS2IR.js";import"./safePolygon-BGfBVKoy.js";import"./zap-DFWOiTJ1.js";import"./flame-D2qOE_W4.js";import"./calendar-days-CJ33_t5O.js";import"./shield-check-DRg8cPKV.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-CINpES_x.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-WELxKEFc.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};
|
package/dashboard/dist/assets/{LeaderboardProBadge-DxEdj2Zq.js → LeaderboardProBadge-DakoXIQn.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V as u,j as o,y as m,r as b,c as n}from"./__vite-browser-external-
|
|
1
|
+
import{V as u,j as o,y as m,r as b,c as n}from"./__vite-browser-external-DCy_YLfe.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-CMQjA-HE.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-
|
|
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-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-DIFnFzkv.js","assets/__vite-browser-external-DCy_YLfe.js","assets/__vite-browser-external-B0m8a6Te.css","assets/react-DDOtS4Bd.js","assets/AchievementBadge-BmWRsZMx.js","assets/zap-DFWOiTJ1.js","assets/flame-D2qOE_W4.js","assets/calendar-days-CJ33_t5O.js","assets/shield-check-DRg8cPKV.js","assets/use-transform-sjGGXCNn.js","assets/use-reduced-motion-HUGf223R.js","assets/AchievementsSection-BeNyJ0LW.js","assets/format-tokens-CqDmm-sK.js","assets/DialogTitle-CduwXjqH.js","assets/composite-IIgJPPIw.js","assets/store-DfGPS2IR.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-DCy_YLfe.js";import{A as _e,f as Ne}from"./provider-display-CQlWusXH.js";import{u as we}from"./useCurrency-DAKIY1nR.js";import{u as X}from"./useTokenFormat-gtgw8k2Z.js";import{L as Y,a as K}from"./LeaderboardProBadge-DakoXIQn.js";import{P as $}from"./ProviderIcon-BF2Ch7wi.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-BmWRsZMx.js";import{A as Ie}from"./AchievementsSection-BeNyJ0LW.js";import{A as U}from"./arrow-up-right-CmdJ7gd7.js";import{L as De}from"./link-2-BgNpTaO4.js";import{C as Te}from"./check-Dbubk4Il.js";import{D as Be,a as Le,b as $e,c as Ue,d as Re,e as Fe}from"./DialogTitle-CduwXjqH.js";import"./terminal-hXIrrL2b.js";import"./play-CBPvTiWM.js";import"./info-xhrso9aO.js";import"./TooltipPopup-CMQjA-HE.js";import"./composite-IIgJPPIw.js";import"./store-DfGPS2IR.js";import"./safePolygon-BGfBVKoy.js";import"./usePositioner-B7vVQ7th.js";import"./zap-DFWOiTJ1.js";import"./flame-D2qOE_W4.js";import"./calendar-days-CJ33_t5O.js";import"./shield-check-DRg8cPKV.js";import"./react-DDOtS4Bd.js";import"./format-tokens-CqDmm-sK.js";import"./use-reduced-motion-HUGf223R.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-
|
|
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-DIFnFzkv.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-
|
|
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-DCy_YLfe.js";import{u as ke}from"./useCurrency-DAKIY1nR.js";import{H as Me}from"./HeaderGithubStar-tUtJoFHh.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-CINpES_x.js";import{D as Te}from"./download-DxtH7w6a.js";import"./provider-display-CQlWusXH.js";import"./useTokenFormat-gtgw8k2Z.js";import"./terminal-hXIrrL2b.js";import"./play-CBPvTiWM.js";import"./info-xhrso9aO.js";import"./LeaderboardProBadge-DakoXIQn.js";import"./TooltipPopup-CMQjA-HE.js";import"./composite-IIgJPPIw.js";import"./store-DfGPS2IR.js";import"./safePolygon-BGfBVKoy.js";import"./usePositioner-B7vVQ7th.js";import"./ProviderIcon-BF2Ch7wi.js";import"./AchievementBadge-BmWRsZMx.js";import"./zap-DFWOiTJ1.js";import"./flame-D2qOE_W4.js";import"./calendar-days-CJ33_t5O.js";import"./shield-check-DRg8cPKV.js";import"./AchievementsSection-BeNyJ0LW.js";import"./react-DDOtS4Bd.js";import"./format-tokens-CqDmm-sK.js";import"./use-reduced-motion-HUGf223R.js";import"./arrow-up-right-CmdJ7gd7.js";import"./link-2-BgNpTaO4.js";import"./check-Dbubk4Il.js";import"./DialogTitle-CduwXjqH.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=`
|