tokentracker-cli 1.2.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/dashboard/dist/assets/AchievementBadge-BaqdyZaV.js +1 -0
  4. package/dashboard/dist/assets/AchievementsPage-B4Ju0guv.js +2 -0
  5. package/dashboard/dist/assets/{AchievementsSection-DoYMz2Rr.js → AchievementsSection-CDUUEfIi.js} +1 -1
  6. package/dashboard/dist/assets/BadgeDetailModal-B-XMJAvL.js +1 -0
  7. package/dashboard/dist/assets/{BotAnimated-C21PdYSf.js → BotAnimated-Dx_vvTtC.js} +1 -1
  8. package/dashboard/dist/assets/Card-D-5mABVt.js +1 -0
  9. package/dashboard/dist/assets/CloudCheckoutPage-BELoh56h.js +1 -0
  10. package/dashboard/dist/assets/CloudPage-CfBruNxe.js +1 -0
  11. package/dashboard/dist/assets/CloudUsageExport-BoFU7xCT.js +4 -0
  12. package/dashboard/dist/assets/CommandPalette-BmmKZWn-.js +1 -0
  13. package/dashboard/dist/assets/CommunityStatsModal-BF77zVhN.js +1 -0
  14. package/dashboard/dist/assets/{ConfirmModal-zUljpLNe.js → ConfirmModal-BQ-xB1S_.js} +1 -1
  15. package/dashboard/dist/assets/Controls-BnTeX7T4.js +1 -0
  16. package/dashboard/dist/assets/DashboardPage-BWulHa5J.js +1 -0
  17. package/dashboard/dist/assets/{DevicePage-CCIyAYH3.js → DevicePage-Dg6XkIaY.js} +1 -1
  18. package/dashboard/dist/assets/DialogClose-DAyilsH-.js +1 -0
  19. package/dashboard/dist/assets/DialogDescription-j4XnRy6y.js +1 -0
  20. package/dashboard/dist/assets/{DialogTitle-6q0jyME6.js → DialogTitle-B1iNGD2S.js} +1 -1
  21. package/dashboard/dist/assets/{FadeIn-BUm1z22V.js → FadeIn-ChVf45WW.js} +1 -1
  22. package/dashboard/dist/assets/{HeaderGithubStar-CxdmloMy.js → HeaderGithubStar-B740_G7a.js} +1 -1
  23. package/dashboard/dist/assets/{HoverTooltip-CrMdGYZj.js → HoverTooltip-BzP5FudR.js} +1 -1
  24. package/dashboard/dist/assets/{IpCheckPage-w6UUK_1K.js → IpCheckPage-BuZH3F14.js} +1 -1
  25. package/dashboard/dist/assets/LandingPage-Dtgq_caz.js +2 -0
  26. package/dashboard/dist/assets/LeaderboardPage-Di1kEg2O.js +2 -0
  27. package/dashboard/dist/assets/LeaderboardProBadge-h8FfR0au.js +1 -0
  28. package/dashboard/dist/assets/LeaderboardProfileModal-OUZvO6u-.js +73 -0
  29. package/dashboard/dist/assets/{LeaderboardProfilePage-Fljho5RP.js → LeaderboardProfilePage-bHI1oTEK.js} +2 -2
  30. package/dashboard/dist/assets/{LimitsPage-Do_uJqdQ.js → LimitsPage-DKojB73_.js} +2 -2
  31. package/dashboard/dist/assets/{LocalOnlyNotice-RIj2XT_X.js → LocalOnlyNotice-BaEq6qN7.js} +1 -1
  32. package/dashboard/dist/assets/LoginCard-Dn5Xy4If.js +1 -0
  33. package/dashboard/dist/assets/LoginModal-C5h-5GOA.js +1 -0
  34. package/dashboard/dist/assets/LoginPage-BpX8Tgjj.js +1 -0
  35. package/dashboard/dist/assets/PetPage-BPBsUHyL.js +1 -0
  36. package/dashboard/dist/assets/PopoverPopup-CVTiEVHs.js +1 -0
  37. package/dashboard/dist/assets/{ProviderIcon-BSI-1Cy8.js → ProviderIcon-BshO2uER.js} +1 -1
  38. package/dashboard/dist/assets/ResetPasswordPage-RTFTD8Dr.js +1 -0
  39. package/dashboard/dist/assets/{Select-B6CM0ico.js → Select-CtTceC4T.js} +1 -1
  40. package/dashboard/dist/assets/SelectItemText-C7xi8iGp.js +1 -0
  41. package/dashboard/dist/assets/SelfHostPage-BlwTt8XM.js +1 -0
  42. package/dashboard/dist/assets/{ServiceStatusPage-B4lIs2fc.js → ServiceStatusPage-BkIcJpYK.js} +1 -1
  43. package/dashboard/dist/assets/SessionsPage-okHobk_L.js +3 -0
  44. package/dashboard/dist/assets/SettingsPage-C-cc6wcF.js +2 -0
  45. package/dashboard/dist/assets/SkillsPage-D2LlKKJN.js +1 -0
  46. package/dashboard/dist/assets/{TokenGalaxy-Bk3kGSGi.js → TokenGalaxy-DiXUpXKF.js} +2 -2
  47. package/dashboard/dist/assets/TrendMonitor-C88S-5aa.js +19 -0
  48. package/dashboard/dist/assets/WidgetsPage-WsEFPNwp.js +1 -0
  49. package/dashboard/dist/assets/{WrappedPage-DHRmP4Ey.js → WrappedPage-ClEo-RmR.js} +1 -1
  50. package/dashboard/dist/assets/__vite-browser-external-DFRX9dp-.css +1 -0
  51. package/dashboard/dist/assets/__vite-browser-external-DUJeOWgd.js +45 -0
  52. package/dashboard/dist/assets/agent-logos-BM9jlReI.js +1 -0
  53. package/dashboard/dist/assets/arrow-left-BEM-HVmC.js +1 -0
  54. package/dashboard/dist/assets/arrow-right-CwBz5dwb.js +1 -0
  55. package/dashboard/dist/assets/{arrow-up-right-c39fdiDQ.js → arrow-up-right-jPmRN562.js} +1 -1
  56. package/dashboard/dist/assets/{check-8LQ7IvkH.js → check-CKwHc4Hv.js} +1 -1
  57. package/dashboard/dist/assets/cloud-checkout-nYNHDFoR.js +1 -0
  58. package/dashboard/dist/assets/composite-B4Z3F65o.js +1 -0
  59. package/dashboard/dist/assets/{download-x3Gmv-wu.js → download-CJUnX1Bs.js} +1 -1
  60. package/dashboard/dist/assets/{external-link-daw-XTjZ.js → external-link-B5yXxdPy.js} +1 -1
  61. package/dashboard/dist/assets/{flame-B9o0_EF8.js → flame-CKjAluj_.js} +1 -1
  62. package/dashboard/dist/assets/{format-tokens-o9atQGtV.js → format-tokens-mk49THtv.js} +1 -1
  63. package/dashboard/dist/assets/{host-mode-GPY2DxE4.js → host-mode-efKlSYjX.js} +1 -1
  64. package/dashboard/dist/assets/{icons-CmM2z-Jt.js → icons-ZB1ZthjH.js} +1 -1
  65. package/dashboard/dist/assets/{index-CPcJP0uH.js → index-BImBG3eS.js} +1 -1
  66. package/dashboard/dist/assets/{index-CtQOew7C.js → index-BgdM7kBl.js} +1 -1
  67. package/dashboard/dist/assets/{index-Bfgblk6o.js → index-DweUMAUD.js} +1 -1
  68. package/dashboard/dist/assets/{info-BaK8Hoi2.js → info-CyDY7NYM.js} +1 -1
  69. package/dashboard/dist/assets/{link-2-CV3uvMH3.js → link-2-Dn2soiyd.js} +1 -1
  70. package/dashboard/dist/assets/{loader-circle-DYpa-xTZ.js → loader-circle-CNT630zn.js} +1 -1
  71. package/dashboard/dist/assets/{modifiers.esm-Ds4Uh7JO.js → modifiers.esm-WPx0bc2K.js} +1 -1
  72. package/dashboard/dist/assets/{monitor-smartphone-BbeYHvY-.js → monitor-smartphone-C-qC0RAt.js} +1 -1
  73. package/dashboard/dist/assets/os-DMmhX9tk.js +1 -0
  74. package/dashboard/dist/assets/{plus-C9qGVLFv.js → plus-Cx82jb7o.js} +1 -1
  75. package/dashboard/dist/assets/{provider-display-BWYNyitK.js → provider-display-CodMmiRb.js} +2 -2
  76. package/dashboard/dist/assets/{react-CO1HovF5.js → react-B7SkZTgg.js} +1 -1
  77. package/dashboard/dist/assets/safePolygon-CKpREa4K.js +1 -0
  78. package/dashboard/dist/assets/{search-DBnhkzG_.js → search-Ol3OZBm4.js} +1 -1
  79. package/dashboard/dist/assets/server-DFCbznC7.js +1 -0
  80. package/dashboard/dist/assets/shield-check-YcmLwVZ6.js +1 -0
  81. package/dashboard/dist/assets/skills-api-C-9vK884.js +1 -0
  82. package/dashboard/dist/assets/{sortable.esm-SVl6OixH.js → sortable.esm-CKC9NuR-.js} +1 -1
  83. package/dashboard/dist/assets/store-C9yWYHfg.js +1 -0
  84. package/dashboard/dist/assets/{terminal-kUMdPZhq.js → terminal-B3_fCLFs.js} +1 -1
  85. package/dashboard/dist/assets/{trash-Dd_vbrYo.js → trash-CZGfgbFa.js} +1 -1
  86. package/dashboard/dist/assets/{use-community-stats-Bmlmv4H-.js → use-community-stats-CW-qkYn7.js} +1 -1
  87. package/dashboard/dist/assets/{use-latest-request-guard-CqZwzrCW.js → use-latest-request-guard-DHv7vfFE.js} +1 -1
  88. package/dashboard/dist/assets/{use-limits-display-prefs-CDC0MZRY.js → use-limits-display-prefs-NZ-AAYD5.js} +1 -1
  89. package/dashboard/dist/assets/use-native-settings-CWiLqfZh.js +1 -0
  90. package/dashboard/dist/assets/{use-ordered-list-DvBI7mUU.js → use-ordered-list-Df8pw-WJ.js} +1 -1
  91. package/dashboard/dist/assets/use-pet-settings-Bg2CDprr.js +2 -0
  92. package/dashboard/dist/assets/use-reduced-motion-iDZEUyua.js +1 -0
  93. package/dashboard/dist/assets/{use-transform-uSKYTYaW.js → use-transform-BHwEAfmO.js} +1 -1
  94. package/dashboard/dist/assets/use-usage-limits-CSxFFn3_.js +1 -0
  95. package/dashboard/dist/assets/{useCurrency-t1iy_pC3.js → useCurrency-pwClnCZ5.js} +1 -1
  96. package/dashboard/dist/assets/usePositioner-B0j1orGj.js +1 -0
  97. package/dashboard/dist/assets/useTokenFormat-BMvVAe6V.js +1 -0
  98. package/dashboard/dist/assets/{zap-DFM6AsYo.js → zap-DvX2aYx5.js} +1 -1
  99. package/dashboard/dist/index.html +2 -2
  100. package/dashboard/dist/ip-check.html +2 -2
  101. package/dashboard/dist/leaderboard.html +2 -2
  102. package/dashboard/dist/pricing.html +6 -5
  103. package/dashboard/dist/privacy.html +3 -3
  104. package/dashboard/dist/share.html +2 -2
  105. package/dashboard/dist/terms.html +6 -6
  106. package/package.json +6 -2
  107. package/src/commands/device-login.js +60 -33
  108. package/src/commands/init.js +26 -7
  109. package/src/commands/serve.js +3 -3
  110. package/src/commands/sync.js +43 -22
  111. package/src/lib/atomic-json.js +27 -0
  112. package/src/lib/bearer-token.js +11 -0
  113. package/src/lib/cloud-account.js +4 -1
  114. package/src/lib/local-api.js +282 -69
  115. package/src/lib/openclaw-cli.js +104 -0
  116. package/src/lib/openclaw-hook.js +1 -46
  117. package/src/lib/openclaw-session-plugin.js +1 -59
  118. package/src/lib/pricing/seed-snapshot.json +1 -1
  119. package/src/lib/proxy-env.js +8 -3
  120. package/src/lib/rollout.js +15 -10
  121. package/src/lib/runtime-config.js +84 -14
  122. package/src/lib/skills-manager.js +8 -1
  123. package/src/lib/static-server.js +19 -4
  124. package/src/lib/upload-throttle.js +18 -4
  125. package/dashboard/dist/assets/AchievementBadge-DPlXNqoK.js +0 -1
  126. package/dashboard/dist/assets/AchievementsPage-B49wjdK_.js +0 -2
  127. package/dashboard/dist/assets/BadgeDetailModal-DUCS6K1n.js +0 -1
  128. package/dashboard/dist/assets/Card-BU2CqxfU.js +0 -1
  129. package/dashboard/dist/assets/CommandPalette-O3pOLyJo.js +0 -1
  130. package/dashboard/dist/assets/CommunityStatsModal-Bt82neQ7.js +0 -1
  131. package/dashboard/dist/assets/Controls-D56v-YJw.js +0 -1
  132. package/dashboard/dist/assets/DashboardPage-CKEuFzuc.js +0 -1
  133. package/dashboard/dist/assets/DialogClose-C-QK97qp.js +0 -1
  134. package/dashboard/dist/assets/DialogDescription-COXweCuc.js +0 -1
  135. package/dashboard/dist/assets/LandingPage-DLDE7wdR.js +0 -2
  136. package/dashboard/dist/assets/LeaderboardAvatar-BqD4dEvQ.js +0 -1
  137. package/dashboard/dist/assets/LeaderboardPage-kgHSryiT.js +0 -2
  138. package/dashboard/dist/assets/LeaderboardProfileModal-zLdeOiA3.js +0 -73
  139. package/dashboard/dist/assets/LoginCard-Dx6MmGjU.js +0 -1
  140. package/dashboard/dist/assets/LoginModal-BWaZVRnT.js +0 -1
  141. package/dashboard/dist/assets/LoginPage-BNkU-riS.js +0 -1
  142. package/dashboard/dist/assets/PetPage-CyEgU2Vm.js +0 -1
  143. package/dashboard/dist/assets/PopoverPopup-CmUIY8lF.js +0 -1
  144. package/dashboard/dist/assets/ResetPasswordPage-CUXKkLb4.js +0 -1
  145. package/dashboard/dist/assets/SelectItemText-CZ7puxuB.js +0 -1
  146. package/dashboard/dist/assets/SessionsPage-D99UfBgy.js +0 -3
  147. package/dashboard/dist/assets/SettingsPage-DT3rld91.js +0 -2
  148. package/dashboard/dist/assets/SkillsPage-Dv47kVCB.js +0 -1
  149. package/dashboard/dist/assets/TrendMonitor-mB1x3c_o.js +0 -19
  150. package/dashboard/dist/assets/WidgetsPage-BhUArowe.js +0 -1
  151. package/dashboard/dist/assets/__vite-browser-external-BW1rxvYq.js +0 -45
  152. package/dashboard/dist/assets/__vite-browser-external-gKkiQad5.css +0 -1
  153. package/dashboard/dist/assets/agent-logos-D7f7AMF-.js +0 -1
  154. package/dashboard/dist/assets/composite-BgLSXWKA.js +0 -1
  155. package/dashboard/dist/assets/skills-api-BSkbxC8-.js +0 -1
  156. package/dashboard/dist/assets/store-DrEEdO_u.js +0 -1
  157. package/dashboard/dist/assets/use-pet-settings-C_FrqySO.js +0 -2
  158. package/dashboard/dist/assets/use-reduced-motion-BEOENqBa.js +0 -1
  159. package/dashboard/dist/assets/use-session-efficiency-pref-D8cAb4A9.js +0 -1
  160. package/dashboard/dist/assets/use-usage-limits-DFgOKTtv.js +0 -1
  161. package/dashboard/dist/assets/useTokenFormat-0bPjtaaM.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as c,aI as te,aK as k,j as v,aH as Fe,$ as M,bT as Te,aJ as z,bz as Pe,aO as G,aQ as xe,aT as U,aN as Le,bW as Ne,bX as Be,aL as j,bY as _e,bZ as le,aM as ue,aS as pe,b_ as Q,b$ as Ue,c0 as Ve,bw as Ye,be,bf as Xe,a6 as de,J as fe,bc as J,bd as $e,bi as Ge,c1 as Ke,bj as Je,bP as We,a1 as Ze,bo as ze,_ as Re,c2 as Qe,aP as q,c3 as qe,bs as et,bv as tt,c as $}from"./__vite-browser-external-DUJeOWgd.js";import{g as K,u as nt,c as ot,a as rt,s as st,b as it}from"./safePolygon-CKpREa4K.js";import{i as ye,D as at,P as ct,m as lt,j as ut,k as pt,l as dt,n as ft,o as gt,u as ht,p as mt,c as Tt,t as Pt,x as xt,y as bt}from"./composite-B4Z3F65o.js";import{p as Rt,c as yt}from"./store-C9yWYHfg.js";import{u as vt,a as Ct,g as St}from"./usePositioner-B0j1orGj.js";const ve=c.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Fe,currentIdRef:{current:null},currentContextRef:{current:null}});function Et(n,e){n.current=e.current}function Ot(n){const{children:e,delay:t,timeoutMs:r=0}=n,o=c.useRef(t),p=c.useRef(t),i=c.useRef(null),l=c.useRef(null),f=te();return k(()=>{if(p.current=t,!i.current){o.current=t;return}o.current={open:K(o.current,"open"),close:K(t,"close")}},[t,i,o,p]),v.jsx(ve.Provider,{value:c.useMemo(()=>({hasProvider:!0,delayRef:o,initialDelayRef:p,currentIdRef:i,timeoutMs:r,currentContextRef:l,timeout:f}),[r,f]),children:e})}function It(n,e={open:!1}){const{open:t}=e,r="rootStore"in n?n.rootStore:n,o=r.useState("floatingId"),p=c.useContext(ve),{currentIdRef:i,delayRef:l,timeoutMs:f,initialDelayRef:h,currentContextRef:u,hasProvider:T,timeout:d}=p,[m,s]=c.useState(!1),x=c.useRef(t);return k(()=>{x.current=t},[t]),k(()=>{function a(){u.current?.setIsInstantPhase(!1),i.current=null,u.current=null,l.current=h.current,d.clear()}if(i.current&&!t&&i.current===o){if(s(!1),f){const g=o;return d.start(f,()=>{r.select("open")||i.current&&i.current!==g||a()}),()=>{(x.current||i.current!==g)&&d.clear()}}a()}},[t,o,i,l,f,h,u,d,r]),k(()=>{if(!t)return;const a=u.current,g=i.current;d.clear(),u.current={onOpenChange:r.setOpen,setIsInstantPhase:s},i.current=o,l.current={open:0,close:K(h.current,"close")},g!==null&&g!==o?(s(!0),a?.setIsInstantPhase(!0),a?.onOpenChange(!1,M(Te))):(s(!1),a?.setIsInstantPhase(!1))},[t,o,r,i,l,h,u,d]),k(()=>()=>{if(i.current===o){if(u.current=null,!x.current)return;i.current=null,Et(l,h),d.clear()}},[u,i,l,o,h,d]),c.useMemo(()=>({activeIdRef:i,hasProvider:T,delayRef:l,isInstantPhase:m}),[i,T,l,m])}function wt(n,e){let t=null,r=null,o=!1;return{contextElement:n||void 0,getBoundingClientRect(){const p=n?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=e.axis==="x"||e.axis==="both",l=e.axis==="y"||e.axis==="both",f=["mouseenter","mousemove"].includes(e.dataRef.current.openEvent?.type||"")&&e.pointerType!=="touch";let h=p.width,u=p.height,T=p.x,d=p.y;return t==null&&e.x&&i&&(t=p.x-e.x),r==null&&e.y&&l&&(r=p.y-e.y),T-=t||0,d-=r||0,h=0,u=0,!o||f?(h=e.axis==="y"?p.width:0,u=e.axis==="x"?p.height:0,T=i&&e.x!=null?e.x:T,d=l&&e.y!=null?e.y:d):o&&!f&&(u=e.axis==="x"?p.height:u,h=e.axis==="y"?p.width:h),o=!0,{width:h,height:u,x:T,y:d,top:d,right:T+h,bottom:d+u,left:T}}}}function ge(n){return n!=null&&n.clientX!=null}function Mt(n,e={}){const{enabled:t=!0,axis:r="both"}=e,o="rootStore"in n?n.rootStore:n,p=o.useState("open"),i=o.useState("floatingElement"),l=o.useState("domReferenceElement"),f=o.context.dataRef,h=c.useRef(!1),u=c.useRef(null),[T,d]=c.useState(),[m,s]=c.useState([]),x=z(P=>{o.set("positionReference",P)}),a=z((P,y,E)=>{h.current||f.current.openEvent&&!ge(f.current.openEvent)||o.set("positionReference",wt(E??l,{x:P,y,axis:r,dataRef:f,pointerType:T}))}),g=z(P=>{p?u.current||(a(P.clientX,P.clientY,P.currentTarget),s([])):a(P.clientX,P.clientY,P.currentTarget)}),C=ye(T)?i:p;c.useEffect(()=>{if(!t){x(l);return}if(!C)return;function P(){u.current?.(),u.current=null}const y=Pe(i);function E(S){const I=xe(S);U(i,I)?P():a(S.clientX,S.clientY)}return!f.current.openEvent||ge(f.current.openEvent)?u.current=G(y,"mousemove",E):x(l),P},[C,t,i,f,l,o,a,x,m]),c.useEffect(()=>()=>{o.set("positionReference",null)},[o]),c.useEffect(()=>{t&&!i&&(h.current=!1)},[t,i]),c.useEffect(()=>{!t&&p&&(h.current=!0)},[t,p]);const b=c.useMemo(()=>{function P(y){d(y.pointerType)}return{onPointerDown:P,onPointerEnter:P,onMouseMove:g,onMouseEnter:g}},[g]);return c.useMemo(()=>t?{reference:b,trigger:b}:{},[t,b])}const ee=Ne&&Be;function Dt(n,e={}){const{enabled:t=!0,delay:r}=e,o="rootStore"in n?n.rootStore:n,{events:p,dataRef:i}=o.context,l=c.useRef(!1),f=c.useRef(null),h=c.useRef(!0),u=te();c.useEffect(()=>{const d=o.select("domReferenceElement");if(!t)return;const m=Pe(d);function s(){const g=o.select("domReferenceElement");!o.select("open")&&Ye(g)&&g===le(ue(g))&&(l.current=!0,f.current=g)}function x(){h.current=!0}function a(){h.current=!1}return Le(G(m,"blur",s),ee&&G(m,"keydown",x,!0),ee&&G(m,"pointerdown",a,!0))},[o,t]),c.useEffect(()=>{if(!t)return;function d(m){if(m.reason===be||m.reason===Xe){const s=o.select("domReferenceElement");j(s)&&(f.current=s,l.current=!0)}}return p.on("openchange",d),()=>{p.off("openchange",d)}},[p,t,o]);const T=c.useMemo(()=>{function d(){l.current=!1,f.current=null}return{onMouseLeave(){d()},onFocus(m){const s=m.currentTarget;if(l.current){if(f.current===s)return;d()}const x=xe(m.nativeEvent);if(j(x)){if(ee&&!m.relatedTarget){if(!h.current&&!Ue(x))return}else if(!Ve(x))return}const a=pe(m.relatedTarget,o.context.triggerElements),{nativeEvent:g,currentTarget:C}=m,b=typeof r=="function"?r():r;if(o.select("open")&&a||b===0||b===void 0){o.setOpen(!0,M(Q,g,C));return}u.start(b,()=>{l.current||o.setOpen(!0,M(Q,g,C))})},onBlur(m){d();const s=m.relatedTarget,x=m.nativeEvent,a=j(s)&&s.hasAttribute(_e("focus-guard"))&&s.getAttribute("data-type")==="outside";u.start(0,()=>{const g=o.select("domReferenceElement"),C=le(ue(g));!s&&C===g||U(i.current.floatingContext?.refs.floating.current,C)||U(g,C)||a||pe(s??C,o.context.triggerElements)||o.setOpen(!1,M(Q,x))})}}},[i,r,o,u]);return c.useMemo(()=>t?{reference:T,trigger:T}:{},[t,T])}function kt(n){let e=0;const t=String(n??"");for(let r=0;r<t.length;r+=1)e=Math.imul(31,e)+t.charCodeAt(r)|0;return Math.abs(e)%360}function At(n){const e=String(n??"").trim();if(!e)return"?";const t=e.split(/\s+/).filter(Boolean);if(t.length>=2){const r=t[0][0]||"",o=t[1][0]||"";return`${r}${o}`.toUpperCase()}return e.slice(0,2).toUpperCase()}const he={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 rn({avatarUrl:n,displayName:e,seed:t,size:r="md",proActive:o=!1,className:p}){const i=he[r]||he.md,l=kt(t??e??""),f=typeof n=="string"?n.trim():"",[h,u]=de.useState(!1),T=o===!0?"leaderboard-pro-avatar":null;return de.useEffect(()=>{u(!1)},[f]),f&&!h?v.jsx("img",{src:f,alt:"",referrerPolicy:"no-referrer",onError:()=>u(!0),className:fe("rounded-full object-cover ring-1 ring-white/10",i,p,T)}):v.jsx("div",{className:fe("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",i,p,T),style:{backgroundColor:`hsl(${l} 42% 34%)`},"aria-hidden":!0,children:At(e)})}const Ce=c.createContext(void 0);function W(n){const e=c.useContext(Ce);if(e===void 0&&!n)throw new Error(J(72));return e}const Ht={...Rt,disabled:n=>n.disabled,instantType:n=>n.instantType,isInstantPhase:n=>n.isInstantPhase,trackCursorAxis:n=>n.trackCursorAxis,disableHoverablePopup:n=>n.disableHoverablePopup,lastOpenChangeReason:n=>n.openChangeReason,closeOnClick:n=>n.closeOnClick,closeDelay:n=>n.closeDelay,adaptiveOrigin:n=>n.adaptiveOrigin};class jt extends $e{constructor(e,t,r){const o=new ct;super(Ft(e,o,t,r),Lt(o),Ht)}setOpen=(e,t)=>{at(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,M(be,e))}}function Ft(n,e,t,r=!1){return{...yt(e,t,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...n}}function Lt(n){return{popupRef:c.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:n}}const Nt=Ge(function(e){const{disabled:t=!1,defaultOpen:r=!1,open:o,disableHoverablePopup:p=!1,trackCursorAxis:i="none",actionsRef:l,onOpenChange:f,onOpenChangeComplete:h,handle:u,triggerId:T,defaultTriggerId:d=null,children:m}=e,s=lt((F,L)=>new jt({open:r,openProp:o,activeTriggerId:d,triggerIdProp:T},F,L));s.useControlledProp("openProp",o),s.useControlledProp("triggerIdProp",T),s.useContextCallback("onOpenChange",f),s.useContextCallback("onOpenChangeComplete",h);const x=s.useState("open"),a=!t&&x,g=s.useState("activeTriggerId"),C=s.useState("mounted"),b=s.useState("payload");s.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:p,disabled:t}),ut(s,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:P,transitionStatus:y}=pt(a,s),E=s.useState("isInstantPhase"),S=s.useState("instantType"),I=s.useState("lastOpenChangeReason"),D=c.useRef(null);k(()=>{x&&t&&s.setOpen(!1,M(Ke))},[x,t,s]),k(()=>{y==="ending"&&I===Te||y!=="ending"&&E?(S!=="delay"&&(D.current=S),s.set("instantType","delay")):D.current!==null&&(s.set("instantType",D.current),D.current=null)},[y,E,I,S,s]),k(()=>{a&&g==null&&s.set("payload",void 0)},[s,g,a]),c.useImperativeHandle(l,()=>({unmount:P,close:()=>s.setOpen(!1,M(Je))}),[P,s]);const H=a||C||!t&&i!=="none";return v.jsxs(Ce.Provider,{value:s,children:[u&&v.jsx(dt,{handle:u,store:s}),H&&v.jsx(Bt,{store:s,disabled:t,trackCursorAxis:i}),typeof m=="function"?m({payload:b}):m]})});function Bt({store:n,disabled:e,trackCursorAxis:t}){const r=n.useState("floatingRootContext"),o=ft(r,{enabled:!e,referencePress:()=>n.select("closeOnClick")}),p=Mt(r,{enabled:!e&&t!=="none",axis:t==="none"?void 0:t}),i=c.useMemo(()=>We(p.reference,o.reference),[p.reference,o.reference]);return gt(n,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:o.floating??Ze}),null}const Se=c.createContext(void 0);function _t(){return c.useContext(Se)}const Ut=600,Ee="data-base-ui-tooltip-trigger";function me(n){if("composedPath"in n){const t=n.composedPath();for(let r=0;r<t.length;r+=1){const o=t[r];if(j(o))return o}}const e=n.target;return j(e)?e:null}function Vt(n){let e=n;for(;e;){const t=e.closest(`[${Ee}]`);if(t)return t;const r=e.getRootNode();e="host"in r&&j(r.host)?r.host:null}return null}const Yt=ze(function(e,t){const{render:r,className:o,style:p,handle:i,payload:l,disabled:f,delay:h,closeOnClick:u=!0,closeDelay:T,id:d,...m}=e,s=W(!0),a=nt(i)??s;if(!a)throw new Error(J(82));const g=ht(d),C=a.useState("isTriggerActive",g),b=a.useState("isOpenedByTrigger",g),P=a.useState("floatingRootContext"),y=c.useRef(null),E=T??0,{registerTrigger:S,isMountedByThisTrigger:I}=mt(g,y,a,{payload:l,closeOnClick:u,closeDelay:E}),D=_t(),{activeIdRef:H,delayRef:F,isInstantPhase:L,hasProvider:O}=It(P,{open:b}),N=ot(P);a.useSyncedValue("isInstantPhase",L);const Z=a.useState("disabled"),B=f??Z,ne=Tt(B),oe=a.useState("trackCursorAxis"),we=a.useState("disableHoverablePopup"),_=c.useRef(!1),V=te(),Y=c.useRef(void 0);function re(){return O&&H.current!=null?0:h??D??Ut}function se(R){const w=y.current;if(!w||!R)return!1;const A=Vt(R);return A!==null&&A!==w&&U(w,A)}function Me(R){const w=se(R);return _.current=w,w&&(N.openChangeTimeout.clear(),N.restTimeout.clear(),N.restTimeoutPending=!1,V.clear()),w}const De=rt(P,{enabled:!B,mouseOnly:!0,move:!1,handleClose:!we&&oe!=="both"?st():null,restMs:re,delay(){return T==null&&O?{close:K(F.current,"close")}:{close:E}},triggerElementRef:y,isActiveTrigger:C,isClosing:()=>a.select("transitionStatus")==="ending",shouldOpen(){return!_.current}}),ke=Dt(P,{enabled:!B}).reference,Ae=R=>{const w=_.current,A=me(R),ie=Me(A),X=y.current,je=X&&A&&U(X,A);if(ie&&a.select("open")&&a.select("lastOpenChangeReason")===q){a.setOpen(!1,M(q,R));return}if(w&&!ie&&je&&!ne.current&&!a.select("open")&&X&&ye(Y.current)){const ae=()=>{!_.current&&!ne.current&&!a.select("open")&&a.setOpen(!0,M(q,R,X))},ce=re();ce===0?(V.clear(),ae()):V.start(ce,ae)}},He=a.useState("triggerProps",I);return Re("button",e,{state:{open:b},ref:[t,S,y],props:[De,ke,I||oe!=="none"?He:void 0,{onMouseOver(R){Ae(R.nativeEvent)},onFocus(R){se(me(R.nativeEvent))&&R.preventBaseUIHandler()},onMouseLeave(){_.current=!1,V.clear(),Y.current=void 0},onPointerEnter(R){Y.current=R.pointerType},onPointerDown(R){Y.current=R.pointerType,a.set("closeOnClick",u),u&&!a.select("open")&&a.cancelPendingOpen(R.nativeEvent)},onClick(R){u&&!a.select("open")&&a.cancelPendingOpen(R.nativeEvent)},id:g,[Qe]:B?"":void 0,[Ee]:B?void 0:""},m],stateAttributesMapping:Pt})}),Oe=c.createContext(void 0);function Xt(){const n=c.useContext(Oe);if(n===void 0)throw new Error(J(70));return n}const $t=c.forwardRef(function(e,t){const{keepMounted:r=!1,...o}=e;return W().useState("mounted")||r?v.jsx(Oe.Provider,{value:r,children:v.jsx(qe,{ref:t,...o})}):null}),Ie=c.createContext(void 0);function Gt(){const n=c.useContext(Ie);if(n===void 0)throw new Error(J(71));return n}const Kt=c.forwardRef(function(e,t){const{render:r,className:o,anchor:p,positionMethod:i="absolute",side:l="top",align:f="center",sideOffset:h=0,alignOffset:u=0,collisionBoundary:T="clipping-ancestors",collisionPadding:d=5,arrowPadding:m=5,sticky:s=!1,disableAnchorTracking:x=!1,collisionAvoidance:a=et,style:g,...C}=e,b=W(),P=Xt(),y=b.useState("open"),E=b.useState("mounted"),S=b.useState("trackCursorAxis"),I=b.useState("disableHoverablePopup"),D=b.useState("floatingRootContext"),H=b.useState("instantType"),F=b.useState("transitionStatus"),L=b.useState("adaptiveOrigin"),O=vt({anchor:p,positionMethod:i,floatingRootContext:D,mounted:E,side:l,sideOffset:h,align:f,alignOffset:u,collisionBoundary:T,collisionPadding:d,sticky:s,arrowPadding:m,disableAnchorTracking:x,keepMounted:P,collisionAvoidance:a,adaptiveOrigin:L}),N=c.useMemo(()=>({open:y,side:O.side,align:O.align,anchorHidden:O.anchorHidden,instant:S!=="none"?"tracking-cursor":H}),[y,O.side,O.align,O.anchorHidden,S,H]),Z=Ct(e,N,{styles:O.positionerStyles,transitionStatus:F,props:C,refs:[t,b.useStateSetter("positionerElement")],hidden:!E,inert:!y||S==="both"||I});return v.jsx(Ie.Provider,{value:O,children:Z})}),Jt=c.forwardRef(function(e,t){const{render:r,className:o,style:p,...i}=e,l=W(),{side:f,align:h}=Gt(),u=l.useState("open"),T=l.useState("instantType"),d=l.useState("transitionStatus"),m=l.useState("popupProps"),s=l.useState("floatingRootContext"),x=l.useState("disabled"),a=l.useState("closeDelay");tt({open:u,ref:l.context.popupRef,onComplete(){u&&l.context.onOpenChangeComplete?.(!0)}}),it(s,{enabled:!x,closeDelay:a});const g=l.useStateSetter("popupElement");return Re("div",e,{state:{open:u,side:f,align:h,instant:T,transitionStatus:d},ref:[t,l.context.popupRef,g],props:[xt,m,St(d),i],stateAttributesMapping:bt})}),Wt=function(e){const{delay:t,closeDelay:r,timeout:o=400}=e,p=c.useMemo(()=>({open:t,close:r}),[t,r]);return v.jsx(Se.Provider,{value:t,children:v.jsx(Ot,{delay:p,timeoutMs:o,children:e.children})})};function sn({proActive:n=!1}){return n!==!0?null:v.jsx(Wt,{delay:350,children:v.jsxs(Nt,{children:[v.jsx(Yt,{render:v.jsx("span",{role:"img",tabIndex:0}),className:"leaderboard-pro-badge","aria-label":$("leaderboard.pro.badge_aria"),"aria-description":$("leaderboard.pro.tooltip"),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.stopPropagation()},children:$("leaderboard.pro.badge")}),v.jsx($t,{children:v.jsx(Kt,{side:"top",sideOffset:6,className:"leaderboard-pro-tooltip-layer",children:v.jsx(Jt,{className:"leaderboard-pro-tooltip",children:$("leaderboard.pro.tooltip")})})})]})})}export{rn as L,sn as a};
