tokentracker-cli 0.76.0 → 0.76.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dashboard/dist/assets/{ActivityHeatmap-Cc7rHzpc.js → ActivityHeatmap-CPGN-WN1.js} +1 -1
  2. package/dashboard/dist/assets/{Card-i15i_EDL.js → Card-Bw438EXT.js} +1 -1
  3. package/dashboard/dist/assets/{ClawdAnimated-DMuZ5d5m.js → ClawdAnimated-DuxB7qei.js} +1 -1
  4. package/dashboard/dist/assets/{CommunityStatsModal-cKwxGEGB.js → CommunityStatsModal--AuOLfq1.js} +1 -1
  5. package/dashboard/dist/assets/{ConfirmModal-Ck-ybj6p.js → ConfirmModal-DXV9mzMw.js} +1 -1
  6. package/dashboard/dist/assets/{Controls-CxmOdwJ3.js → Controls-D0h-lPHC.js} +1 -1
  7. package/dashboard/dist/assets/{DashboardPage-ED4-b7kr.js → DashboardPage-_9IPwhlZ.js} +1 -1
  8. package/dashboard/dist/assets/{DevicePage-DcKvkJNR.js → DevicePage-CMa1l2sC.js} +1 -1
  9. package/dashboard/dist/assets/{DialogClose-C6nuJJ_i.js → DialogClose-DBKCvZPm.js} +1 -1
  10. package/dashboard/dist/assets/DialogDescription-Dj5LvyRi.js +1 -0
  11. package/dashboard/dist/assets/{DialogTitle-D0xEUAQD.js → DialogTitle-CuhKU10w.js} +1 -1
  12. package/dashboard/dist/assets/{FadeIn-GWxxEiEG.js → FadeIn-BoYq0Lpr.js} +1 -1
  13. package/dashboard/dist/assets/{HeaderGithubStar-BNs6lPrd.js → HeaderGithubStar-DD58NKiQ.js} +1 -1
  14. package/dashboard/dist/assets/{IpCheckPage-BHEGYdwZ.js → IpCheckPage-Pw-_Uvsa.js} +1 -1
  15. package/dashboard/dist/assets/{LandingPage-qCAwHW-r.js → LandingPage-D2t79SLx.js} +1 -1
  16. package/dashboard/dist/assets/{LeaderboardAvatar-aso6D7AA.js → LeaderboardAvatar-D_fl_xuD.js} +1 -1
  17. package/dashboard/dist/assets/{LeaderboardPage-BVDho0zN.js → LeaderboardPage-0jDDohE4.js} +2 -2
  18. package/dashboard/dist/assets/{LeaderboardProfileModal-D5qe822P.js → LeaderboardProfileModal-DSMTxieN.js} +1 -1
  19. package/dashboard/dist/assets/{LeaderboardProfilePage-BhfX0BP4.js → LeaderboardProfilePage-neatevKp.js} +1 -1
  20. package/dashboard/dist/assets/{LimitsPage-BDld2Tw9.js → LimitsPage-DqaIA0Es.js} +1 -1
  21. package/dashboard/dist/assets/{LocalOnlyNotice-B7Ws4lUu.js → LocalOnlyNotice-Ds7yPxS1.js} +1 -1
  22. package/dashboard/dist/assets/{LoginPage-D7OQrvP6.js → LoginPage-7dsJbTEb.js} +1 -1
  23. package/dashboard/dist/assets/PetPage-UWW1N1PL.js +1 -0
  24. package/dashboard/dist/assets/{PopoverPopup-MhHKPgtt.js → PopoverPopup-Bg8XtAJ5.js} +1 -1
  25. package/dashboard/dist/assets/{ResetPasswordPage-C3QmfXcI.js → ResetPasswordPage-Czaz9zzN.js} +1 -1
  26. package/dashboard/dist/assets/{Select-B9zxyBF3.js → Select-Dk9uTtUI.js} +1 -1
  27. package/dashboard/dist/assets/{SelectItemText-D-kCTY6-.js → SelectItemText-Dontd_dr.js} +1 -1
  28. package/dashboard/dist/assets/{SettingsPage-1NY7r1OL.js → SettingsPage-CunCphUc.js} +1 -1
  29. package/dashboard/dist/assets/{SkillsPage-B6dZnAvn.js → SkillsPage-BElcW79T.js} +1 -1
  30. package/dashboard/dist/assets/{WidgetsPage-BY_51IWL.js → WidgetsPage-CpAPhR3_.js} +1 -1
  31. package/dashboard/dist/assets/{WrappedPage-BNvs3dW4.js → WrappedPage-DikP22Sw.js} +1 -1
  32. package/dashboard/dist/assets/{agent-logos-Cg92StIs.js → agent-logos-D8OYqlhF.js} +1 -1
  33. package/dashboard/dist/assets/{arrow-up-right-5jhx4tzl.js → arrow-up-right-DsLWfytD.js} +1 -1
  34. package/dashboard/dist/assets/check-CPB_1BeX.js +1 -0
  35. package/dashboard/dist/assets/{copy-CcD9E3do.js → copy-BxHuZgA1.js} +1 -1
  36. package/dashboard/dist/assets/{download-hUD-lQh8.js → download-tXehSjsQ.js} +1 -1
  37. package/dashboard/dist/assets/{format-tokens-BPZCO1fQ.js → format-tokens-ab57-P2J.js} +1 -1
  38. package/dashboard/dist/assets/{info-4Bz63oh6.js → info-Xcqww53Y.js} +1 -1
  39. package/dashboard/dist/assets/{main-nNmpL8Cj.js → main-BQdH4mOs.js} +2 -2
  40. package/dashboard/dist/assets/main-zch5Z6OA.css +1 -0
  41. package/dashboard/dist/assets/{use-community-stats-D6SkhwbZ.js → use-community-stats-DFBJP4bf.js} +1 -1
  42. package/dashboard/dist/assets/{use-limits-display-prefs-BAQYB-31.js → use-limits-display-prefs-gmXXzoWe.js} +1 -1
  43. package/dashboard/dist/assets/{use-native-settings-xp2V6xfM.js → use-native-settings-BNv4MqR-.js} +1 -1
  44. package/dashboard/dist/assets/{use-ordered-list-C5_uGsrS.js → use-ordered-list-Dl82Utll.js} +1 -1
  45. package/dashboard/dist/assets/{use-quality-per-dollar-pref-iQsn9WQp.js → use-quality-per-dollar-pref-XOF93N4q.js} +1 -1
  46. package/dashboard/dist/assets/{use-usage-limits-6uexiute.js → use-usage-limits-YUhemFAp.js} +1 -1
  47. package/dashboard/dist/assets/{useCurrency-CmVvLPhb.js → useCurrency-B6KHWgVk.js} +1 -1
  48. package/dashboard/dist/assets/{useScrollLock-C-uJaCDp.js → useScrollLock-BEZTkDaR.js} +1 -1
  49. package/dashboard/dist/index.html +2 -2
  50. package/dashboard/dist/share.html +2 -2
  51. package/package.json +1 -1
  52. package/src/lib/pricing/seed-snapshot.json +1 -1
  53. package/src/lib/rollout.js +40 -10
  54. package/dashboard/dist/assets/DialogDescription-C6z_szoN.js +0 -1
  55. package/dashboard/dist/assets/PetPage-DsCEXiJf.js +0 -1
  56. package/dashboard/dist/assets/check-DhneqxBx.js +0 -1
  57. package/dashboard/dist/assets/main-BI3jOnQS.css +0 -1