@@ -0,0 +1,73 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-B-XMJAvL.js","assets/__vite-browser-external-DUJeOWgd.js","assets/__vite-browser-external-DFRX9dp-.css","assets/react-B7SkZTgg.js","assets/AchievementBadge-BaqdyZaV.js","assets/zap-DvX2aYx5.js","assets/flame-CKjAluj_.js","assets/shield-check-YcmLwVZ6.js","assets/use-transform-BHwEAfmO.js","assets/use-reduced-motion-iDZEUyua.js","assets/AchievementsSection-CDUUEfIi.js","assets/format-tokens-mk49THtv.js","assets/DialogTitle-B1iNGD2S.js","assets/composite-B4Z3F65o.js","assets/store-C9yWYHfg.js"])))=>i.map(i=>d[i]);
2
+ import{A as oe,a as E,r as h,as as ie,j as e,c as i,at as ne,a3 as le,a5 as de,au as ce,av as me,J as c,D as xe,P as ge,L as pe,a6 as W,aj as he,l as ue,aw as fe,X as be,i as ye,a9 as ke,ax as ve,ay as je}from"./__vite-browser-external-DUJeOWgd.js";import{A as Ne,f as _e}from"./provider-display-CodMmiRb.js";import{u as we}from"./useCurrency-pwClnCZ5.js";import{u as Z}from"./useTokenFormat-BMvVAe6V.js";import{L as G,a as X}from"./LeaderboardProBadge-h8FfR0au.js";import{P as B}from"./ProviderIcon-BshO2uER.js";import{H as Ae,A as Y,s as Se,c as Me,b as ze,t as Pe,h as Ce}from"./AchievementBadge-BaqdyZaV.js";import{A as De}from"./AchievementsSection-CDUUEfIi.js";import{A as $}from"./arrow-up-right-jPmRN562.js";import{L as Ie}from"./link-2-Dn2soiyd.js";import{C as Te}from"./check-CKwHc4Hv.js";import{D as Le,a as Be,b as $e,c as Ue,d as Fe,e as Re}from"./DialogTitle-B1iNGD2S.js";import"./terminal-B3_fCLFs.js";import"./info-CyDY7NYM.js";import"./safePolygon-CKpREa4K.js";import"./composite-B4Z3F65o.js";import"./store-C9yWYHfg.js";import"./usePositioner-B0j1orGj.js";import"./zap-DvX2aYx5.js";import"./flame-CKjAluj_.js";import"./shield-check-YcmLwVZ6.js";import"./react-B7SkZTgg.js";import"./format-tokens-mk49THtv.js";import"./use-reduced-motion-iDZEUyua.js";const K={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};K.node;const He=oe(K),U="tokentracker_anon_id";let A=null;function F(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)})}function R(){if(A)return A;try{let a=localStorage.getItem(U);return a||(a=F(),localStorage.setItem(U,a)),A=a,a}catch{return A=F(),A}}function q({userId:a}){const{signedIn:r,getAccessToken:o}=E(),[t,s]=h.useState(!1),[l,g]=h.useState(0),[n,x]=h.useState(!1),[u,f]=h.useState(!1),[S,M]=h.useState(!1),[z,I]=h.useState([]),[j,N]=h.useState(!1),P=h.useRef(0),y=h.useCallback(async()=>{if(r)try{const d=await o();if(d)return{accessToken:d,anonId:R()}}catch{}return{anonId:R()}},[r,o]);h.useEffect(()=>{let d=!1;return a?(x(!1),(async()=>{const m=await y();try{const p=await ie({userId:a,...m});if(d)return;g(Number(p?.count)||0),s(!!p?.liked),x(!0)}catch{if(d)return;g(0),s(!1),x(!0)}})(),()=>{d=!0}):(x(!1),()=>{d=!0})},[a,y]);const k=()=>{M(!0),setTimeout(()=>M(!1),450),N(!0),setTimeout(()=>N(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let b=0;b<12;b++){const v=(b*30+Math.random()*20-10)*(Math.PI/180),C=45+Math.random()*45,J=Math.cos(v)*C,Q=Math.sin(v)*C-(10+Math.random()*15),ee=Math.random()*360-180,ae=6+Math.random()*8,re=d[Math.floor(Math.random()*d.length)],te=m[Math.floor(Math.random()*m.length)],se=++P.current;p.push({id:se,tx:J,ty:Q,rot:ee,size:ae,color:re,shape:te})}I(b=>[...b,...p]),setTimeout(()=>{I(b=>b.filter(v=>!p.find(C=>C.id===v.id)))},850)},_=async d=>{f(!0);try{const m=await y(),p=await ne({userId:a,action:d,...m});p&&Number.isFinite(Number(p.count))&&g(Number(p.count)),p&&typeof p.liked=="boolean"&&s(p.liked)}catch{s(m=>!m),g(m=>d==="like"?Math.max(0,m-1):m+1)}finally{f(!1)}},w=d=>{d.stopPropagation(),!(!a||!n||u)&&(t?(s(!1),g(m=>Math.max(0,m-1)),_("unlike")):(s(!0),g(m=>m+1),k(),_("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
3
+ @keyframes tt-like-pop {
4
+ 0% { transform: scale(1); }
5
+ 25% { transform: scale(0.75); }
6
+ 50% { transform: scale(1.35); }
7
+ 75% { transform: scale(0.9); }
8
+ 100% { transform: scale(1); }
9
+ }
10
+ @keyframes tt-particle-fly {
11
+ 0% {
12
+ transform: translate(0, 0) scale(1) rotate(0deg);
13
+ opacity: 1;
14
+ }
15
+ 70% {
16
+ opacity: 0.8;
17
+ }
18
+ 100% {
19
+ transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot));
20
+ opacity: 0;
21
+ }
22
+ }
23
+ @keyframes tt-num-scroll {
24
+ 0% { transform: translateY(8px); opacity: 0; }
25
+ 100% { transform: translateY(0); opacity: 1; }
26
+ }
27
+ .tt-animate-pop {
28
+ animation: tt-like-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
29
+ }
30
+ .tt-particle {
31
+ position: absolute;
32
+ top: 50%;
33
+ left: 50%;
34
+ margin-top: -6px;
35
+ margin-left: -6px;
36
+ pointer-events: none;
37
+ z-index: 50;
38
+ }
39
+ .tt-num-anim {
40
+ animation: tt-num-scroll 0.25s ease-out forwards;
41
+ }
42
+ `}}),z.map(d=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${d.tx}px`,"--ty":`${d.ty}px`,"--rot":`${d.rot}deg`,width:`${d.size}px`,height:`${d.size}px`,backgroundColor:d.shape==="circle"?d.color:"transparent",borderRadius:d.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:d.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:d.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},d.id)),e.jsxs("button",{type:"button",onClick:w,disabled:!n||u,"aria-label":t?i("leaderboard.profile.like.aria_unlike"):i("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:S?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(Ae,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${j?"tt-num-anim":""}`,children:n?l:"·"})]})]})}function Oe({badge:a,badgeLabel:r,className:o="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${o}`,children:[e.jsx(G,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(Y,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Ee({badges:a,isOwn:r=!1,onSelect:o,className:t=""}){const s=Se((Array.isArray(a)?a:[]).filter(l=>l&&Me.has(l.id))).filter(l=>r||(l.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((l,g)=>{const n=(l.tier||0)>=1,x=i(ze(l.id,"name")),u=n?i(`achievements.tier.${Pe(l.tier)}`):i("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:o?()=>o(l):void 0,title:`${x} · ${u}`,"aria-label":i("achievements.badge.aria",{name:x,tier:u}),style:{zIndex:s.length-g},className:"group relative shrink-0 -mr-2.5 rounded-full transition-transform duration-200 ease-out hover:z-30 hover:-translate-y-1 active:scale-95 focus-visible:z-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60",children:e.jsx(Y,{badgeId:l.id,tier:l.tier,locked:!n,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},l.id)})})}const We=W.lazy(()=>ke(()=>import("./BadgeDetailModal-B-XMJAvL.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])));function Ze(a,r,o){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:ve(t,{decimals:2,currency:r,rate:o})}function H(a,r,o){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Ze(t,r,o);const s=r==="USD"?t:t*(o||1);return`${r==="USD"?"$":""}${ye(s,{decimals:1})}`}function Ge(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const o=r.map(s=>({day:s.date,total_tokens:s.total_tokens,models:s.models||null})),t=r[r.length-1]?.date;return fe({dailyRows:o,weeks:52,to:t})}const Xe=`
43
+ @keyframes tt-shimmer {
44
+ 100% { transform: translateX(100%); }
45
+ }
46
+ .tt-shimmer-bar {
47
+ position: relative;
48
+ overflow: hidden;
49
+ }
50
+ .tt-shimmer-bar::after {
51
+ position: absolute;
52
+ top: 0; right: 0; bottom: 0; left: 0;
53
+ transform: translateX(-100%);
54
+ background-image: linear-gradient(
55
+ 90deg,
56
+ rgba(0, 0, 0, 0) 0%,
57
+ rgba(0, 0, 0, 0.02) 20%,
58
+ rgba(0, 0, 0, 0.06) 60%,
59
+ rgba(0, 0, 0, 0) 100%
60
+ );
61
+ animation: tt-shimmer 1.6s infinite;
62
+ content: '';
63
+ }
64
+ .dark .tt-shimmer-bar::after {
65
+ background-image: linear-gradient(
66
+ 90deg,
67
+ rgba(255, 255, 255, 0) 0%,
68
+ rgba(255, 255, 255, 0.02) 20%,
69
+ rgba(255, 255, 255, 0.06) 60%,
70
+ rgba(255, 255, 255, 0) 100%
71
+ );
72
+ }
73
+ `;function Ye({variant:a="modal"}){const r="rounded bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar",o=a==="page";return e.jsxs("div",{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:Xe}}),o?e.jsxs("div",{className:"flex items-start gap-5 px-6 sm:px-8 pt-8 pb-7 animate-fade-in",children:[e.jsx("div",{className:"h-[68px] w-[68px] rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 flex items-start justify-between gap-4 pt-0.5",children:[e.jsxs("div",{className:"min-w-0 space-y-2.5",children:[e.jsx("div",{className:c(r,"h-7 w-48")}),e.jsx("div",{className:c(r,"h-3.5 w-32")})]}),e.jsxs("div",{className:"shrink-0 space-y-1.5 flex flex-col items-end",children:[e.jsx("div",{className:c(r,"h-2.5 w-8")}),e.jsx("div",{className:c(r,"h-7 w-12")})]})]})]}):e.jsxs("div",{className:"flex items-start gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60 animate-fade-in",children:[e.jsx("div",{className:"h-14 w-14 rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2 pt-1",children:[e.jsx("div",{className:c(r,"h-4 w-40")}),e.jsx("div",{className:c(r,"h-3 w-56")})]}),e.jsx("div",{className:c(r,"h-4 w-4 shrink-0 mt-1")})]}),e.jsxs("div",{className:c("space-y-6",o?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"px-6 py-5"),children:[e.jsx("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:Array.from({length:4}).map((t,s)=>e.jsxs("div",{children:[e.jsx("div",{className:c(r,"h-6 w-20")}),e.jsx("div",{className:c(r,"mt-2 h-3 w-14")})]},s))}),e.jsx("div",{className:"space-y-3 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:Array.from({length:3}).map((t,s)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-3 w-24")}),e.jsx("div",{className:c(r,"h-3 w-44")})]},s))}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-44 mb-4")}),e.jsx("div",{className:"grid grid-cols-[repeat(52,1fr)] gap-[2px]",children:Array.from({length:364}).map((t,s)=>e.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},s))})]}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-28 mb-3")}),e.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((t,s)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-4 w-4")}),e.jsx("div",{className:c(r,"h-3 w-16")}),e.jsx("div",{className:c(r,"h-[3px] flex-1")}),e.jsx("div",{className:c(r,"h-3 w-12")})]},s))})]})]})]})}function V(a){if(!a)return null;const r=String(a).match(/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})/i);return r?r[1]:null}function T({children:a}){return e.jsx("h3",{className:"text-[11px] uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400 mb-3",children:a})}function D({value:a,label:r,title:o}){return e.jsxs("div",{children:[e.jsx("div",{title:o,className:"text-2xl font-black tabular-nums tracking-tight leading-none text-oai-black dark:text-white",style:{fontFamily:'"DIN Alternate-Bold", "DIN Alternate", "DIN Condensed-Bold", "Impact", -apple-system, sans-serif',fontWeight:900},children:a}),e.jsx("div",{className:"mt-1.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r})]})}function L({label:a,children:r}){return e.jsxs("div",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"shrink-0 w-28 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"min-w-0 flex-1 text-oai-gray-900 dark:text-oai-gray-100 tabular-nums truncate flex items-baseline gap-2 flex-wrap",children:r})]})}function Ke({user:a,onClose:r}){const o=V(a?.github_url);return e.jsxs("div",{className:"flex items-center gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60",children:[e.jsx(G,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"lg",proActive:a?.pro_active===!0,className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:a?.display_name||"—"}),e.jsx(X,{proActive:a?.pro_active===!0}),a?.rank?e.jsx("span",{className:c("shrink-0 inline-flex items-center px-2 py-0.5 rounded text-xs font-bold font-mono uppercase tracking-wider border shadow-sm",a.rank===1&&"bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400 dark:bg-amber-400/10",a.rank===2&&"bg-slate-500/10 text-slate-600 border-slate-500/20 dark:text-slate-400 dark:bg-slate-400/10",a.rank===3&&"bg-orange-500/10 text-orange-700 border-orange-500/20 dark:text-orange-400 dark:bg-orange-400/10",a.rank>3&&"bg-oai-gray-100 dark:bg-oai-gray-900/60 text-oai-gray-500 dark:text-oai-gray-400 border-oai-gray-200/60 dark:border-oai-gray-800"),children:i("leaderboard.profile_modal.rank",{rank:a.rank})}):null]}),o&&e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-[12px] text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200 transition-colors",children:[e.jsx(B,{provider:"GITHUB",size:11}),e.jsxs("span",{children:["@",o]})]})]}),a?.user_id&&e.jsx("div",{className:"shrink-0 flex items-center justify-center",children:e.jsx(q,{userId:a.user_id})}),r&&e.jsx("button",{type:"button",onClick:r,className:"shrink-0 -mr-1 -mt-1 flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors group","aria-label":i("leaderboard.profile_modal.close"),children:e.jsx(be,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function qe({user:a,topBadge:r}){const o=V(a?.github_url),t=Number(a?.rank)||0,s=t===1?"text-amber-500 dark:text-amber-400":t===2?"text-slate-500 dark:text-slate-300":t===3?"text-orange-600 dark:text-orange-400":"text-oai-gray-400 dark:text-oai-gray-500";return e.jsxs("div",{className:"flex items-center gap-5 px-6 sm:px-8 pt-8 pb-7",children:[e.jsx(Oe,{badge:r,avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"xl",proActive:a?.pro_active===!0,className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"truncate text-2xl sm:text-[28px] font-semibold tracking-tight leading-tight text-oai-black dark:text-white",children:a?.display_name||"—"}),e.jsx(X,{proActive:a?.pro_active===!0}),a?.user_id&&e.jsx(q,{userId:a.user_id})]}),o?e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(B,{provider:"GITHUB",size:13}),e.jsxs("span",{children:["@",o]})]}):null]}),t?e.jsxs("div",{className:"shrink-0 text-right leading-none",children:[e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-oai-gray-400 dark:text-oai-gray-500",children:i("leaderboard.profile.hero.rank_label")}),e.jsx("div",{className:c("mt-1.5 text-3xl font-black tabular-nums tracking-tight",s),children:i("leaderboard.profile_modal.rank",{rank:t})})]}):null]})]})}function Ve({data:a}){const{formatTokens:r,formatTokensTooltip:o}=Z(),t=Array.isArray(a)?a:[];return t.length===0?e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i("leaderboard.profile_modal.providers.none")}):e.jsx("ul",{className:"space-y-2",children:t.map(s=>{const l=Math.max(0,Math.min(1,Number(s?.percent)||0));return e.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center w-4 h-4",children:e.jsx(B,{provider:String(s.source).toUpperCase(),size:14})}),e.jsx("span",{className:"w-20 shrink-0 text-oai-gray-700 dark:text-oai-gray-300",children:_e(s.source)}),e.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:e.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(l*100).toFixed(1)}%`}})}),e.jsx("span",{title:o(s.total_tokens),className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:r(s.total_tokens)}),e.jsxs("span",{className:"shrink-0 w-10 text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[(l*100).toFixed(0),"%"]})]},s.source)})})}function O({icon:a,label:r,value:o}){const[t,s]=h.useState(!1),l=async()=>{await je(o)&&(s(!0),setTimeout(()=>s(!1),1600))};return e.jsxs("button",{type:"button",onClick:l,className:c("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",t?"border-emerald-500/30 text-emerald-600 dark:text-emerald-400 bg-emerald-500/[0.06]":"border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-gray-900 dark:hover:text-oai-gray-100 hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[t?e.jsx(Te,{size:13,strokeWidth:2,"aria-hidden":!0}):e.jsx(a,{size:13,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t?i("leaderboard.profile_modal.badge.copied"):r})]})}function Je({data:a,currency:r,rate:o,onClose:t,variant:s="modal"}){const{formatTokens:l,formatTokensTooltip:g}=Z(),{user:n,totals:x,streak:u,best_day:f,models:S,by_provider:M,heatmap:z,period:I}=a,j=s==="page",N=h.useMemo(()=>Ge(z),[z]),P=S?.favorite?.model_name,y=Number(S?.count)||0,k=Array.isArray(a.badges)?a.badges:[],[_,w]=h.useState(null),d=E(),m=!!(d?.user?.id&&n?.user_id&&d.user.id===n.user_id),p=n?.user_id?`https://www.tokentracker.cc/u/${n.user_id}`:null,b=n?.user_id?`[![My AI coding usage](${xe()}/functions/tokentracker-embed-svg?user_id=${n.user_id}&theme=dark)](${p}?ref=readme)`:null;return e.jsxs(e.Fragment,{children:[j?e.jsx(qe,{user:n,topBadge:Ce(k)}):e.jsx(Ke,{user:n,onClose:t}),e.jsxs("div",{className:c("space-y-6",j?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"flex-1 min-h-0 overflow-y-auto oai-scrollbar px-6 py-5"),children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-4",children:[e.jsx(D,{value:l(x?.total_tokens),title:g(x?.total_tokens),label:i("leaderboard.profile_modal.stat.total_tokens")}),e.jsx(D,{value:H(x?.estimated_cost_usd,r,o),label:i("leaderboard.profile_modal.stat.total_cost")}),e.jsx(D,{value:String(x?.active_days??0),label:i("leaderboard.profile_modal.stat.active_days")}),e.jsx(D,{value:H(x?.avg_per_day_usd,r,o),label:i("leaderboard.profile_modal.stat.avg_per_day")})]}),e.jsxs("dl",{className:"space-y-2 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsxs(L,{label:i("leaderboard.profile_modal.streak.current"),children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:i("leaderboard.profile_modal.streak.days",{count:u?.current_days??0})}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",u?.longest_days??0,")"]})]}),e.jsx(L,{label:i("leaderboard.profile_modal.best_day.title"),children:f?e.jsxs(e.Fragment,{children:[e.jsx("span",{title:g(f.total_tokens),className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:l(f.total_tokens)}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",f.date]})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:i("leaderboard.profile_modal.best_day.none")})}),e.jsx(L,{label:i("leaderboard.profile_modal.models.favorite"),children:P?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30 truncate max-w-[200px] inline-block align-bottom",children:P}),y>1&&e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:i("leaderboard.profile_modal.models.count",{count:y})})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:i("leaderboard.profile_modal.models.none")})})]}),(m||k.some(v=>(v?.tier||0)>=1))&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(T,{children:i("achievements.section.title")}),j?e.jsx(De,{achievements:k,isOwn:m&&!!a.badges_include_unearned,scope:"cloud",onSelect:w}):e.jsx(Ee,{badges:k,isOwn:m&&!!a.badges_include_unearned,onSelect:w})]}),N&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(T,{children:i("leaderboard.profile_modal.heatmap.title")}),e.jsx("div",{className:"min-w-0",children:e.jsx(Ne,{heatmap:N,hideLegend:!0,embedded:!0})})]}),e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(T,{children:i("leaderboard.profile_modal.providers.title")}),e.jsx(Ve,{data:M})]}),n?.user_id&&(t||m)&&e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-3",children:[t&&(ge()?e.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",onClick:t,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:i("leaderboard.profile_modal.view_full")}),e.jsx($,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]}):e.jsxs(pe,{to:`/u/${n.user_id}`,onClick:t,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:i("leaderboard.profile_modal.view_full")}),e.jsx($,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})),m&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{icon:Ie,label:i("leaderboard.profile_modal.badge.copy_url"),value:p}),e.jsx(O,{icon:He,label:i("leaderboard.profile_modal.badge.copy"),value:b})]})]})]}),_&&e.jsx(W.Suspense,{fallback:null,children:e.jsx(We,{badge:_,onClose:()=>w(null)})})]})}function Qe({userId:a,period:r,accessToken:o,enabled:t=!0}){const[s,l]=h.useState({loading:!1,error:null,data:null}),g=h.useMemo(()=>le(),[]),n=h.useMemo(()=>de(),[]);return h.useEffect(()=>{if(!t||!a)return;let x=!0;return l({loading:!0,error:null,data:null}),(async()=>{try{const u=o?await ce(o):null;if(!x)return;const f=await me({accessToken:u,userId:a,period:r||"week",timeZone:g,tzOffsetMinutes:n});if(!x)return;l({loading:!1,error:null,data:f})}catch(u){if(!x)return;u?.status===404?l({loading:!1,error:null,data:null}):l({loading:!1,error:u?.message||String(u),data:null})}})(),()=>{x=!1}},[t,a,r,o,g,n]),s}function _a({isOpen:a,onClose:r,userId:o,period:t,accessToken:s}){const{currency:l,rate:g}=we(),n=Qe({userId:o,period:t,accessToken:s,enabled:a});return e.jsx(Le,{open:a,onOpenChange:x=>{x||r?.()},children:e.jsxs(Be,{children:[e.jsx($e,{className:"cost-modal-backdrop"}),e.jsx(Ue,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(Fe,{className:c("cost-modal-popup","relative w-full max-w-[540px] max-h-[calc(100vh-2rem)] flex flex-col","rounded-2xl bg-white dark:bg-oai-gray-950","shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)]","ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden","dark:border-t dark:border-white/[0.08]"),children:[e.jsx(Re,{render:e.jsx("h2",{className:"sr-only"}),children:n.data?.user?.display_name||i("leaderboard.profile_modal.loading")}),n.loading&&e.jsx(Ye,{}),!n.loading&&n.error&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:i("leaderboard.profile_modal.error")})}),!n.loading&&!n.error&&!n.data&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:i("leaderboard.profile_modal.empty")})}),!n.loading&&!n.error&&n.data&&e.jsx(he,{mode:ue.COMPACT,children:e.jsx(Je,{data:n.data,currency:l,rate:g,onClose:r})})]})})]})})}export{_a as LeaderboardProfileModal,Je as ProfileContent,Ye as ProfileSkeleton,Qe as useLeaderboardProfileData};
@@ -1,4 +1,4 @@
1
- import{r as _,j as p,a2 as xe,u as ge,a as ve,$ as be,L as Tt,a3 as we,c as Y,a4 as ye}from"./__vite-browser-external-BW1rxvYq.js";import{u as ke}from"./useCurrency-t1iy_pC3.js";import{H as Me}from"./HeaderGithubStar-CxdmloMy.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-zLdeOiA3.js";import{D as Te}from"./download-x3Gmv-wu.js";import"./provider-display-BWYNyitK.js";import"./useTokenFormat-0bPjtaaM.js";import"./terminal-kUMdPZhq.js";import"./info-BaK8Hoi2.js";import"./LeaderboardAvatar-BqD4dEvQ.js";import"./ProviderIcon-BSI-1Cy8.js";import"./AchievementBadge-DPlXNqoK.js";import"./zap-DFM6AsYo.js";import"./flame-B9o0_EF8.js";import"./AchievementsSection-DoYMz2Rr.js";import"./react-CO1HovF5.js";import"./format-tokens-o9atQGtV.js";import"./use-reduced-motion-BEOENqBa.js";import"./arrow-up-right-c39fdiDQ.js";import"./link-2-CV3uvMH3.js";import"./check-8LQ7IvkH.js";import"./DialogTitle-6q0jyME6.js";import"./composite-BgLSXWKA.js";import"./store-DrEEdO_u.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
1
+ import{r as _,j as p,ak as xe,u as ge,a as ve,P as be,L as Tt,al as we,c as Y,am as ye}from"./__vite-browser-external-DUJeOWgd.js";import{u as ke}from"./useCurrency-pwClnCZ5.js";import{H as Me}from"./HeaderGithubStar-B740_G7a.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-OUZvO6u-.js";import{D as Te}from"./download-CJUnX1Bs.js";import"./provider-display-CodMmiRb.js";import"./useTokenFormat-BMvVAe6V.js";import"./terminal-B3_fCLFs.js";import"./info-CyDY7NYM.js";import"./LeaderboardProBadge-h8FfR0au.js";import"./safePolygon-CKpREa4K.js";import"./composite-B4Z3F65o.js";import"./store-C9yWYHfg.js";import"./usePositioner-B0j1orGj.js";import"./ProviderIcon-BshO2uER.js";import"./AchievementBadge-BaqdyZaV.js";import"./zap-DvX2aYx5.js";import"./flame-CKjAluj_.js";import"./shield-check-YcmLwVZ6.js";import"./AchievementsSection-CDUUEfIi.js";import"./react-B7SkZTgg.js";import"./format-tokens-mk49THtv.js";import"./use-reduced-motion-iDZEUyua.js";import"./arrow-up-right-jPmRN562.js";import"./link-2-Dn2soiyd.js";import"./check-CKwHc4Hv.js";import"./DialogTitle-B1iNGD2S.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
2
2
  attribute vec2 a_position;
3
3
  void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
4
4
  `,Ge=`
@@ -418,4 +418,4 @@ import{r as _,j as p,a2 as xe,u as ge,a as ve,$ as be,L as Tt,a3 as we,c as Y,a4
418
418
  [data-metal-fx-reflect-host] {
419
419
  isolation: isolate;
420
420
  }
421
- `;let vt=!1;function dr(){if(vt||typeof document>"u")return;if(document.getElementById(Vt)){vt=!0;return}const t=document.createElement("style");t.id=Vt,t.textContent=cr,document.head.appendChild(t),vt=!0}dr();const ur={position:"absolute",inset:0,width:"100%",height:"100%"},hr={position:"absolute",inset:3},fr={position:"absolute",inset:0,pointerEvents:"none",zIndex:3,borderRadius:"inherit"},ct=new Map;aa((t,e)=>{const a=ct.get(t);a&&Pa(a.handles,t,e,t.opacityMul,a.themeRef.current)});function pr(t){const[e,a]=_.useState(()=>t!=="auto"?t:typeof window>"u"||!window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return _.useEffect(()=>{if(t!=="auto"){a(t);return}if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches?"dark":"light");return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),e}const he=_.forwardRef(function({children:t,variant:e="button",preset:a="chromatic",theme:r="auto",strength:o=1,paused:n=!1,borderRadius:i,normalizeHostStyles:u=!0,reflectionTargets:l,disableGlow:c=!1,shaderScale:h,ringCssPx:f,scale:d=1,className:g,style:x,...m},F){const b=_.useRef(null),P=_.useRef(null),j=_.useRef(null),L=_.useRef(null),C=_.useRef(null),E=_.useRef(null),z=_.useRef("dark"),X=_.useRef(0),[N,$]=_.useState(!1),k=pr(r);z.current=k;const I=e==="circle"?"circle":"pill",W=!c;_.useImperativeHandle(F,()=>b.current,[]);const B=(y,w)=>{if(I==="circle")return Math.min(y,w)/2;const v=typeof i=="number"?i:(()=>{var M;const S=(M=L.current)==null?void 0:M.firstElementChild;if(S){const O=parseFloat(getComputedStyle(S).borderTopLeftRadius);if(Number.isFinite(O)&&O>0)return O}return X.current})();return Math.min(v,Math.min(y,w)/2)};_.useEffect(()=>{ea(a,k)},[a,k]),_.useEffect(()=>{const y=C.current;y&&rt(y,{paused:n})},[n]),_.useEffect(()=>{const y=C.current;if(!y)return;const w={};h!==void 0&&(w.shaderScale=h),f!==void 0&&(w.ringCssPx=f),d!==void 0&&(w.scale=d),Object.keys(w).length>0&&rt(y,w)},[h,f,d]),_.useLayoutEffect(()=>{const y=P.current,w=b.current,v=j.current;if(!y||!w)return;{const T=getComputedStyle(w),A=parseFloat(T.borderTopLeftRadius);X.current=Number.isFinite(A)?A:0}const M=()=>{const T=w.getBoundingClientRect(),A=Math.max(1,Math.round(T.width)),Q=Math.max(1,Math.round(T.height));return{cssWidth:A,cssHeight:Q,cornerRadius:B(A,Q)}},S=M();C.current=Ye({hostCanvas:y,cssWidth:S.cssWidth,cssHeight:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,paused:n,shaderScale:h,ringCssPx:f,scale:d,onFirstCopy:()=>$(!0)}),w.style.setProperty("--mfx-radius",`${S.cornerRadius}px`),w.style.borderRadius=`${S.cornerRadius}px`,v&&(E.current=zt(v,{width:S.cssWidth,height:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,scale:d}));let O=0;const D=new ResizeObserver(()=>{O===0&&(O=requestAnimationFrame(()=>{O=0;const T=M(),A=C.current;A&&(rt(A,{cssWidth:T.cssWidth,cssHeight:T.cssHeight,cornerRadius:T.cornerRadius}),w.style.setProperty("--mfx-radius",`${T.cornerRadius}px`),w.style.borderRadius=`${T.cornerRadius}px`,v&&(v.innerHTML="",E.current=zt(v,{width:T.cssWidth,height:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,scale:d}),A&&E.current&&ct.set(A,{handles:E.current,themeRef:z})))}))});D.observe(w);let U=null;return typeof IntersectionObserver<"u"&&(U=new IntersectionObserver(T=>{const A=C.current;if(A)for(const Q of T)ta(A,Q.isIntersecting)},{rootMargin:"64px"}),U.observe(w)),C.current&&E.current&&(ct.set(C.current,{handles:E.current,themeRef:z}),Ze(C.current)),()=>{D.disconnect(),U?.disconnect(),O!==0&&cancelAnimationFrame(O);const T=C.current;T&&(ct.delete(T),Je(T),Ke(T)),C.current=null,E.current=null,v&&(v.innerHTML="")}},[I]),_.useEffect(()=>{const y=C.current;y&&rt(y,{opacityMul:Math.max(0,Math.min(1,o))})},[o,e]),_.useEffect(()=>{const y=C.current,w=b.current;if(!y||!w||!l||k!=="dark")return;y.onAfterFrame=lr;const v=l.flatMap(M=>M.current?[M.current]:[]);for(const M of v)nr(M,y,w);return()=>{y.onAfterFrame=void 0;for(const M of v)ir(M)}},[l,k]),_.useEffect(()=>{const y=b.current,w=C.current;if(!y||!w)return;const v=B(w.cssWidth,w.cssHeight);rt(w,{cornerRadius:v}),y.style.setProperty("--mfx-radius",`${v}px`),y.style.borderRadius=`${v}px`},[i,k,e,I]);const H=_.useMemo(()=>({...x,"--mfx-strength":String(Math.min(1,Math.max(0,o))),opacity:N?1:0,visibility:N?"visible":"hidden",transition:N?"opacity 0.15s ease-out":"none"}),[x,o,N]);return p.jsxs("div",{...m,ref:b,className:g?`metal-fx-root ${g}`:"metal-fx-root","data-variant":e,"data-shape":I,"data-theme":k,"data-paused":n?"true":void 0,"data-normalize":u?"true":"false",style:H,children:[p.jsx("canvas",{ref:P,className:"metal-fx-canvas",style:ur}),p.jsx("div",{className:"metal-fx-inner","aria-hidden":"true",style:hr}),p.jsx("div",{ref:j,"aria-hidden":"true",style:{...fr,display:W?void 0:"none"}}),p.jsx("div",{ref:L,className:"metal-fx-content",children:t})]})});he.displayName="MetalFx";const et=18;function fe(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"4"}),p.jsx("path",{d:"M12 2v2"}),p.jsx("path",{d:"M12 20v2"}),p.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),p.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),p.jsx("path",{d:"M2 12h2"}),p.jsx("path",{d:"M20 12h2"}),p.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),p.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function pe(){return p.jsx("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function mr(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),p.jsx("path",{d:"M8 21h8"}),p.jsx("path",{d:"M12 17v4"})]})}const xr=[{value:"light",label:"Light",Icon:fe},{value:"dark",label:"Dark",Icon:pe},{value:"system",label:"System",Icon:mr}];function gr(t){return t==="dark"?pe:fe}function vr({theme:t,resolvedTheme:e,onSetTheme:a,className:r="",direction:o="down",align:n="right"}){const[i,u]=_.useState(!1),l=_.useRef(null),c=_.useCallback(()=>u(!1),[]);_.useEffect(()=>{if(!i)return;const f=d=>{l.current&&!l.current.contains(d.target)&&c()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i,c]),_.useEffect(()=>{if(!i)return;const f=d=>{d.key==="Escape"&&c()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[i,c]);const h=gr(e);return p.jsxs("div",{ref:l,className:`relative ${r}`,children:[p.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,onClick:()=>u(f=>!f),className:"flex items-center justify-center w-9 h-9 rounded-lg 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",children:p.jsx(h,{})}),i&&p.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${o==="up"?"bottom-full mb-1":"top-full mt-1"} ${n==="left"?"left-0":"right-0"}`,children:xr.map(({value:f,label:d,Icon:g})=>{const x=t===f;return p.jsxs("button",{type:"button",onClick:()=>{a(f),c()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${x?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[p.jsx(g,{}),p.jsx("span",{children:d})]},f)})})]})}const br="https://github.com/xiufengsun/TokenTracker/releases/latest";function Dr({auth:t,signedIn:e,sessionSoftExpired:a,userId:r}){const{currency:o,rate:n}=ke(),{theme:i,resolvedTheme:u,setTheme:l}=xe(),{openLoginModal:c}=ge(),{signedIn:h,loading:f}=ve(),d=!be(),g=e&&!a,x=_.useMemo(()=>g&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,g]),m=_e({userId:r,period:"total",accessToken:x});return p.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[p.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:p.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsxs(Tt,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[p.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),p.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),p.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:p.jsx(Me,{})})]}),p.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[p.jsxs(Tt,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[p.jsx(we,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),p.jsx("span",{children:Y("leaderboard.profile.nav.back")})]}),d&&p.jsx(he,{variant:"button",preset:"chromatic",theme:"dark",borderRadius:9999,disableGlow:!0,className:"!bg-black",children:p.jsxs("a",{href:br,target:"_blank",rel:"noopener noreferrer",className:"group no-underline inline-flex h-8 items-center gap-1.5 px-3 text-xs font-bold rounded-full bg-black text-white transition-transform duration-200 active:scale-[0.98]",children:[p.jsx(Te,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:translate-y-0.5"}),p.jsx("span",{className:"hidden sm:inline",children:Y("leaderboard.profile.nav.download")})]})}),f?p.jsx("div",{className:"h-8 w-16 animate-pulse rounded-full bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):h?p.jsx(ye,{}):p.jsx("button",{type:"button",onClick:c,className:"inline-flex h-8 min-w-[76px] items-center justify-center px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm select-none",children:Y("header.auth.sign_in_aria")})]})]})}),p.jsx("main",{className:"flex-1 px-4 pt-4 pb-10 sm:pt-6 sm:pb-16",children:p.jsx("div",{className:"mx-auto max-w-3xl",children:p.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[m.loading&&p.jsx(Ce,{variant:"page"}),!m.loading&&m.error&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:Y("leaderboard.profile_modal.error")})}),!m.loading&&!m.error&&!m.data&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Y("leaderboard.profile_modal.empty")})}),!m.loading&&!m.error&&m.data&&p.jsx(Se,{data:m.data,currency:o,rate:n,variant:"page"})]})})}),p.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 px-4 transition-colors duration-200",children:p.jsxs("div",{className:"mx-auto flex max-w-3xl items-center justify-between text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[p.jsx("p",{children:Y("landing.v2.footer.line")}),p.jsx(vr,{theme:i,resolvedTheme:u,onSetTheme:l,direction:"up",align:"right"})]})})]})}export{Dr as LeaderboardProfilePage};
421
+ `;let vt=!1;function dr(){if(vt||typeof document>"u")return;if(document.getElementById(Vt)){vt=!0;return}const t=document.createElement("style");t.id=Vt,t.textContent=cr,document.head.appendChild(t),vt=!0}dr();const ur={position:"absolute",inset:0,width:"100%",height:"100%"},hr={position:"absolute",inset:3},fr={position:"absolute",inset:0,pointerEvents:"none",zIndex:3,borderRadius:"inherit"},ct=new Map;aa((t,e)=>{const a=ct.get(t);a&&Pa(a.handles,t,e,t.opacityMul,a.themeRef.current)});function pr(t){const[e,a]=_.useState(()=>t!=="auto"?t:typeof window>"u"||!window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return _.useEffect(()=>{if(t!=="auto"){a(t);return}if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches?"dark":"light");return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),e}const he=_.forwardRef(function({children:t,variant:e="button",preset:a="chromatic",theme:r="auto",strength:o=1,paused:n=!1,borderRadius:i,normalizeHostStyles:u=!0,reflectionTargets:l,disableGlow:c=!1,shaderScale:h,ringCssPx:f,scale:d=1,className:g,style:x,...m},F){const b=_.useRef(null),P=_.useRef(null),j=_.useRef(null),L=_.useRef(null),C=_.useRef(null),E=_.useRef(null),z=_.useRef("dark"),X=_.useRef(0),[N,$]=_.useState(!1),k=pr(r);z.current=k;const I=e==="circle"?"circle":"pill",W=!c;_.useImperativeHandle(F,()=>b.current,[]);const B=(y,w)=>{if(I==="circle")return Math.min(y,w)/2;const v=typeof i=="number"?i:(()=>{var M;const S=(M=L.current)==null?void 0:M.firstElementChild;if(S){const O=parseFloat(getComputedStyle(S).borderTopLeftRadius);if(Number.isFinite(O)&&O>0)return O}return X.current})();return Math.min(v,Math.min(y,w)/2)};_.useEffect(()=>{ea(a,k)},[a,k]),_.useEffect(()=>{const y=C.current;y&&rt(y,{paused:n})},[n]),_.useEffect(()=>{const y=C.current;if(!y)return;const w={};h!==void 0&&(w.shaderScale=h),f!==void 0&&(w.ringCssPx=f),d!==void 0&&(w.scale=d),Object.keys(w).length>0&&rt(y,w)},[h,f,d]),_.useLayoutEffect(()=>{const y=P.current,w=b.current,v=j.current;if(!y||!w)return;{const T=getComputedStyle(w),A=parseFloat(T.borderTopLeftRadius);X.current=Number.isFinite(A)?A:0}const M=()=>{const T=w.getBoundingClientRect(),A=Math.max(1,Math.round(T.width)),Q=Math.max(1,Math.round(T.height));return{cssWidth:A,cssHeight:Q,cornerRadius:B(A,Q)}},S=M();C.current=Ye({hostCanvas:y,cssWidth:S.cssWidth,cssHeight:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,paused:n,shaderScale:h,ringCssPx:f,scale:d,onFirstCopy:()=>$(!0)}),w.style.setProperty("--mfx-radius",`${S.cornerRadius}px`),w.style.borderRadius=`${S.cornerRadius}px`,v&&(E.current=zt(v,{width:S.cssWidth,height:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,scale:d}));let O=0;const D=new ResizeObserver(()=>{O===0&&(O=requestAnimationFrame(()=>{O=0;const T=M(),A=C.current;A&&(rt(A,{cssWidth:T.cssWidth,cssHeight:T.cssHeight,cornerRadius:T.cornerRadius}),w.style.setProperty("--mfx-radius",`${T.cornerRadius}px`),w.style.borderRadius=`${T.cornerRadius}px`,v&&(v.innerHTML="",E.current=zt(v,{width:T.cssWidth,height:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,scale:d}),A&&E.current&&ct.set(A,{handles:E.current,themeRef:z})))}))});D.observe(w);let U=null;return typeof IntersectionObserver<"u"&&(U=new IntersectionObserver(T=>{const A=C.current;if(A)for(const Q of T)ta(A,Q.isIntersecting)},{rootMargin:"64px"}),U.observe(w)),C.current&&E.current&&(ct.set(C.current,{handles:E.current,themeRef:z}),Ze(C.current)),()=>{D.disconnect(),U?.disconnect(),O!==0&&cancelAnimationFrame(O);const T=C.current;T&&(ct.delete(T),Je(T),Ke(T)),C.current=null,E.current=null,v&&(v.innerHTML="")}},[I]),_.useEffect(()=>{const y=C.current;y&&rt(y,{opacityMul:Math.max(0,Math.min(1,o))})},[o,e]),_.useEffect(()=>{const y=C.current,w=b.current;if(!y||!w||!l||k!=="dark")return;y.onAfterFrame=lr;const v=l.flatMap(M=>M.current?[M.current]:[]);for(const M of v)nr(M,y,w);return()=>{y.onAfterFrame=void 0;for(const M of v)ir(M)}},[l,k]),_.useEffect(()=>{const y=b.current,w=C.current;if(!y||!w)return;const v=B(w.cssWidth,w.cssHeight);rt(w,{cornerRadius:v}),y.style.setProperty("--mfx-radius",`${v}px`),y.style.borderRadius=`${v}px`},[i,k,e,I]);const H=_.useMemo(()=>({...x,"--mfx-strength":String(Math.min(1,Math.max(0,o))),opacity:N?1:0,visibility:N?"visible":"hidden",transition:N?"opacity 0.15s ease-out":"none"}),[x,o,N]);return p.jsxs("div",{...m,ref:b,className:g?`metal-fx-root ${g}`:"metal-fx-root","data-variant":e,"data-shape":I,"data-theme":k,"data-paused":n?"true":void 0,"data-normalize":u?"true":"false",style:H,children:[p.jsx("canvas",{ref:P,className:"metal-fx-canvas",style:ur}),p.jsx("div",{className:"metal-fx-inner","aria-hidden":"true",style:hr}),p.jsx("div",{ref:j,"aria-hidden":"true",style:{...fr,display:W?void 0:"none"}}),p.jsx("div",{ref:L,className:"metal-fx-content",children:t})]})});he.displayName="MetalFx";const et=18;function fe(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"4"}),p.jsx("path",{d:"M12 2v2"}),p.jsx("path",{d:"M12 20v2"}),p.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),p.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),p.jsx("path",{d:"M2 12h2"}),p.jsx("path",{d:"M20 12h2"}),p.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),p.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function pe(){return p.jsx("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function mr(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),p.jsx("path",{d:"M8 21h8"}),p.jsx("path",{d:"M12 17v4"})]})}const xr=[{value:"light",label:"Light",Icon:fe},{value:"dark",label:"Dark",Icon:pe},{value:"system",label:"System",Icon:mr}];function gr(t){return t==="dark"?pe:fe}function vr({theme:t,resolvedTheme:e,onSetTheme:a,className:r="",direction:o="down",align:n="right"}){const[i,u]=_.useState(!1),l=_.useRef(null),c=_.useCallback(()=>u(!1),[]);_.useEffect(()=>{if(!i)return;const f=d=>{l.current&&!l.current.contains(d.target)&&c()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i,c]),_.useEffect(()=>{if(!i)return;const f=d=>{d.key==="Escape"&&c()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[i,c]);const h=gr(e);return p.jsxs("div",{ref:l,className:`relative ${r}`,children:[p.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,onClick:()=>u(f=>!f),className:"flex items-center justify-center w-9 h-9 rounded-lg 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",children:p.jsx(h,{})}),i&&p.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${o==="up"?"bottom-full mb-1":"top-full mt-1"} ${n==="left"?"left-0":"right-0"}`,children:xr.map(({value:f,label:d,Icon:g})=>{const x=t===f;return p.jsxs("button",{type:"button",onClick:()=>{a(f),c()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${x?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[p.jsx(g,{}),p.jsx("span",{children:d})]},f)})})]})}const br="https://github.com/xiufengsun/TokenTracker/releases/latest";function Qr({auth:t,signedIn:e,sessionSoftExpired:a,userId:r}){const{currency:o,rate:n}=ke(),{theme:i,resolvedTheme:u,setTheme:l}=xe(),{openLoginModal:c}=ge(),{signedIn:h,loading:f}=ve(),d=!be(),g=e&&!a,x=_.useMemo(()=>g&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,g]),m=_e({userId:r,period:"total",accessToken:x});return p.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[p.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:p.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsxs(Tt,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[p.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),p.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),p.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:p.jsx(Me,{})})]}),p.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[p.jsxs(Tt,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[p.jsx(we,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),p.jsx("span",{children:Y("leaderboard.profile.nav.back")})]}),d&&p.jsx(he,{variant:"button",preset:"chromatic",theme:"dark",borderRadius:9999,disableGlow:!0,className:"!bg-black",children:p.jsxs("a",{href:br,target:"_blank",rel:"noopener noreferrer",className:"group no-underline inline-flex h-8 items-center gap-1.5 px-3 text-xs font-bold rounded-full bg-black text-white transition-transform duration-200 active:scale-[0.98]",children:[p.jsx(Te,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:translate-y-0.5"}),p.jsx("span",{className:"hidden sm:inline",children:Y("leaderboard.profile.nav.download")})]})}),f?p.jsx("div",{className:"h-8 w-16 animate-pulse rounded-full bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):h?p.jsx(ye,{}):p.jsx("button",{type:"button",onClick:c,className:"inline-flex h-8 min-w-[76px] items-center justify-center px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm select-none",children:Y("header.auth.sign_in_aria")})]})]})}),p.jsx("main",{className:"flex-1 px-4 pt-4 pb-10 sm:pt-6 sm:pb-16",children:p.jsx("div",{className:"mx-auto max-w-3xl",children:p.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[m.loading&&p.jsx(Ce,{variant:"page"}),!m.loading&&m.error&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:Y("leaderboard.profile_modal.error")})}),!m.loading&&!m.error&&!m.data&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Y("leaderboard.profile_modal.empty")})}),!m.loading&&!m.error&&m.data&&p.jsx(Se,{data:m.data,currency:o,rate:n,variant:"page"})]})})}),p.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 px-4 transition-colors duration-200",children:p.jsxs("div",{className:"mx-auto flex max-w-3xl items-center justify-between text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[p.jsx("p",{children:Y("landing.v2.footer.line")}),p.jsx(vr,{theme:i,resolvedTheme:u,onSetTheme:l,direction:"up",align:"right"})]})})]})}export{Qr as LeaderboardProfilePage};
@@ -1,8 +1,8 @@
1
- import{q as z,j as e,e as Te,c as r,k as ae,r as x,W as ot,B,aC as lt,d as D,h as ct,H as ve,L as dt,aD as ut,K as mt,ae as xt}from"./__vite-browser-external-BW1rxvYq.js";import{m as ke}from"./react-CO1HovF5.js";import{P as ge,c as pt,r as re,a as gt,u as ht,b as ft,s as bt}from"./use-usage-limits-DFgOKTtv.js";import{b as k,c as Ee,l as Z,d as He,u as yt}from"./use-limits-display-prefs-CDC0MZRY.js";import{C as Ie}from"./Card-BU2CqxfU.js";import{F as vt}from"./FadeIn-BUm1z22V.js";import{P as Ae}from"./ProviderIcon-BSI-1Cy8.js";import{H as kt}from"./HoverTooltip-CrMdGYZj.js";import{C as jt}from"./ConfirmModal-zUljpLNe.js";import{I as je,L as wt}from"./LocalOnlyNotice-RIj2XT_X.js";import{S as ue}from"./Select-B6CM0ico.js";import{P as Nt}from"./plus-C9qGVLFv.js";import{P as _t,a as Ct,b as Pt,c as Mt,d as St}from"./PopoverPopup-CmUIY8lF.js";import{u as Dt}from"./use-reduced-motion-BEOENqBa.js";import"./use-latest-request-guard-CqZwzrCW.js";import"./DialogTitle-6q0jyME6.js";import"./composite-BgLSXWKA.js";import"./store-DrEEdO_u.js";import"./DialogDescription-COXweCuc.js";import"./arrow-up-right-c39fdiDQ.js";import"./download-x3Gmv-wu.js";import"./SelectItemText-CZ7puxuB.js";import"./check-8LQ7IvkH.js";const Re={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};Re.node;const Tt=z(Re);const Oe={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};Oe.node;const Et=z(Oe);const Le={name:"calendar-clock",size:24,node:[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338",key:"7hb8p4"}],["path",{d:"M3 9h5.859",key:"numkqi"}],["path",{d:"M8 2v3",key:"1ioesn"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]};Le.node;const Fe=z(Le);const $e={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};$e.node;const Ue=z($e);const Be={name:"infinity",size:24,node:[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]};Be.node;const Ge=z(Be),Ht=[3,2,3,3,2,2,3];function I({className:t}){return e.jsx("div",{className:Te("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function It(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-3 w-12 shrink-0"}),e.jsx(I,{className:"flex-1 h-1.5 rounded-full min-w-0"}),e.jsx(I,{className:"h-3 w-[30px] shrink-0"}),e.jsx(I,{className:"h-3 w-6 shrink-0"})]})}function At({bars:t,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(I,{className:"h-[14px] w-[14px] rounded shrink-0"}),e.jsx(I,{className:Te("h-4",i)})]}),Array.from({length:t},(s,n)=>e.jsx(It,{},n))]})}function Rt(){return e.jsx(Ie,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(I,{className:"h-3.5 w-28"}),Ht.map((t,a)=>e.jsx(At,{bars:t,index:a},a))]})})}const he=100;function we(t){const a=Date.parse(t);return Number.isFinite(a)?a:null}function Ot(t){return Math.max(0,Math.min(he,Math.round(t)))}function Lt(t){return new Intl.DateTimeFormat(ae(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t))}function Ft(t,a,i){if(t==null||t>=a)return he;const s=a-t,n=a-i;return Ot(n/s*he)}function $t(t){const a=t.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function Ut(t,{now:a}={}){if(!t||typeof t!="object")return null;const i=$t(t);if(i===void 0)return null;const s=Array.isArray(t.credits)?t.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),o=[];for(const l of s){const c=we(l?.expires_at);if(c==null)continue;const d=o.length+1;o.push({key:`reset-${d}`,label:r("limits.codex_reset_bank.row_label",{index:d}),expiresAt:Lt(c),expiresMs:c,percent:Ft(we(l?.granted_at),c,n)})}return i===0?null:o.length>0?{kind:"rows",availableCount:i??o.length,rows:o}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const W=864e5;function A(t,a){const i=new Date(t),s=i.getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()+a,1,i.getUTCHours(),i.getUTCMinutes())),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(s,o)),n.getTime()}function We(t,a){if(a==="weekly")return t-7*W;if(a==="yearly")return A(t,-12);const i=new Date(t),s=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),0)).getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()-1,1,i.getUTCHours(),i.getUTCMinutes()));return n.setUTCDate(Math.min(i.getUTCDate(),s)),n.getTime()}function ze(t,a){return a==="weekly"?t+7*W:a==="yearly"?A(t,12):A(t,1)}function Bt(t){if(t.startedAt!=null){const a=new Date(t.startedAt).getTime();if(Number.isFinite(a))return a}return We(new Date(t.nextBillingAt).getTime(),t.cycle)}function Gt(t,a,i){if(t.startedAt!=null){const s=new Date(t.startedAt).getTime();if(Number.isFinite(s))return s}return We(i,a)}function Wt(t,a,i){if(a==="weekly"){const c=7*W,d=i<=t?0:Math.floor((i-t)/c);return{startMs:t+d*c,endMs:t+(d+1)*c}}const s=a==="yearly"?12:1,n=s*30.436875*W;let o=i<=t?0:Math.floor((i-t)/n);for(;o>0&&A(t,o*s)>i;)o-=1;let l=0;for(;A(t,(o+1)*s)<=i&&l<12e3;)o+=1,l+=1;return{startMs:A(t,o*s),endMs:A(t,(o+1)*s)}}function ee(t,a){const i=new Date(t.nextBillingAt).getTime();if(!Number.isFinite(i))return null;const s=["weekly","monthly","yearly"].includes(t.cycle)?t.cycle:"monthly",n=Gt(t,s,i);if(!Number.isFinite(n))return null;let o,l,c=!1;t.autoRenew?{startMs:o,endMs:l}=Wt(n,s,a):t.startedAt!=null?(o=n,l=ze(n,s),c=l<=a):(o=n,l=i,c=l<=a);const d=Math.max(1,l-o),m=c?1:Math.max(0,Math.min(1,(a-o)/d));return{endMs:l,startMs:o,progress:m,cycleDays:Math.max(1,Math.round(d/W)),expired:c}}function qe(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.ceil(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function fe(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.floor(i/6e4),n=Math.floor(s/1440),o=Math.floor(s%1440/60),l=s%60;return r("subscriptions.countdown",{days:n,hours:o,minutes:l})}const zt="shrink-0 text-oai-black dark:text-oai-white";function Ve(){const t=typeof navigator>"u"?"":navigator.userAgent||"";return/Windows/i.test(t)?"windows":/Linux/i.test(t)?"linux":"macos"}function Ye(){return Ve()==="windows"?r("limits.commandCode.setupHint.snippet_login_windows"):r("limits.commandCode.setupHint.snippet_login")}function Ke(){return r("limits.devin.setupHint.snippet_login")}function qt(t){const a=re(t);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const s=Math.floor(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function Vt(t,a){const i=a===k.REMAINING?100-t:t;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function te(t,a="used_percent"){return t?a==="utilization"?t.utilization:t.used_percent:null}function ie(t,a="reset_at"){return t?a==="resets_at"?t.resets_at:t.reset_at:null}function me(t){const a=Math.max(0,Math.min(100,Number(t)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function Q(t,{useGrouping:a=!0,maximumFractionDigits:i}={}){const s=Number(t);return Number.isFinite(s)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:i??(s>=100?0:2),useGrouping:a}).format(s):null}function Yt(t){if(!t||typeof t!="object"||!(Number(t.limit_credits)>0))return null;const a={useGrouping:t.unit!=="calls"},i=Q(t.used_credits,a),s=Q(t.limit_credits,a),n=Q(t.remaining_credits,a);if(!i||!s||!n)return null;const o=t.unit==="calls"?"limits.qoder_calls.detail":"limits.codex_credits.detail";return r(o,{used:i,limit:s,remaining:n})}function Kt(t,a,i){return pt({usedPercent:te(t.window,t.pctField),windowSeconds:gt(t,t.window),resetMs:re(ie(t.window,t.resetField)),mode:a,now:i})}function Xe(t){return Number.isFinite(t)?new Intl.DateTimeFormat(ae(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):null}function Xt(t,a,i){const s=[Qe(t,a,i)],n=re(ie(t.window,t.resetField)),o=Xe(n);o&&s.push(r(t.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:o}));const l=Yt(t.window);return l&&s.push(l),s.join(`
1
+ import{A as z,j as e,J as Te,c as r,h as ae,r as x,ai as ot,B,ba as lt,a6 as D,e as ct,a7 as ve,L as dt,bb as ut,G as mt,I as xt}from"./__vite-browser-external-DUJeOWgd.js";import{m as ke}from"./react-B7SkZTgg.js";import{P as ge,c as pt,r as re,a as gt,u as ht,b as ft,s as bt}from"./use-usage-limits-CSxFFn3_.js";import{b as k,c as Ee,l as Z,d as He,u as yt}from"./use-limits-display-prefs-NZ-AAYD5.js";import{C as Ie}from"./Card-D-5mABVt.js";import{F as vt}from"./FadeIn-ChVf45WW.js";import{P as Ae}from"./ProviderIcon-BshO2uER.js";import{H as kt}from"./HoverTooltip-BzP5FudR.js";import{C as jt}from"./ConfirmModal-BQ-xB1S_.js";import{I as je,L as wt}from"./LocalOnlyNotice-BaEq6qN7.js";import{S as ue}from"./Select-CtTceC4T.js";import{P as Nt}from"./plus-Cx82jb7o.js";import{P as _t,a as Ct,b as Pt,c as Mt,d as St}from"./PopoverPopup-CVTiEVHs.js";import{u as Dt}from"./use-reduced-motion-iDZEUyua.js";import"./use-latest-request-guard-DHv7vfFE.js";import"./DialogTitle-B1iNGD2S.js";import"./composite-B4Z3F65o.js";import"./store-C9yWYHfg.js";import"./DialogDescription-j4XnRy6y.js";import"./arrow-up-right-jPmRN562.js";import"./download-CJUnX1Bs.js";import"./SelectItemText-C7xi8iGp.js";import"./usePositioner-B0j1orGj.js";import"./check-CKwHc4Hv.js";import"./safePolygon-CKpREa4K.js";const Re={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};Re.node;const Tt=z(Re);const Oe={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};Oe.node;const Et=z(Oe);const Le={name:"calendar-clock",size:24,node:[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338",key:"7hb8p4"}],["path",{d:"M3 9h5.859",key:"numkqi"}],["path",{d:"M8 2v3",key:"1ioesn"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]};Le.node;const Fe=z(Le);const $e={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};$e.node;const Ue=z($e);const Be={name:"infinity",size:24,node:[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]};Be.node;const Ge=z(Be),Ht=[3,2,3,3,2,2,3];function I({className:t}){return e.jsx("div",{className:Te("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function It(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-3 w-12 shrink-0"}),e.jsx(I,{className:"flex-1 h-1.5 rounded-full min-w-0"}),e.jsx(I,{className:"h-3 w-[30px] shrink-0"}),e.jsx(I,{className:"h-3 w-6 shrink-0"})]})}function At({bars:t,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(I,{className:"h-[14px] w-[14px] rounded shrink-0"}),e.jsx(I,{className:Te("h-4",i)})]}),Array.from({length:t},(s,n)=>e.jsx(It,{},n))]})}function Rt(){return e.jsx(Ie,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(I,{className:"h-3.5 w-28"}),Ht.map((t,a)=>e.jsx(At,{bars:t,index:a},a))]})})}const he=100;function we(t){const a=Date.parse(t);return Number.isFinite(a)?a:null}function Ot(t){return Math.max(0,Math.min(he,Math.round(t)))}function Lt(t){return new Intl.DateTimeFormat(ae(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t))}function Ft(t,a,i){if(t==null||t>=a)return he;const s=a-t,n=a-i;return Ot(n/s*he)}function $t(t){const a=t.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function Ut(t,{now:a}={}){if(!t||typeof t!="object")return null;const i=$t(t);if(i===void 0)return null;const s=Array.isArray(t.credits)?t.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),o=[];for(const l of s){const c=we(l?.expires_at);if(c==null)continue;const d=o.length+1;o.push({key:`reset-${d}`,label:r("limits.codex_reset_bank.row_label",{index:d}),expiresAt:Lt(c),expiresMs:c,percent:Ft(we(l?.granted_at),c,n)})}return i===0?null:o.length>0?{kind:"rows",availableCount:i??o.length,rows:o}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const W=864e5;function A(t,a){const i=new Date(t),s=i.getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()+a,1,i.getUTCHours(),i.getUTCMinutes())),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(s,o)),n.getTime()}function We(t,a){if(a==="weekly")return t-7*W;if(a==="yearly")return A(t,-12);const i=new Date(t),s=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),0)).getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()-1,1,i.getUTCHours(),i.getUTCMinutes()));return n.setUTCDate(Math.min(i.getUTCDate(),s)),n.getTime()}function ze(t,a){return a==="weekly"?t+7*W:a==="yearly"?A(t,12):A(t,1)}function Bt(t){if(t.startedAt!=null){const a=new Date(t.startedAt).getTime();if(Number.isFinite(a))return a}return We(new Date(t.nextBillingAt).getTime(),t.cycle)}function Gt(t,a,i){if(t.startedAt!=null){const s=new Date(t.startedAt).getTime();if(Number.isFinite(s))return s}return We(i,a)}function Wt(t,a,i){if(a==="weekly"){const c=7*W,d=i<=t?0:Math.floor((i-t)/c);return{startMs:t+d*c,endMs:t+(d+1)*c}}const s=a==="yearly"?12:1,n=s*30.436875*W;let o=i<=t?0:Math.floor((i-t)/n);for(;o>0&&A(t,o*s)>i;)o-=1;let l=0;for(;A(t,(o+1)*s)<=i&&l<12e3;)o+=1,l+=1;return{startMs:A(t,o*s),endMs:A(t,(o+1)*s)}}function ee(t,a){const i=new Date(t.nextBillingAt).getTime();if(!Number.isFinite(i))return null;const s=["weekly","monthly","yearly"].includes(t.cycle)?t.cycle:"monthly",n=Gt(t,s,i);if(!Number.isFinite(n))return null;let o,l,c=!1;t.autoRenew?{startMs:o,endMs:l}=Wt(n,s,a):t.startedAt!=null?(o=n,l=ze(n,s),c=l<=a):(o=n,l=i,c=l<=a);const d=Math.max(1,l-o),m=c?1:Math.max(0,Math.min(1,(a-o)/d));return{endMs:l,startMs:o,progress:m,cycleDays:Math.max(1,Math.round(d/W)),expired:c}}function qe(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.ceil(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function fe(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.floor(i/6e4),n=Math.floor(s/1440),o=Math.floor(s%1440/60),l=s%60;return r("subscriptions.countdown",{days:n,hours:o,minutes:l})}const zt="shrink-0 text-oai-black dark:text-oai-white";function Ve(){const t=typeof navigator>"u"?"":navigator.userAgent||"";return/Windows/i.test(t)?"windows":/Linux/i.test(t)?"linux":"macos"}function Ye(){return Ve()==="windows"?r("limits.commandCode.setupHint.snippet_login_windows"):r("limits.commandCode.setupHint.snippet_login")}function Ke(){return r("limits.devin.setupHint.snippet_login")}function qt(t){const a=re(t);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const s=Math.floor(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function Vt(t,a){const i=a===k.REMAINING?100-t:t;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function te(t,a="used_percent"){return t?a==="utilization"?t.utilization:t.used_percent:null}function ie(t,a="reset_at"){return t?a==="resets_at"?t.resets_at:t.reset_at:null}function me(t){const a=Math.max(0,Math.min(100,Number(t)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function Q(t,{useGrouping:a=!0,maximumFractionDigits:i}={}){const s=Number(t);return Number.isFinite(s)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:i??(s>=100?0:2),useGrouping:a}).format(s):null}function Yt(t){if(!t||typeof t!="object"||!(Number(t.limit_credits)>0))return null;const a={useGrouping:t.unit!=="calls"},i=Q(t.used_credits,a),s=Q(t.limit_credits,a),n=Q(t.remaining_credits,a);if(!i||!s||!n)return null;const o=t.unit==="calls"?"limits.qoder_calls.detail":"limits.codex_credits.detail";return r(o,{used:i,limit:s,remaining:n})}function Kt(t,a,i){return pt({usedPercent:te(t.window,t.pctField),windowSeconds:gt(t,t.window),resetMs:re(ie(t.window,t.resetField)),mode:a,now:i})}function Xe(t){return Number.isFinite(t)?new Intl.DateTimeFormat(ae(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):null}function Xt(t,a,i){const s=[Qe(t,a,i)],n=re(ie(t.window,t.resetField)),o=Xe(n);o&&s.push(r(t.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:o}));const l=Yt(t.window);return l&&s.push(l),s.join(`
2
2
  `)}const Je=kt;function Jt({label:t,pct:a,reset:i,mode:s=k.USED,pacePercent:n=null,paceOver:o=!1,title:l=null}){const c=Math.max(0,Math.min(100,Number(a)||0)),d=s===k.REMAINING?100-c:c,m=Math.round(d),h=d>0&&m===0?Math.max(d,.35):d;let f=String(m);d>0&&m===0&&(f=r("limits.bar.sub_one_percent"));const b=n==null?null:Math.max(0,Math.min(100,n));return e.jsxs("div",{className:"group relative flex items-center gap-2",children:[e.jsx(Je,{text:l}),e.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t}),e.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[e.jsx("div",{className:`${Vt(d,s)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${h}%`,minWidth:d>0?"3px":0}}),b!=null&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${b}% - 3px)`,width:"6px"}}),e.jsx("div",{className:`absolute top-0 h-full ${o?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${b}% - 1px)`,width:"2px"}})]})]}),e.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[f,"%"]}),i&&e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i})]})}function Qe(t,a,i){const s=t.label??r(t.labelKey),n=i===k.REMAINING,o=d=>n?100-d:d;if(a.expectedPercent==null){const d=Math.max(0,Math.min(100,Number(te(t.window,t.pctField))||0)),m=me(o(d));return n?r("limits.explain.remaining",{label:s,used:m}):r("limits.explain.used",{label:s,used:m})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:s,eta:a.runsOutEta});const d=me(o(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:s,pct:d})}const l=Math.max(0,Math.min(100,Number(te(t.window,t.pctField))||0)),c=me(o(a.projectedEnd??l));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:s,pct:c})}function Qt({pace:t}){return t.pacePercent!=null}function Zt({rows:t,mode:a,now:i=Date.now()}){if(t.length===0)return null;const s=a===k.REMAINING,n=t.some(Qt);return e.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[t.map(({spec:o,pace:l})=>{const c=Xe(re(ie(o.window,o.resetField)));return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[Qe(o,l,a),c?e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r(o.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:c})]}):null]},o.key)}),n?e.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:r(s?"limits.explain.body_remaining":"limits.explain.body")}):null]})}function G(t){if(!t)return null;const a=Date.now()-new Date(t).getTime();if(a<0)return null;const i=Math.floor(a/6e4);if(i<1)return r("shared.time.now");if(i<60)return r("shared.time.m_ago",{n:i});const s=Math.floor(i/60);if(s<24)return r("shared.time.h_ago",{n:s});const n=Math.floor(s/24);return r("shared.time.d_ago",{n})}const Ne={live:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-emerald-500",pulse:"bg-emerald-400"},stale:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"},cached:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"}},ea={claude:"claude",codex:"codex",antigravity:"agy"};function L({label:t,age:a=null,tone:i="live",tooltip:s=null}){const n=Ne[i]||Ne.live,o=i==="live";return e.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:l=>l.stopPropagation(),children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider border leading-normal ${n.surface}`,children:[o?e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),e.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),t,a?e.jsxs(e.Fragment,{children:[" · ",a]}):null]}),s?e.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[s,e.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]}):null]})}function Ze({name:t,providerId:a,children:i,expandable:s=!1,expanded:n=!1,onToggle:o,badge:l=null,rightAdornment:c=null}){const d=He(a),m=e.jsxs("div",{className:"flex items-center gap-1.5",children:[d?e.jsx(Ae,{provider:d,size:14,className:zt}):null,e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:t}),c?e.jsx("span",{className:"shrink-0",children:c}):null,l]});return s?e.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:o,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[m,i]}):e.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,i]})}function et({subscription:t}){const a=t.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),i=t.autoRenew?Ge:Ue;return e.jsx("span",{role:"img","aria-label":a,title:a,className:`inline-flex translate-y-px ${t.autoRenew?"text-oai-brand-600 dark:text-oai-brand-400":"text-blue-600 dark:text-blue-400"}`,children:e.jsx(i,{size:14,strokeWidth:2,"aria-hidden":!0})})}function tt({subscription:t,now:a,mode:i=k.USED}){const s=ee(t,a);if(!s)return null;const{endMs:n,expired:o}=s,l=!o&&n-a<=3*864e5,c=o?100:s.progress*100,d=i===k.REMAINING?100-c:c,m=o?100:Math.max(0,Math.min(100,d)),h=Math.round(m),f=m>0&&h===0?r("limits.bar.sub_one_percent"):`${h}%`;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:r("subscriptions.inline.label")}),e.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:`${o?"bg-red-500":l?"bg-amber-500":"bg-blue-500"} rounded-full h-full block motion-safe:transition-[width] motion-safe:duration-500 ease-out motion-reduce:transition-none`,style:{width:`${m}%`,minWidth:m>0?"3px":0}})}),e.jsx("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:f}),e.jsx("span",{className:`text-[10px] tabular-nums shrink-0 whitespace-nowrap w-6 text-right ${o?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:qe(n,a)})]})}function at({subscription:t,now:a}){const i=ee(t,a);if(!i)return null;const s=new Intl.DateTimeFormat(ae(),{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:r("subscriptions.inline.label")}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:":"}),e.jsx("span",{children:t.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")}),e.jsx("span",{children:" "}),e.jsx("span",{className:"font-mono tabular-nums",children:s.format(new Date(i.endMs))}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{className:i.expired?"text-oai-error":void 0,children:fe(i.endMs,a)}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{children:t.autoRenew?r("subscriptions.status.auto_renew"):r("subscriptions.status.manual")})]})}const ta=Ee;function R({children:t,tone:a="neutral"}){const i=a==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return e.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:t})}function aa({rows:t,mode:a,extra:i=null}){const s=t.length===0&&!i;return e.jsxs(e.Fragment,{children:[t.map(({spec:n,pace:o})=>e.jsx(Jt,{label:n.label??r(n.labelKey),pct:te(n.window,n.pctField),reset:qt(ie(n.window,n.resetField)),mode:a,pacePercent:o.pacePercent,paceOver:o.paceOver,title:Xt(n,o,a)},n.key)),s?e.jsx(R,{children:r("limits.status.no_data")}):null,i]})}function ra(t){if(!Number.isFinite(t.expiresMs))return null;const a=Math.floor((t.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:t.expiresAt}):r("limits.reset_bank.hover_detail",{date:t.expiresAt,days:a})}function ia({row:t}){const a=Math.max(0,Math.min(100,Number(t.percent)||0));return e.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[e.jsx(Je,{text:ra(t)}),e.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t.label}),e.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${a}%`,minWidth:a>0?"3px":0}})}),e.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:t.expiresAt})]})}function na({model:t}){const a=t.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:t.availableCount}):null;return e.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":t.kind,children:[e.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codex_reset_bank.title")}),a?e.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):t.rows.map(i=>e.jsx(ia,{row:i},i.key))]})}function rt(t,a){if(t==="codex_meta"){const i=Ut(a.reset_credits);return i?e.jsx(na,{model:i}):null}if(t==="kimi_parallel"&&a.parallel_limit)return e.jsx(R,{children:r("limits.label.kimi_parallel",{count:a.parallel_limit})});if(t==="kiro_credits"&&Number.isFinite(Number(a.tracked_credits))&&Number(a.tracked_credit_records)>0){const i=Q(a.tracked_credits,{maximumFractionDigits:2});return e.jsx(R,{children:r("limits.label.kiro_tracked_credits",{credits:i,count:Number(a.tracked_credit_records)})})}return t==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?e.jsx(la,{defaultDir:a.otel_default_dir}):null}function sa(t,a,i,s,n,o,l=null,c=null,d=Date.now()){const m=ge[t];if(!m)return null;const h=m.windows(a).filter(b=>b.window).map(b=>({spec:b,pace:Kt(b,s,d)})),f=rt(m.extra,a);return e.jsxs(Ze,{name:i,providerId:t,expandable:h.length>0||!!c,expanded:n,onToggle:o,badge:l,rightAdornment:c?e.jsx(et,{subscription:c}):null,children:[e.jsx(aa,{mode:s,rows:h,extra:f}),c?e.jsx(tt,{subscription:c,now:d,mode:s}):null,n?e.jsx(Zt,{rows:h,mode:s,now:d}):null,n&&c?e.jsx(at,{subscription:c,now:d}):null]},t)}function xe(t,a,i,s,n=null,o=Date.now(),l=k.USED){const c=!!n;return e.jsxs(Ze,{name:Z(t),providerId:t,expandable:c,expanded:i,onToggle:s,rightAdornment:c?e.jsx(et,{subscription:n}):null,children:[a,c?e.jsx(tt,{subscription:n,now:o,mode:l}):null,c&&i?e.jsx("div",{className:"mt-1",children:e.jsx(at,{subscription:n,now:o})}):null]},t)}function oa(t,a,i,s,n,o=null,l=Date.now()){if(!ge[t])return null;if(!a?.configured)return xe(t,e.jsxs(e.Fragment,{children:[e.jsx(R,{children:r("limits.status.not_connected")}),t==="opencodeGo"?e.jsx(_e,{}):null,t==="commandCode"?e.jsx(Ce,{}):null,t==="codingPlan"?e.jsx(Me,{}):null,t==="agentPlan"?e.jsx(Se,{}):null,t==="devin"?e.jsx(Pe,{}):null]}),s,n,o,l,i);if(t==="opencodeGo"&&a.subscription_status==="inactive")return xe(t,e.jsx(R,{children:r("limits.opencodeGo.status.inactive")}),s,n,o,l,i);if(a.error)return xe(t,e.jsxs(e.Fragment,{children:[e.jsx(R,{tone:"error",children:r("shared.error.prefix",{error:a.error})}),t==="kiro"?rt(ge.kiro.extra,a):null,t==="opencodeGo"?e.jsx(_e,{}):null,t==="commandCode"?e.jsx(Ce,{}):null,t==="codingPlan"?e.jsx(Me,{}):null,t==="agentPlan"?e.jsx(Se,{}):null,t==="devin"?e.jsx(Pe,{}):null]}),s,n,o,l,i);const c=Z(t),d=a.plan_label?`${c} ${a.plan_label}`:c;let m=null;if(a.auth_action_required==="reauth"){const f=t==="commandCode"?Ye():t==="devin"?Ke():ea[t];m=e.jsx(L,{label:r("limits.reauth.badge"),age:G(a.cached_at),tone:"stale",tooltip:f?r("limits.reauth.tooltip",{command:f}):null})}if(!m&&t==="antigravity")if(a.cached){const f=G(a.cached_at);m=e.jsx(L,{label:r("limits.label.antigravity_cached"),age:f,tone:"cached",tooltip:r("limits.tooltip.antigravity_cached")})}else m=e.jsx(L,{label:r("limits.label.antigravity_live"),tone:"live",tooltip:r("limits.tooltip.antigravity_live")});!m&&(t==="qoder"||t==="qoderCn")&&a.cached&&(m=e.jsx(L,{label:r("limits.label.antigravity_cached"),age:G(a.cached_at),tone:"cached",tooltip:r("limits.tooltip.qoder_cached")})),!m&&(t==="codingPlan"||t==="agentPlan")&&a.cached&&(m=e.jsx(L,{label:r("limits.label.antigravity_cached"),age:G(a.cached_at),tone:"cached",tooltip:r("limits.tooltip.ark_cached")}));const h=a.provenance;return h?.stale&&!m&&(m=e.jsx(L,{label:r("limits.provenance.stale"),age:G(h.captured_at),tone:"stale",tooltip:r("limits.provenance.tooltip",{source:h.source,confidence:h.confidence})})),sa(t,a,d,i,s,n,m,o,l)}function la({defaultDir:t}){const[a,i]=x.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${t||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
3
3
  `),o=async l=>{l.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),e.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:n}),e.jsx("button",{type:"button",onClick:o,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function j({n:t,children:a}){return e.jsxs("li",{className:"flex gap-2.5",children:[e.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:t}),e.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function be(){return e.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function _e(){const[t,a]=x.useState(!1),i=["read -r -s OPENCODE_GO_API_KEY","export OPENCODE_GO_API_KEY",'launchctl setenv OPENCODE_GO_API_KEY "$OPENCODE_GO_API_KEY"'].join(`
4
4
  `),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.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:[e.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.opencodeGo.setupHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.opencodeGo.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(j,{n:"1",children:[e.jsx("div",{children:r("limits.opencodeGo.setupHint.step1")}),e.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:n=>n.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:[r("limits.opencodeGo.setupHint.cta"),e.jsx(be,{})]})]}),e.jsx(j,{n:"2",children:e.jsx("div",{children:r("limits.opencodeGo.setupHint.step2")})}),e.jsxs(j,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.opencodeGo.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,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:t?r("limits.opencodeGo.setupHint.copied"):r("limits.opencodeGo.setupHint.copy")})]}),e.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:i}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Ce(){const[t,a]=x.useState(!1),i=Ve(),s=Ye(),n=i==="windows"?r("limits.commandCode.setupHint.snippet_env_windows").replaceAll("\\n",`
5
5
  `):[r("limits.commandCode.setupHint.snippet_read"),r("limits.commandCode.setupHint.snippet_export"),...i==="macos"?[r("limits.commandCode.setupHint.snippet_setenv")]:[]].join(`
6
6
  `),o=async l=>{l.stopPropagation();try{await navigator.clipboard.writeText(n),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.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:[e.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.commandCode.setupHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.commandCode.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(j,{n:"1",children:[e.jsx("div",{children:r("limits.commandCode.setupHint.step1")}),e.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:s})]}),e.jsxs(j,{n:"2",children:[e.jsx("div",{children:r("limits.commandCode.setupHint.step2")}),e.jsx("div",{className:"mt-1.5 flex items-center gap-2",children:e.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:t?r("limits.commandCode.setupHint.copied"):r("limits.commandCode.setupHint.copy")})}),e.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:n}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:i==="windows"?r("limits.commandCode.setupHint.note_windows"):i==="linux"?r("limits.commandCode.setupHint.note_linux"):r("limits.commandCode.setupHint.note_app")})]})]})]})}function Pe(){const t=Ke();return e.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:[e.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.devin.setupHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.devin.setupHint.subtitle")}),e.jsx("ol",{className:"mt-2.5 space-y-2.5",children:e.jsxs(j,{n:"1",children:[e.jsx("div",{children:r("limits.devin.setupHint.step1")}),e.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:t}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.devin.setupHint.note")})]})})]})}function Me(){const[t,a]=x.useState(!1),i=["npm install -g @volcengine/ark-cli","arkcli auth login volc-sso # browser SSO (recommended)","arkcli auth status # verify the session"].join(`
7
7
  `),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.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:[e.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.codingPlan.setupHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.codingPlan.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(j,{n:"1",children:[e.jsx("div",{children:r("limits.codingPlan.setupHint.step1")}),e.jsxs("a",{href:"https://www.volcengine.com/docs/82379/2536875",target:"_blank",rel:"noreferrer",onClick:n=>n.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:[r("limits.codingPlan.setupHint.cta"),e.jsx(be,{})]})]}),e.jsxs(j,{n:"2",children:[e.jsx("div",{children:r("limits.codingPlan.setupHint.step2")}),e.jsx("div",{className:"mt-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.codingPlan.setupHint.step2_remote")})]}),e.jsxs(j,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.codingPlan.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,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:t?r("limits.codingPlan.setupHint.copied"):r("limits.codingPlan.setupHint.copy")})]}),e.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:i}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codingPlan.setupHint.note_app")})]})]})]})}function Se(){const[t,a]=x.useState(!1),i=[r("limits.agentPlan.setupHint.snippet_install"),r("limits.agentPlan.setupHint.snippet_login"),r("limits.agentPlan.setupHint.snippet_status")].join(`
8
- `),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.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:[e.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.agentPlan.setupHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.agentPlan.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(j,{n:"1",children:[e.jsx("div",{children:r("limits.agentPlan.setupHint.step1")}),e.jsxs("a",{href:"https://www.volcengine.com/docs/82379/2536875",target:"_blank",rel:"noreferrer",onClick:n=>n.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:[r("limits.agentPlan.setupHint.cta"),e.jsx(be,{})]})]}),e.jsxs(j,{n:"2",children:[e.jsx("div",{children:r("limits.agentPlan.setupHint.step2")}),e.jsx("div",{className:"mt-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.agentPlan.setupHint.step2_remote")})]}),e.jsxs(j,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.agentPlan.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,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:t?r("limits.agentPlan.setupHint.copied"):r("limits.agentPlan.setupHint.copy")})]}),e.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:i}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.agentPlan.setupHint.note_app")})]})]})]})}function ca(t){const[a,i]=x.useState(0);return x.useLayoutEffect(()=>{const s=t.current;if(!s)return;const n=s.querySelectorAll("[data-limit-label]");let o=0,l=null;if(n.length>0)try{l=document.createElement("canvas").getContext("2d")}catch{l=null}if(l){const d=window.getComputedStyle(n[0]);l.font=`${d.fontStyle} ${d.fontWeight} ${d.fontSize} ${d.fontFamily}`;for(const m of n)o=Math.max(o,l.measureText(m.textContent).width)}const c=Math.ceil(o);i(d=>d===c?d:c)}),a}function da({claude:t,codex:a,cursor:i,gemini:s,kimi:n,kiro:o,grok:l,antigravity:c,copilot:d,zcode:m,opencodeGo:h,commandCode:f,qoder:b,qoderCn:N,codingPlan:T,agentPlan:_,devin:w,order:E,visibility:q,displayMode:V,subscriptions:ne=[],showSubscriptions:F=!0}){const se={claude:t,codex:a,cursor:i,gemini:s,kimi:n,kiro:o,grok:l,antigravity:c,copilot:d,zcode:m,opencodeGo:h,commandCode:f,qoder:b,qoderCn:N,codingPlan:T,agentPlan:_,devin:w},oe=x.useRef(null),C=ca(oe),[le,Y]=x.useState(null),[P,K]=x.useState(()=>Date.now()),ce=Array.isArray(E)&&E.length>0?E:ta,X=V===k.REMAINING?k.REMAINING:k.USED,de=X===k.REMAINING?r("limits.settings.display_mode_remaining"):r("limits.settings.display_mode_used");x.useEffect(()=>{const g=setInterval(()=>K(Date.now()),6e4);return()=>clearInterval(g)},[]);const H=new Map;if(F)for(const g of ne||[]){if(!g?.provider)continue;const M=new Date(g.nextBillingAt).getTime();if(!Number.isFinite(M))continue;const J=H.get(g.provider);if(!J){H.set(g.provider,g);continue}const S=new Date(J.nextBillingAt).getTime(),U=M>P,u=S>P;(U&&(!u||S>M)||!U&&!u&&M>S)&&H.set(g.provider,g)}const $=ce.filter(g=>!q||q[g]!==!1||H.has(g)).map(g=>oa(g,se[g],X,le===g,()=>Y(M=>M===g?null:g),H.get(g)||null,P)).filter(Boolean);return e.jsx(vt,{delay:.15,children:e.jsx(Ie,{children:e.jsxs("div",{ref:oe,className:"flex flex-col gap-3",style:C>0?{"--tt-limits-label-w":`${C}px`}:void 0,children:[e.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[r("limits.panel.title"),r("limits.panel.mode_separator"),de]}),$.length>0?$:e.jsx(R,{children:r("limits.status.all_hidden")})]})})})}async function it(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Subscription request failed with HTTP ${t.status}`);return a}async function ua(){const t=await fetch("/functions/tokentracker-subscription-manager",{headers:{Accept:"application/json"},cache:"no-store"}),a=await it(t);return Array.isArray(a.subscriptions)?a.subscriptions:[]}async function ye(t){const a=await ot();return it(await fetch("/functions/tokentracker-subscription-manager",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function ma(t){return ye({action:"create",subscription:t})}function xa(t,a){return ye({action:"update",id:t,subscription:a})}function pa(t){return ye({action:"delete",id:t})}const pe={plan:"",provider:"",cycle:"monthly",autoRenew:!0,startedAt:""};function ga(t){const a=new Date(t);if(Number.isNaN(a.getTime()))return"";const i=s=>String(s).padStart(2,"0");return`${a.getFullYear()}-${i(a.getMonth()+1)}-${i(a.getDate())}T${i(a.getHours())}:${i(a.getMinutes())}`}function ha({subscriptions:t,onChanged:a}){const[i,s]=x.useState(!1),[n,o]=x.useState(null),[l,c]=x.useState(pe),[d,m]=x.useState(!1),[h,f]=x.useState(!1),[b,N]=x.useState(!1),[T,_]=x.useState(!1),[w,E]=x.useState(null),[q,V]=x.useState(!1),[ne,F]=x.useState(!1),[se,oe]=x.useState(null),[C,le]=x.useState(()=>Date.now()),Y=x.useRef(null),P=ae(),K=x.useMemo(()=>new Intl.DateTimeFormat(P,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),[P]);x.useEffect(()=>{const u=setInterval(()=>le(Date.now()),6e4);return()=>clearInterval(u)},[]),x.useEffect(()=>{if(!i)return;const u=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;Y.current?.scrollIntoView?.({behavior:u?"auto":"smooth",block:"nearest"})},[i,n]);const ce=x.useMemo(()=>Ee.map(u=>{const v=(t||[]).some(y=>y.provider===u&&y.id!==n),p=Z(u);return{value:u,label:v?`${p} ${r("subscriptions.form.provider_taken_suffix")}`:p,disabled:v}}),[P,t,n]),X=x.useMemo(()=>[{value:"weekly",label:r("subscriptions.form.cycle_weekly")},{value:"monthly",label:r("subscriptions.form.cycle_monthly")},{value:"yearly",label:r("subscriptions.form.cycle_yearly")}],[P]),de=x.useMemo(()=>[{value:"true",label:r("subscriptions.form.auto_renew_on")},{value:"false",label:r("subscriptions.form.auto_renew_off")}],[P]),H=x.useCallback(()=>{c(pe),o(null),f(!1),N(!1),_(!1),s(!0)},[]),$=x.useCallback(u=>{c({plan:u.plan||"",provider:u.provider||"",cycle:u.cycle||"monthly",autoRenew:u.autoRenew,startedAt:ga(new Date(Bt(u)).toISOString())}),o(u.id),f(!1),N(!1),_(!1),s(!0)},[]),g=x.useCallback(()=>{s(!1),o(null),c(pe),f(!1),N(!1),_(!1)},[]),M=x.useCallback(async u=>{if(u.preventDefault(),f(!1),!l.provider){N(!0);return}if((t||[]).some(O=>O.provider===l.provider&&O.id!==n)){_(!0);return}const p=new Date(l.startedAt).getTime();if(!Number.isFinite(p)){f(!0);return}const y={service:Z(l.provider),plan:l.plan,provider:l.provider||null,autoRenew:l.autoRenew,cycle:l.cycle,startedAt:p,nextBillingAt:ze(p,l.cycle)};m(!0);try{n?await xa(n,y):await ma(y),g(),await a?.()}catch{f(!0)}finally{m(!1)}},[g,n,l,a,t]),J=x.useCallback(async()=>{if(w){V(!0),F(!1);try{await pa(w.id),w.id===n&&g(),E(null),await a?.()}catch{F(!0)}finally{V(!1)}}},[g,n,a,w]),S=t||[],U=()=>{const u=n?S.find(p=>p.id===n):null,v=u?ee(u,C):null;return e.jsxs("form",{ref:Y,onSubmit:M,className:"grid grid-cols-1 gap-3 px-3 py-3 text-left sm:grid-cols-2",children:[e.jsx("div",{className:"flex items-center justify-between sm:col-span-2",children:e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:n?r("subscriptions.edit"):r("subscriptions.add")})}),v?e.jsxs("div",{className:"sm:col-span-2 rounded-md bg-oai-gray-50 dark:bg-oai-gray-800/50 px-2.5 py-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:u.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")})," ",e.jsx("span",{className:"font-mono tabular-nums",children:K.format(new Date(v.endMs))})," · ",e.jsx("span",{className:v.expired?"text-oai-error":void 0,children:fe(v.endMs,C)})]}):null,e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-provider",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.provider")}),e.jsx(ue,{id:"subscription-provider",value:l.provider,onValueChange:p=>c({...l,provider:String(p)}),options:ce,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsx("div",{className:"sm:col-span-1",children:e.jsx(je,{label:r("subscriptions.form.plan"),value:l.plan,maxLength:120,placeholder:r("subscriptions.form.plan_placeholder"),onChange:p=>c({...l,plan:p.target.value})})}),e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-cycle",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.cycle")}),e.jsx(ue,{id:"subscription-cycle",value:l.cycle,onValueChange:p=>c({...l,cycle:String(p)}),options:X,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-auto-renew",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.auto_renew")}),e.jsx(ue,{id:"subscription-auto-renew",value:String(l.autoRenew),onValueChange:p=>c({...l,autoRenew:p==="true"}),options:de,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(je,{label:r("subscriptions.form.started_at"),type:"datetime-local",value:l.startedAt,required:!0,onChange:p=>c({...l,startedAt:p.target.value})})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 sm:col-span-2",children:[n?e.jsx(B,{type:"button",variant:"secondary",size:"sm",onClick:()=>{const p=S.find(y=>y.id===n);p&&E(p)},className:"!text-red-600 dark:!text-red-400 mr-auto",children:r("subscriptions.delete")}):null,b?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.provider_required")}):null,T?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.provider_taken")}):null,h?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.error")}):null,e.jsx(B,{type:"button",variant:"secondary",size:"sm",onClick:g,children:r("shared.action.cancel")}),e.jsx(B,{type:"submit",size:"sm",disabled:d,children:r("subscriptions.save")})]})]})};return e.jsxs("div",{className:"flex max-h-[min(80vh,42rem)] w-[min(92vw,32rem)] flex-col gap-3 overflow-y-auto rounded-xl border border-oai-gray-200 bg-white p-4 shadow-lg dark:border-oai-gray-700 dark:bg-oai-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"min-w-0",children:e.jsx("span",{className:"block truncate text-sm font-semibold text-oai-black dark:text-white",children:r("limits.page.openSubscriptions")})}),e.jsxs(B,{type:"button",size:"sm",onClick:H,className:"shrink-0 gap-1.5",children:[e.jsx(Nt,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("subscriptions.add")})]})]}),S.length===0&&!(i&&!n)?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-700",children:[e.jsx(Fe,{className:"h-6 w-6 text-oai-gray-300 dark:text-oai-gray-600 mb-2","aria-hidden":!0}),e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:r("subscriptions.empty.title")}),e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("subscriptions.empty.body")})]}):e.jsxs("ul",{className:"flex flex-col gap-1.5",children:[S.map(u=>{const v=ee(u,C);if(!v)return null;const{endMs:p,expired:y}=v,O=y?100:v.progress*100,nt=!y&&p-C<=3*864e5,st=se===u.id;return e.jsxs("li",{className:"rounded-lg border border-oai-gray-100 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button",onClick:()=>$(u),"aria-label":`${r("subscriptions.edit")} ${u.service}`,"aria-expanded":n===u.id,className:"w-full flex flex-col gap-1.5 px-3 py-2.5 text-left cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Ae,{provider:He(u.provider)||"OTHER",size:14}),e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-white truncate",children:u.service}),e.jsx("span",{role:"img","aria-label":u.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),title:u.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),className:`inline-flex shrink-0 translate-y-px ${u.autoRenew?"text-oai-brand-600 dark:text-oai-brand-400":"text-blue-600 dark:text-blue-400"}`,children:u.autoRenew?e.jsx(Ge,{size:14,strokeWidth:2,"aria-hidden":!0}):e.jsx(Ue,{size:14,strokeWidth:2,"aria-hidden":!0})}),u.plan?e.jsx("span",{className:"text-xs rounded-full border border-oai-gray-200 dark:border-oai-gray-700 px-2 py-0.5 text-oai-gray-500 dark:text-oai-gray-400 shrink-0",children:u.plan}):null]}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0",children:r("subscriptions.inline.label")}),e.jsx("span",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1 overflow-hidden",children:e.jsx("span",{className:`${y?"bg-red-500":nt?"bg-amber-500":"bg-blue-500"} rounded-full h-full block transition-[width] duration-500 ease-out`,style:{width:`${O}%`,minWidth:O>0?"3px":0}})}),e.jsx("span",{className:`text-[10px] tabular-nums shrink-0 ${y?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:qe(p,C)})]})]}),n===u.id?e.jsx("div",{className:"border-t border-oai-gray-100 dark:border-oai-gray-800",children:U()}):null,n!==u.id&&st?e.jsxs("div",{className:"px-3 pb-3 flex flex-col gap-2 border-t border-oai-gray-100 dark:border-oai-gray-800",children:[e.jsxs("p",{className:"pt-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:u.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")})," ",e.jsx("span",{className:"font-mono tabular-nums",children:K.format(new Date(p))})," · ",e.jsx("span",{className:y?"text-oai-error":void 0,children:fe(p,C)})," · ",e.jsx("span",{children:u.autoRenew?r("subscriptions.status.auto_renew"):r("subscriptions.status.manual")})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(B,{type:"button",variant:"secondary",size:"sm",onClick:()=>$(u),children:r("subscriptions.edit")})})]}):null]},u.id)}),i&&!n?e.jsx("li",{className:"rounded-lg border border-oai-gray-100 dark:border-oai-gray-800",children:U()}):null]}),e.jsx(jt,{open:!!w,title:r("subscriptions.confirm_delete_title"),description:w?.service||"",error:ne?r("subscriptions.delete_error"):null,confirmLabel:r("subscriptions.delete"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:q,onCancel:()=>{E(null),F(!1)},onConfirm:J})]})}const De=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),fa="x-apple.systempreferences:com.apple.preference.notifications";function ba(){const t=Dt(),a=mt(),i=r("limits.alert.blocked"),s=a?ke.button:ke.div;return e.jsxs(s,{type:a?"button":void 0,onClick:a?()=>xt({type:"action",name:"openURL",value:fa}):void 0,initial:t?!1:{opacity:0,x:14,scale:.9},animate:{opacity:1,x:0,scale:1},transition:{type:"spring",stiffness:320,damping:18},title:i,className:`relative hidden sm:inline-flex min-w-0 max-w-[360px] items-center gap-1.5 rounded-full border border-amber-300/70 bg-amber-50 px-3 py-1.5 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 ${a?"cursor-pointer transition-colors hover:bg-amber-100 dark:hover:bg-amber-500/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60":""}`,children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"truncate",children:i}),e.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-[5px] border-transparent border-l-amber-300/80 dark:border-l-amber-500/40"})]})}function Ba(){const t=lt(),{data:a,error:i,isLoading:s}=ht(t?{initialRefresh:!0,initialState:t,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),n=yt(),o=ft(),[l,c]=D.useState([]),[d,m]=D.useState(!1),[h,f]=D.useState(!1),[b]=ct(),N=D.useRef(0),T=D.useCallback(async()=>{if(!De&&!ve())return;const _=++N.current;try{const w=await ua();if(_!==N.current)return;c(w),m(!1)}catch{if(_!==N.current)return;m(!0)}},[]);return D.useEffect(()=>{T()},[T]),D.useEffect(()=>{b.get("openSubscriptions")==="1"&&f(!0)},[b]),D.useEffect(()=>{o.enabled&&a&&bt(a)},[o.enabled,a]),!De&&!ve()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(wt,{})}):e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:r("nav.limits")}),e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:r("limits.page.subtitle")})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[o.enabled&&o.permissionBlocked?e.jsx(ba,{}):null,e.jsxs(_t,{open:h,onOpenChange:f,children:[e.jsx(Ct,{"aria-label":r("limits.page.openSubscriptions"),title:r("limits.page.openSubscriptions"),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 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:e.jsx(Fe,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(Pt,{children:e.jsx(Mt,{side:"bottom",align:"end",sideOffset:8,className:"z-50",children:e.jsx(St,{children:e.jsx(ha,{subscriptions:l,onChanged:T})})})})]}),e.jsx("button",{type:"button",onClick:()=>{o.setEnabled(!o.enabled)},"aria-label":o.enabled?r("limits.alert.disable"):r("limits.alert.enable"),title:o.enabled?r("limits.alert.disable"):r("limits.alert.enable"),className:`inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 ${o.enabled&&o.permissionBlocked?"text-amber-600 dark:text-amber-400":"text-oai-gray-600 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"}`,children:o.enabled?e.jsx(Et,{className:"h-4 w-4","aria-hidden":!0}):e.jsx(Tt,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(dt,{to:"/settings?section=limits","aria-label":r("limits.page.openSettings"),title:r("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:e.jsx(ut,{className:"h-4 w-4","aria-hidden":!0})})]})]}),s?e.jsx(Rt,{}):e.jsxs(e.Fragment,{children:[i?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:r("shared.error.prefix",{error:i})}):null,d?e.jsx("p",{className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("subscriptions.load_error")}):null,e.jsx(da,{claude:a?.claude,codex:a?.codex,cursor:a?.cursor,gemini:a?.gemini,kimi:a?.kimi,kiro:a?.kiro,grok:a?.grok,antigravity:a?.antigravity,copilot:a?.copilot,zcode:a?.zcode,opencodeGo:a?.opencodeGo,commandCode:a?.commandCode,qoder:a?.qoder,qoderCn:a?.qoderCn,codingPlan:a?.codingPlan,agentPlan:a?.agentPlan,devin:a?.devin,order:n.order,visibility:n.visibility,displayMode:n.displayMode,subscriptions:l,showSubscriptions:n.showSubscriptions!==!1})]})]})})})}export{Ba as LimitsPage};
8
+ `),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.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:[e.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.agentPlan.setupHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.agentPlan.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(j,{n:"1",children:[e.jsx("div",{children:r("limits.agentPlan.setupHint.step1")}),e.jsxs("a",{href:"https://www.volcengine.com/docs/82379/2536875",target:"_blank",rel:"noreferrer",onClick:n=>n.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:[r("limits.agentPlan.setupHint.cta"),e.jsx(be,{})]})]}),e.jsxs(j,{n:"2",children:[e.jsx("div",{children:r("limits.agentPlan.setupHint.step2")}),e.jsx("div",{className:"mt-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.agentPlan.setupHint.step2_remote")})]}),e.jsxs(j,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.agentPlan.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,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:t?r("limits.agentPlan.setupHint.copied"):r("limits.agentPlan.setupHint.copy")})]}),e.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:i}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.agentPlan.setupHint.note_app")})]})]})]})}function ca(t){const[a,i]=x.useState(0);return x.useLayoutEffect(()=>{const s=t.current;if(!s)return;const n=s.querySelectorAll("[data-limit-label]");let o=0,l=null;if(n.length>0)try{l=document.createElement("canvas").getContext("2d")}catch{l=null}if(l){const d=window.getComputedStyle(n[0]);l.font=`${d.fontStyle} ${d.fontWeight} ${d.fontSize} ${d.fontFamily}`;for(const m of n)o=Math.max(o,l.measureText(m.textContent).width)}const c=Math.ceil(o);i(d=>d===c?d:c)}),a}function da({claude:t,codex:a,cursor:i,gemini:s,kimi:n,kiro:o,grok:l,antigravity:c,copilot:d,zcode:m,opencodeGo:h,commandCode:f,qoder:b,qoderCn:N,codingPlan:T,agentPlan:_,devin:w,order:E,visibility:q,displayMode:V,subscriptions:ne=[],showSubscriptions:F=!0}){const se={claude:t,codex:a,cursor:i,gemini:s,kimi:n,kiro:o,grok:l,antigravity:c,copilot:d,zcode:m,opencodeGo:h,commandCode:f,qoder:b,qoderCn:N,codingPlan:T,agentPlan:_,devin:w},oe=x.useRef(null),C=ca(oe),[le,Y]=x.useState(null),[P,K]=x.useState(()=>Date.now()),ce=Array.isArray(E)&&E.length>0?E:ta,X=V===k.REMAINING?k.REMAINING:k.USED,de=X===k.REMAINING?r("limits.settings.display_mode_remaining"):r("limits.settings.display_mode_used");x.useEffect(()=>{const g=setInterval(()=>K(Date.now()),6e4);return()=>clearInterval(g)},[]);const H=new Map;if(F)for(const g of ne||[]){if(!g?.provider)continue;const M=new Date(g.nextBillingAt).getTime();if(!Number.isFinite(M))continue;const J=H.get(g.provider);if(!J){H.set(g.provider,g);continue}const S=new Date(J.nextBillingAt).getTime(),U=M>P,u=S>P;(U&&(!u||S>M)||!U&&!u&&M>S)&&H.set(g.provider,g)}const $=ce.filter(g=>!q||q[g]!==!1||H.has(g)).map(g=>oa(g,se[g],X,le===g,()=>Y(M=>M===g?null:g),H.get(g)||null,P)).filter(Boolean);return e.jsx(vt,{delay:.15,children:e.jsx(Ie,{children:e.jsxs("div",{ref:oe,className:"flex flex-col gap-3",style:C>0?{"--tt-limits-label-w":`${C}px`}:void 0,children:[e.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[r("limits.panel.title"),r("limits.panel.mode_separator"),de]}),$.length>0?$:e.jsx(R,{children:r("limits.status.all_hidden")})]})})})}async function it(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Subscription request failed with HTTP ${t.status}`);return a}async function ua(){const t=await fetch("/functions/tokentracker-subscription-manager",{headers:{Accept:"application/json"},cache:"no-store"}),a=await it(t);return Array.isArray(a.subscriptions)?a.subscriptions:[]}async function ye(t){const a=await ot();return it(await fetch("/functions/tokentracker-subscription-manager",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function ma(t){return ye({action:"create",subscription:t})}function xa(t,a){return ye({action:"update",id:t,subscription:a})}function pa(t){return ye({action:"delete",id:t})}const pe={plan:"",provider:"",cycle:"monthly",autoRenew:!0,startedAt:""};function ga(t){const a=new Date(t);if(Number.isNaN(a.getTime()))return"";const i=s=>String(s).padStart(2,"0");return`${a.getFullYear()}-${i(a.getMonth()+1)}-${i(a.getDate())}T${i(a.getHours())}:${i(a.getMinutes())}`}function ha({subscriptions:t,onChanged:a}){const[i,s]=x.useState(!1),[n,o]=x.useState(null),[l,c]=x.useState(pe),[d,m]=x.useState(!1),[h,f]=x.useState(!1),[b,N]=x.useState(!1),[T,_]=x.useState(!1),[w,E]=x.useState(null),[q,V]=x.useState(!1),[ne,F]=x.useState(!1),[se,oe]=x.useState(null),[C,le]=x.useState(()=>Date.now()),Y=x.useRef(null),P=ae(),K=x.useMemo(()=>new Intl.DateTimeFormat(P,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),[P]);x.useEffect(()=>{const u=setInterval(()=>le(Date.now()),6e4);return()=>clearInterval(u)},[]),x.useEffect(()=>{if(!i)return;const u=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;Y.current?.scrollIntoView?.({behavior:u?"auto":"smooth",block:"nearest"})},[i,n]);const ce=x.useMemo(()=>Ee.map(u=>{const v=(t||[]).some(y=>y.provider===u&&y.id!==n),p=Z(u);return{value:u,label:v?`${p} ${r("subscriptions.form.provider_taken_suffix")}`:p,disabled:v}}),[P,t,n]),X=x.useMemo(()=>[{value:"weekly",label:r("subscriptions.form.cycle_weekly")},{value:"monthly",label:r("subscriptions.form.cycle_monthly")},{value:"yearly",label:r("subscriptions.form.cycle_yearly")}],[P]),de=x.useMemo(()=>[{value:"true",label:r("subscriptions.form.auto_renew_on")},{value:"false",label:r("subscriptions.form.auto_renew_off")}],[P]),H=x.useCallback(()=>{c(pe),o(null),f(!1),N(!1),_(!1),s(!0)},[]),$=x.useCallback(u=>{c({plan:u.plan||"",provider:u.provider||"",cycle:u.cycle||"monthly",autoRenew:u.autoRenew,startedAt:ga(new Date(Bt(u)).toISOString())}),o(u.id),f(!1),N(!1),_(!1),s(!0)},[]),g=x.useCallback(()=>{s(!1),o(null),c(pe),f(!1),N(!1),_(!1)},[]),M=x.useCallback(async u=>{if(u.preventDefault(),f(!1),!l.provider){N(!0);return}if((t||[]).some(O=>O.provider===l.provider&&O.id!==n)){_(!0);return}const p=new Date(l.startedAt).getTime();if(!Number.isFinite(p)){f(!0);return}const y={service:Z(l.provider),plan:l.plan,provider:l.provider||null,autoRenew:l.autoRenew,cycle:l.cycle,startedAt:p,nextBillingAt:ze(p,l.cycle)};m(!0);try{n?await xa(n,y):await ma(y),g(),await a?.()}catch{f(!0)}finally{m(!1)}},[g,n,l,a,t]),J=x.useCallback(async()=>{if(w){V(!0),F(!1);try{await pa(w.id),w.id===n&&g(),E(null),await a?.()}catch{F(!0)}finally{V(!1)}}},[g,n,a,w]),S=t||[],U=()=>{const u=n?S.find(p=>p.id===n):null,v=u?ee(u,C):null;return e.jsxs("form",{ref:Y,onSubmit:M,className:"grid grid-cols-1 gap-3 px-3 py-3 text-left sm:grid-cols-2",children:[e.jsx("div",{className:"flex items-center justify-between sm:col-span-2",children:e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:n?r("subscriptions.edit"):r("subscriptions.add")})}),v?e.jsxs("div",{className:"sm:col-span-2 rounded-md bg-oai-gray-50 dark:bg-oai-gray-800/50 px-2.5 py-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:u.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")})," ",e.jsx("span",{className:"font-mono tabular-nums",children:K.format(new Date(v.endMs))})," · ",e.jsx("span",{className:v.expired?"text-oai-error":void 0,children:fe(v.endMs,C)})]}):null,e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-provider",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.provider")}),e.jsx(ue,{id:"subscription-provider",value:l.provider,onValueChange:p=>c({...l,provider:String(p)}),options:ce,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsx("div",{className:"sm:col-span-1",children:e.jsx(je,{label:r("subscriptions.form.plan"),value:l.plan,maxLength:120,placeholder:r("subscriptions.form.plan_placeholder"),onChange:p=>c({...l,plan:p.target.value})})}),e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-cycle",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.cycle")}),e.jsx(ue,{id:"subscription-cycle",value:l.cycle,onValueChange:p=>c({...l,cycle:String(p)}),options:X,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-auto-renew",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.auto_renew")}),e.jsx(ue,{id:"subscription-auto-renew",value:String(l.autoRenew),onValueChange:p=>c({...l,autoRenew:p==="true"}),options:de,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(je,{label:r("subscriptions.form.started_at"),type:"datetime-local",value:l.startedAt,required:!0,onChange:p=>c({...l,startedAt:p.target.value})})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 sm:col-span-2",children:[n?e.jsx(B,{type:"button",variant:"secondary",size:"sm",onClick:()=>{const p=S.find(y=>y.id===n);p&&E(p)},className:"!text-red-600 dark:!text-red-400 mr-auto",children:r("subscriptions.delete")}):null,b?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.provider_required")}):null,T?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.provider_taken")}):null,h?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.error")}):null,e.jsx(B,{type:"button",variant:"secondary",size:"sm",onClick:g,children:r("shared.action.cancel")}),e.jsx(B,{type:"submit",size:"sm",disabled:d,children:r("subscriptions.save")})]})]})};return e.jsxs("div",{className:"flex max-h-[min(80vh,42rem)] w-[min(92vw,32rem)] flex-col gap-3 overflow-y-auto rounded-xl border border-oai-gray-200 bg-white p-4 shadow-lg dark:border-oai-gray-700 dark:bg-oai-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"min-w-0",children:e.jsx("span",{className:"block truncate text-sm font-semibold text-oai-black dark:text-white",children:r("limits.page.openSubscriptions")})}),e.jsxs(B,{type:"button",size:"sm",onClick:H,className:"shrink-0 gap-1.5",children:[e.jsx(Nt,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("subscriptions.add")})]})]}),S.length===0&&!(i&&!n)?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-700",children:[e.jsx(Fe,{className:"h-6 w-6 text-oai-gray-300 dark:text-oai-gray-600 mb-2","aria-hidden":!0}),e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:r("subscriptions.empty.title")}),e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("subscriptions.empty.body")})]}):e.jsxs("ul",{className:"flex flex-col gap-1.5",children:[S.map(u=>{const v=ee(u,C);if(!v)return null;const{endMs:p,expired:y}=v,O=y?100:v.progress*100,nt=!y&&p-C<=3*864e5,st=se===u.id;return e.jsxs("li",{className:"rounded-lg border border-oai-gray-100 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button",onClick:()=>$(u),"aria-label":`${r("subscriptions.edit")} ${u.service}`,"aria-expanded":n===u.id,className:"w-full flex flex-col gap-1.5 px-3 py-2.5 text-left cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Ae,{provider:He(u.provider)||"OTHER",size:14}),e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-white truncate",children:u.service}),e.jsx("span",{role:"img","aria-label":u.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),title:u.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),className:`inline-flex shrink-0 translate-y-px ${u.autoRenew?"text-oai-brand-600 dark:text-oai-brand-400":"text-blue-600 dark:text-blue-400"}`,children:u.autoRenew?e.jsx(Ge,{size:14,strokeWidth:2,"aria-hidden":!0}):e.jsx(Ue,{size:14,strokeWidth:2,"aria-hidden":!0})}),u.plan?e.jsx("span",{className:"text-xs rounded-full border border-oai-gray-200 dark:border-oai-gray-700 px-2 py-0.5 text-oai-gray-500 dark:text-oai-gray-400 shrink-0",children:u.plan}):null]}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0",children:r("subscriptions.inline.label")}),e.jsx("span",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1 overflow-hidden",children:e.jsx("span",{className:`${y?"bg-red-500":nt?"bg-amber-500":"bg-blue-500"} rounded-full h-full block transition-[width] duration-500 ease-out`,style:{width:`${O}%`,minWidth:O>0?"3px":0}})}),e.jsx("span",{className:`text-[10px] tabular-nums shrink-0 ${y?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:qe(p,C)})]})]}),n===u.id?e.jsx("div",{className:"border-t border-oai-gray-100 dark:border-oai-gray-800",children:U()}):null,n!==u.id&&st?e.jsxs("div",{className:"px-3 pb-3 flex flex-col gap-2 border-t border-oai-gray-100 dark:border-oai-gray-800",children:[e.jsxs("p",{className:"pt-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:u.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")})," ",e.jsx("span",{className:"font-mono tabular-nums",children:K.format(new Date(p))})," · ",e.jsx("span",{className:y?"text-oai-error":void 0,children:fe(p,C)})," · ",e.jsx("span",{children:u.autoRenew?r("subscriptions.status.auto_renew"):r("subscriptions.status.manual")})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(B,{type:"button",variant:"secondary",size:"sm",onClick:()=>$(u),children:r("subscriptions.edit")})})]}):null]},u.id)}),i&&!n?e.jsx("li",{className:"rounded-lg border border-oai-gray-100 dark:border-oai-gray-800",children:U()}):null]}),e.jsx(jt,{open:!!w,title:r("subscriptions.confirm_delete_title"),description:w?.service||"",error:ne?r("subscriptions.delete_error"):null,confirmLabel:r("subscriptions.delete"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:q,onCancel:()=>{E(null),F(!1)},onConfirm:J})]})}const De=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),fa="x-apple.systempreferences:com.apple.preference.notifications";function ba(){const t=Dt(),a=mt(),i=r("limits.alert.blocked"),s=a?ke.button:ke.div;return e.jsxs(s,{type:a?"button":void 0,onClick:a?()=>xt({type:"action",name:"openURL",value:fa}):void 0,initial:t?!1:{opacity:0,x:14,scale:.9},animate:{opacity:1,x:0,scale:1},transition:{type:"spring",stiffness:320,damping:18},title:i,className:`relative hidden sm:inline-flex min-w-0 max-w-[360px] items-center gap-1.5 rounded-full border border-amber-300/70 bg-amber-50 px-3 py-1.5 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 ${a?"cursor-pointer transition-colors hover:bg-amber-100 dark:hover:bg-amber-500/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60":""}`,children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"truncate",children:i}),e.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-[5px] border-transparent border-l-amber-300/80 dark:border-l-amber-500/40"})]})}function Wa(){const t=lt(),{data:a,error:i,isLoading:s}=ht(t?{initialRefresh:!0,initialState:t,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),n=yt(),o=ft(),[l,c]=D.useState([]),[d,m]=D.useState(!1),[h,f]=D.useState(!1),[b]=ct(),N=D.useRef(0),T=D.useCallback(async()=>{if(!De&&!ve())return;const _=++N.current;try{const w=await ua();if(_!==N.current)return;c(w),m(!1)}catch{if(_!==N.current)return;m(!0)}},[]);return D.useEffect(()=>{T()},[T]),D.useEffect(()=>{b.get("openSubscriptions")==="1"&&f(!0)},[b]),D.useEffect(()=>{o.enabled&&a&&bt(a)},[o.enabled,a]),!De&&!ve()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(wt,{})}):e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:r("nav.limits")}),e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:r("limits.page.subtitle")})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[o.enabled&&o.permissionBlocked?e.jsx(ba,{}):null,e.jsxs(_t,{open:h,onOpenChange:f,children:[e.jsx(Ct,{"aria-label":r("limits.page.openSubscriptions"),title:r("limits.page.openSubscriptions"),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 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:e.jsx(Fe,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(Pt,{children:e.jsx(Mt,{side:"bottom",align:"end",sideOffset:8,className:"z-50",children:e.jsx(St,{children:e.jsx(ha,{subscriptions:l,onChanged:T})})})})]}),e.jsx("button",{type:"button",onClick:()=>{o.setEnabled(!o.enabled)},"aria-label":o.enabled?r("limits.alert.disable"):r("limits.alert.enable"),title:o.enabled?r("limits.alert.disable"):r("limits.alert.enable"),className:`inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 ${o.enabled&&o.permissionBlocked?"text-amber-600 dark:text-amber-400":"text-oai-gray-600 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"}`,children:o.enabled?e.jsx(Et,{className:"h-4 w-4","aria-hidden":!0}):e.jsx(Tt,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(dt,{to:"/settings?section=limits","aria-label":r("limits.page.openSettings"),title:r("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:e.jsx(ut,{className:"h-4 w-4","aria-hidden":!0})})]})]}),s?e.jsx(Rt,{}):e.jsxs(e.Fragment,{children:[i?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:r("shared.error.prefix",{error:i})}):null,d?e.jsx("p",{className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("subscriptions.load_error")}):null,e.jsx(da,{claude:a?.claude,codex:a?.codex,cursor:a?.cursor,gemini:a?.gemini,kimi:a?.kimi,kiro:a?.kiro,grok:a?.grok,antigravity:a?.antigravity,copilot:a?.copilot,zcode:a?.zcode,opencodeGo:a?.opencodeGo,commandCode:a?.commandCode,qoder:a?.qoder,qoderCn:a?.qoderCn,codingPlan:a?.codingPlan,agentPlan:a?.agentPlan,devin:a?.devin,order:n.order,visibility:n.visibility,displayMode:n.displayMode,subscriptions:l,showSubscriptions:n.showSubscriptions!==!1})]})]})})})}export{Wa as LimitsPage};
@@ -1 +1 @@
1
- import{r as h,j as e,c as r}from"./__vite-browser-external-BW1rxvYq.js";import{A as p}from"./arrow-up-right-c39fdiDQ.js";import{D as b}from"./download-x3Gmv-wu.js";function I({id:t,value:l,onChange:d,placeholder:c,disabled:i=!1,type:x="text",label:s,error:a,className:g="",...m}){const y=h.useId(),o=t||y,n=a?`${o}-error`:void 0,u=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${i?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${a?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${g}`;return e.jsxs("div",{className:"w-full",children:[s&&e.jsx("label",{htmlFor:o,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:s}),e.jsx("input",{id:o,type:x,value:l,onChange:d,placeholder:c,disabled:i,"aria-invalid":a?!0:void 0,"aria-describedby":n,className:u,...m}),a&&e.jsx("p",{id:n,className:"mt-1.5 text-sm text-oai-error",children:a})]})}const f="https://github.com/xiufengsun/TokenTracker/releases/latest";function _(){const t=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:r("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:t,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:r("local_only.open_app")}),e.jsx(p,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(b,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("local_only.download")})]})]})]})})}export{I,_ as L};
1
+ import{r as h,j as e,c as r}from"./__vite-browser-external-DUJeOWgd.js";import{A as p}from"./arrow-up-right-jPmRN562.js";import{D as b}from"./download-CJUnX1Bs.js";function I({id:t,value:l,onChange:d,placeholder:c,disabled:i=!1,type:x="text",label:s,error:a,className:g="",...m}){const y=h.useId(),o=t||y,n=a?`${o}-error`:void 0,u=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${i?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${a?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${g}`;return e.jsxs("div",{className:"w-full",children:[s&&e.jsx("label",{htmlFor:o,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:s}),e.jsx("input",{id:o,type:x,value:l,onChange:d,placeholder:c,disabled:i,"aria-invalid":a?!0:void 0,"aria-describedby":n,className:u,...m}),a&&e.jsx("p",{id:n,className:"mt-1.5 text-sm text-oai-error",children:a})]})}const f="https://github.com/xiufengsun/TokenTracker/releases/latest";function _(){const t=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:r("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:t,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:r("local_only.open_app")}),e.jsx(p,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(b,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("local_only.download")})]})]})]})})}export{I,_ as L};
@@ -0,0 +1 @@
1
+ import{A as me,aa as xe,a as he,r as o,F as ae,c as a,j as e,J as h}from"./__vite-browser-external-DUJeOWgd.js";import{A as be}from"./arrow-left-BEM-HVmC.js";const te={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};te.node;const fe=me(te),pe=e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),ye=e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),we={google:pe,github:ye},ke={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function ve(i){return ke[i]||String(i||"").replace(/-/g," ")}function je(i){if(typeof i=="string"&&i.trim())return i.trim();if(i&&typeof i=="object"){if(typeof i.token=="string"&&i.token.trim())return i.token.trim();if(typeof i.otp=="string"&&i.otp.trim())return i.otp.trim()}return""}function Ce({title:i,subtitle:D,className:oe="",onSuccess:S,hideLogo:H=!1,initialMode:p="signin",tokenFromUrl:P="",initialEmail:y="",initialCode:v=""}){xe();const{enabled:w,configurationError:se,connectionHost:G,signedIn:j,refreshUser:A,signInWithPassword:Z,signUp:T,signInWithOAuth:U,getPublicAuthConfig:V,sendResetPasswordEmail:$,exchangeResetPasswordToken:W,resetPassword:z}=he(),[n,u]=o.useState(p),[c,k]=o.useState(y),[m,N]=o.useState(""),[E,L]=o.useState(""),[F,ie]=o.useState(""),[R,J]=o.useState(v),[_,x]=o.useState(!1),[K,s]=o.useState(null),[C,b]=o.useState(null),[q,O]=o.useState(!1),[ne,le]=o.useState(!!(p!=="signin"||y)),[M,Q]=o.useState(!0),[I,X]=o.useState([]),[Y,de]=o.useState(8);o.useEffect(()=>{p&&u(p)},[p]),o.useEffect(()=>{y&&k(y)},[y]),o.useEffect(()=>{v&&J(v)},[v]),o.useEffect(()=>{if(!w)return;let r=!0;return Q(!0),(async()=>{const{data:t,error:l}=await V();if(r){if(l||!t)X(["google","github"]);else{const d=Array.isArray(t.oAuthProviders)?t.oAuthProviders:[],f=Array.isArray(t.customOAuthProviders)?t.customOAuthProviders:[];X([...d,...f]),typeof t.passwordMinLength=="number"&&t.passwordMinLength>0&&de(t.passwordMinLength)}Q(!1)}})(),()=>{r=!1}},[w,V]),o.useEffect(()=>{j&&S&&S()},[j,S]);const ee=o.useCallback(()=>{if(typeof window>"u")return"";const r=new URLSearchParams(window.location.search).get("next");return!ae()&&/^\/(cloud|billing\/checkout)(\?|$)/.test(r||"")?`${window.location.origin}/dashboard`:ae()?"tokentracker://auth/callback":`${window.location.origin}/`},[]),re=o.useMemo(()=>typeof window>"u"?"/reset-password":`${window.location.origin}/reset-password`,[]),B=o.useCallback(async r=>{s(null),x(!0);try{const{error:t}=await U(r,ee());t&&s(t.message||String(t))}finally{x(!1)}},[U,ee]);o.useEffect(()=>{if(!w||M||j||typeof window>"u")return;const r=window.location.search;if(!r)return;const t=new URLSearchParams(r),l=t.get("native")==="1",d=t.get("provider");l&&d&&[...I].includes(d)&&B(d)},[w,M,j,I,B]);const ce=o.useCallback(async r=>{r.preventDefault(),s(null),x(!0);try{if(n==="signup"){const{data:l,error:d}=await T({email:c.trim(),password:m,name:F.trim()||void 0});if(d){s(d.message||String(d));return}if(l?.requireEmailVerification){b(a("login.verify_email_pending")),u("signin");return}await A();return}const{error:t}=await Z({email:c.trim(),password:m});if(t){s(t.message||String(t));return}await A()}finally{x(!1)}},[n,c,m,F,T,Z,A]),ge=o.useCallback(async r=>{r.preventDefault(),s(null),x(!0);try{const t=c.trim(),{error:l}=await $({email:t,redirectTo:re});if(l){s(l.message||String(l));return}k(t),b(a("reset_password.request.sent")),u("reset_confirm")}finally{x(!1)}},[c,re,$]),ue=o.useCallback(async r=>{if(r.preventDefault(),s(null),m!==E){s(a("reset_password.error.password_mismatch"));return}x(!0);try{let t=P;if(!t){const{data:d,error:f}=await W({email:c.trim(),code:R.trim()});if(f){s(f.message||String(f));return}if(t=je(d),!t){s(a("reset_password.error.missing_token"));return}}const{error:l}=await z({newPassword:m,otp:t});if(l){s(l.message||String(l));return}O(!0),b(a("reset_password.success"))}finally{x(!1)}},[R,E,c,W,m,z,P]);if(!w)return se?e.jsx("p",{role:"alert",className:"p-4 text-sm leading-6 text-oai-gray-700 dark:text-oai-gray-300",children:a("instance.configuration.invalid")}):null;const g=n==="reset_email"||n==="reset_confirm";return e.jsxs("div",{className:h("w-full bg-white dark:bg-oai-gray-950 p-6 transition-colors duration-200",oe),children:[g&&e.jsxs("button",{type:"button",onClick:()=>{u("signin"),b(null),s(null),O(!1),N(""),L("")},className:"flex items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors mb-4 focus:outline-none",children:[e.jsx(be,{className:"h-3.5 w-3.5"}),a("reset_password.back_to_sign_in")]}),e.jsxs("div",{className:h("mb-6",g?"text-left":"text-center"),children:[!H&&!g&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),e.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white font-oai tracking-tight",children:a("shared.app_name")})]}),e.jsx("h2",{className:h("text-sm font-semibold text-oai-black dark:text-white tracking-tight mb-1",(H||g)&&"text-base font-bold md:text-lg"),children:g?a("reset_password.title"):i||a("login_modal.subtitle")}),!g&&D&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px] mx-auto",children:D}),g&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px]",children:C&&n==="reset_confirm"&&!q?C:a("reset_password.subtitle")})]}),G?e.jsx("p",{className:"mb-4 text-center text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a("instance.connection.destination",{host:G})}):null,C&&(!g||q)&&e.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:C}),K&&e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400 text-center",role:"alert",children:K}),n==="reset_email"&&e.jsxs("form",{onSubmit:ge,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.request.submit")})]}),n==="reset_confirm"&&(q?e.jsx("button",{type:"button",onClick:()=>{u("signin"),O(!1),b(null),s(null),N(""),L("")},className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors text-center shadow-sm",children:a("reset_password.success_cta")}):e.jsxs("form",{onSubmit:ue,className:"space-y-3",children:[!P&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email-confirm",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-code",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.code")}),e.jsx("input",{id:"card-reset-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:R,onChange:r=>J(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.new_password")}),e.jsx("input",{id:"card-reset-password",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:m,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.confirm_password")}),e.jsx("input",{id:"card-reset-password-confirm",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:E,onChange:r=>L(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.reset.submit")})]})),!g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2.5 mb-5",children:M?e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"}),e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"})]}):I.map(r=>e.jsxs("button",{type:"button",disabled:_,onClick:()=>B(r),className:h("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[we[r]||null,a("login.oauth.continue",{provider:ve(r)})]},r))}),ne?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login_modal.divider_email")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[e.jsx("button",{type:"button",className:h("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",n==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{u("signin"),s(null)},children:a("login.tab.sign_in")}),e.jsx("button",{type:"button",className:h("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",n==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{u("signup"),s(null)},children:a("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:ce,className:"space-y-3",children:[n==="signup"&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.name")}),e.jsx("input",{id:"card-name",type:"text",autoComplete:"name",value:F,onChange:r=>ie(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:a("login.field.name_placeholder")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-email",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.password")}),e.jsx("input",{id:"card-password",type:"password",autoComplete:n==="signup"?"new-password":"current-password",required:!0,minLength:n==="signup"?Y:void 0,value:m,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),n==="signup"&&e.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:a("login.password_hint",{min:String(Y)})}),n==="signin"&&e.jsx("div",{className:"mt-1 text-right",children:e.jsx("button",{type:"button",onClick:()=>{u("reset_email"),s(null),b(null)},className:"text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white no-underline bg-transparent border-0 p-0 cursor-pointer focus:outline-none",children:a("login.forgot_password")})})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:n==="signup"?a("login.submit.sign_up"):a("login.submit.sign_in")})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login.divider")})})]}),e.jsxs("button",{type:"button",onClick:()=>le(!0),className:h("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[e.jsx(fe,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),a("login_modal.continue_email")]})]})]})]})}export{Ce as L};