@@ -1 +1 @@
1
- import{R as l,j as c,a0 as h}from"./main-nNmpL8Cj.js";function x(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function d(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={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 g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=x(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:d(t)})}export{g as L};
1
+ import{R as l,j as c,a0 as h}from"./main-BQdH4mOs.js";function x(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function d(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={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 g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=x(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:d(t)})}export{g as L};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-D5qe822P.js","assets/main-nNmpL8Cj.js","assets/main-BI3jOnQS.css","assets/useCurrency-CmVvLPhb.js","assets/LeaderboardAvatar-aso6D7AA.js","assets/ActivityHeatmap-Cc7rHzpc.js","assets/info-4Bz63oh6.js","assets/arrow-up-right-5jhx4tzl.js","assets/check-DhneqxBx.js","assets/DialogTitle-D0xEUAQD.js","assets/useScrollLock-C-uJaCDp.js","assets/CommunityStatsModal-cKwxGEGB.js","assets/format-tokens-BPZCO1fQ.js","assets/DialogClose-C6nuJJ_i.js","assets/DialogDescription-C6z_szoN.js"])))=>i.map(i=>d[i]);
2
- import{c as la,j as e,a0 as d,r as i,N as n,av as da,aw as ca,a1 as ua,a2 as ma,ax as xa,l as ga,n as ba,ay as pa,az as ha,aA as re,aa as ya,aB as fa,h as ka,$ as wa,L as va,Q as ja,am as Ie,O as Na,aC as _a,aD as Sa,aE as Le,aF as Ca,a8 as Be,S as La}from"./main-nNmpL8Cj.js";import{S as Pa}from"./Select-B9zxyBF3.js";import{a as Ma,C as Ea,u as Aa,b as Ka,c as Pe,D as Ta,d as Ra,S as za,h as Ia,s as Ba,K as Ua,P as Oa}from"./use-ordered-list-C5_uGsrS.js";import{u as $a}from"./useCurrency-CmVvLPhb.js";import{L as te}from"./LeaderboardAvatar-aso6D7AA.js";import{u as Da}from"./use-community-stats-D6SkhwbZ.js";import"./SelectItemText-D-kCTY6-.js";import"./useScrollLock-C-uJaCDp.js";import"./check-DhneqxBx.js";const Fa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ga=la("arrow-right",Fa),Ya=a=>{let{transform:r}=a;return{...r,y:0}};function D(a,{min:r,max:o,fallback:s}){const c=Number(a);if(!Number.isFinite(c))return s;const l=Math.floor(c);return l<r?r:l>o?o:l}function Ha(a,r){const o=D(r,{min:0,max:1e6,fallback:0}),s=D(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const c=new Set([1,o,s-2,s-1,s,s+1,s+2]),l=Array.from(c).filter(m=>Number.isInteger(m)&&m>=1&&m<=o).sort((m,h)=>m-h),b=[];let p=null;for(const m of l)p!=null&&m-p>1&&b.push(null),b.push(m),p=m;return b}function Wa({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,s=o?D(r,{min:0,max:1e6,fallback:0}):null,c=D(a,{min:1,max:o?Math.max(1,s||1):1e6,fallback:1}),l=c>1,b=o?c<s:!0;return{canPrev:l,canNext:b,safePage:c,safeTotal:s}}function Va({entries:a,me:r,meLabel:o}){const s=Array.isArray(a)?a:[],c=r&&typeof r.rank=="number"?r.rank:null;return!c||s.some(b=>!!b?.is_me)?s:[{rank:c,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,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},...s]}function Ja(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.ceil(o/s)}const Za=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function qa({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 ${Za.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const V=[{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}],Ue="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",Oe="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 oe(a){return d("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-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function ne(a){return d("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-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function j({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function Qa({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",s=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(oe(!1),"!group-hover:bg-transparent"),children:e.jsx(j,{className:"h-4 w-6"})}),e.jsx("td",{className:d(ne(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(j,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(j,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:"h-4 w-12"})}),V.map(c=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:d("h-4",s)})},c.key))]})}function Xa({rows:a=10}){return e.jsx("div",{className:"w-full overflow-x-auto",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:d(Ue,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(j,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(Oe,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(j,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-14"})}),V.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{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(Qa,{index:o},o))})]})})}function er({id:a,thClassName:r,children:o}){const{attributes:s,listeners:c,setNodeRef:l,transform:b,transition:p,isDragging:m}=Ma({id:a}),h=Ea.Transform.toString(b)||"";i.useLayoutEffect(()=>{const y=document.querySelectorAll(`td[data-column-key="${a}"]`),f="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return y.forEach(x=>{x.style.transform=h,x.style.transition=p||"",x.style.zIndex=m?"20":"",x.style.position=h?"relative":"",x.style.boxShadow=m?f:""}),()=>{y.forEach(x=>{x.style.transform="",x.style.transition="",x.style.zIndex="",x.style.position="",x.style.boxShadow=""})}},[a,h,p,m]);const L={transform:h,transition:p,position:h?"relative":void 0,zIndex:m?20:void 0,boxShadow:m?"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:l,style:L,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...s,...c,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-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",m&&"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 ar="tokentracker.leaderboard.columnOrder.v1";function rr(a){return Aa(ar,a)}const tr=50;function or(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.min(100,Math.max(1,Math.ceil(o/s*100)))}function $e(a){return typeof a=="string"?a.trim():""}function nr(a){const r=$e(a);return r?r.toLowerCase()==="anonymous":!0}function sr({me:a,totalEntries:r,meLabel:o,onOpenProfile:s,onJumpToMe:c,canJump:l,className:b}){const p=a&&typeof a.rank=="number"?a.rank:null;if(!p)return null;const m=Number(r)||0,h=or(p,m),L=$e(a?.display_name),y=!L||nr(L)?o||"You":L,f=a?.user_id||y,x=s||(l?c:null),E=typeof x=="function",A=E?"button":"div",J=E?{type:"button",onClick:x,"aria-label":n(s?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(A,{...J,className:d("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-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/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]",b),children:[e.jsx(te,{size:"sm",avatarUrl:a?.avatar_url,displayName:y,seed:f}),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-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:y}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",p.toLocaleString()]}),h!=null&&h<=tr&&e.jsx("span",{className:d("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",h<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:n("leaderboard.summary.percentile",{p:String(h)})}),E?e.jsx(Ga,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 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-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const ir=i.lazy(()=>Be(()=>import("./LeaderboardProfileModal-D5qe822P.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(a=>({default:a.LeaderboardProfileModal}))),lr=i.lazy(()=>Be(()=>import("./CommunityStatsModal-cKwxGEGB.js"),__vite__mapDeps([11,1,2,12,9,10,13,14])).then(a=>({default:a.CommunityStatsModal}))),se=[10,20,50,100],ie=20,De="tokentracker:leaderboard:pageSize";function dr(){if(typeof window>"u")return ie;try{const a=window.localStorage.getItem(De),r=Number(a);if(se.includes(r))return r}catch{}return ie}function Me(a,r,o){const s=Number(a);if(!Number.isFinite(s)||s<=0)return"-";const c=Na(r),l=r===La?s:s*o;return l>=1e3?`${c}${Math.round(l).toLocaleString()}`:l>=10?`${c}${Math.round(l)}`:`${c}${l.toFixed(2)}`}function Ee({value:a}){return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:ja(a)}),e.jsx("span",{className:"hidden sm:inline",children:Ie(a)})]})}function cr({communityStats:a,onClick:r}){return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex h-9 items-center gap-2.5 rounded-full border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md px-3.5 select-none text-xs text-oai-gray-500 dark:text-oai-gray-400 hover:border-oai-brand-400 dark:hover:border-oai-brand-500/80 hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 transition-all duration-300 active:scale-[0.97] cursor-pointer",title:n("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-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-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:Math.round(a.tokenFloor).toLocaleString("en-US")}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("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.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:(Number(a.totalEntries)||0).toLocaleString("en-US")}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.community.devs_chip")})]})]})}function Ae(a,r,o){const s=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",c=r?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60";return o.map(l=>e.jsx("td",{"data-column-key":l.key,className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",s,c),children:Ie(a?.[l.key])},l.key))}const ur={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 Ke({rank:a,placeholder:r}){const o=ur[a];return o?e.jsx("span",{className:d("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 Te(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function mr(a){if(!a)return n("shared.error.prefix",{error:n("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||n("leaderboard.error.unknown");return n("shared.error.prefix",{error:o})}function Fe(a){return typeof a!="string"?"":a.trim()}function xr(a){const r=Fe(a);return r?r.toLowerCase()==="anonymous":!0}function Re(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function ze({githubUrl:a}){return e.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":n("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:e.jsx(wa,{provider:"GITHUB",size:16})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute right-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:n("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[n("leaderboard.github.tooltipPrefix")," ",e.jsx(va,{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:n("leaderboard.github.tooltipSettingsLink")}),n("leaderboard.github.tooltipSuffix")]})]})]})}function _r({auth:a,signedIn:r,sessionSoftExpired:o}){const s=da(),c=ca(),{openLoginModal:l}=ua(),{signedIn:b,loading:p,user:m}=ma(),{currency:h,rate:L}=$a(),y=i.useMemo(()=>xa(),[]),f=ga(),x=r&&!o,E=i.useMemo(()=>x&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,x]),A=x?E:null,J=x&&ba(A),le=n("shared.placeholder.short"),Ge=i.useMemo(()=>V.map(t=>t.key),[]),{order:Z,reorder:de}=rr(Ge),ce=i.useMemo(()=>{const t=new Map;for(const u of V)t.set(u.key,u);return t},[]),F=i.useMemo(()=>Z.map(t=>ce.get(t)).filter(Boolean),[Z,ce]),Ye=Ka(Pe(Oa,{activationConstraint:{distance:6}}),Pe(Ua,{coordinateGetter:Ba})),He=i.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||de(String(u.id),String(w.id))},[de]),[q,P]=i.useState(1),[N,We]=i.useState(dr),[ue,me]=i.useState(null),[Ve,xe]=i.useState(!1),Q=i.useCallback(t=>{typeof t=="string"&&t.trim()&&me(t.trim())},[]),Je=i.useCallback(()=>me(null),[]),Ze=i.useCallback(t=>{const u=se.includes(t)?t:ie;We(u),P(1);try{window.localStorage.setItem(De,String(u))}catch{}},[]),[ge,qe]=i.useState(0),[Qe,Xe]=i.useState(()=>pa()),[be,pe]=i.useState(!1),v=i.useMemo(()=>{const t=new URLSearchParams(s?.search||"");return Te(t.get("period"))||"total"},[s?.search]),ea=t=>{const u=Te(t);if(!u||u===v)return;const w=new URLSearchParams(s?.search||"");w.set("period",u),P(1),c(`${s?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};i.useEffect(()=>{p||f||b||l()},[b,p,f,l]),i.useEffect(()=>{P(1)},[v]);const G=i.useMemo(()=>(D(q,{min:1,max:1e6,fallback:1})-1)*N,[q,N]),K=i.useMemo(()=>f?"mock":p?"unavailable":b?"cloud":r?"local":y?"public":"unavailable",[p,b,y,f,r]),g=i.useMemo(()=>ha({accessMode:K,baseUrl:y,mockEnabled:f,userId:m?.id||null,period:v,pageSize:N,offset:G}),[m?.id,K,y,G,f,N,v]),[I,B]=i.useState(()=>{const t=re(g);return t?{loading:!1,error:null,data:t.data,contextKey:g}:{loading:!1,error:null,data:null,contextKey:null}});i.useEffect(()=>{if(!y&&!f||!f&&K==="unavailable"){B({loading:!1,error:null,data:null,contextKey:null});return}const t=re(g);let u=!0;return B(t?{loading:!1,error:null,data:t.data,contextKey:g}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await ya({userId:m?.id||null,period:v,limit:N,offset:G});u&&(fa(w,{activeContextKey:g,contextKey:g,source:ge>0?"manual-refresh":"page-load"}),B({loading:!1,error:null,data:w,contextKey:g}))})().catch(w=>{if(!u)return;const z=mr(w);B(O=>O.contextKey===g?{...O,loading:!1,error:z}:{loading:!1,error:z,data:null,contextKey:g})}),()=>{u=!1}},[y,K,m?.id,g,G,ge,f,v,N]);const X=i.useMemo(()=>I.contextKey===g?null:re(g),[g,I.contextKey]),k=i.useMemo(()=>I.contextKey===g?I:X?{loading:!1,error:null,data:X.data,contextKey:g}:{loading:!!(y||f)&&K!=="unavailable",error:null,data:null,contextKey:g},[K,y,g,I,f,X]),_=k.data,Y=_?.total_pages??null,aa=_?.total_entries??0,T=_?.page??q,ra=i.useMemo(()=>Ha(T,Y),[T,Y]),he=_?.from||null,ye=_?.to||null,fe=_?.generated_at||null,ke=Da(),M=_?.me||null,H=n("leaderboard.me_label"),ta=n("leaderboard.anon_label"),we=n("leaderboard.period.week"),ve=n("leaderboard.period.month"),je=n("leaderboard.period.total"),Ne=v==="month"?ve:v==="total"?je:we,ee=i.useMemo(()=>{const t=Array.isArray(_?.entries)?_.entries:[];return Va({entries:t,me:M,meLabel:H})},[_?.entries,M,H]),R=i.useMemo(()=>Ja(M?.rank,N),[M?.rank,N]),oa=R!=null&&R===T,na=i.useCallback(()=>{R!=null&&P(R)},[R]),sa=async()=>{pe(!0);try{_a(!0),Xe(!0),await Sa(()=>Le(A));const t=await Le(A);t&&await Ca({accessToken:t,period:v,source:"leaderboard-enable-sync"}),qe(u=>u+1)}catch(t){console.warn("[tokentracker] sync:",t)}finally{pe(!1)}},{canPrev:_e,canNext:Se}=Wa({page:T,totalPages:Y}),W=Array.isArray(ee)&&ee.length!==0;let U=null;k.loading&&!W?U=e.jsx(Xa,{rows:N}):k.error&&!W?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:k.error})}):W?U=e.jsx(Ta,{sensors:Ye,collisionDetection:Ra,modifiers:[Ya],onDragEnd:He,children:e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-full sm: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:d(Ue,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:n("leaderboard.column.rank")}),e.jsx("th",{className:d(Oe,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:n("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:n("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:n("leaderboard.column.est_cost")}),e.jsx(za,{items:Z,strategy:Ia,children:F.map(t=>e.jsx(er,{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(qa,{iconSrc:t.icon,label:n(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:ee.map((t,u)=>{if(t?.is_ellipsis){const C=4+F.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:C,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-${u}`)}const w=!!t?.is_me,z=typeof t?.user_id=="string"?t.user_id:null,O=Fe(t?.display_name),ia=xr(O)?ta:O,S=w?H:ia,$=!!z,Ce=$?{role:"button",tabIndex:0,onClick:$?()=>Q(z):void 0,onKeyDown:$?C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),Q(z))}:void 0,"aria-label":n("leaderboard.profile_modal.row_aria",{name:S})}:{};if(w){const C=!!t?.is_pinned;return e.jsxs("tr",{...Ce,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",C?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",$&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(oe(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",C&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx(Ke,{rank:t?.rank,placeholder:le})}),e.jsx("td",{className:ne(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(te,{avatarUrl:t?.avatar_url,displayName:S,seed:Re(t,S)}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:S}),t?.github_url&&e.jsx(ze,{githubUrl:t.github_url})]})}),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-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(Ee,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:Me(t?.estimated_cost_usd,h,L)}),Ae(t,!0,F)]},`row-${t?.rank}-${S}${C?"-pin":""}`)}return e.jsxs("tr",{...Ce,className:d("group transition-colors",$&&"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-brand-500/60"),children:[e.jsx("td",{className:d(oe(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(Ke,{rank:t?.rank,placeholder:le})}),e.jsx("td",{className:ne(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(te,{avatarUrl:t?.avatar_url,displayName:S,seed:Re(t,S)}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:S}),t?.github_url&&e.jsx(ze,{githubUrl:t.github_url})]})}),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(Ee,{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:Me(t?.estimated_cost_usd,h,L)}),Ae(t,!1,F)]},`row-${t?.rank}-${S}`)})})]})})}):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:n("leaderboard.empty")})});let ae=null;return typeof Y=="number"?ae=ra.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.pagination.ellipsis")},`ellipsis-${u}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===T?"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:()=>P(t),disabled:k.loading,children:String(t)},`page-${t}`)):ae=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.pagination.page_unknown",{page:String(T)})}),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-5 sm:mb-6",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-2 sm:mb-3",children:n("leaderboard.title")}),e.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[v==="total"?n("leaderboard.range.total"):he&&ye?n("leaderboard.range",{period:Ne,from:he,to:ye}):n("leaderboard.range_loading",{period:Ne}),fe&&e.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 hidden sm:inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:n("leaderboard.generated_at",{ts:fe})})]})]}),e.jsxs("div",{className:"mb-6 sm:mb-8 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsx("div",{className:"inline-flex h-9 p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-full items-center relative self-start",children:["week","month","total"].map(t=>{const u=v===t;return e.jsxs("button",{onClick:()=>ea(t),disabled:k.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",u?"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"?we:t==="month"?ve:je}),u&&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:"flex flex-row items-center gap-2.5 self-end sm:self-auto shrink-0 flex-wrap",children:[e.jsx(cr,{communityStats:ke,onClick:()=>xe(!0)}),e.jsx(sr,{me:M,totalEntries:aa,meLabel:H,onOpenProfile:M?.user_id?()=>Q(M.user_id):void 0,onJumpToMe:na,canJump:R!=null&&!oa&&!k.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:n("leaderboard.signin_prompt")}),e.jsx("button",{onClick:l,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:n("leaderboard.signin_button")})]}),x&&J&&!Qe&&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:n("leaderboard.sync_prompt")}),e.jsx("button",{onClick:sa,disabled:be,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:be?n("leaderboard.sync_button.busy"):n("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[k.error&&W?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:k.error})}):null,U,e.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-end gap-x-4 gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:n("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:N,onValueChange:t=>Ze(Number(t)),disabled:k.loading,ariaLabel:n("leaderboard.pagination.page_size_label"),options:se.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:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),e.jsx("button",{className:d("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",_e&&!k.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:()=>P(t=>Math.max(1,t-1)),disabled:!_e||k.loading,children:n("leaderboard.pagination.prev")}),e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:ae}),e.jsx("button",{className:d("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Se&&!k.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:()=>P(t=>t+1),disabled:!Se||k.loading,children:n("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:n("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/mm7894215/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:n("landing.v2.nav.github")})]})}),e.jsxs(i.Suspense,{fallback:null,children:[e.jsx(ir,{isOpen:!!ue,userId:ue,period:v,accessToken:A,onClose:Je}),e.jsx(lr,{isOpen:Ve,onClose:()=>xe(!1),communityStats:ke})]})]})}export{_r as LeaderboardPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-DSMTxieN.js","assets/main-BQdH4mOs.js","assets/main-zch5Z6OA.css","assets/useCurrency-B6KHWgVk.js","assets/LeaderboardAvatar-D_fl_xuD.js","assets/ActivityHeatmap-CPGN-WN1.js","assets/info-Xcqww53Y.js","assets/arrow-up-right-DsLWfytD.js","assets/check-CPB_1BeX.js","assets/DialogTitle-CuhKU10w.js","assets/useScrollLock-BEZTkDaR.js","assets/CommunityStatsModal--AuOLfq1.js","assets/format-tokens-ab57-P2J.js","assets/DialogClose-DBKCvZPm.js","assets/DialogDescription-Dj5LvyRi.js"])))=>i.map(i=>d[i]);
2
+ import{c as la,j as e,a0 as d,r as i,N as n,av as da,aw as ca,a1 as ua,a2 as ma,ax as xa,l as ga,n as ba,ay as pa,az as ha,aA as re,aa as ya,aB as fa,h as ka,$ as wa,L as va,Q as ja,am as Ie,O as Na,aC as _a,aD as Sa,aE as Le,aF as Ca,a8 as Be,S as La}from"./main-BQdH4mOs.js";import{S as Pa}from"./Select-Dk9uTtUI.js";import{a as Ma,C as Ea,u as Aa,b as Ka,c as Pe,D as Ta,d as Ra,S as za,h as Ia,s as Ba,K as Ua,P as Oa}from"./use-ordered-list-Dl82Utll.js";import{u as $a}from"./useCurrency-B6KHWgVk.js";import{L as te}from"./LeaderboardAvatar-D_fl_xuD.js";import{u as Da}from"./use-community-stats-DFBJP4bf.js";import"./SelectItemText-Dontd_dr.js";import"./useScrollLock-BEZTkDaR.js";import"./check-CPB_1BeX.js";const Fa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ga=la("arrow-right",Fa),Ya=a=>{let{transform:r}=a;return{...r,y:0}};function D(a,{min:r,max:o,fallback:s}){const c=Number(a);if(!Number.isFinite(c))return s;const l=Math.floor(c);return l<r?r:l>o?o:l}function Ha(a,r){const o=D(r,{min:0,max:1e6,fallback:0}),s=D(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const c=new Set([1,o,s-2,s-1,s,s+1,s+2]),l=Array.from(c).filter(m=>Number.isInteger(m)&&m>=1&&m<=o).sort((m,h)=>m-h),b=[];let p=null;for(const m of l)p!=null&&m-p>1&&b.push(null),b.push(m),p=m;return b}function Wa({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,s=o?D(r,{min:0,max:1e6,fallback:0}):null,c=D(a,{min:1,max:o?Math.max(1,s||1):1e6,fallback:1}),l=c>1,b=o?c<s:!0;return{canPrev:l,canNext:b,safePage:c,safeTotal:s}}function Va({entries:a,me:r,meLabel:o}){const s=Array.isArray(a)?a:[],c=r&&typeof r.rank=="number"?r.rank:null;return!c||s.some(b=>!!b?.is_me)?s:[{rank:c,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,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},...s]}function Ja(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.ceil(o/s)}const Za=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function qa({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 ${Za.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const V=[{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}],Ue="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",Oe="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 oe(a){return d("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-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function ne(a){return d("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-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function j({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function Qa({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",s=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(oe(!1),"!group-hover:bg-transparent"),children:e.jsx(j,{className:"h-4 w-6"})}),e.jsx("td",{className:d(ne(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(j,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(j,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:"h-4 w-12"})}),V.map(c=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:d("h-4",s)})},c.key))]})}function Xa({rows:a=10}){return e.jsx("div",{className:"w-full overflow-x-auto",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:d(Ue,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(j,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(Oe,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(j,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-14"})}),V.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{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(Qa,{index:o},o))})]})})}function er({id:a,thClassName:r,children:o}){const{attributes:s,listeners:c,setNodeRef:l,transform:b,transition:p,isDragging:m}=Ma({id:a}),h=Ea.Transform.toString(b)||"";i.useLayoutEffect(()=>{const y=document.querySelectorAll(`td[data-column-key="${a}"]`),f="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return y.forEach(x=>{x.style.transform=h,x.style.transition=p||"",x.style.zIndex=m?"20":"",x.style.position=h?"relative":"",x.style.boxShadow=m?f:""}),()=>{y.forEach(x=>{x.style.transform="",x.style.transition="",x.style.zIndex="",x.style.position="",x.style.boxShadow=""})}},[a,h,p,m]);const L={transform:h,transition:p,position:h?"relative":void 0,zIndex:m?20:void 0,boxShadow:m?"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:l,style:L,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...s,...c,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-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",m&&"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 ar="tokentracker.leaderboard.columnOrder.v1";function rr(a){return Aa(ar,a)}const tr=50;function or(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.min(100,Math.max(1,Math.ceil(o/s*100)))}function $e(a){return typeof a=="string"?a.trim():""}function nr(a){const r=$e(a);return r?r.toLowerCase()==="anonymous":!0}function sr({me:a,totalEntries:r,meLabel:o,onOpenProfile:s,onJumpToMe:c,canJump:l,className:b}){const p=a&&typeof a.rank=="number"?a.rank:null;if(!p)return null;const m=Number(r)||0,h=or(p,m),L=$e(a?.display_name),y=!L||nr(L)?o||"You":L,f=a?.user_id||y,x=s||(l?c:null),E=typeof x=="function",A=E?"button":"div",J=E?{type:"button",onClick:x,"aria-label":n(s?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(A,{...J,className:d("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-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/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]",b),children:[e.jsx(te,{size:"sm",avatarUrl:a?.avatar_url,displayName:y,seed:f}),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-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:y}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",p.toLocaleString()]}),h!=null&&h<=tr&&e.jsx("span",{className:d("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",h<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:n("leaderboard.summary.percentile",{p:String(h)})}),E?e.jsx(Ga,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 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-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const ir=i.lazy(()=>Be(()=>import("./LeaderboardProfileModal-DSMTxieN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(a=>({default:a.LeaderboardProfileModal}))),lr=i.lazy(()=>Be(()=>import("./CommunityStatsModal--AuOLfq1.js"),__vite__mapDeps([11,1,2,12,9,10,13,14])).then(a=>({default:a.CommunityStatsModal}))),se=[10,20,50,100],ie=20,De="tokentracker:leaderboard:pageSize";function dr(){if(typeof window>"u")return ie;try{const a=window.localStorage.getItem(De),r=Number(a);if(se.includes(r))return r}catch{}return ie}function Me(a,r,o){const s=Number(a);if(!Number.isFinite(s)||s<=0)return"-";const c=Na(r),l=r===La?s:s*o;return l>=1e3?`${c}${Math.round(l).toLocaleString()}`:l>=10?`${c}${Math.round(l)}`:`${c}${l.toFixed(2)}`}function Ee({value:a}){return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:ja(a)}),e.jsx("span",{className:"hidden sm:inline",children:Ie(a)})]})}function cr({communityStats:a,onClick:r}){return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex h-9 items-center gap-2.5 rounded-full border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md px-3.5 select-none text-xs text-oai-gray-500 dark:text-oai-gray-400 hover:border-oai-brand-400 dark:hover:border-oai-brand-500/80 hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 transition-all duration-300 active:scale-[0.97] cursor-pointer",title:n("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-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-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:Math.round(a.tokenFloor).toLocaleString("en-US")}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("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.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:(Number(a.totalEntries)||0).toLocaleString("en-US")}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.community.devs_chip")})]})]})}function Ae(a,r,o){const s=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",c=r?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60";return o.map(l=>e.jsx("td",{"data-column-key":l.key,className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",s,c),children:Ie(a?.[l.key])},l.key))}const ur={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 Ke({rank:a,placeholder:r}){const o=ur[a];return o?e.jsx("span",{className:d("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 Te(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function mr(a){if(!a)return n("shared.error.prefix",{error:n("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||n("leaderboard.error.unknown");return n("shared.error.prefix",{error:o})}function Fe(a){return typeof a!="string"?"":a.trim()}function xr(a){const r=Fe(a);return r?r.toLowerCase()==="anonymous":!0}function Re(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function ze({githubUrl:a}){return e.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":n("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:e.jsx(wa,{provider:"GITHUB",size:16})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute right-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:n("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[n("leaderboard.github.tooltipPrefix")," ",e.jsx(va,{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:n("leaderboard.github.tooltipSettingsLink")}),n("leaderboard.github.tooltipSuffix")]})]})]})}function _r({auth:a,signedIn:r,sessionSoftExpired:o}){const s=da(),c=ca(),{openLoginModal:l}=ua(),{signedIn:b,loading:p,user:m}=ma(),{currency:h,rate:L}=$a(),y=i.useMemo(()=>xa(),[]),f=ga(),x=r&&!o,E=i.useMemo(()=>x&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,x]),A=x?E:null,J=x&&ba(A),le=n("shared.placeholder.short"),Ge=i.useMemo(()=>V.map(t=>t.key),[]),{order:Z,reorder:de}=rr(Ge),ce=i.useMemo(()=>{const t=new Map;for(const u of V)t.set(u.key,u);return t},[]),F=i.useMemo(()=>Z.map(t=>ce.get(t)).filter(Boolean),[Z,ce]),Ye=Ka(Pe(Oa,{activationConstraint:{distance:6}}),Pe(Ua,{coordinateGetter:Ba})),He=i.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||de(String(u.id),String(w.id))},[de]),[q,P]=i.useState(1),[N,We]=i.useState(dr),[ue,me]=i.useState(null),[Ve,xe]=i.useState(!1),Q=i.useCallback(t=>{typeof t=="string"&&t.trim()&&me(t.trim())},[]),Je=i.useCallback(()=>me(null),[]),Ze=i.useCallback(t=>{const u=se.includes(t)?t:ie;We(u),P(1);try{window.localStorage.setItem(De,String(u))}catch{}},[]),[ge,qe]=i.useState(0),[Qe,Xe]=i.useState(()=>pa()),[be,pe]=i.useState(!1),v=i.useMemo(()=>{const t=new URLSearchParams(s?.search||"");return Te(t.get("period"))||"total"},[s?.search]),ea=t=>{const u=Te(t);if(!u||u===v)return;const w=new URLSearchParams(s?.search||"");w.set("period",u),P(1),c(`${s?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};i.useEffect(()=>{p||f||b||l()},[b,p,f,l]),i.useEffect(()=>{P(1)},[v]);const G=i.useMemo(()=>(D(q,{min:1,max:1e6,fallback:1})-1)*N,[q,N]),K=i.useMemo(()=>f?"mock":p?"unavailable":b?"cloud":r?"local":y?"public":"unavailable",[p,b,y,f,r]),g=i.useMemo(()=>ha({accessMode:K,baseUrl:y,mockEnabled:f,userId:m?.id||null,period:v,pageSize:N,offset:G}),[m?.id,K,y,G,f,N,v]),[I,B]=i.useState(()=>{const t=re(g);return t?{loading:!1,error:null,data:t.data,contextKey:g}:{loading:!1,error:null,data:null,contextKey:null}});i.useEffect(()=>{if(!y&&!f||!f&&K==="unavailable"){B({loading:!1,error:null,data:null,contextKey:null});return}const t=re(g);let u=!0;return B(t?{loading:!1,error:null,data:t.data,contextKey:g}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await ya({userId:m?.id||null,period:v,limit:N,offset:G});u&&(fa(w,{activeContextKey:g,contextKey:g,source:ge>0?"manual-refresh":"page-load"}),B({loading:!1,error:null,data:w,contextKey:g}))})().catch(w=>{if(!u)return;const z=mr(w);B(O=>O.contextKey===g?{...O,loading:!1,error:z}:{loading:!1,error:z,data:null,contextKey:g})}),()=>{u=!1}},[y,K,m?.id,g,G,ge,f,v,N]);const X=i.useMemo(()=>I.contextKey===g?null:re(g),[g,I.contextKey]),k=i.useMemo(()=>I.contextKey===g?I:X?{loading:!1,error:null,data:X.data,contextKey:g}:{loading:!!(y||f)&&K!=="unavailable",error:null,data:null,contextKey:g},[K,y,g,I,f,X]),_=k.data,Y=_?.total_pages??null,aa=_?.total_entries??0,T=_?.page??q,ra=i.useMemo(()=>Ha(T,Y),[T,Y]),he=_?.from||null,ye=_?.to||null,fe=_?.generated_at||null,ke=Da(),M=_?.me||null,H=n("leaderboard.me_label"),ta=n("leaderboard.anon_label"),we=n("leaderboard.period.week"),ve=n("leaderboard.period.month"),je=n("leaderboard.period.total"),Ne=v==="month"?ve:v==="total"?je:we,ee=i.useMemo(()=>{const t=Array.isArray(_?.entries)?_.entries:[];return Va({entries:t,me:M,meLabel:H})},[_?.entries,M,H]),R=i.useMemo(()=>Ja(M?.rank,N),[M?.rank,N]),oa=R!=null&&R===T,na=i.useCallback(()=>{R!=null&&P(R)},[R]),sa=async()=>{pe(!0);try{_a(!0),Xe(!0),await Sa(()=>Le(A));const t=await Le(A);t&&await Ca({accessToken:t,period:v,source:"leaderboard-enable-sync"}),qe(u=>u+1)}catch(t){console.warn("[tokentracker] sync:",t)}finally{pe(!1)}},{canPrev:_e,canNext:Se}=Wa({page:T,totalPages:Y}),W=Array.isArray(ee)&&ee.length!==0;let U=null;k.loading&&!W?U=e.jsx(Xa,{rows:N}):k.error&&!W?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:k.error})}):W?U=e.jsx(Ta,{sensors:Ye,collisionDetection:Ra,modifiers:[Ya],onDragEnd:He,children:e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-full sm: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:d(Ue,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:n("leaderboard.column.rank")}),e.jsx("th",{className:d(Oe,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:n("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:n("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:n("leaderboard.column.est_cost")}),e.jsx(za,{items:Z,strategy:Ia,children:F.map(t=>e.jsx(er,{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(qa,{iconSrc:t.icon,label:n(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:ee.map((t,u)=>{if(t?.is_ellipsis){const C=4+F.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:C,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-${u}`)}const w=!!t?.is_me,z=typeof t?.user_id=="string"?t.user_id:null,O=Fe(t?.display_name),ia=xr(O)?ta:O,S=w?H:ia,$=!!z,Ce=$?{role:"button",tabIndex:0,onClick:$?()=>Q(z):void 0,onKeyDown:$?C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),Q(z))}:void 0,"aria-label":n("leaderboard.profile_modal.row_aria",{name:S})}:{};if(w){const C=!!t?.is_pinned;return e.jsxs("tr",{...Ce,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",C?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",$&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(oe(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",C&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx(Ke,{rank:t?.rank,placeholder:le})}),e.jsx("td",{className:ne(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(te,{avatarUrl:t?.avatar_url,displayName:S,seed:Re(t,S)}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:S}),t?.github_url&&e.jsx(ze,{githubUrl:t.github_url})]})}),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-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(Ee,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:Me(t?.estimated_cost_usd,h,L)}),Ae(t,!0,F)]},`row-${t?.rank}-${S}${C?"-pin":""}`)}return e.jsxs("tr",{...Ce,className:d("group transition-colors",$&&"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-brand-500/60"),children:[e.jsx("td",{className:d(oe(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(Ke,{rank:t?.rank,placeholder:le})}),e.jsx("td",{className:ne(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(te,{avatarUrl:t?.avatar_url,displayName:S,seed:Re(t,S)}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:S}),t?.github_url&&e.jsx(ze,{githubUrl:t.github_url})]})}),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(Ee,{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:Me(t?.estimated_cost_usd,h,L)}),Ae(t,!1,F)]},`row-${t?.rank}-${S}`)})})]})})}):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:n("leaderboard.empty")})});let ae=null;return typeof Y=="number"?ae=ra.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.pagination.ellipsis")},`ellipsis-${u}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===T?"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:()=>P(t),disabled:k.loading,children:String(t)},`page-${t}`)):ae=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.pagination.page_unknown",{page:String(T)})}),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-5 sm:mb-6",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-2 sm:mb-3",children:n("leaderboard.title")}),e.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[v==="total"?n("leaderboard.range.total"):he&&ye?n("leaderboard.range",{period:Ne,from:he,to:ye}):n("leaderboard.range_loading",{period:Ne}),fe&&e.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 hidden sm:inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:n("leaderboard.generated_at",{ts:fe})})]})]}),e.jsxs("div",{className:"mb-6 sm:mb-8 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsx("div",{className:"inline-flex h-9 p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-full items-center relative self-start",children:["week","month","total"].map(t=>{const u=v===t;return e.jsxs("button",{onClick:()=>ea(t),disabled:k.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",u?"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"?we:t==="month"?ve:je}),u&&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:"flex flex-row items-center gap-2.5 self-end sm:self-auto shrink-0 flex-wrap",children:[e.jsx(cr,{communityStats:ke,onClick:()=>xe(!0)}),e.jsx(sr,{me:M,totalEntries:aa,meLabel:H,onOpenProfile:M?.user_id?()=>Q(M.user_id):void 0,onJumpToMe:na,canJump:R!=null&&!oa&&!k.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:n("leaderboard.signin_prompt")}),e.jsx("button",{onClick:l,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:n("leaderboard.signin_button")})]}),x&&J&&!Qe&&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:n("leaderboard.sync_prompt")}),e.jsx("button",{onClick:sa,disabled:be,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:be?n("leaderboard.sync_button.busy"):n("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[k.error&&W?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:k.error})}):null,U,e.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-end gap-x-4 gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:n("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:N,onValueChange:t=>Ze(Number(t)),disabled:k.loading,ariaLabel:n("leaderboard.pagination.page_size_label"),options:se.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:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),e.jsx("button",{className:d("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",_e&&!k.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:()=>P(t=>Math.max(1,t-1)),disabled:!_e||k.loading,children:n("leaderboard.pagination.prev")}),e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:ae}),e.jsx("button",{className:d("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Se&&!k.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:()=>P(t=>t+1),disabled:!Se||k.loading,children:n("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:n("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/mm7894215/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:n("landing.v2.nav.github")})]})}),e.jsxs(i.Suspense,{fallback:null,children:[e.jsx(ir,{isOpen:!!ue,userId:ue,period:v,accessToken:A,onClose:Je}),e.jsx(lr,{isOpen:Ve,onClose:()=>xe(!1),communityStats:ke})]})]})}export{_r as LeaderboardPage};
@@ -1,4 +1,4 @@
1
- import{c as D,a2 as X,r as g,d9 as te,j as e,N as i,da as se,aE as oe,db as ie,a0 as d,dc as ne,aI as le,L as de,s as ce,$ as U,X as xe,Q as q,P as me,an as ge}from"./main-nNmpL8Cj.js";import{u as pe}from"./useCurrency-CmVvLPhb.js";import{L as G}from"./LeaderboardAvatar-aso6D7AA.js";import{A as he}from"./ActivityHeatmap-Cc7rHzpc.js";import{A as T}from"./arrow-up-right-5jhx4tzl.js";import{C as fe}from"./check-DhneqxBx.js";import{D as ue,a as be,b as ye,c as ke,d as je,e as ve}from"./DialogTitle-D0xEUAQD.js";import"./info-4Bz63oh6.js";import"./useScrollLock-C-uJaCDp.js";const Ne=[["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"}]],_e=D("code-xml",Ne);const we=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Ae=D("heart",we);const Me=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Se=D("link-2",Me),F="tokentracker_anon_id";let v=null;function H(){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 R(){if(v)return v;try{let a=localStorage.getItem(F);return a||(a=H(),localStorage.setItem(F,a)),v=a,a}catch{return v=H(),v}}function Y({userId:a}){const{signedIn:r,getAccessToken:s}=X(),[t,o]=g.useState(!1),[c,x]=g.useState(0),[l,h]=g.useState(!1),[b,N]=g.useState(!1),[_,P]=g.useState(!1),[w,y]=g.useState([]),[A,k]=g.useState(!1),M=g.useRef(0),u=g.useCallback(async()=>{if(r)try{const n=await s();if(n)return{accessToken:n,anonId:R()}}catch{}return{anonId:R()}},[r,s]);g.useEffect(()=>{let n=!1;return a?(h(!1),(async()=>{const m=await u();try{const p=await te({userId:a,...m});if(n)return;x(Number(p?.count)||0),o(!!p?.liked),h(!0)}catch{if(n)return;x(0),o(!1),h(!0)}})(),()=>{n=!0}):(h(!1),()=>{n=!0})},[a,u]);const j=()=>{P(!0),setTimeout(()=>P(!1),450),k(!0),setTimeout(()=>k(!1),500);const n=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let f=0;f<12;f++){const z=(f*30+Math.random()*20-10)*(Math.PI/180),C=45+Math.random()*45,K=Math.cos(z)*C,Q=Math.sin(z)*C-(10+Math.random()*15),V=Math.random()*360-180,J=6+Math.random()*8,ee=n[Math.floor(Math.random()*n.length)],ae=m[Math.floor(Math.random()*m.length)],re=++M.current;p.push({id:re,tx:K,ty:Q,rot:V,size:J,color:ee,shape:ae})}y(f=>[...f,...p]),setTimeout(()=>{y(f=>f.filter(z=>!p.find(C=>C.id===z.id)))},850)},S=async n=>{N(!0);try{const m=await u(),p=await se({userId:a,action:n,...m});p&&Number.isFinite(Number(p.count))&&x(Number(p.count)),p&&typeof p.liked=="boolean"&&o(p.liked)}catch{o(m=>!m),x(m=>n==="like"?Math.max(0,m-1):m+1)}finally{N(!1)}},Z=n=>{n.stopPropagation(),!(!a||!l||b)&&(t?(o(!1),x(m=>Math.max(0,m-1)),S("unlike")):(o(!0),x(m=>m+1),j(),S("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
1
+ import{c as D,a2 as X,r as g,d9 as te,j as e,N as i,da as se,aE as oe,db as ie,a0 as d,dc as ne,aI as le,L as de,s as ce,$ as U,X as xe,Q as q,P as me,an as ge}from"./main-BQdH4mOs.js";import{u as pe}from"./useCurrency-B6KHWgVk.js";import{L as G}from"./LeaderboardAvatar-D_fl_xuD.js";import{A as he}from"./ActivityHeatmap-CPGN-WN1.js";import{A as T}from"./arrow-up-right-DsLWfytD.js";import{C as fe}from"./check-CPB_1BeX.js";import{D as ue,a as be,b as ye,c as ke,d as je,e as ve}from"./DialogTitle-CuhKU10w.js";import"./info-Xcqww53Y.js";import"./useScrollLock-BEZTkDaR.js";const Ne=[["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"}]],_e=D("code-xml",Ne);const we=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Ae=D("heart",we);const Me=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Se=D("link-2",Me),F="tokentracker_anon_id";let v=null;function H(){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 R(){if(v)return v;try{let a=localStorage.getItem(F);return a||(a=H(),localStorage.setItem(F,a)),v=a,a}catch{return v=H(),v}}function Y({userId:a}){const{signedIn:r,getAccessToken:s}=X(),[t,o]=g.useState(!1),[c,x]=g.useState(0),[l,h]=g.useState(!1),[b,N]=g.useState(!1),[_,P]=g.useState(!1),[w,y]=g.useState([]),[A,k]=g.useState(!1),M=g.useRef(0),u=g.useCallback(async()=>{if(r)try{const n=await s();if(n)return{accessToken:n,anonId:R()}}catch{}return{anonId:R()}},[r,s]);g.useEffect(()=>{let n=!1;return a?(h(!1),(async()=>{const m=await u();try{const p=await te({userId:a,...m});if(n)return;x(Number(p?.count)||0),o(!!p?.liked),h(!0)}catch{if(n)return;x(0),o(!1),h(!0)}})(),()=>{n=!0}):(h(!1),()=>{n=!0})},[a,u]);const j=()=>{P(!0),setTimeout(()=>P(!1),450),k(!0),setTimeout(()=>k(!1),500);const n=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let f=0;f<12;f++){const z=(f*30+Math.random()*20-10)*(Math.PI/180),C=45+Math.random()*45,K=Math.cos(z)*C,Q=Math.sin(z)*C-(10+Math.random()*15),V=Math.random()*360-180,J=6+Math.random()*8,ee=n[Math.floor(Math.random()*n.length)],ae=m[Math.floor(Math.random()*m.length)],re=++M.current;p.push({id:re,tx:K,ty:Q,rot:V,size:J,color:ee,shape:ae})}y(f=>[...f,...p]),setTimeout(()=>{y(f=>f.filter(z=>!p.find(C=>C.id===z.id)))},850)},S=async n=>{N(!0);try{const m=await u(),p=await se({userId:a,action:n,...m});p&&Number.isFinite(Number(p.count))&&x(Number(p.count)),p&&typeof p.liked=="boolean"&&o(p.liked)}catch{o(m=>!m),x(m=>n==="like"?Math.max(0,m-1):m+1)}finally{N(!1)}},Z=n=>{n.stopPropagation(),!(!a||!l||b)&&(t?(o(!1),x(m=>Math.max(0,m-1)),S("unlike")):(o(!0),x(m=>m+1),j(),S("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
2
2
  @keyframes tt-like-pop {
3
3
  0% { transform: scale(1); }
4
4
  25% { transform: scale(0.75); }
@@ -1,4 +1,4 @@
1
- import{r as _,j as p,_ as xe,a1 as ge,a2 as ve,aI as be,L as Tt,aJ as we,N as Y,at as ye}from"./main-nNmpL8Cj.js";import{u as ke}from"./useCurrency-CmVvLPhb.js";import{H as Me}from"./HeaderGithubStar-BNs6lPrd.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-D5qe822P.js";import{D as Te}from"./download-hUD-lQh8.js";import"./LeaderboardAvatar-aso6D7AA.js";import"./ActivityHeatmap-Cc7rHzpc.js";import"./info-4Bz63oh6.js";import"./arrow-up-right-5jhx4tzl.js";import"./check-DhneqxBx.js";import"./DialogTitle-D0xEUAQD.js";import"./useScrollLock-C-uJaCDp.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 Ie(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 Fe=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
1
+ import{r as _,j as p,_ as xe,a1 as ge,a2 as ve,aI as be,L as Tt,aJ as we,N as Y,at as ye}from"./main-BQdH4mOs.js";import{u as ke}from"./useCurrency-B6KHWgVk.js";import{H as Me}from"./HeaderGithubStar-DD58NKiQ.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-DSMTxieN.js";import{D as Te}from"./download-tXehSjsQ.js";import"./LeaderboardAvatar-D_fl_xuD.js";import"./ActivityHeatmap-CPGN-WN1.js";import"./info-Xcqww53Y.js";import"./arrow-up-right-DsLWfytD.js";import"./check-CPB_1BeX.js";import"./DialogTitle-CuhKU10w.js";import"./useScrollLock-BEZTkDaR.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 Ie(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 Fe=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
2
2
  attribute vec2 a_position;
3
3
  void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
4
4
  `,Ge=`
@@ -1,4 +1,4 @@
1
- import{j as i,a0 as R,N as n,U as C,r as b,$ as Y,aL as q,l as J,L as Q,aM as Z}from"./main-nNmpL8Cj.js";import{u as ee}from"./use-usage-limits-6uexiute.js";import{L as p,a as te,l as v,b as ie,u as re}from"./use-limits-display-prefs-BAQYB-31.js";import{C as D}from"./Card-i15i_EDL.js";import{F as ae}from"./FadeIn-GWxxEiEG.js";import{L as ne}from"./LocalOnlyNotice-B7Ws4lUu.js";import"./arrow-up-right-5jhx4tzl.js";import"./download-hUD-lQh8.js";const oe=[3,2,3,3,2,2,3];function g({className:e}){return i.jsx("div",{className:R("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function le(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(g,{className:"h-3 w-12 shrink-0"}),i.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(g,{className:"h-3 w-[30px] shrink-0"}),i.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function se({bars:e,index:t}){const r=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(g,{className:R("h-4",r)})]}),Array.from({length:e},(o,a)=>i.jsx(le,{},a))]})}function de(){return i.jsx(D,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(g,{className:"h-3.5 w-28"}),oe.map((e,t)=>i.jsx(se,{bars:e,index:t},t))]})})}function ce(e,t){if(!(e>0))return null;const r=(e-t)/e;return Number.isFinite(r)?Math.min(Math.max(r,0),1):null}function ue(e,t,r=.03){return e>t+r}function me(e){const t=Math.max(0,Math.floor(e)),r=Math.floor(t/3600);return r>24?`${Math.floor(r/24)}d`:r>0?`${r}h`:`${Math.floor(t/60)}m`}function xe(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const r=t[e.windowSecondsField];return typeof r=="number"&&r>0?r:null}return null}function _(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function pe({usedPercent:e,windowSeconds:t,resetMs:r,mode:o,now:a=Date.now()}){const s=Math.min(Math.max(Number(e)||0,0),100)/100,d={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(r))return d;const c=Math.max(0,(r-a)/1e3),l=ce(t,c);if(l==null)return d;if(d.expectedPercent=Math.round(l*100),d.paceOver=ue(s,l),s>=.05){const u=o==="remaining"?1-l:l;d.pacePercent=u*100}if(l>.02&&s>0){const u=t*l,m=s/u,x=s/l;x>=1&&m>0?d.runsOutEta=me((1-s)/m):d.projectedEnd=Math.round(Math.min(x,1)*100)}return d}const E=100;function O(e){const t=Date.parse(e);return Number.isFinite(t)?t:null}function ye(e){return Math.max(0,Math.min(E,Math.round(e)))}function ge(e){return new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function he(e,t,r){if(e==null||e>=t)return E;const o=t-e,a=t-r;return ye(a/o*E)}function be(e){const t=e.available_count;return t===null?null:Number.isInteger(t)&&t>=0?t:void 0}function we(e,{now:t}={}){if(!e||typeof e!="object")return null;const r=be(e);if(r===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],a=t instanceof Date?t.getTime():Number(t??Date.now()),s=[];for(const d of o){const c=O(d?.expires_at);if(c==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:n("limits.codex_reset_bank.row_label",{index:l}),expiresAt:ge(c),expiresMs:c,percent:he(O(d?.granted_at),c,a)})}return r===0?null:s.length>0?{kind:"rows",availableCount:r??s.length,rows:s}:r>0?{kind:"count_only",availableCount:r,rows:[]}:null}const T={claude:{windows(e){const t=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(r=>({key:`scoped-${r.label}`,label:r.label,window:r,pctField:"utilization",resetField:"resets_at",windowSeconds:604800})):[];return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},...t]}},codex:{extra:"codex_meta",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"credits",labelKey:"limits.label.codex_credits",window:e.credit_window},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude-weekly",labelKey:"limits.label.antigravity_claude_weekly",window:e.primary_window},{key:"claude-5h",labelKey:"limits.label.antigravity_claude_5h",window:e.secondary_window},{key:"gemini-weekly",labelKey:"limits.label.antigravity_gemini_weekly",window:e.tertiary_window},{key:"gemini-5h",labelKey:"limits.label.antigravity_gemini_5h",window:e.quaternary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return e.plan_kind==="coding-plan"?[{key:"5h",labelKey:"limits.label.zcode_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.zcode_weekly",window:e.secondary_window},{key:"tools",labelKey:"limits.label.zcode_tools",window:e.tertiary_window}]:[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}}},fe="shrink-0 text-oai-black dark:text-oai-white";function _e(e){const t=_(e);if(!Number.isFinite(t))return null;const r=t-Date.now();if(r<=0)return n("shared.time.now");const o=Math.floor(r/6e4);if(o<60)return`${o}m`;const a=Math.floor(o/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function ke(e,t){const r=t===p.REMAINING?100-e:e;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function f(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function k(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function j(e){const t=Math.max(0,Math.min(100,Number(e)||0)),r=Math.round(t);return t>0&&r===0?n("limits.bar.sub_one_percent"):String(r)}function N(e){const t=Number(e);return Number.isFinite(t)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:t>=100?0:2}).format(t):null}function ve(e){if(!e||typeof e!="object")return null;const t=N(e.used_credits),r=N(e.limit_credits),o=N(e.remaining_credits);return!t||!r||!o?null:n("limits.codex_credits.detail",{used:t,limit:r,remaining:o})}function je(e,t){return pe({usedPercent:f(e.window,e.pctField),windowSeconds:xe(e,e.window),resetMs:_(k(e.window,e.resetField)),mode:t})}function A(e){return Number.isFinite(e)?new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function Ne(e,t,r){const o=[$(e,t,r)],a=_(k(e.window,e.resetField)),s=A(a);if(s&&o.push(n("limits.hover.resets_at",{time:s})),e.key==="credits"){const d=ve(e.window);d&&o.push(d)}return o.join(`
1
+ import{j as i,a0 as R,N as n,U as C,r as b,$ as Y,aL as q,l as J,L as Q,aM as Z}from"./main-BQdH4mOs.js";import{u as ee}from"./use-usage-limits-YUhemFAp.js";import{L as p,a as te,l as v,b as ie,u as re}from"./use-limits-display-prefs-gmXXzoWe.js";import{C as D}from"./Card-Bw438EXT.js";import{F as ae}from"./FadeIn-BoYq0Lpr.js";import{L as ne}from"./LocalOnlyNotice-Ds7yPxS1.js";import"./arrow-up-right-DsLWfytD.js";import"./download-tXehSjsQ.js";const oe=[3,2,3,3,2,2,3];function g({className:e}){return i.jsx("div",{className:R("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function le(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(g,{className:"h-3 w-12 shrink-0"}),i.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(g,{className:"h-3 w-[30px] shrink-0"}),i.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function se({bars:e,index:t}){const r=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(g,{className:R("h-4",r)})]}),Array.from({length:e},(o,a)=>i.jsx(le,{},a))]})}function de(){return i.jsx(D,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(g,{className:"h-3.5 w-28"}),oe.map((e,t)=>i.jsx(se,{bars:e,index:t},t))]})})}function ce(e,t){if(!(e>0))return null;const r=(e-t)/e;return Number.isFinite(r)?Math.min(Math.max(r,0),1):null}function ue(e,t,r=.03){return e>t+r}function me(e){const t=Math.max(0,Math.floor(e)),r=Math.floor(t/3600);return r>24?`${Math.floor(r/24)}d`:r>0?`${r}h`:`${Math.floor(t/60)}m`}function xe(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const r=t[e.windowSecondsField];return typeof r=="number"&&r>0?r:null}return null}function _(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function pe({usedPercent:e,windowSeconds:t,resetMs:r,mode:o,now:a=Date.now()}){const s=Math.min(Math.max(Number(e)||0,0),100)/100,d={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(r))return d;const c=Math.max(0,(r-a)/1e3),l=ce(t,c);if(l==null)return d;if(d.expectedPercent=Math.round(l*100),d.paceOver=ue(s,l),s>=.05){const u=o==="remaining"?1-l:l;d.pacePercent=u*100}if(l>.02&&s>0){const u=t*l,m=s/u,x=s/l;x>=1&&m>0?d.runsOutEta=me((1-s)/m):d.projectedEnd=Math.round(Math.min(x,1)*100)}return d}const E=100;function O(e){const t=Date.parse(e);return Number.isFinite(t)?t:null}function ye(e){return Math.max(0,Math.min(E,Math.round(e)))}function ge(e){return new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function he(e,t,r){if(e==null||e>=t)return E;const o=t-e,a=t-r;return ye(a/o*E)}function be(e){const t=e.available_count;return t===null?null:Number.isInteger(t)&&t>=0?t:void 0}function we(e,{now:t}={}){if(!e||typeof e!="object")return null;const r=be(e);if(r===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],a=t instanceof Date?t.getTime():Number(t??Date.now()),s=[];for(const d of o){const c=O(d?.expires_at);if(c==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:n("limits.codex_reset_bank.row_label",{index:l}),expiresAt:ge(c),expiresMs:c,percent:he(O(d?.granted_at),c,a)})}return r===0?null:s.length>0?{kind:"rows",availableCount:r??s.length,rows:s}:r>0?{kind:"count_only",availableCount:r,rows:[]}:null}const T={claude:{windows(e){const t=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(r=>({key:`scoped-${r.label}`,label:r.label,window:r,pctField:"utilization",resetField:"resets_at",windowSeconds:604800})):[];return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},...t]}},codex:{extra:"codex_meta",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"credits",labelKey:"limits.label.codex_credits",window:e.credit_window},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude-weekly",labelKey:"limits.label.antigravity_claude_weekly",window:e.primary_window},{key:"claude-5h",labelKey:"limits.label.antigravity_claude_5h",window:e.secondary_window},{key:"gemini-weekly",labelKey:"limits.label.antigravity_gemini_weekly",window:e.tertiary_window},{key:"gemini-5h",labelKey:"limits.label.antigravity_gemini_5h",window:e.quaternary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return e.plan_kind==="coding-plan"?[{key:"5h",labelKey:"limits.label.zcode_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.zcode_weekly",window:e.secondary_window},{key:"tools",labelKey:"limits.label.zcode_tools",window:e.tertiary_window}]:[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}}},fe="shrink-0 text-oai-black dark:text-oai-white";function _e(e){const t=_(e);if(!Number.isFinite(t))return null;const r=t-Date.now();if(r<=0)return n("shared.time.now");const o=Math.floor(r/6e4);if(o<60)return`${o}m`;const a=Math.floor(o/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function ke(e,t){const r=t===p.REMAINING?100-e:e;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function f(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function k(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function j(e){const t=Math.max(0,Math.min(100,Number(e)||0)),r=Math.round(t);return t>0&&r===0?n("limits.bar.sub_one_percent"):String(r)}function N(e){const t=Number(e);return Number.isFinite(t)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:t>=100?0:2}).format(t):null}function ve(e){if(!e||typeof e!="object")return null;const t=N(e.used_credits),r=N(e.limit_credits),o=N(e.remaining_credits);return!t||!r||!o?null:n("limits.codex_credits.detail",{used:t,limit:r,remaining:o})}function je(e,t){return pe({usedPercent:f(e.window,e.pctField),windowSeconds:xe(e,e.window),resetMs:_(k(e.window,e.resetField)),mode:t})}function A(e){return Number.isFinite(e)?new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function Ne(e,t,r){const o=[$(e,t,r)],a=_(k(e.window,e.resetField)),s=A(a);if(s&&o.push(n("limits.hover.resets_at",{time:s})),e.key==="credits"){const d=ve(e.window);d&&o.push(d)}return o.join(`
2
2
  `)}function G({text:e}){return e?i.jsx("div",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 w-max max-w-[260px] -translate-x-1/2 whitespace-pre-line rounded-xl border border-oai-gray-200/50 dark:border-oai-gray-800/50 bg-white/90 dark:bg-oai-gray-900/90 backdrop-blur-md px-2.5 py-1.5 text-[10.5px] leading-snug text-oai-gray-700 dark:text-oai-gray-200 shadow-xl opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:e}):null}function Me({label:e,pct:t,reset:r,mode:o=p.USED,pacePercent:a=null,paceOver:s=!1,title:d=null}){const c=Math.max(0,Math.min(100,Number(t)||0)),l=o===p.REMAINING?100-c:c,u=Math.round(l),m=l>0&&u===0?Math.max(l,.35):l;let x=String(u);l>0&&u===0&&(x=n("limits.bar.sub_one_percent"));const h=a==null?null:Math.max(0,Math.min(100,a));return i.jsxs("div",{className:"group relative flex items-center gap-2",children:[i.jsx(G,{text:d}),i.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),i.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[i.jsx("div",{className:`${ke(l,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${m}%`,minWidth:l>0?"3px":0}}),h!=null&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${h}% - 3px)`,width:"6px"}}),i.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${h}% - 1px)`,width:"2px"}})]})]}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[x,"%"]}),r&&i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r})]})}function $(e,t,r){const o=e.label??n(e.labelKey),a=r===p.REMAINING,s=l=>a?100-l:l;if(t.expectedPercent==null){const l=Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0)),u=j(s(l));return a?n("limits.explain.remaining",{label:o,used:u}):n("limits.explain.used",{label:o,used:u})}if(t.paceOver){if(t.runsOutEta)return n("limits.explain.ahead_eta",{label:o,eta:t.runsOutEta});const l=j(s(t.projectedEnd??100));return n(a?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const d=Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0)),c=j(s(t.projectedEnd??d));return n(a?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:c})}function Ee({rows:e,mode:t}){if(e.length===0)return null;const r=t===p.REMAINING;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:o,pace:a})=>{const s=A(_(k(o.window,o.resetField)));return i.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[$(o,a,t),s?i.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",n("limits.hover.resets_at",{time:s})]}):null]},o.key)}),i.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:n(r?"limits.explain.body_remaining":"limits.explain.body")})]})}function Se(e){if(!e)return null;const t=Date.now()-new Date(e).getTime();if(t<0)return null;const r=Math.floor(t/6e4);if(r<1)return n("shared.time.now");if(r<60)return n("shared.time.m_ago",{n:r});const o=Math.floor(r/60);if(o<24)return n("shared.time.h_ago",{n:o});const a=Math.floor(o/24);return n("shared.time.d_ago",{n:a})}function S({name:e,providerId:t,children:r,expandable:o=!1,expanded:a=!1,onToggle:s,badge:d=null}){const c=ie(t),l=i.jsxs("div",{className:"flex items-center gap-1.5",children:[c?i.jsx(Y,{provider:c,size:14,className:fe}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e}),d]});return o?i.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":a,onClick:s,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[l,r]}):i.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,r]})}const Pe=te;function w({children:e,tone:t="neutral"}){const r=t==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:e})}function Ie({rows:e,mode:t,extra:r=null}){const o=e.length===0&&!r;return i.jsxs(i.Fragment,{children:[e.map(({spec:a,pace:s})=>i.jsx(Me,{label:a.label??n(a.labelKey),pct:f(a.window,a.pctField),reset:_e(k(a.window,a.resetField)),mode:t,pacePercent:s.pacePercent,paceOver:s.paceOver,title:Ne(a,s,t)},a.key)),o?i.jsx(w,{children:n("limits.status.no_data")}):null,r]})}function Fe(e){if(!Number.isFinite(e.expiresMs))return null;const t=Math.floor((e.expiresMs-Date.now())/864e5);return t<0?null:t===0?n("limits.reset_bank.hover_detail_today",{date:e.expiresAt}):n("limits.reset_bank.hover_detail",{date:e.expiresAt,days:t})}function Le({row:e}){const t=Math.max(0,Math.min(100,Number(e.percent)||0));return i.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[i.jsx(G,{text:Fe(e)}),i.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e.label}),i.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${t}%`,minWidth:t>0?"3px":0}})}),i.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:e.expiresAt})]})}function Oe({model:e}){const t=e.kind==="count_only"?n("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[i.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.codex_reset_bank.title")}),t?i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:t}):e.rows.map(r=>i.jsx(Le,{row:r},r.key))]})}function Ke(e,t){if(e==="codex_meta"){const r=we(t.reset_credits);return r?i.jsx(Oe,{model:r}):null}return e==="kimi_parallel"&&t.parallel_limit?i.jsx(w,{children:n("limits.label.kimi_parallel",{count:t.parallel_limit})}):e==="copilot_otel"&&!t.otel_has_files&&!t.otel_enabled?i.jsx(De,{defaultDir:t.otel_default_dir}):null}function Re(e,t,r,o,a,s,d=null){const c=T[e];if(!c)return null;const l=c.windows(t).filter(m=>m.window).map(m=>({spec:m,pace:je(m,o)})),u=Ke(c.extra,t);return i.jsxs(S,{name:r,providerId:e,expandable:l.length>0,expanded:a,onToggle:s,badge:d,children:[i.jsx(Ie,{mode:o,rows:l,extra:u}),a?i.jsx(Ee,{rows:l,mode:o}):null]},e)}function Ce(e,t,r,o,a){if(!T[e])return null;if(!t?.configured)return i.jsxs(S,{name:v(e),providerId:e,children:[i.jsx(w,{children:n("limits.status.not_connected")}),e==="opencodeGo"?i.jsx(K,{}):null]},e);if(t.error)return i.jsxs(S,{name:v(e),providerId:e,children:[i.jsx(w,{tone:"error",children:n("shared.error.prefix",{error:t.error})}),e==="opencodeGo"?i.jsx(K,{}):null]},e);const s=v(e),d=t.plan_label?`${s} ${t.plan_label}`:s;let c=null;if(e==="antigravity")if(t.cached){const l=Se(t.cached_at);c=i.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:u=>u.stopPropagation(),children:[i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider bg-oai-gray-100 dark:bg-oai-gray-800 border border-oai-gray-200/50 dark:border-oai-gray-700/50 text-oai-gray-500 dark:text-oai-gray-400 leading-normal",children:[i.jsx("span",{className:"h-1 w-1 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"}),n("limits.label.antigravity_cached"),l?i.jsxs(i.Fragment,{children:[" · ",l]}):null]}),i.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[n("limits.tooltip.antigravity_cached"),i.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]})]})}else c=i.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:l=>l.stopPropagation(),children:[i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider bg-emerald-500/10 dark:bg-emerald-500/15 border border-emerald-500/20 text-emerald-600 dark:text-emerald-400 leading-normal",children:[i.jsxs("span",{className:"relative flex h-1 w-1",children:[i.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),i.jsx("span",{className:"relative inline-flex rounded-full h-1 w-1 bg-emerald-500"})]}),n("limits.label.antigravity_live")]}),i.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[n("limits.tooltip.antigravity_live"),i.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]})]});return Re(e,t,d,r,o,a,c)}function De({defaultDir:e}){const[t,r]=b.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
3
3
  `),s=async d=>{d.stopPropagation();try{await navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:n("limits.copilot.otelHint.body")}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:a}),i.jsx("button",{type:"button",onClick:s,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:t?n("limits.copilot.otelHint.copied"):n("limits.copilot.otelHint.copy")})]})}function M({n:e,children:t}){return i.jsxs("li",{className:"flex gap-2.5",children:[i.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:e}),i.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:t})]})}function Te(){return i.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function K(){const[e,t]=b.useState(!1),r=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
4
4
  `),o=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(r),t(!0),setTimeout(()=>t(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:n("limits.opencodeGo.setupHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:n("limits.opencodeGo.setupHint.subtitle")}),i.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[i.jsxs(M,{n:"1",children:[i.jsx("div",{children:n("limits.opencodeGo.setupHint.step1")}),i.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:a=>a.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[n("limits.opencodeGo.setupHint.cta"),i.jsx(Te,{})]})]}),i.jsxs(M,{n:"2",children:[i.jsx("div",{children:n("limits.opencodeGo.setupHint.step2")}),i.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[i.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_workspace")}),i.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_cookie")})]})]}),i.jsxs(M,{n:"3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:n("limits.opencodeGo.setupHint.step3")}),i.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?n("limits.opencodeGo.setupHint.copied"):n("limits.opencodeGo.setupHint.copy")})]}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:r}),i.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Ae(e){const[t,r]=b.useState(0);return b.useLayoutEffect(()=>{const o=e.current;if(!o)return;const a=o.querySelectorAll("[data-limit-label]");let s=0,d=null;if(a.length>0)try{d=document.createElement("canvas").getContext("2d")}catch{d=null}if(d){const l=window.getComputedStyle(a[0]);d.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of a)s=Math.max(s,d.measureText(u.textContent).width)}const c=Math.ceil(s);r(l=>l===c?l:c)}),t}function Ge({claude:e,codex:t,cursor:r,gemini:o,kimi:a,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m,order:x,visibility:h,displayMode:H}){const z={claude:e,codex:t,cursor:r,gemini:o,kimi:a,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m},P=b.useRef(null),I=Ae(P),[W,B]=b.useState(null),U=Array.isArray(x)&&x.length>0?x:Pe,F=H===p.REMAINING?p.REMAINING:p.USED,V=F===p.REMAINING?n("limits.settings.display_mode_remaining"):n("limits.settings.display_mode_used"),L=U.filter(y=>!h||h[y]!==!1).map(y=>Ce(y,z[y],F,W===y,()=>B(X=>X===y?null:y))).filter(Boolean);return i.jsx(ae,{delay:.15,children:i.jsx(D,{children:i.jsxs("div",{ref:P,className:"flex flex-col gap-3",style:I>0?{"--tt-limits-label-w":`${I}px`}:void 0,children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[n("limits.panel.title"),n("limits.panel.mode_separator"),V]}),L.length>0?L:i.jsx(w,{children:n("limits.status.all_hidden")})]})})})}const $e=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function qe(){const e=q(),{data:t,error:r,isLoading:o}=ee(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),a=re();return!$e&&!J()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(ne,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("limits.page.subtitle")})]}),i.jsx(Q,{to:"/settings","aria-label":n("limits.page.openSettings"),title:n("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:i.jsx(Z,{className:"h-4 w-4","aria-hidden":!0})})]}),o?i.jsx(de,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:n("shared.error.prefix",{error:r})}):null,i.jsx(Ge,{claude:t?.claude,codex:t?.codex,cursor:t?.cursor,gemini:t?.gemini,kimi:t?.kimi,kiro:t?.kiro,grok:t?.grok,antigravity:t?.antigravity,copilot:t?.copilot,zcode:t?.zcode,opencodeGo:t?.opencodeGo,order:a.order,visibility:a.visibility,displayMode:a.displayMode})]})]})})})}export{qe as LimitsPage};
@@ -1 +1 @@
1
- import{j as e,N as t}from"./main-nNmpL8Cj.js";import{A as r}from"./arrow-up-right-5jhx4tzl.js";import{D as o}from"./download-hUD-lQh8.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
1
+ import{j as e,N as t}from"./main-BQdH4mOs.js";import{A as r}from"./arrow-up-right-DsLWfytD.js";import{D as o}from"./download-tXehSjsQ.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
@@ -1 +1 @@
1
- import{aw as p,aO as w,a2 as v,r,N as s,j as e,L as y,a5 as j}from"./main-nNmpL8Cj.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function k(){const i=p(),[t,u]=w(),{enabled:n,loading:f,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[h,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),m=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&m&&d(s("shared.error.prefix",{error:m}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||f)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,f,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{u(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[u]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[h?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:h}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{k as LoginPage};
1
+ import{aw as p,aO as w,a2 as v,r,N as s,j as e,L as y,a5 as j}from"./main-BQdH4mOs.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function k(){const i=p(),[t,u]=w(),{enabled:n,loading:f,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[h,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),m=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&m&&d(s("shared.error.prefix",{error:m}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||f)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,f,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{u(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[u]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[h?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:h}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{k as LoginPage};
@@ -0,0 +1 @@
1
+ import{c as h,aI as v,d5 as j,r as n,d6 as N,d7 as w,d8 as S,N as t,j as e,a0 as x}from"./main-BQdH4mOs.js";import{T as z,b as C}from"./Controls-D0h-lPHC.js";import{n as K,C as p}from"./ClawdAnimated-DuxB7qei.js";import{F as b}from"./FadeIn-BoYq0Lpr.js";import"./Card-Bw438EXT.js";const P=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],A=h("monitor-up",P);const E=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],I=h("zap",E),_={visible:!1,character:"clawd",size:"medium"};function R(){const r=v()&&j(),[i,s]=n.useState(_);n.useEffect(()=>{if(!r)return;const d=N(a=>{s({visible:!!a.visible,character:K(a.character),size:["small","medium","large"].includes(a.size)?a.size:"medium"})});return w(),d},[r]);const o=n.useCallback((d,a)=>{s(c=>({...c,[d]:a})),r&&S(d,a)},[r]);return{available:r,settings:i,setSetting:o}}const T=[{id:"clawd",nameKey:"pet.character.clawd",tint:"from-oai-amber-50 dark:from-orange-950/70"},{id:"sprout",nameKey:"pet.character.sprout",tint:"from-oai-brand-100 dark:from-emerald-950/70"},{id:"byte",nameKey:"pet.character.byte",tint:"from-oai-gray-200 dark:from-slate-800/70"},{id:"ember",nameKey:"pet.character.ember",tint:"from-orange-100 dark:from-orange-950/80"}],m=[{id:"idle-living",labelKey:"pet.state.calm"},{id:"working-thinking",labelKey:"pet.state.focus"},{id:"working-juggling",labelKey:"pet.state.multitask"},{id:"working-wizard",labelKey:"pet.state.streak"},{id:"happy",labelKey:"pet.state.celebrate"},{id:"sleeping",labelKey:"pet.state.rest"}];function M({character:r,selected:i,onSelect:s}){return e.jsxs("button",{type:"button",onClick:s,"aria-pressed":i,className:x("group relative overflow-hidden rounded-xl border p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",i?"border-oai-brand-500/40 bg-white dark:border-oai-brand-500/25 dark:bg-oai-gray-900/80":"border-oai-gray-200/80 bg-white/55 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:bg-oai-gray-950/55 dark:hover:border-oai-gray-600"),children:[e.jsx("div",{className:x("absolute inset-0 bg-gradient-to-br to-transparent opacity-80 dark:opacity-55",r.tint)}),e.jsxs("div",{className:"relative flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-white/70 dark:bg-black/15",children:e.jsx(p,{state:"idle-living",character:r.id,size:44})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:t(r.nameKey)}),i?e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-oai-brand-500","aria-hidden":!0}):null]})]})]})}function L({character:r,state:i,onStateChange:s}){const o=m.find(function(c){return c.id===i}),d=t(o?.labelKey||"pet.state.calm");return e.jsxs("section",{className:"relative flex min-h-[400px] flex-col overflow-hidden bg-oai-gray-50 dark:bg-oai-gray-950 sm:min-h-[440px] lg:min-h-[480px]",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.16] dark:opacity-[0.12]",style:{backgroundImage:"radial-gradient(currentColor 0.7px, transparent 0.7px)",backgroundSize:"14px 14px"},"aria-hidden":!0}),e.jsxs("div",{className:"relative flex items-center justify-between gap-3 px-5 pt-5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-oai-gray-500 dark:text-oai-gray-400",children:t("pet.preview.states")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-black/5 bg-white/65 px-3 py-1.5 text-[11px] font-medium text-oai-gray-600 backdrop-blur-md dark:border-white/10 dark:bg-black/20 dark:text-oai-gray-300",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500","aria-hidden":!0}),d]})]}),e.jsx("div",{className:"relative flex flex-1 items-center justify-center px-6 py-5",children:e.jsxs("div",{className:"relative flex h-52 w-52 items-center justify-center sm:h-56 sm:w-56",children:[e.jsx("div",{className:"absolute bottom-5 h-3 w-28 rounded-full bg-black/10 blur-sm dark:bg-black/35","aria-hidden":!0}),e.jsx(p,{state:i,character:r,size:190})]})}),e.jsx("div",{className:"relative border-t border-oai-gray-200/70 bg-white/70 px-3 py-2 backdrop-blur-sm dark:border-oai-gray-800 dark:bg-oai-gray-950/70",children:e.jsx("div",{className:"grid grid-cols-3 gap-1","aria-label":t("pet.preview.states"),children:m.map(a=>e.jsxs("button",{type:"button",onClick:()=>s(a.id),"aria-pressed":i===a.id,className:x("flex min-h-10 flex-col items-center justify-center gap-1 rounded-lg px-1.5 text-xs transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500",i===a.id?"font-semibold text-oai-black dark:text-white":"font-medium text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[e.jsx("span",{children:t(a.labelKey)}),e.jsx("span",{className:x("h-1 w-1 rounded-full transition-colors duration-200",i===a.id?"bg-oai-black dark:bg-white":"bg-transparent"),"aria-hidden":!0})]},a.id))})})]})}function W(){const{available:r,settings:i,setSetting:s}=R(),[o,d]=n.useState("idle-living"),[a,c]=n.useState(!0),g=i.character||"clawd";n.useEffect(()=>{if(!a)return;const l=window.setInterval(()=>{d(f=>{const y=m.findIndex(k=>k.id===f);return m[(y+1)%m.length].id})},5e3);return()=>window.clearInterval(l)},[a]);const u=[{value:"small",label:t("pet.size.small")},{value:"medium",label:t("pet.size.medium")},{value:"large",label:t("pet.size.large")}];return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-14 pt-8 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(b,{y:12,children:e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:t("pet.page.title")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("pet.page.subtitle")})]})}),e.jsx(b,{y:12,delay:.04,children:e.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-oai-gray-200 bg-white/75 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 lg:grid lg:grid-cols-[1.12fr_0.88fr]",children:[e.jsx(L,{character:g,state:o,onStateChange:l=>{c(!1),d(l)}}),e.jsxs("aside",{className:"flex flex-col border-t border-oai-gray-200 p-5 dark:border-oai-gray-800 lg:min-h-[480px] lg:border-l lg:border-t-0",children:[e.jsxs("section",{"aria-labelledby":"pet-character-title",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"pet-character-title",className:"text-sm font-semibold",children:t("pet.characters.title")}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("pet.characters.subtitle")})]}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2",children:T.map(l=>e.jsx(M,{character:l,selected:g===l.id,onSelect:()=>s("character",l.id)},l.id))})]}),e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-4 w-4 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("h2",{className:"text-sm font-semibold",children:t("pet.controls.title")})]}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:t("pet.controls.show")}),e.jsx(z,{checked:i.visible,onChange:()=>s("visible",!i.visible),disabled:!r,ariaLabel:t("pet.controls.show")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:t("pet.controls.size")}),e.jsx("div",{className:"shrink-0",children:e.jsx(C,{options:u,value:i.size,onChange:l=>s("size",l),disabled:!r})})]})]})]}),r?null:e.jsxs("div",{className:"mt-6 flex gap-2 rounded-xl bg-oai-gray-100 p-3 text-xs leading-relaxed text-oai-gray-500 dark:bg-oai-gray-800/70 dark:text-oai-gray-400",children:[e.jsx(I,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),t("pet.controls.native_only")]})]})]})})]})})})}export{W as PetPage};
@@ -1 +1 @@
1
- import{c as we,bc as Ue,bF as Ke,bG as le,bH as We,bI as ne,ba as ge,r as m,bJ as z,bK as me,bL as he,bM as oe,bN as be,bO as qe,bP as Le,bQ as $,bl as J,bR as W,aG as ue,bb as pe,bS as $e,bT as Ee,bU as Qe,bV as Je,bW as ze,bX as Te,bY as q,j as Y,bZ as Ze,bh as Me,bg as et,b_ as tt,b$ as nt,c0 as ot,c1 as st,bd as rt,b9 as He,c2 as it,c3 as ye,c4 as at,c5 as ct,c6 as lt,c7 as ut,bn as ft,c8 as dt,bo as pt}from"./main-nNmpL8Cj.js";import{i as Ce,b as Ae,c as _e,g as Pe,d as se,P as gt,e as mt,f as ht,s as Et,F as Tt,h as Ct,j as Pt,k as vt,l as bt,m as Rt,n as Be,o as St,u as Ot,p as It,q as Mt,t as yt,r as xt,I as Ft,v as kt,w as wt,x as Lt,C as Ht,y as At}from"./useScrollLock-C-uJaCDp.js";import{f as _t,p as Bt,g as Dt}from"./DialogTitle-D0xEUAQD.js";import{p as Nt,q as jt,r as Yt,t as Gt,v as Vt,w as Xt,x as Ut,y as Kt}from"./SelectItemText-D-kCTY6-.js";const Wt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cn=we("chevron-right",Wt);const qt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Pn=we("loader-circle",qt);function $t(e,n){return n!=null&&!Ce(n)?0:typeof e=="function"?e():e}function ve(e,n,t){const l=$t(e,t);return typeof l=="number"?l:l?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function Qt(e){return e?.includes("mouse")&&e!=="mousedown"}class Re{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Re}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ne(e,n){const{scopeElement:t,referenceElement:l,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=l,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",l.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function Jt(e,n={}){const{enabled:t=!0,closeDelay:l=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),S=o.useState("domReferenceElement"),{dataRef:c}=o.context,r=Ae(),O=_e(),h=je(o),j=We(),u=ne(()=>De(c.current.openEvent?.type,h.interactedInside)),_=ne(()=>Qt(c.current.openEvent?.type)),g=ne(()=>{de(h)});ge(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),ge(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&_()&&z(S)&&E){const x=S,a=E,d=me(E),F=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const A=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,C=F!==a?F:null,v=h.handleCloseOptions?.getScope?.()??A??C??x.closest("[data-rootownerid]")??d.body;return Ne(h,{scopeElement:v,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,_,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&Pe(r.nodesRef.current,O).length>0)}function a(b){const M=ve(l,"close",h.pointerType),D=()=>{o.setOpen(!1,J(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,D):(h.openChangeTimeout.clear(),D())}function d(b){const M=be(b);if(!qe(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function F(){h.openChangeTimeout.clear(),j.clear(),r?.events.off("floating.closed",C),g()}function A(b){if(x()&&r){r.events.on("floating.closed",C);return}if(Le(b.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,D=b.relatedTarget;if(!(r&&M&&z(D)&&Pe(r.nodesRef.current,M,!1).some(X=>$(X.context?.elements.floating,D)))){if(h.handler){h.handler(b);return}g(),_()&&!u()&&a(b)}}function C(b){!r||!O||x()||j.start(0,()=>{r.events.off("floating.closed",C),o.setOpen(!1,J(W,b)),r.events.emit("floating.closed",b)})}const v=E;return he(v&&oe(v,"mouseenter",F),v&&oe(v,"mouseleave",A),v&&oe(v,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",C)})},[t,E,o,c,l,i,_,u,g,h,r,O,j])}const zt={current:null};function Zt(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=zt,externalTree:c,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:j}=n,u="rootStore"in e?e.rootStore:e,{dataRef:_,events:g}=u.context,x=Ae(c),a=je(u),d=m.useRef(!1),F=se(i),A=se(l),C=se(p),v=se(t),b=se(j),M=se(h),D=ne(()=>De(_.current.openEvent?.type,a.interactedInside)),V=ne(()=>b.current?.()!==!1),X=ne((s,T,L)=>{const R=u.context.triggerElements;if(R.hasElement(T))return!s||!$(s,T);if(!z(L))return!1;const f=L;return R.hasMatchingElement(H=>$(H,f))&&(!s||!$(s,f))}),N=ne(()=>{if(!a.handler)return;me(u.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),w=ne(()=>{de(a)});return r&&(a.handleCloseOptions=F.current?.__options),m.useEffect(()=>N,[N]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===W,N(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,N]),m.useEffect(()=>{if(!t)return;function s(f,H=!0){const B=ve(A.current,"close",a.pointerType);B?a.openChangeTimeout.start(B,()=>{u.setOpen(!1,J(W,f)),x?.events.emit("floating.closed",f)}):H&&(a.openChangeTimeout.clear(),u.setOpen(!1,J(W,f)),x?.events.emit("floating.closed",f))}const T=S.current??(r?u.select("domReferenceElement"):null);if(!z(T))return;function L(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Ce(a.pointerType))return;const H=xe(C.current),B=ve(A.current,"open",a.pointerType),G=be(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(z(G)&&!u.context.triggerElements.hasElement(G)){for(const Ie of u.context.triggerElements.elements())if($(Ie,G)){k=Ie;break}}z(U)&&z(I)&&!u.context.triggerElements.hasElement(U)&&$(U,I)&&(k=I);const P=k==null?!1:X(I,k,G),Q=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",K=!Q&&Z&&d.current,ee=!P&&z(k)&&z(I)&&$(I,k)&&K,te=H>0&&!B,Xe=P&&(Q||K)||ee,Oe=!Q||P;if(Xe){V()&&u.setOpen(!0,J(W,f,k));return}te||(B?a.openChangeTimeout.start(B,()=>{Oe&&V()&&u.setOpen(!0,J(W,f,k))}):Oe&&V()&&u.setOpen(!0,J(W,f,k)))}function R(f){if(D()){w();return}N();const H=u.select("domReferenceElement"),B=me(H);a.restTimeout.clear(),a.restTimeoutPending=!1;const G=_.current.floatingContext??O?.();if(Le(f.relatedTarget,u.context.triggerElements))return;if(F.current&&G){u.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=F.current({...G,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),N(),v.current&&!D()&&I===u.select("domReferenceElement")&&s(f,!0)}}),B.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!$(u.select("floatingElement"),f.relatedTarget))&&s(f)}return E?he(oe(T,"mousemove",L,{once:!0}),oe(T,"mouseenter",L),oe(T,"mouseleave",R)):he(oe(T,"mouseenter",L),oe(T,"mouseleave",R))},[N,w,_,A,u,t,F,a,r,X,D,o,E,C,S,x,v,O,M,V]),m.useMemo(()=>{if(!t)return;function s(T){a.pointerType=T.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(T){const{nativeEvent:L}=T,R=T.currentTarget,f=u.select("domReferenceElement"),H=u.select("open"),B=X(f,R,T.target);if(o&&!Ce(a.pointerType))return;if(H&&B&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;Ne(a,{scopeElement:k,referenceElement:R,floatingElement:I})}}const G=xe(C.current);if(H&&!B||G===0||!B&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,D())return;const I=u.select("open");!a.blockMouseMove&&(!I||B)&&V()&&u.setOpen(!0,J(W,L,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):B&&H?U():(a.restTimeoutPending=!0,a.restTimeout.start(G,U))}}},[t,a,D,X,o,u,C,V])}const Fe=.1,en=Fe*Fe,y=.5;function ie(e,n,t,l,i,o){return l>=n!=o>=n&&e<=(i-t)*(n-l)/(o-l)+t}function ae(e,n,t,l,i,o,p,E,S,c){let r=!1;return ie(e,n,t,l,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,S,c)&&(r=!r),ie(e,n,S,c,t,l)&&(r=!r),r}function tn(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,l,i,o){const p=Math.min(t,i),E=Math.max(t,i),S=Math.min(l,o),c=Math.max(l,o);return e>=p&&e<=E&&n>=S&&n<=c}function nn(e={}){const{blockPointerEvents:n=!1}=e,t=new le,l=({x:i,y:o,placement:p,elements:E,onClose:S,nodeId:c,tree:r})=>{const O=p?.split("-")[0];let h=!1,j=null,u=null,_=typeof performance<"u"?performance.now():0;function g(a,d){const F=performance.now(),A=F-_;if(j===null||u===null||A===0)return j=a,u=d,_=F,!1;const C=a-j,v=d-u,b=C*C+v*v,M=A*A*en;return j=a,u=d,_=F,b<M}function x(){t.clear(),S()}return function(d){t.clear();const F=E.domReference,A=E.floating;if(!F||!A||O==null||i==null||o==null)return;const{clientX:C,clientY:v}=d,b=be(d),M=d.type==="mouseleave",D=$(A,b),V=$(F,b);if(D&&(h=!0,!M))return;if(V&&(h=!1,!M)){h=!0;return}if(M&&z(d.relatedTarget)&&$(A,d.relatedTarget))return;function X(){return!!(r&&Pe(r.nodesRef.current,c).length>0)}function N(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=A.getBoundingClientRect(),T=i>s.right-s.width/2,L=o>s.bottom-s.height/2,R=s.width>w.width,f=s.height>w.height,H=(R?w:s).left,B=(R?w:s).right,G=(f?w:s).top,U=(f?w:s).bottom;if(O==="top"&&o>=w.bottom-1||O==="bottom"&&o<=w.top+1||O==="left"&&i>=w.right-1||O==="right"&&i<=w.left+1){N();return}let I=!1;switch(O){case"top":I=ce(C,v,H,w.top+1,B,s.bottom-1);break;case"bottom":I=ce(C,v,H,s.top+1,B,w.bottom-1);break;case"left":I=ce(C,v,s.right-1,U,w.left+1,G);break;case"right":I=ce(C,v,w.right-1,U,s.left+1,G);break}if(I)return;if(h&&!tn(C,v,w)){N();return}if(!M&&g(C,v)){N();return}let k=!1;switch(O){case"top":{const P=R?y/2:y*4,Q=R||T?i+P:i-P,Z=R?i-P:T?i+P:i-P,K=o+y+1,ee=T||R?s.bottom-y:s.top,te=T?R?s.bottom-y:s.top:s.bottom-y;k=ae(C,v,Q,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const P=R?y/2:y*4,Q=R||T?i+P:i-P,Z=R?i-P:T?i+P:i-P,K=o-y,ee=T||R?s.top+y:s.bottom,te=T?R?s.top+y:s.bottom:s.top+y;k=ae(C,v,Q,K,Z,K,s.left,ee,s.right,te);break}case"left":{const P=f?y/2:y*4,Q=f||L?o+P:o-P,Z=f?o-P:L?o+P:o-P,K=i+y+1,ee=L||f?s.right-y:s.left,te=L?f?s.right-y:s.left:s.right-y;k=ae(C,v,ee,s.top,te,s.bottom,K,Q,K,Z);break}case"right":{const P=f?y/2:y*4,Q=f||L?o+P:o-P,Z=f?o-P:L?o+P:o-P,K=i-y,ee=L||f?s.left+y:s.right,te=L?f?s.left+y:s.right:s.left+y;k=ae(C,v,K,Q,K,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,N):N()}};return l.__options={...e,blockPointerEvents:n},l}const Ye=m.createContext(void 0);function re(e){const n=m.useContext(Ye);if(n===void 0&&!e)throw new Error(pe(47));return n}function on(){return{...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const sn={...Bt,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class Se extends $e{constructor(n,t,l=!1){const i={...on(),...n},o=new gt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=_t(o,t,l),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},sn)}setOpen=(n,t)=>{const l=t.reason===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===Qe||t.reason==null),p=mt(t),E=this.select("activeTriggerId");if(!n&&t.reason===Je&&t.trigger==null&&E!=null&&(t.trigger=this.context.triggerElements.getById(E)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const S=()=>{const c={open:n,openChangeReason:t.reason};Et(c,n,t.trigger,p()),this.update(c)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(ze,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(S)):S(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===Te?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:l,internalStore:i}=ht(n,(o,p)=>new Se(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),l}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:l=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:S,defaultTriggerId:c=null}=e,r=Se.useStore(E?.store,{modal:p,open:l,openProp:t,activeTriggerId:c,triggerIdProp:S});Ct(r,t,l,c),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",S);const O=r.useState("open"),h=r.useState("mounted"),j=r.useState("payload"),u=_e()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),Pt(r,O),vt(r);const{forceUnmount:_}=bt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:u}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,J(Ze))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:_,close:g}),[_,g]);const x=O||h,a=m.useMemo(()=>({store:r}),[r]);return Y.jsxs(Ye.Provider,{value:a,children:[x&&Y.jsx(rn,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function vn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Tt,{children:Y.jsx(ke,{props:e})})}function rn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=Rt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=l.reference??Me,o=l.trigger??Me,p=m.useMemo(()=>et(Be,l.floating),[l.floating]);return St(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const an=300;function cn(e,n){const t=m.useRef(null);function l(o){ue.flushSync(()=>{e.setOpen(!1,J(Te,o.nativeEvent,o.currentTarget))}),st(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&tt(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,J(Te,o.nativeEvent,o.currentTarget))});let E=nt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&$(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const bn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:S,payload:c,openOnHover:r=!1,delay:O=an,closeDelay:h=0,id:j,...u}=n,_=re(!0),g=S?.store??_?.store;if(!g)throw new Error(pe(74));const x=Ot(j),a=g.useState("isTriggerActive",x),d=g.useState("floatingRootContext"),F=g.useState("isOpenedByTrigger",x),A=g.useState("triggerPopupId",x),C=m.useRef(null),{registerTrigger:v,isMountedByThisTrigger:b}=It(x,C,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),D=g.useState("stickIfOpen"),V=g.useState("openMethod"),X=g.useState("focusManagerModal"),N=Zt(d,{enabled:!p&&d!=null&&r&&(V!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:nn(),restMs:O,delay:{close:h},triggerElementRef:C,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=Nt(d,{enabled:d!=null,stickIfOpen:D}),s=jt(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",b),{getButtonProps:L,buttonRef:R}=rt({disabled:p,native:E}),f={open(k){return k&&M===Ee?Mt.open(k):yt.open(k)}},{preFocusGuardRef:H,handlePreFocusGuardFocus:B,handleFocusTargetFocus:G}=cn(g,C),I=He("button",n,{state:{disabled:p,open:F},ref:[R,t,v,C],props:[w.reference,N,T,s,{[it]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":A},u,L],stateAttributesMapping:f});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:H,onFocus:B}),Y.jsx(m.Fragment,{children:I},x),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:G})]}):Y.jsx(m.Fragment,{children:I},x)}),Ge=m.createContext(void 0);function ln(){const e=m.useContext(Ge);if(e===void 0)throw new Error(pe(45));return e}const Rn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?Y.jsx(Ge.Provider,{value:l,children:Y.jsx(at,{ref:t,...i})}):null}),Ve=m.createContext(void 0);function un(){const e=m.useContext(Ve);if(!e)throw new Error(pe(46));return e}const Sn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,anchor:p,positionMethod:E="absolute",side:S="bottom",align:c="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:j=5,arrowPadding:u=5,sticky:_=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=ct,...a}=n,{store:d}=re(),F=ln(),A=xt(),C=d.useState("floatingRootContext"),v=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),D=d.useState("activeTriggerElement"),V=d.useState("modal"),X=d.useState("openMethod"),N=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),L=m.useRef(null),R=lt(N,!1,!1),f=Yt({anchor:p,floatingRootContext:C,positionMethod:E,mounted:v,side:S,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:j,sticky:_,disableAnchorTracking:g,keepMounted:F,nodeId:A,collisionAvoidance:x,adaptiveOrigin:T?Xt:void 0}),H=C.useState("domReferenceElement");ge(()=>{const I=H,k=L.current;if(I&&(L.current=I),k&&I&&I!==k){d.set("instantType",void 0);const P=new AbortController;return R(()=>{d.set("instantType","trigger-change")},P.signal),()=>{P.abort()}}},[H,R,d]),Gt(b&&V===!0&&M!==W,X==="touch",N,D);const B=m.useCallback(I=>{d.set("positionerElement",I)},[d]),G={open:b,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Vt(n,G,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,B],hidden:!v,inert:!b});return Y.jsxs(Ve.Provider,{value:f,children:[v&&V===!0&&M!==W&&Y.jsx(Ft,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:D}),Y.jsx(kt,{id:A,children:U})]})}),fn=m.createContext(void 0);function dn(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function pn(e){const{value:n,children:t}=e;return Y.jsx(fn.Provider,{value:n,children:t})}const gn={...At,...pt},On=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:c}=re(),r=un(),O=Ut()!=null,{context:h,hasClosePart:j}=dn(),u=c.useState("open"),_=c.useState("openMethod"),g=c.useState("instantType"),x=c.useState("transitionStatus"),a=c.useState("popupProps"),d=c.useState("titleElementId"),F=c.useState("descriptionElementId"),A=c.useState("modal"),C=c.useState("mounted"),v=c.useState("openChangeReason"),b=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),D=M.useState("floatingId"),V=c.useState("disabled"),X=c.useState("openOnHover"),N=c.useState("closeDelay"),w=S.id??D;ft({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),Jt(M,{enabled:X&&!V,closeDelay:N});const s=p===void 0?wt(c.context.popupRef):p,T=A!==!1&&j;c.useSyncedValue("focusManagerModal",T);const L=m.useCallback(H=>{c.set("popupElement",H)},[c]),R={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=He("div",n,{state:R,ref:[t,c.context.popupRef,L],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(H){O&&Ht.has(H.key)&&H.stopPropagation()}},Kt(x),S],stateAttributesMapping:gn});return Y.jsx(Lt,{context:M,openInteractionType:_,modal:T,disabled:!C||v===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:Y.jsx(pn,{value:h,children:f})})});export{Cn as C,Pn as L,vn as P,bn as a,Rn as b,Sn as c,On as d};
1
+ import{c as we,bc as Ue,bF as Ke,bG as le,bH as We,bI as ne,ba as ge,r as m,bJ as z,bK as me,bL as he,bM as oe,bN as be,bO as qe,bP as Le,bQ as $,bl as J,bR as W,aG as ue,bb as pe,bS as $e,bT as Ee,bU as Qe,bV as Je,bW as ze,bX as Te,bY as q,j as Y,bZ as Ze,bh as Me,bg as et,b_ as tt,b$ as nt,c0 as ot,c1 as st,bd as rt,b9 as He,c2 as it,c3 as ye,c4 as at,c5 as ct,c6 as lt,c7 as ut,bn as ft,c8 as dt,bo as pt}from"./main-BQdH4mOs.js";import{i as Ce,b as Ae,c as _e,g as Pe,d as se,P as gt,e as mt,f as ht,s as Et,F as Tt,h as Ct,j as Pt,k as vt,l as bt,m as Rt,n as Be,o as St,u as Ot,p as It,q as Mt,t as yt,r as xt,I as Ft,v as kt,w as wt,x as Lt,C as Ht,y as At}from"./useScrollLock-BEZTkDaR.js";import{f as _t,p as Bt,g as Dt}from"./DialogTitle-CuhKU10w.js";import{p as Nt,q as jt,r as Yt,t as Gt,v as Vt,w as Xt,x as Ut,y as Kt}from"./SelectItemText-Dontd_dr.js";const Wt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cn=we("chevron-right",Wt);const qt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Pn=we("loader-circle",qt);function $t(e,n){return n!=null&&!Ce(n)?0:typeof e=="function"?e():e}function ve(e,n,t){const l=$t(e,t);return typeof l=="number"?l:l?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function Qt(e){return e?.includes("mouse")&&e!=="mousedown"}class Re{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Re}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ne(e,n){const{scopeElement:t,referenceElement:l,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=l,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",l.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function Jt(e,n={}){const{enabled:t=!0,closeDelay:l=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),S=o.useState("domReferenceElement"),{dataRef:c}=o.context,r=Ae(),O=_e(),h=je(o),j=We(),u=ne(()=>De(c.current.openEvent?.type,h.interactedInside)),_=ne(()=>Qt(c.current.openEvent?.type)),g=ne(()=>{de(h)});ge(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),ge(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&_()&&z(S)&&E){const x=S,a=E,d=me(E),F=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const A=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,C=F!==a?F:null,v=h.handleCloseOptions?.getScope?.()??A??C??x.closest("[data-rootownerid]")??d.body;return Ne(h,{scopeElement:v,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,_,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&Pe(r.nodesRef.current,O).length>0)}function a(b){const M=ve(l,"close",h.pointerType),D=()=>{o.setOpen(!1,J(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,D):(h.openChangeTimeout.clear(),D())}function d(b){const M=be(b);if(!qe(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function F(){h.openChangeTimeout.clear(),j.clear(),r?.events.off("floating.closed",C),g()}function A(b){if(x()&&r){r.events.on("floating.closed",C);return}if(Le(b.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,D=b.relatedTarget;if(!(r&&M&&z(D)&&Pe(r.nodesRef.current,M,!1).some(X=>$(X.context?.elements.floating,D)))){if(h.handler){h.handler(b);return}g(),_()&&!u()&&a(b)}}function C(b){!r||!O||x()||j.start(0,()=>{r.events.off("floating.closed",C),o.setOpen(!1,J(W,b)),r.events.emit("floating.closed",b)})}const v=E;return he(v&&oe(v,"mouseenter",F),v&&oe(v,"mouseleave",A),v&&oe(v,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",C)})},[t,E,o,c,l,i,_,u,g,h,r,O,j])}const zt={current:null};function Zt(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=zt,externalTree:c,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:j}=n,u="rootStore"in e?e.rootStore:e,{dataRef:_,events:g}=u.context,x=Ae(c),a=je(u),d=m.useRef(!1),F=se(i),A=se(l),C=se(p),v=se(t),b=se(j),M=se(h),D=ne(()=>De(_.current.openEvent?.type,a.interactedInside)),V=ne(()=>b.current?.()!==!1),X=ne((s,T,L)=>{const R=u.context.triggerElements;if(R.hasElement(T))return!s||!$(s,T);if(!z(L))return!1;const f=L;return R.hasMatchingElement(H=>$(H,f))&&(!s||!$(s,f))}),N=ne(()=>{if(!a.handler)return;me(u.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),w=ne(()=>{de(a)});return r&&(a.handleCloseOptions=F.current?.__options),m.useEffect(()=>N,[N]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===W,N(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,N]),m.useEffect(()=>{if(!t)return;function s(f,H=!0){const B=ve(A.current,"close",a.pointerType);B?a.openChangeTimeout.start(B,()=>{u.setOpen(!1,J(W,f)),x?.events.emit("floating.closed",f)}):H&&(a.openChangeTimeout.clear(),u.setOpen(!1,J(W,f)),x?.events.emit("floating.closed",f))}const T=S.current??(r?u.select("domReferenceElement"):null);if(!z(T))return;function L(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Ce(a.pointerType))return;const H=xe(C.current),B=ve(A.current,"open",a.pointerType),G=be(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(z(G)&&!u.context.triggerElements.hasElement(G)){for(const Ie of u.context.triggerElements.elements())if($(Ie,G)){k=Ie;break}}z(U)&&z(I)&&!u.context.triggerElements.hasElement(U)&&$(U,I)&&(k=I);const P=k==null?!1:X(I,k,G),Q=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",K=!Q&&Z&&d.current,ee=!P&&z(k)&&z(I)&&$(I,k)&&K,te=H>0&&!B,Xe=P&&(Q||K)||ee,Oe=!Q||P;if(Xe){V()&&u.setOpen(!0,J(W,f,k));return}te||(B?a.openChangeTimeout.start(B,()=>{Oe&&V()&&u.setOpen(!0,J(W,f,k))}):Oe&&V()&&u.setOpen(!0,J(W,f,k)))}function R(f){if(D()){w();return}N();const H=u.select("domReferenceElement"),B=me(H);a.restTimeout.clear(),a.restTimeoutPending=!1;const G=_.current.floatingContext??O?.();if(Le(f.relatedTarget,u.context.triggerElements))return;if(F.current&&G){u.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=F.current({...G,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),N(),v.current&&!D()&&I===u.select("domReferenceElement")&&s(f,!0)}}),B.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!$(u.select("floatingElement"),f.relatedTarget))&&s(f)}return E?he(oe(T,"mousemove",L,{once:!0}),oe(T,"mouseenter",L),oe(T,"mouseleave",R)):he(oe(T,"mouseenter",L),oe(T,"mouseleave",R))},[N,w,_,A,u,t,F,a,r,X,D,o,E,C,S,x,v,O,M,V]),m.useMemo(()=>{if(!t)return;function s(T){a.pointerType=T.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(T){const{nativeEvent:L}=T,R=T.currentTarget,f=u.select("domReferenceElement"),H=u.select("open"),B=X(f,R,T.target);if(o&&!Ce(a.pointerType))return;if(H&&B&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;Ne(a,{scopeElement:k,referenceElement:R,floatingElement:I})}}const G=xe(C.current);if(H&&!B||G===0||!B&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,D())return;const I=u.select("open");!a.blockMouseMove&&(!I||B)&&V()&&u.setOpen(!0,J(W,L,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):B&&H?U():(a.restTimeoutPending=!0,a.restTimeout.start(G,U))}}},[t,a,D,X,o,u,C,V])}const Fe=.1,en=Fe*Fe,y=.5;function ie(e,n,t,l,i,o){return l>=n!=o>=n&&e<=(i-t)*(n-l)/(o-l)+t}function ae(e,n,t,l,i,o,p,E,S,c){let r=!1;return ie(e,n,t,l,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,S,c)&&(r=!r),ie(e,n,S,c,t,l)&&(r=!r),r}function tn(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,l,i,o){const p=Math.min(t,i),E=Math.max(t,i),S=Math.min(l,o),c=Math.max(l,o);return e>=p&&e<=E&&n>=S&&n<=c}function nn(e={}){const{blockPointerEvents:n=!1}=e,t=new le,l=({x:i,y:o,placement:p,elements:E,onClose:S,nodeId:c,tree:r})=>{const O=p?.split("-")[0];let h=!1,j=null,u=null,_=typeof performance<"u"?performance.now():0;function g(a,d){const F=performance.now(),A=F-_;if(j===null||u===null||A===0)return j=a,u=d,_=F,!1;const C=a-j,v=d-u,b=C*C+v*v,M=A*A*en;return j=a,u=d,_=F,b<M}function x(){t.clear(),S()}return function(d){t.clear();const F=E.domReference,A=E.floating;if(!F||!A||O==null||i==null||o==null)return;const{clientX:C,clientY:v}=d,b=be(d),M=d.type==="mouseleave",D=$(A,b),V=$(F,b);if(D&&(h=!0,!M))return;if(V&&(h=!1,!M)){h=!0;return}if(M&&z(d.relatedTarget)&&$(A,d.relatedTarget))return;function X(){return!!(r&&Pe(r.nodesRef.current,c).length>0)}function N(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=A.getBoundingClientRect(),T=i>s.right-s.width/2,L=o>s.bottom-s.height/2,R=s.width>w.width,f=s.height>w.height,H=(R?w:s).left,B=(R?w:s).right,G=(f?w:s).top,U=(f?w:s).bottom;if(O==="top"&&o>=w.bottom-1||O==="bottom"&&o<=w.top+1||O==="left"&&i>=w.right-1||O==="right"&&i<=w.left+1){N();return}let I=!1;switch(O){case"top":I=ce(C,v,H,w.top+1,B,s.bottom-1);break;case"bottom":I=ce(C,v,H,s.top+1,B,w.bottom-1);break;case"left":I=ce(C,v,s.right-1,U,w.left+1,G);break;case"right":I=ce(C,v,w.right-1,U,s.left+1,G);break}if(I)return;if(h&&!tn(C,v,w)){N();return}if(!M&&g(C,v)){N();return}let k=!1;switch(O){case"top":{const P=R?y/2:y*4,Q=R||T?i+P:i-P,Z=R?i-P:T?i+P:i-P,K=o+y+1,ee=T||R?s.bottom-y:s.top,te=T?R?s.bottom-y:s.top:s.bottom-y;k=ae(C,v,Q,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const P=R?y/2:y*4,Q=R||T?i+P:i-P,Z=R?i-P:T?i+P:i-P,K=o-y,ee=T||R?s.top+y:s.bottom,te=T?R?s.top+y:s.bottom:s.top+y;k=ae(C,v,Q,K,Z,K,s.left,ee,s.right,te);break}case"left":{const P=f?y/2:y*4,Q=f||L?o+P:o-P,Z=f?o-P:L?o+P:o-P,K=i+y+1,ee=L||f?s.right-y:s.left,te=L?f?s.right-y:s.left:s.right-y;k=ae(C,v,ee,s.top,te,s.bottom,K,Q,K,Z);break}case"right":{const P=f?y/2:y*4,Q=f||L?o+P:o-P,Z=f?o-P:L?o+P:o-P,K=i-y,ee=L||f?s.left+y:s.right,te=L?f?s.left+y:s.right:s.left+y;k=ae(C,v,K,Q,K,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,N):N()}};return l.__options={...e,blockPointerEvents:n},l}const Ye=m.createContext(void 0);function re(e){const n=m.useContext(Ye);if(n===void 0&&!e)throw new Error(pe(47));return n}function on(){return{...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const sn={...Bt,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class Se extends $e{constructor(n,t,l=!1){const i={...on(),...n},o=new gt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=_t(o,t,l),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},sn)}setOpen=(n,t)=>{const l=t.reason===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===Qe||t.reason==null),p=mt(t),E=this.select("activeTriggerId");if(!n&&t.reason===Je&&t.trigger==null&&E!=null&&(t.trigger=this.context.triggerElements.getById(E)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const S=()=>{const c={open:n,openChangeReason:t.reason};Et(c,n,t.trigger,p()),this.update(c)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(ze,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(S)):S(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===Te?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:l,internalStore:i}=ht(n,(o,p)=>new Se(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),l}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:l=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:S,defaultTriggerId:c=null}=e,r=Se.useStore(E?.store,{modal:p,open:l,openProp:t,activeTriggerId:c,triggerIdProp:S});Ct(r,t,l,c),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",S);const O=r.useState("open"),h=r.useState("mounted"),j=r.useState("payload"),u=_e()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),Pt(r,O),vt(r);const{forceUnmount:_}=bt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:u}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,J(Ze))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:_,close:g}),[_,g]);const x=O||h,a=m.useMemo(()=>({store:r}),[r]);return Y.jsxs(Ye.Provider,{value:a,children:[x&&Y.jsx(rn,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function vn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Tt,{children:Y.jsx(ke,{props:e})})}function rn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=Rt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=l.reference??Me,o=l.trigger??Me,p=m.useMemo(()=>et(Be,l.floating),[l.floating]);return St(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const an=300;function cn(e,n){const t=m.useRef(null);function l(o){ue.flushSync(()=>{e.setOpen(!1,J(Te,o.nativeEvent,o.currentTarget))}),st(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&tt(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,J(Te,o.nativeEvent,o.currentTarget))});let E=nt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&$(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const bn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:S,payload:c,openOnHover:r=!1,delay:O=an,closeDelay:h=0,id:j,...u}=n,_=re(!0),g=S?.store??_?.store;if(!g)throw new Error(pe(74));const x=Ot(j),a=g.useState("isTriggerActive",x),d=g.useState("floatingRootContext"),F=g.useState("isOpenedByTrigger",x),A=g.useState("triggerPopupId",x),C=m.useRef(null),{registerTrigger:v,isMountedByThisTrigger:b}=It(x,C,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),D=g.useState("stickIfOpen"),V=g.useState("openMethod"),X=g.useState("focusManagerModal"),N=Zt(d,{enabled:!p&&d!=null&&r&&(V!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:nn(),restMs:O,delay:{close:h},triggerElementRef:C,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=Nt(d,{enabled:d!=null,stickIfOpen:D}),s=jt(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",b),{getButtonProps:L,buttonRef:R}=rt({disabled:p,native:E}),f={open(k){return k&&M===Ee?Mt.open(k):yt.open(k)}},{preFocusGuardRef:H,handlePreFocusGuardFocus:B,handleFocusTargetFocus:G}=cn(g,C),I=He("button",n,{state:{disabled:p,open:F},ref:[R,t,v,C],props:[w.reference,N,T,s,{[it]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":A},u,L],stateAttributesMapping:f});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:H,onFocus:B}),Y.jsx(m.Fragment,{children:I},x),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:G})]}):Y.jsx(m.Fragment,{children:I},x)}),Ge=m.createContext(void 0);function ln(){const e=m.useContext(Ge);if(e===void 0)throw new Error(pe(45));return e}const Rn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?Y.jsx(Ge.Provider,{value:l,children:Y.jsx(at,{ref:t,...i})}):null}),Ve=m.createContext(void 0);function un(){const e=m.useContext(Ve);if(!e)throw new Error(pe(46));return e}const Sn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,anchor:p,positionMethod:E="absolute",side:S="bottom",align:c="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:j=5,arrowPadding:u=5,sticky:_=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=ct,...a}=n,{store:d}=re(),F=ln(),A=xt(),C=d.useState("floatingRootContext"),v=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),D=d.useState("activeTriggerElement"),V=d.useState("modal"),X=d.useState("openMethod"),N=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),L=m.useRef(null),R=lt(N,!1,!1),f=Yt({anchor:p,floatingRootContext:C,positionMethod:E,mounted:v,side:S,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:j,sticky:_,disableAnchorTracking:g,keepMounted:F,nodeId:A,collisionAvoidance:x,adaptiveOrigin:T?Xt:void 0}),H=C.useState("domReferenceElement");ge(()=>{const I=H,k=L.current;if(I&&(L.current=I),k&&I&&I!==k){d.set("instantType",void 0);const P=new AbortController;return R(()=>{d.set("instantType","trigger-change")},P.signal),()=>{P.abort()}}},[H,R,d]),Gt(b&&V===!0&&M!==W,X==="touch",N,D);const B=m.useCallback(I=>{d.set("positionerElement",I)},[d]),G={open:b,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Vt(n,G,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,B],hidden:!v,inert:!b});return Y.jsxs(Ve.Provider,{value:f,children:[v&&V===!0&&M!==W&&Y.jsx(Ft,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:D}),Y.jsx(kt,{id:A,children:U})]})}),fn=m.createContext(void 0);function dn(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function pn(e){const{value:n,children:t}=e;return Y.jsx(fn.Provider,{value:n,children:t})}const gn={...At,...pt},On=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:c}=re(),r=un(),O=Ut()!=null,{context:h,hasClosePart:j}=dn(),u=c.useState("open"),_=c.useState("openMethod"),g=c.useState("instantType"),x=c.useState("transitionStatus"),a=c.useState("popupProps"),d=c.useState("titleElementId"),F=c.useState("descriptionElementId"),A=c.useState("modal"),C=c.useState("mounted"),v=c.useState("openChangeReason"),b=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),D=M.useState("floatingId"),V=c.useState("disabled"),X=c.useState("openOnHover"),N=c.useState("closeDelay"),w=S.id??D;ft({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),Jt(M,{enabled:X&&!V,closeDelay:N});const s=p===void 0?wt(c.context.popupRef):p,T=A!==!1&&j;c.useSyncedValue("focusManagerModal",T);const L=m.useCallback(H=>{c.set("popupElement",H)},[c]),R={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=He("div",n,{state:R,ref:[t,c.context.popupRef,L],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(H){O&&Ht.has(H.key)&&H.stopPropagation()}},Kt(x),S],stateAttributesMapping:gn});return Y.jsx(Lt,{context:M,openInteractionType:_,modal:T,disabled:!C||v===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:Y.jsx(pn,{value:h,children:f})})});export{Cn as C,Pn as L,vn as P,bn as a,Rn as b,Sn as c,On as d};
@@ -1 +1 @@
1
- import{aO as d,a2 as m,r as t,j as e,L as l,N as o,a5 as x}from"./main-nNmpL8Cj.js";function n(s,a){for(const r of a){const i=s.get(r);if(typeof i=="string"&&i.trim())return i.trim()}return""}function u(){const[s]=d(),{enabled:a}=m(),r=t.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),i=t.useMemo(()=>n(s,["email"]),[s]),c=t.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:r?"reset_confirm":"reset_email",tokenFromUrl:r,initialEmail:i,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:o("login.cloud_only")})})]})}export{u as ResetPasswordPage};
1
+ import{aO as d,a2 as m,r as t,j as e,L as l,N as o,a5 as x}from"./main-BQdH4mOs.js";function n(s,a){for(const r of a){const i=s.get(r);if(typeof i=="string"&&i.trim())return i.trim()}return""}function u(){const[s]=d(),{enabled:a}=m(),r=t.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),i=t.useMemo(()=>n(s,["email"]),[s]),c=t.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:r?"reset_confirm":"reset_email",tokenFromUrl:r,initialEmail:i,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:o("login.cloud_only")})})]})}export{u as ResetPasswordPage};
@@ -1 +1 @@
1
- import{r as v,b8 as l,bI as w,b9 as k,j as e,a0 as x}from"./main-nNmpL8Cj.js";import{u as j,z as N,s as i,L as C,A as I,S as E,h as R,i as T,C as A,j as L,k as P,l as _,m as z,o as D,n as G}from"./SelectItemText-D-kCTY6-.js";import{C as M}from"./check-DhneqxBx.js";const O=v.forwardRef(function(t,s){const{render:n,className:p,style:o,...c}=t,{store:r,scrollHandlerRef:d}=j(),{alignItemWithTriggerActive:g}=N(),u=l(r,i.hasScrollArrows),h=l(r,i.openMethod),a=l(r,i.multiple),m={id:`${l(r,i.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(b){d.current?.(b.currentTarget)},...g&&{style:C},className:u&&h!=="touch"?I.className:void 0},S=w(b=>{r.set("listElement",b)});return k("div",t,{ref:[s,S],props:[m,c]})}),V="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function U({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:p,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(E,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(R,{id:p,"aria-label":n,className:x(V,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c,e.jsx(T,{className:"truncate"})]}),e.jsx(A,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(_,{className:x("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(O,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(z,{value:a.value,disabled:a.disabled,className:({selected:f,disabled:m})=>x("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",f?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",m&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(D,{children:e.jsx(M,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(G,{children:a.label})})]},String(a.value)))})})})})]})}export{U as S};
1
+ import{r as v,b8 as l,bI as w,b9 as k,j as e,a0 as x}from"./main-BQdH4mOs.js";import{u as j,z as N,s as i,L as C,A as I,S as E,h as R,i as T,C as A,j as L,k as P,l as _,m as z,o as D,n as G}from"./SelectItemText-Dontd_dr.js";import{C as M}from"./check-CPB_1BeX.js";const O=v.forwardRef(function(t,s){const{render:n,className:p,style:o,...c}=t,{store:r,scrollHandlerRef:d}=j(),{alignItemWithTriggerActive:g}=N(),u=l(r,i.hasScrollArrows),h=l(r,i.openMethod),a=l(r,i.multiple),m={id:`${l(r,i.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(b){d.current?.(b.currentTarget)},...g&&{style:C},className:u&&h!=="touch"?I.className:void 0},S=w(b=>{r.set("listElement",b)});return k("div",t,{ref:[s,S],props:[m,c]})}),V="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function U({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:p,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(E,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(R,{id:p,"aria-label":n,className:x(V,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c,e.jsx(T,{className:"truncate"})]}),e.jsx(A,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(_,{className:x("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(O,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(z,{value:a.value,disabled:a.disabled,className:({selected:f,disabled:m})=>x("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",f?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",m&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(D,{children:e.jsx(M,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(G,{children:a.label})})]},String(a.value)))})})})})]})}export{U as S};