tokentracker-cli 1.3.8 → 1.3.9

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 (112) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-BqLeP5y3.js → AchievementBadge-C6ZoXGzv.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-BwVkM45R.js → AchievementsPage-BkHoOrUq.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-CglgOcQ1.js → AchievementsSection-BmK0_LQF.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-IurF0cmo.js → BadgeDetailModal-DwoD1Nsr.js} +1 -1
  5. package/dashboard/dist/assets/{BotAnimated-C4_NxPuy.js → BotAnimated-m4GXCXTJ.js} +1 -1
  6. package/dashboard/dist/assets/{Card-C-UuIN42.js → Card-D_SqQIBC.js} +1 -1
  7. package/dashboard/dist/assets/{CloudCheckoutPage-CrMDquLi.js → CloudCheckoutPage-BSYvxA_x.js} +1 -1
  8. package/dashboard/dist/assets/{CloudPage-D6xTPnMs.js → CloudPage-Bwnj7Ocg.js} +2 -2
  9. package/dashboard/dist/assets/{CommandPalette-8LFLY-LQ.js → CommandPalette-CBMCbek2.js} +1 -1
  10. package/dashboard/dist/assets/{CommunityStatsModal-DYTjxABN.js → CommunityStatsModal-DkMCREYc.js} +1 -1
  11. package/dashboard/dist/assets/{ConfirmModal-St89kP59.js → ConfirmModal-DAt5opxx.js} +1 -1
  12. package/dashboard/dist/assets/Controls-DsJLsMpr.js +1 -0
  13. package/dashboard/dist/assets/{DashboardPage-BvGqFvP7.js → DashboardPage-B4hR6Jr1.js} +1 -1
  14. package/dashboard/dist/assets/{DateRangePopover-Cbd1idiF.js → DateRangePopover-CyAT0F7i.js} +1 -1
  15. package/dashboard/dist/assets/{DevicePage-BcSU0xgf.js → DevicePage-CaZzXt8j.js} +1 -1
  16. package/dashboard/dist/assets/{DialogClose-Cb1-Hd8P.js → DialogClose-Dg8Rrcbc.js} +1 -1
  17. package/dashboard/dist/assets/DialogDescription-gdxwXQBG.js +1 -0
  18. package/dashboard/dist/assets/{DialogTitle-VXrHY7H0.js → DialogTitle-CgQTzYDB.js} +1 -1
  19. package/dashboard/dist/assets/{ElectricLogo-DmQqYnSD.js → ElectricLogo-PbWNE6Jw.js} +1 -1
  20. package/dashboard/dist/assets/{FadeIn-BEieTXMD.js → FadeIn-CgGVCeA7.js} +1 -1
  21. package/dashboard/dist/assets/{HeaderGithubStar-BlYC_PSb.js → HeaderGithubStar-D8I6O4H1.js} +1 -1
  22. package/dashboard/dist/assets/{HoverTooltip-C5Pe7iBz.js → HoverTooltip-BQ0w0NcA.js} +1 -1
  23. package/dashboard/dist/assets/{IpCheckPage-Diln3EdG.js → IpCheckPage-D9vVoMNk.js} +1 -1
  24. package/dashboard/dist/assets/{LandingPage-BzGYuAO7.js → LandingPage-DNV9PcRZ.js} +2 -2
  25. package/dashboard/dist/assets/{LeaderboardPage-Bn-ehU5S.js → LeaderboardPage-BVfC39jk.js} +2 -2
  26. package/dashboard/dist/assets/{LeaderboardProBadge-SovdGwYs.js → LeaderboardProBadge-g6XLqOpA.js} +1 -1
  27. package/dashboard/dist/assets/{LeaderboardProfileModal-BhxmTcHh.js → LeaderboardProfileModal-Dxwperqt.js} +3 -3
  28. package/dashboard/dist/assets/{LeaderboardProfilePage-3iAYvoTb.js → LeaderboardProfilePage-C9552VgQ.js} +1 -1
  29. package/dashboard/dist/assets/{LimitsPage-DHxFAdqK.js → LimitsPage-CWaM8Ubc.js} +1 -1
  30. package/dashboard/dist/assets/{LocalOnlyNotice-HlGfiiI3.js → LocalOnlyNotice-DJ8t4CkI.js} +1 -1
  31. package/dashboard/dist/assets/{LoginCard-CamUYmiF.js → LoginCard-5cDUjlaP.js} +1 -1
  32. package/dashboard/dist/assets/{LoginModal-CcmYUJ45.js → LoginModal-CaEskXOR.js} +1 -1
  33. package/dashboard/dist/assets/{LoginPage-DMNNmZwr.js → LoginPage--buWhwDc.js} +1 -1
  34. package/dashboard/dist/assets/{PetPage-D6xFX8QA.js → PetPage-DZlGXdiW.js} +2 -2
  35. package/dashboard/dist/assets/{PopoverPopup-CKKgItAT.js → PopoverPopup-IQrgeWzz.js} +1 -1
  36. package/dashboard/dist/assets/{ProviderIcon-B-uS3pJ3.js → ProviderIcon-CSKhjDnT.js} +1 -1
  37. package/dashboard/dist/assets/{ResetPasswordPage-DX4RJjX0.js → ResetPasswordPage-ClzIMLjQ.js} +1 -1
  38. package/dashboard/dist/assets/{Select-Dcg7FYAt.js → Select-KHVnbrwD.js} +1 -1
  39. package/dashboard/dist/assets/{SelectItemText-4vuj6xMs.js → SelectItemText-BqAFvX8b.js} +1 -1
  40. package/dashboard/dist/assets/{SelfHostPage-ButVBgE7.js → SelfHostPage-DHA9hDnA.js} +1 -1
  41. package/dashboard/dist/assets/{ServiceStatusPage-DJDDO6lV.js → ServiceStatusPage-A4WcSrnG.js} +1 -1
  42. package/dashboard/dist/assets/{SessionsPage-CiUirFMD.js → SessionsPage-CWu0gXwO.js} +1 -1
  43. package/dashboard/dist/assets/SettingsPage-DzurIV6u.js +5 -0
  44. package/dashboard/dist/assets/{SkillsPage-D2tfFFY8.js → SkillsPage-CfM8w0xf.js} +1 -1
  45. package/dashboard/dist/assets/{TokenGalaxy-TQ-eWK8P.js → TokenGalaxy-BiCXCnEH.js} +1 -1
  46. package/dashboard/dist/assets/{TooltipPopup-BhSCJqFR.js → TooltipPopup-BcnMVc6a.js} +1 -1
  47. package/dashboard/dist/assets/{TrendMonitor-CP6ZZ53c.js → TrendMonitor-PFSJn43N.js} +1 -1
  48. package/dashboard/dist/assets/{WidgetsPage-BdeR7P8D.js → WidgetsPage-CnH4zkP8.js} +1 -1
  49. package/dashboard/dist/assets/{WrappedPage-OqcqupRE.js → WrappedPage-BpsnuM4e.js} +1 -1
  50. package/dashboard/dist/assets/__vite-browser-external-CbUj3l39.css +1 -0
  51. package/dashboard/dist/assets/{__vite-browser-external-BXwSXUpN.js → __vite-browser-external-CbhiyufG.js} +2 -2
  52. package/dashboard/dist/assets/{agent-logos-E6GfkcgD.js → agent-logos-DFupeEJz.js} +1 -1
  53. package/dashboard/dist/assets/{arrow-left-D_ufthLH.js → arrow-left-Cu0jOgzo.js} +1 -1
  54. package/dashboard/dist/assets/{arrow-right-CgV_OrFz.js → arrow-right-DgFuyz9F.js} +1 -1
  55. package/dashboard/dist/assets/{arrow-up-right-CzeEeXRz.js → arrow-up-right-COoZfksW.js} +1 -1
  56. package/dashboard/dist/assets/{calendar-days-BQdTF7ec.js → calendar-days-B_QPPq3a.js} +1 -1
  57. package/dashboard/dist/assets/{check-C--D8Lze.js → check-D_enaDhp.js} +1 -1
  58. package/dashboard/dist/assets/{chevron-down-BzkceD4z.js → chevron-down-Di_xdF9P.js} +1 -1
  59. package/dashboard/dist/assets/{cloud-checkout-m1Yllbij.js → cloud-checkout-DNFMqoiZ.js} +1 -1
  60. package/dashboard/dist/assets/{composite-7DhFi6TA.js → composite-CUbvhoGL.js} +1 -1
  61. package/dashboard/dist/assets/{download-BSyGLtfW.js → download-CrDgjohg.js} +1 -1
  62. package/dashboard/dist/assets/{external-link-KzFbueBT.js → external-link-DgnNV6zS.js} +1 -1
  63. package/dashboard/dist/assets/{flame-DlPM_oaj.js → flame-Lsd5DkgX.js} +1 -1
  64. package/dashboard/dist/assets/{format-tokens-BHBaWyA3.js → format-tokens-DSxX2imE.js} +1 -1
  65. package/dashboard/dist/assets/{gift-BhWBQnun.js → gift-BA3WiW1-.js} +1 -1
  66. package/dashboard/dist/assets/{host-mode--iIPGrkN.js → host-mode-BiJLkMdX.js} +1 -1
  67. package/dashboard/dist/assets/{icons-COEaSBYi.js → icons-BxxxA-aw.js} +1 -1
  68. package/dashboard/dist/assets/{index-Bo8CSxCq.js → index-BTC0A20d.js} +1 -1
  69. package/dashboard/dist/assets/{index-CW6A_Ff_.js → index-BlvkImKO.js} +1 -1
  70. package/dashboard/dist/assets/{index-Cf4HcmLp.js → index-V-WILWJ0.js} +1 -1
  71. package/dashboard/dist/assets/{info-D1gOdsM_.js → info-CluBWyTe.js} +1 -1
  72. package/dashboard/dist/assets/{link-2-CXDnDOK4.js → link-2-M880npIj.js} +1 -1
  73. package/dashboard/dist/assets/{loader-circle-DWeQPecG.js → loader-circle-BEowiVYF.js} +1 -1
  74. package/dashboard/dist/assets/{modifiers.esm-BljqMT7V.js → modifiers.esm-pR4sKZep.js} +1 -1
  75. package/dashboard/dist/assets/{monitor-smartphone-DpkdtOjk.js → monitor-smartphone-GOnwL7NC.js} +1 -1
  76. package/dashboard/dist/assets/{play-BlGNrekI.js → play-C2Yih72t.js} +1 -1
  77. package/dashboard/dist/assets/{plus-CpYVQ_t-.js → plus-KF6U4UP_.js} +1 -1
  78. package/dashboard/dist/assets/{provider-display-D6Blvktj.js → provider-display-Bio3tJX4.js} +1 -1
  79. package/dashboard/dist/assets/{react-BMJ2wuz1.js → react-Dt52_FiQ.js} +1 -1
  80. package/dashboard/dist/assets/{safePolygon-BFHXICk1.js → safePolygon-D7wQNKcm.js} +1 -1
  81. package/dashboard/dist/assets/{search-0NxXkytY.js → search-CW0YCdKx.js} +1 -1
  82. package/dashboard/dist/assets/{server-GHkrUKSI.js → server-DKLG1DuM.js} +1 -1
  83. package/dashboard/dist/assets/{shield-check-C16cbx1z.js → shield-check-DkJ3sCHH.js} +1 -1
  84. package/dashboard/dist/assets/{skills-api-DAm1fFB4.js → skills-api-yS1uW-mw.js} +1 -1
  85. package/dashboard/dist/assets/{sortable.esm-CkOax8h0.js → sortable.esm-DZo9A4kG.js} +1 -1
  86. package/dashboard/dist/assets/{store-DR444-5P.js → store-BbYtf4Vy.js} +1 -1
  87. package/dashboard/dist/assets/{terminal-BpvNaIz9.js → terminal-FK6txO2c.js} +1 -1
  88. package/dashboard/dist/assets/{trash-DX8LwOmN.js → trash-QX4FHz_p.js} +1 -1
  89. package/dashboard/dist/assets/{use-community-stats-BFW4-DYG.js → use-community-stats-DaURJ5sU.js} +1 -1
  90. package/dashboard/dist/assets/{use-latest-request-guard-Cpcl08EJ.js → use-latest-request-guard-BZnnoQct.js} +1 -1
  91. package/dashboard/dist/assets/{use-limits-display-prefs-BqixyeAa.js → use-limits-display-prefs-C77UTTya.js} +1 -1
  92. package/dashboard/dist/assets/{use-native-settings-BSx7lGEK.js → use-native-settings-DHS101SR.js} +1 -1
  93. package/dashboard/dist/assets/{use-ordered-list-UCjB0_zK.js → use-ordered-list-h5iXqXbU.js} +1 -1
  94. package/dashboard/dist/assets/use-reduced-motion-Bpc6LGag.js +1 -0
  95. package/dashboard/dist/assets/{use-session-efficiency-pref-BgOJaGEy.js → use-session-efficiency-pref-DZVvvmoq.js} +1 -1
  96. package/dashboard/dist/assets/{use-transform-Y98QifnQ.js → use-transform-dcPyhMQK.js} +1 -1
  97. package/dashboard/dist/assets/{use-usage-limits-DJGO-Kxv.js → use-usage-limits-BBAi4Wvb.js} +1 -1
  98. package/dashboard/dist/assets/{useCurrency-DL458pqS.js → useCurrency-CW5GHWIB.js} +1 -1
  99. package/dashboard/dist/assets/{usePositioner-DnCQwlVT.js → usePositioner-BQgBHX5s.js} +1 -1
  100. package/dashboard/dist/assets/{useTokenFormat-CYLt9pgs.js → useTokenFormat-DntK8yNR.js} +1 -1
  101. package/dashboard/dist/assets/{zap-BW6E_Jv3.js → zap-Brp6hC7u.js} +1 -1
  102. package/dashboard/dist/index.html +2 -2
  103. package/dashboard/dist/ip-check.html +2 -2
  104. package/dashboard/dist/leaderboard.html +2 -2
  105. package/dashboard/dist/share.html +2 -2
  106. package/package.json +1 -1
  107. package/src/lib/pricing/seed-snapshot.json +1 -1
  108. package/dashboard/dist/assets/Controls-BJAwM2gB.js +0 -1
  109. package/dashboard/dist/assets/DialogDescription-DQvYzWMp.js +0 -1
  110. package/dashboard/dist/assets/SettingsPage-CB4CML8u.js +0 -5
  111. package/dashboard/dist/assets/__vite-browser-external-DvNSoTb8.css +0 -1
  112. package/dashboard/dist/assets/use-reduced-motion-C6zOHbfR.js +0 -1
@@ -1 +1 @@
1
- import{r as a,a$ as ee,b1 as D,j as k,a_ as De,N as M,bX as de,b0 as Z,bJ as ge,b5 as X,b7 as me,ba as U,b4 as Ae,bY as ke,bZ as He,b2 as F,b_ as Fe,b$ as ce,b3 as ue,b9 as le,c0 as q,c1 as Le,c2 as Be,bG as Ne,bo as he,bp as je,bm as J,bn as _e,bs as Ue,c3 as Ye,J as Ge,c4 as Ve,bt as Xe,by as $e,K as Te,c5 as Je,b6 as z,c6 as Ke,bC as We,bF as Ze}from"./__vite-browser-external-BXwSXUpN.js";import{i as Re,A as qe,P as ze,m as Qe,j as et,k as tt,l as nt,n as ot,o as rt,u as st,p as it,c as at,t as ct,x as ut,y as lt}from"./composite-7DhFi6TA.js";import{p as pt,c as ft}from"./store-DR444-5P.js";import{g as $,u as dt,c as gt,a as mt,s as ht,b as Tt}from"./safePolygon-BFHXICk1.js";import{u as Rt,a as Pt,g as Ct}from"./usePositioner-DnCQwlVT.js";const Pe=a.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new De,currentIdRef:{current:null},currentContextRef:{current:null}});function bt(e,n){e.current=n.current}function Xt(e){const{children:n,delay:t,timeoutMs:u=0}=e,o=a.useRef(t),p=a.useRef(t),i=a.useRef(null),c=a.useRef(null),m=ee();return D(()=>{if(p.current=t,!i.current){o.current=t;return}o.current={open:$(o.current,"open"),close:$(t,"close")}},[t,i,o,p]),k.jsx(Pe.Provider,{value:a.useMemo(()=>({hasProvider:!0,delayRef:o,initialDelayRef:p,currentIdRef:i,timeoutMs:u,currentContextRef:c,timeout:m}),[u,m]),children:n})}function vt(e,n={open:!1}){const{open:t}=n,u="rootStore"in e?e.rootStore:e,o=u.useState("floatingId"),p=a.useContext(Pe),{currentIdRef:i,delayRef:c,timeoutMs:m,initialDelayRef:h,currentContextRef:l,hasProvider:T,timeout:f}=p,[g,r]=a.useState(!1),P=a.useRef(t);return D(()=>{P.current=t},[t]),D(()=>{function s(){l.current?.setIsInstantPhase(!1),i.current=null,l.current=null,c.current=h.current,f.clear()}if(i.current&&!t&&i.current===o){if(r(!1),m){const d=o;return f.start(m,()=>{u.select("open")||i.current&&i.current!==d||s()}),()=>{(P.current||i.current!==d)&&f.clear()}}s()}},[t,o,i,c,m,h,l,f,u]),D(()=>{if(!t)return;const s=l.current,d=i.current;f.clear(),l.current={onOpenChange:u.setOpen,setIsInstantPhase:r},i.current=o,c.current={open:0,close:$(h.current,"close")},d!==null&&d!==o?(r(!0),s?.setIsInstantPhase(!0),s?.onOpenChange(!1,M(de))):(r(!1),s?.setIsInstantPhase(!1))},[t,o,u,i,c,h,l,f]),D(()=>()=>{if(i.current===o){if(l.current=null,!P.current)return;i.current=null,bt(c,h),f.clear()}},[l,i,c,o,h,f]),a.useMemo(()=>({activeIdRef:i,hasProvider:T,delayRef:c,isInstantPhase:g}),[i,T,c,g])}function yt(e,n){let t=null,u=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){const p=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=n.axis==="x"||n.axis==="both",c=n.axis==="y"||n.axis==="both",m=["mouseenter","mousemove"].includes(n.dataRef.current.openEvent?.type||"")&&n.pointerType!=="touch";let h=p.width,l=p.height,T=p.x,f=p.y;return t==null&&n.x&&i&&(t=p.x-n.x),u==null&&n.y&&c&&(u=p.y-n.y),T-=t||0,f-=u||0,h=0,l=0,!o||m?(h=n.axis==="y"?p.width:0,l=n.axis==="x"?p.height:0,T=i&&n.x!=null?n.x:T,f=c&&n.y!=null?n.y:f):o&&!m&&(l=n.axis==="x"?p.height:l,h=n.axis==="y"?p.width:h),o=!0,{width:h,height:l,x:T,y:f,top:f,right:T+h,bottom:f+l,left:T}}}}function pe(e){return e!=null&&e.clientX!=null}function xt(e,n={}){const{enabled:t=!0,axis:u="both"}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),i=o.useState("floatingElement"),c=o.useState("domReferenceElement"),m=o.context.dataRef,h=a.useRef(!1),l=a.useRef(null),[T,f]=a.useState(),[g,r]=a.useState([]),P=Z(R=>{o.set("positionReference",R)}),s=Z((R,v,S)=>{h.current||m.current.openEvent&&!pe(m.current.openEvent)||o.set("positionReference",yt(S??c,{x:R,y:v,axis:u,dataRef:m,pointerType:T}))}),d=Z(R=>{p?l.current||(s(R.clientX,R.clientY,R.currentTarget),r([])):s(R.clientX,R.clientY,R.currentTarget)}),y=Re(T)?i:p;a.useEffect(()=>{if(!t){P(c);return}if(!y)return;function R(){l.current?.(),l.current=null}const v=ge(i);function S(x){const O=me(x);U(i,O)?R():s(x.clientX,x.clientY)}return!m.current.openEvent||pe(m.current.openEvent)?l.current=X(v,"mousemove",S):P(c),R},[y,t,i,m,c,o,s,P,g]),a.useEffect(()=>()=>{o.set("positionReference",null)},[o]),a.useEffect(()=>{t&&!i&&(h.current=!1)},[t,i]),a.useEffect(()=>{!t&&p&&(h.current=!0)},[t,p]);const C=a.useMemo(()=>{function R(v){f(v.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:d,onMouseEnter:d}},[d]);return a.useMemo(()=>t?{reference:C,trigger:C}:{},[t,C])}const Q=ke&&He;function St(e,n={}){const{enabled:t=!0,delay:u}=n,o="rootStore"in e?e.rootStore:e,{events:p,dataRef:i}=o.context,c=a.useRef(!1),m=a.useRef(null),h=a.useRef(!0),l=ee();a.useEffect(()=>{const f=o.select("domReferenceElement");if(!t)return;const g=ge(f);function r(){const d=o.select("domReferenceElement");!o.select("open")&&Ne(d)&&d===ce(ue(d))&&(c.current=!0,m.current=d)}function P(){h.current=!0}function s(){h.current=!1}return Ae(X(g,"blur",r),Q&&X(g,"keydown",P,!0),Q&&X(g,"pointerdown",s,!0))},[o,t]),a.useEffect(()=>{if(!t)return;function f(g){if(g.reason===he||g.reason===je){const r=o.select("domReferenceElement");F(r)&&(m.current=r,c.current=!0)}}return p.on("openchange",f),()=>{p.off("openchange",f)}},[p,t,o]);const T=a.useMemo(()=>{function f(){c.current=!1,m.current=null}return{onMouseLeave(){f()},onFocus(g){const r=g.currentTarget;if(c.current){if(m.current===r)return;f()}const P=me(g.nativeEvent);if(F(P)){if(Q&&!g.relatedTarget){if(!h.current&&!Le(P))return}else if(!Be(P))return}const s=le(g.relatedTarget,o.context.triggerElements),{nativeEvent:d,currentTarget:y}=g,C=typeof u=="function"?u():u;if(o.select("open")&&s||C===0||C===void 0){o.setOpen(!0,M(q,d,y));return}l.start(C,()=>{c.current||o.setOpen(!0,M(q,d,y))})},onBlur(g){f();const r=g.relatedTarget,P=g.nativeEvent,s=F(r)&&r.hasAttribute(Fe("focus-guard"))&&r.getAttribute("data-type")==="outside";l.start(0,()=>{const d=o.select("domReferenceElement"),y=ce(ue(d));!r&&y===d||U(i.current.floatingContext?.refs.floating.current,y)||U(d,y)||s||le(r??y,o.context.triggerElements)||o.setOpen(!1,M(q,P))})}}},[i,u,o,l]);return a.useMemo(()=>t?{reference:T,trigger:T}:{},[t,T])}const Ce=a.createContext(void 0);function K(e){const n=a.useContext(Ce);if(n===void 0&&!e)throw new Error(J(72));return n}const Et={...pt,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Ot extends _e{constructor(n,t,u){const o=new ze;super(It(n,o,t,u),Mt(o),Et)}setOpen=(n,t)=>{qe(this,n,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(n){this.state.floatingRootContext.dispatchOpenChange(!1,M(he,n))}}function It(e,n,t,u=!1){return{...ft(n,t,u),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function Mt(e){return{popupRef:a.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const $t=Ue(function(n){const{disabled:t=!1,defaultOpen:u=!1,open:o,disableHoverablePopup:p=!1,trackCursorAxis:i="none",actionsRef:c,onOpenChange:m,onOpenChangeComplete:h,handle:l,triggerId:T,defaultTriggerId:f=null,children:g}=n,r=Qe((L,B)=>new Ot({open:u,openProp:o,activeTriggerId:f,triggerIdProp:T},L,B));r.useControlledProp("openProp",o),r.useControlledProp("triggerIdProp",T),r.useContextCallback("onOpenChange",m),r.useContextCallback("onOpenChangeComplete",h);const P=r.useState("open"),s=!t&&P,d=r.useState("activeTriggerId"),y=r.useState("mounted"),C=r.useState("payload");r.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:p,disabled:t}),et(r,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:R,transitionStatus:v}=tt(s,r),S=r.useState("isInstantPhase"),x=r.useState("instantType"),O=r.useState("lastOpenChangeReason"),w=a.useRef(null);D(()=>{P&&t&&r.setOpen(!1,M(Ve))},[P,t,r]),D(()=>{v==="ending"&&O===de||v!=="ending"&&S?(x!=="delay"&&(w.current=x),r.set("instantType","delay")):w.current!==null&&(r.set("instantType",w.current),w.current=null)},[v,S,O,x,r]),D(()=>{s&&d==null&&r.set("payload",void 0)},[r,d,s]),a.useImperativeHandle(c,()=>({unmount:R,close:()=>r.setOpen(!1,M(Xe))}),[R,r]);const H=s||y||!t&&i!=="none";return k.jsxs(Ce.Provider,{value:r,children:[l&&k.jsx(nt,{handle:l,store:r}),H&&k.jsx(wt,{store:r,disabled:t,trackCursorAxis:i}),typeof g=="function"?g({payload:C}):g]})});function wt({store:e,disabled:n,trackCursorAxis:t}){const u=e.useState("floatingRootContext"),o=ot(u,{enabled:!n,referencePress:()=>e.select("closeOnClick")}),p=xt(u,{enabled:!n&&t!=="none",axis:t==="none"?void 0:t}),i=a.useMemo(()=>Ye(p.reference,o.reference),[p.reference,o.reference]);return rt(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:o.floating??Ge}),null}const Dt=a.createContext(void 0);function At(){return a.useContext(Dt)}const kt=600,be="data-base-ui-tooltip-trigger";function fe(e){if("composedPath"in e){const t=e.composedPath();for(let u=0;u<t.length;u+=1){const o=t[u];if(F(o))return o}}const n=e.target;return F(n)?n:null}function Ht(e){let n=e;for(;n;){const t=n.closest(`[${be}]`);if(t)return t;const u=n.getRootNode();n="host"in u&&F(u.host)?u.host:null}return null}const Jt=$e(function(n,t){const{render:u,className:o,style:p,handle:i,payload:c,disabled:m,delay:h,closeOnClick:l=!0,closeDelay:T,id:f,...g}=n,r=K(!0),s=dt(i)??r;if(!s)throw new Error(J(82));const d=st(f),y=s.useState("isTriggerActive",d),C=s.useState("isOpenedByTrigger",d),R=s.useState("floatingRootContext"),v=a.useRef(null),S=T??0,{registerTrigger:x,isMountedByThisTrigger:O}=it(d,v,s,{payload:c,closeOnClick:l,closeDelay:S}),w=At(),{activeIdRef:H,delayRef:L,isInstantPhase:B,hasProvider:E}=vt(R,{open:C}),N=gt(R);s.useSyncedValue("isInstantPhase",B);const W=s.useState("disabled"),j=m??W,te=at(j),ne=s.useState("trackCursorAxis"),xe=s.useState("disableHoverablePopup"),_=a.useRef(!1),Y=ee(),G=a.useRef(void 0);function oe(){return E&&H.current!=null?0:h??w??kt}function re(b){const I=v.current;if(!I||!b)return!1;const A=Ht(b);return A!==null&&A!==I&&U(I,A)}function Se(b){const I=re(b);return _.current=I,I&&(N.openChangeTimeout.clear(),N.restTimeout.clear(),N.restTimeoutPending=!1,Y.clear()),I}const Ee=mt(R,{enabled:!j,mouseOnly:!0,move:!1,handleClose:!xe&&ne!=="both"?ht():null,restMs:oe,delay(){return T==null&&E?{close:$(L.current,"close")}:{close:S}},triggerElementRef:v,isActiveTrigger:y,isClosing:()=>s.select("transitionStatus")==="ending",shouldOpen(){return!_.current}}),Oe=St(R,{enabled:!j}).reference,Ie=b=>{const I=_.current,A=fe(b),se=Se(A),V=v.current,we=V&&A&&U(V,A);if(se&&s.select("open")&&s.select("lastOpenChangeReason")===z){s.setOpen(!1,M(z,b));return}if(I&&!se&&we&&!te.current&&!s.select("open")&&V&&Re(G.current)){const ie=()=>{!_.current&&!te.current&&!s.select("open")&&s.setOpen(!0,M(z,b,V))},ae=oe();ae===0?(Y.clear(),ie()):Y.start(ae,ie)}},Me=s.useState("triggerProps",O);return Te("button",n,{state:{open:C},ref:[t,x,v],props:[Ee,Oe,O||ne!=="none"?Me:void 0,{onMouseOver(b){Ie(b.nativeEvent)},onFocus(b){re(fe(b.nativeEvent))&&b.preventBaseUIHandler()},onMouseLeave(){_.current=!1,Y.clear(),G.current=void 0},onPointerEnter(b){G.current=b.pointerType},onPointerDown(b){G.current=b.pointerType,s.set("closeOnClick",l),l&&!s.select("open")&&s.cancelPendingOpen(b.nativeEvent)},onClick(b){l&&!s.select("open")&&s.cancelPendingOpen(b.nativeEvent)},id:d,[Je]:j?"":void 0,[be]:j?void 0:""},g],stateAttributesMapping:ct})}),ve=a.createContext(void 0);function Ft(){const e=a.useContext(ve);if(e===void 0)throw new Error(J(70));return e}const Kt=a.forwardRef(function(n,t){const{keepMounted:u=!1,...o}=n;return K().useState("mounted")||u?k.jsx(ve.Provider,{value:u,children:k.jsx(Ke,{ref:t,...o})}):null}),ye=a.createContext(void 0);function Lt(){const e=a.useContext(ye);if(e===void 0)throw new Error(J(71));return e}const Wt=a.forwardRef(function(n,t){const{render:u,className:o,anchor:p,positionMethod:i="absolute",side:c="top",align:m="center",sideOffset:h=0,alignOffset:l=0,collisionBoundary:T="clipping-ancestors",collisionPadding:f=5,arrowPadding:g=5,sticky:r=!1,disableAnchorTracking:P=!1,collisionAvoidance:s=We,style:d,...y}=n,C=K(),R=Ft(),v=C.useState("open"),S=C.useState("mounted"),x=C.useState("trackCursorAxis"),O=C.useState("disableHoverablePopup"),w=C.useState("floatingRootContext"),H=C.useState("instantType"),L=C.useState("transitionStatus"),B=C.useState("adaptiveOrigin"),E=Rt({anchor:p,positionMethod:i,floatingRootContext:w,mounted:S,side:c,sideOffset:h,align:m,alignOffset:l,collisionBoundary:T,collisionPadding:f,sticky:r,arrowPadding:g,disableAnchorTracking:P,keepMounted:R,collisionAvoidance:s,adaptiveOrigin:B}),N=a.useMemo(()=>({open:v,side:E.side,align:E.align,anchorHidden:E.anchorHidden,instant:x!=="none"?"tracking-cursor":H}),[v,E.side,E.align,E.anchorHidden,x,H]),W=Pt(n,N,{styles:E.positionerStyles,transitionStatus:L,props:y,refs:[t,C.useStateSetter("positionerElement")],hidden:!S,inert:!v||x==="both"||O});return k.jsx(ye.Provider,{value:E,children:W})}),Zt=a.forwardRef(function(n,t){const{render:u,className:o,style:p,...i}=n,c=K(),{side:m,align:h}=Lt(),l=c.useState("open"),T=c.useState("instantType"),f=c.useState("transitionStatus"),g=c.useState("popupProps"),r=c.useState("floatingRootContext"),P=c.useState("disabled"),s=c.useState("closeDelay");Ze({open:l,ref:c.context.popupRef,onComplete(){l&&c.context.onOpenChangeComplete?.(!0)}}),Tt(r,{enabled:!P,closeDelay:s});const d=c.useStateSetter("popupElement");return Te("div",n,{state:{open:l,side:m,align:h,instant:T,transitionStatus:f},ref:[t,c.context.popupRef,d],props:[ut,g,Ct(f),i],stateAttributesMapping:lt})});export{Xt as F,Dt as T,$t as a,Jt as b,Kt as c,Wt as d,Zt as e};
1
+ import{r as a,a$ as ee,b1 as D,j as k,a_ as De,N as M,bX as de,b0 as Z,bJ as ge,b5 as X,b7 as me,ba as U,b4 as Ae,bY as ke,bZ as He,b2 as F,b_ as Fe,b$ as ce,b3 as ue,b9 as le,c0 as q,c1 as Le,c2 as Be,bG as Ne,bo as he,bp as je,bm as J,bn as _e,bs as Ue,c3 as Ye,J as Ge,c4 as Ve,bt as Xe,by as $e,K as Te,c5 as Je,b6 as z,c6 as Ke,bC as We,bF as Ze}from"./__vite-browser-external-CbhiyufG.js";import{i as Re,A as qe,P as ze,m as Qe,j as et,k as tt,l as nt,n as ot,o as rt,u as st,p as it,c as at,t as ct,x as ut,y as lt}from"./composite-CUbvhoGL.js";import{p as pt,c as ft}from"./store-BbYtf4Vy.js";import{g as $,u as dt,c as gt,a as mt,s as ht,b as Tt}from"./safePolygon-D7wQNKcm.js";import{u as Rt,a as Pt,g as Ct}from"./usePositioner-BQgBHX5s.js";const Pe=a.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new De,currentIdRef:{current:null},currentContextRef:{current:null}});function bt(e,n){e.current=n.current}function Xt(e){const{children:n,delay:t,timeoutMs:u=0}=e,o=a.useRef(t),p=a.useRef(t),i=a.useRef(null),c=a.useRef(null),m=ee();return D(()=>{if(p.current=t,!i.current){o.current=t;return}o.current={open:$(o.current,"open"),close:$(t,"close")}},[t,i,o,p]),k.jsx(Pe.Provider,{value:a.useMemo(()=>({hasProvider:!0,delayRef:o,initialDelayRef:p,currentIdRef:i,timeoutMs:u,currentContextRef:c,timeout:m}),[u,m]),children:n})}function vt(e,n={open:!1}){const{open:t}=n,u="rootStore"in e?e.rootStore:e,o=u.useState("floatingId"),p=a.useContext(Pe),{currentIdRef:i,delayRef:c,timeoutMs:m,initialDelayRef:h,currentContextRef:l,hasProvider:T,timeout:f}=p,[g,r]=a.useState(!1),P=a.useRef(t);return D(()=>{P.current=t},[t]),D(()=>{function s(){l.current?.setIsInstantPhase(!1),i.current=null,l.current=null,c.current=h.current,f.clear()}if(i.current&&!t&&i.current===o){if(r(!1),m){const d=o;return f.start(m,()=>{u.select("open")||i.current&&i.current!==d||s()}),()=>{(P.current||i.current!==d)&&f.clear()}}s()}},[t,o,i,c,m,h,l,f,u]),D(()=>{if(!t)return;const s=l.current,d=i.current;f.clear(),l.current={onOpenChange:u.setOpen,setIsInstantPhase:r},i.current=o,c.current={open:0,close:$(h.current,"close")},d!==null&&d!==o?(r(!0),s?.setIsInstantPhase(!0),s?.onOpenChange(!1,M(de))):(r(!1),s?.setIsInstantPhase(!1))},[t,o,u,i,c,h,l,f]),D(()=>()=>{if(i.current===o){if(l.current=null,!P.current)return;i.current=null,bt(c,h),f.clear()}},[l,i,c,o,h,f]),a.useMemo(()=>({activeIdRef:i,hasProvider:T,delayRef:c,isInstantPhase:g}),[i,T,c,g])}function yt(e,n){let t=null,u=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){const p=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=n.axis==="x"||n.axis==="both",c=n.axis==="y"||n.axis==="both",m=["mouseenter","mousemove"].includes(n.dataRef.current.openEvent?.type||"")&&n.pointerType!=="touch";let h=p.width,l=p.height,T=p.x,f=p.y;return t==null&&n.x&&i&&(t=p.x-n.x),u==null&&n.y&&c&&(u=p.y-n.y),T-=t||0,f-=u||0,h=0,l=0,!o||m?(h=n.axis==="y"?p.width:0,l=n.axis==="x"?p.height:0,T=i&&n.x!=null?n.x:T,f=c&&n.y!=null?n.y:f):o&&!m&&(l=n.axis==="x"?p.height:l,h=n.axis==="y"?p.width:h),o=!0,{width:h,height:l,x:T,y:f,top:f,right:T+h,bottom:f+l,left:T}}}}function pe(e){return e!=null&&e.clientX!=null}function xt(e,n={}){const{enabled:t=!0,axis:u="both"}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),i=o.useState("floatingElement"),c=o.useState("domReferenceElement"),m=o.context.dataRef,h=a.useRef(!1),l=a.useRef(null),[T,f]=a.useState(),[g,r]=a.useState([]),P=Z(R=>{o.set("positionReference",R)}),s=Z((R,v,S)=>{h.current||m.current.openEvent&&!pe(m.current.openEvent)||o.set("positionReference",yt(S??c,{x:R,y:v,axis:u,dataRef:m,pointerType:T}))}),d=Z(R=>{p?l.current||(s(R.clientX,R.clientY,R.currentTarget),r([])):s(R.clientX,R.clientY,R.currentTarget)}),y=Re(T)?i:p;a.useEffect(()=>{if(!t){P(c);return}if(!y)return;function R(){l.current?.(),l.current=null}const v=ge(i);function S(x){const O=me(x);U(i,O)?R():s(x.clientX,x.clientY)}return!m.current.openEvent||pe(m.current.openEvent)?l.current=X(v,"mousemove",S):P(c),R},[y,t,i,m,c,o,s,P,g]),a.useEffect(()=>()=>{o.set("positionReference",null)},[o]),a.useEffect(()=>{t&&!i&&(h.current=!1)},[t,i]),a.useEffect(()=>{!t&&p&&(h.current=!0)},[t,p]);const C=a.useMemo(()=>{function R(v){f(v.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:d,onMouseEnter:d}},[d]);return a.useMemo(()=>t?{reference:C,trigger:C}:{},[t,C])}const Q=ke&&He;function St(e,n={}){const{enabled:t=!0,delay:u}=n,o="rootStore"in e?e.rootStore:e,{events:p,dataRef:i}=o.context,c=a.useRef(!1),m=a.useRef(null),h=a.useRef(!0),l=ee();a.useEffect(()=>{const f=o.select("domReferenceElement");if(!t)return;const g=ge(f);function r(){const d=o.select("domReferenceElement");!o.select("open")&&Ne(d)&&d===ce(ue(d))&&(c.current=!0,m.current=d)}function P(){h.current=!0}function s(){h.current=!1}return Ae(X(g,"blur",r),Q&&X(g,"keydown",P,!0),Q&&X(g,"pointerdown",s,!0))},[o,t]),a.useEffect(()=>{if(!t)return;function f(g){if(g.reason===he||g.reason===je){const r=o.select("domReferenceElement");F(r)&&(m.current=r,c.current=!0)}}return p.on("openchange",f),()=>{p.off("openchange",f)}},[p,t,o]);const T=a.useMemo(()=>{function f(){c.current=!1,m.current=null}return{onMouseLeave(){f()},onFocus(g){const r=g.currentTarget;if(c.current){if(m.current===r)return;f()}const P=me(g.nativeEvent);if(F(P)){if(Q&&!g.relatedTarget){if(!h.current&&!Le(P))return}else if(!Be(P))return}const s=le(g.relatedTarget,o.context.triggerElements),{nativeEvent:d,currentTarget:y}=g,C=typeof u=="function"?u():u;if(o.select("open")&&s||C===0||C===void 0){o.setOpen(!0,M(q,d,y));return}l.start(C,()=>{c.current||o.setOpen(!0,M(q,d,y))})},onBlur(g){f();const r=g.relatedTarget,P=g.nativeEvent,s=F(r)&&r.hasAttribute(Fe("focus-guard"))&&r.getAttribute("data-type")==="outside";l.start(0,()=>{const d=o.select("domReferenceElement"),y=ce(ue(d));!r&&y===d||U(i.current.floatingContext?.refs.floating.current,y)||U(d,y)||s||le(r??y,o.context.triggerElements)||o.setOpen(!1,M(q,P))})}}},[i,u,o,l]);return a.useMemo(()=>t?{reference:T,trigger:T}:{},[t,T])}const Ce=a.createContext(void 0);function K(e){const n=a.useContext(Ce);if(n===void 0&&!e)throw new Error(J(72));return n}const Et={...pt,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class Ot extends _e{constructor(n,t,u){const o=new ze;super(It(n,o,t,u),Mt(o),Et)}setOpen=(n,t)=>{qe(this,n,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(n){this.state.floatingRootContext.dispatchOpenChange(!1,M(he,n))}}function It(e,n,t,u=!1){return{...ft(n,t,u),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function Mt(e){return{popupRef:a.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const $t=Ue(function(n){const{disabled:t=!1,defaultOpen:u=!1,open:o,disableHoverablePopup:p=!1,trackCursorAxis:i="none",actionsRef:c,onOpenChange:m,onOpenChangeComplete:h,handle:l,triggerId:T,defaultTriggerId:f=null,children:g}=n,r=Qe((L,B)=>new Ot({open:u,openProp:o,activeTriggerId:f,triggerIdProp:T},L,B));r.useControlledProp("openProp",o),r.useControlledProp("triggerIdProp",T),r.useContextCallback("onOpenChange",m),r.useContextCallback("onOpenChangeComplete",h);const P=r.useState("open"),s=!t&&P,d=r.useState("activeTriggerId"),y=r.useState("mounted"),C=r.useState("payload");r.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:p,disabled:t}),et(r,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:R,transitionStatus:v}=tt(s,r),S=r.useState("isInstantPhase"),x=r.useState("instantType"),O=r.useState("lastOpenChangeReason"),w=a.useRef(null);D(()=>{P&&t&&r.setOpen(!1,M(Ve))},[P,t,r]),D(()=>{v==="ending"&&O===de||v!=="ending"&&S?(x!=="delay"&&(w.current=x),r.set("instantType","delay")):w.current!==null&&(r.set("instantType",w.current),w.current=null)},[v,S,O,x,r]),D(()=>{s&&d==null&&r.set("payload",void 0)},[r,d,s]),a.useImperativeHandle(c,()=>({unmount:R,close:()=>r.setOpen(!1,M(Xe))}),[R,r]);const H=s||y||!t&&i!=="none";return k.jsxs(Ce.Provider,{value:r,children:[l&&k.jsx(nt,{handle:l,store:r}),H&&k.jsx(wt,{store:r,disabled:t,trackCursorAxis:i}),typeof g=="function"?g({payload:C}):g]})});function wt({store:e,disabled:n,trackCursorAxis:t}){const u=e.useState("floatingRootContext"),o=ot(u,{enabled:!n,referencePress:()=>e.select("closeOnClick")}),p=xt(u,{enabled:!n&&t!=="none",axis:t==="none"?void 0:t}),i=a.useMemo(()=>Ye(p.reference,o.reference),[p.reference,o.reference]);return rt(e,{activeTriggerProps:i,inactiveTriggerProps:i,popupProps:o.floating??Ge}),null}const Dt=a.createContext(void 0);function At(){return a.useContext(Dt)}const kt=600,be="data-base-ui-tooltip-trigger";function fe(e){if("composedPath"in e){const t=e.composedPath();for(let u=0;u<t.length;u+=1){const o=t[u];if(F(o))return o}}const n=e.target;return F(n)?n:null}function Ht(e){let n=e;for(;n;){const t=n.closest(`[${be}]`);if(t)return t;const u=n.getRootNode();n="host"in u&&F(u.host)?u.host:null}return null}const Jt=$e(function(n,t){const{render:u,className:o,style:p,handle:i,payload:c,disabled:m,delay:h,closeOnClick:l=!0,closeDelay:T,id:f,...g}=n,r=K(!0),s=dt(i)??r;if(!s)throw new Error(J(82));const d=st(f),y=s.useState("isTriggerActive",d),C=s.useState("isOpenedByTrigger",d),R=s.useState("floatingRootContext"),v=a.useRef(null),S=T??0,{registerTrigger:x,isMountedByThisTrigger:O}=it(d,v,s,{payload:c,closeOnClick:l,closeDelay:S}),w=At(),{activeIdRef:H,delayRef:L,isInstantPhase:B,hasProvider:E}=vt(R,{open:C}),N=gt(R);s.useSyncedValue("isInstantPhase",B);const W=s.useState("disabled"),j=m??W,te=at(j),ne=s.useState("trackCursorAxis"),xe=s.useState("disableHoverablePopup"),_=a.useRef(!1),Y=ee(),G=a.useRef(void 0);function oe(){return E&&H.current!=null?0:h??w??kt}function re(b){const I=v.current;if(!I||!b)return!1;const A=Ht(b);return A!==null&&A!==I&&U(I,A)}function Se(b){const I=re(b);return _.current=I,I&&(N.openChangeTimeout.clear(),N.restTimeout.clear(),N.restTimeoutPending=!1,Y.clear()),I}const Ee=mt(R,{enabled:!j,mouseOnly:!0,move:!1,handleClose:!xe&&ne!=="both"?ht():null,restMs:oe,delay(){return T==null&&E?{close:$(L.current,"close")}:{close:S}},triggerElementRef:v,isActiveTrigger:y,isClosing:()=>s.select("transitionStatus")==="ending",shouldOpen(){return!_.current}}),Oe=St(R,{enabled:!j}).reference,Ie=b=>{const I=_.current,A=fe(b),se=Se(A),V=v.current,we=V&&A&&U(V,A);if(se&&s.select("open")&&s.select("lastOpenChangeReason")===z){s.setOpen(!1,M(z,b));return}if(I&&!se&&we&&!te.current&&!s.select("open")&&V&&Re(G.current)){const ie=()=>{!_.current&&!te.current&&!s.select("open")&&s.setOpen(!0,M(z,b,V))},ae=oe();ae===0?(Y.clear(),ie()):Y.start(ae,ie)}},Me=s.useState("triggerProps",O);return Te("button",n,{state:{open:C},ref:[t,x,v],props:[Ee,Oe,O||ne!=="none"?Me:void 0,{onMouseOver(b){Ie(b.nativeEvent)},onFocus(b){re(fe(b.nativeEvent))&&b.preventBaseUIHandler()},onMouseLeave(){_.current=!1,Y.clear(),G.current=void 0},onPointerEnter(b){G.current=b.pointerType},onPointerDown(b){G.current=b.pointerType,s.set("closeOnClick",l),l&&!s.select("open")&&s.cancelPendingOpen(b.nativeEvent)},onClick(b){l&&!s.select("open")&&s.cancelPendingOpen(b.nativeEvent)},id:d,[Je]:j?"":void 0,[be]:j?void 0:""},g],stateAttributesMapping:ct})}),ve=a.createContext(void 0);function Ft(){const e=a.useContext(ve);if(e===void 0)throw new Error(J(70));return e}const Kt=a.forwardRef(function(n,t){const{keepMounted:u=!1,...o}=n;return K().useState("mounted")||u?k.jsx(ve.Provider,{value:u,children:k.jsx(Ke,{ref:t,...o})}):null}),ye=a.createContext(void 0);function Lt(){const e=a.useContext(ye);if(e===void 0)throw new Error(J(71));return e}const Wt=a.forwardRef(function(n,t){const{render:u,className:o,anchor:p,positionMethod:i="absolute",side:c="top",align:m="center",sideOffset:h=0,alignOffset:l=0,collisionBoundary:T="clipping-ancestors",collisionPadding:f=5,arrowPadding:g=5,sticky:r=!1,disableAnchorTracking:P=!1,collisionAvoidance:s=We,style:d,...y}=n,C=K(),R=Ft(),v=C.useState("open"),S=C.useState("mounted"),x=C.useState("trackCursorAxis"),O=C.useState("disableHoverablePopup"),w=C.useState("floatingRootContext"),H=C.useState("instantType"),L=C.useState("transitionStatus"),B=C.useState("adaptiveOrigin"),E=Rt({anchor:p,positionMethod:i,floatingRootContext:w,mounted:S,side:c,sideOffset:h,align:m,alignOffset:l,collisionBoundary:T,collisionPadding:f,sticky:r,arrowPadding:g,disableAnchorTracking:P,keepMounted:R,collisionAvoidance:s,adaptiveOrigin:B}),N=a.useMemo(()=>({open:v,side:E.side,align:E.align,anchorHidden:E.anchorHidden,instant:x!=="none"?"tracking-cursor":H}),[v,E.side,E.align,E.anchorHidden,x,H]),W=Pt(n,N,{styles:E.positionerStyles,transitionStatus:L,props:y,refs:[t,C.useStateSetter("positionerElement")],hidden:!S,inert:!v||x==="both"||O});return k.jsx(ye.Provider,{value:E,children:W})}),Zt=a.forwardRef(function(n,t){const{render:u,className:o,style:p,...i}=n,c=K(),{side:m,align:h}=Lt(),l=c.useState("open"),T=c.useState("instantType"),f=c.useState("transitionStatus"),g=c.useState("popupProps"),r=c.useState("floatingRootContext"),P=c.useState("disabled"),s=c.useState("closeDelay");Ze({open:l,ref:c.context.popupRef,onComplete(){l&&c.context.onOpenChangeComplete?.(!0)}}),Tt(r,{enabled:!P,closeDelay:s});const d=c.useStateSetter("popupElement");return Te("div",n,{state:{open:l,side:m,align:h,instant:T,transitionStatus:f},ref:[t,c.context.popupRef,d],props:[ut,g,Ct(f),i],stateAttributesMapping:lt})});export{Xt as F,Dt as T,$t as a,Jt as b,Kt as c,Wt as d,Zt as e};
@@ -1,4 +1,4 @@
1
- import{r as K,W as lt,aA as ct,aB as Me,aC as ut,aD as dt,aE as ft,aF as mt,aG as gt,aH as yt,aI as ht,aJ as _e,aK as qe,V as v,az as Je,j as s,X as pt,c as T,y as V,aL as xt,aM as bt,n as kt,h as Nt}from"./__vite-browser-external-BXwSXUpN.js";import{m as vt}from"./react-BMJ2wuz1.js";import{u as Qe}from"./useCurrency-DL458pqS.js";import{u as Ve}from"./useTokenFormat-CYLt9pgs.js";import{D as De}from"./DateRangePopover-Cbd1idiF.js";import{u as wt}from"./use-latest-request-guard-Cpcl08EJ.js";import{T as jt,M as Tt}from"./terminal-BpvNaIz9.js";import{P as $e,a as Ee,b as Fe,c as Ae,d as Re}from"./PopoverPopup-CKKgItAT.js";import{u as _t}from"./use-reduced-motion-C6zOHbfR.js";function ze(e,r,t){if(!(typeof window>"u"))try{const a=window.localStorage.getItem(e),n=a?JSON.parse(a):[],o=Array.isArray(n)?n.filter(c=>typeof c=="string"&&c!==e):[],i=[r,...o.filter(c=>c!==r)],l=i.splice(t);for(const c of l)window.localStorage.removeItem(c);window.localStorage.setItem(e,JSON.stringify(i))}catch{}}const Ct=24,Pe="tokentracker.trend-cache-index",Ue=24;function St({baseUrl:e,accessToken:r,guestAllowed:t=!1,period:a,from:n,to:o,months:i=Ct,cacheKey:l,timeZone:c,tzOffsetMinutes:f,now:d,sharedRows:y,sharedRange:u,accountView:x=!1,accountAccessToken:m=null,accountRevision:k=0,accountViewResolving:h=!1,deviceId:_=null}={}){const C=!!(x&&m),M=C?"cloud":"local",[D,j]=K.useState([]),[P,R]=K.useState(()=>({from:n,to:o})),[w,F]=K.useState("edge"),[W,U]=K.useState(null),[z,L]=K.useState(!1),[ae,H]=K.useState(null),$=lt(),q=ct(r),Y=!t&&!$,re=Array.isArray(y),Z=u?.from||n,Q=u?.to||o,te=K.useRef({sharedEnabled:re,sharedRows:y,sharedFrom:Z,sharedTo:Q});te.current={sharedEnabled:re,sharedRows:y,sharedFrom:Z,sharedTo:Q};const g=K.useMemo(()=>a==="day"?"hourly":a==="total"?"monthly":"daily",[a]),I=(()=>{if(!l)return null;const N=Mt(e)||"default",E=ht({timeZone:c,offsetMinutes:f}),B=_||"all";if(g==="hourly")return`tokentracker.trend.${l}.${M}.${N}.hourly.${o||n||"day"}.${E}.${B}`;if(g==="monthly")return`tokentracker.trend.${l}.${M}.${N}.monthly.${i}.${o||"today"}.${E}.${B}`;const oe=`${n||""}.${o||""}`;return`tokentracker.trend.${l}.${M}.${N}.daily.${oe}.${E}.${B}`})(),ie=K.useCallback(()=>{if(!I||typeof window>"u")return null;try{const N=window.localStorage.getItem(I);if(!N)return null;const E=JSON.parse(N);return!E||!Array.isArray(E.rows)?null:(ze(Pe,I,Ue),E)}catch{return null}},[I]),fe=K.useCallback(N=>{if(!(!I||typeof window>"u"))try{window.localStorage.setItem(I,JSON.stringify(N)),ze(Pe,I,Ue)}catch{}},[I]),p=K.useCallback(()=>{if(!(!I||typeof window>"u"))try{window.localStorage.removeItem(I)}catch{}},[I]),b=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),A=wt([e,g,n,o,i,M,r,m,k,_,c,f,re,y,Z,Q,t,$,Y,h,q,b]),G=K.useRef(M);K.useEffect(()=>{G.current!==M&&(G.current=M,j([]),R({from:n,to:o}),F("edge"),U(null),H(null),L(!0))},[M]);const O=K.useCallback(async()=>{const N=A(),{sharedEnabled:E,sharedRows:B,sharedFrom:oe,sharedTo:le}=te.current;if(E){j(Array.isArray(B)?B:[]),R({from:oe,to:le}),F("shared"),U(null),L(!1),H(null);return}const me=await Me(r),Ce=C?await Me(m):null;if(!N()||!me&&!$&&!b&&!C)return;if(C&&!Ce){H("Your session expired. Please sign in again to view account data."),L(!1);return}const be=C?Ce:me,ot=C?ut:dt,st=C?ft:mt,it=C?gt:yt;L(!0),H(null);try{let J;g==="hourly"?J=await ot({baseUrl:e,accessToken:be,day:o||n,device:_,timeZone:c,tzOffsetMinutes:f}):g==="monthly"?J=await st({baseUrl:e,accessToken:be,months:i,to:o,device:_,timeZone:c,tzOffsetMinutes:f}):J=await it({baseUrl:e,accessToken:be,from:n,to:o,device:_,timeZone:c,tzOffsetMinutes:f});let S=J?.from||n||J?.day||null;const X=J?.to||o||J?.day||null;g==="monthly"&&!S&&(S=de(X,i));let ne=Array.isArray(J?.data)?J.data:[];g==="daily"?ne=ke(ne,S||n,X||o,{timeZone:c,offsetMinutes:f,now:d}):g==="hourly"?(ne=Ne(ne,S||n||J?.day,{timeZone:c,offsetMinutes:f,now:d}),ne=ve(ne,{timeZone:c,offsetMinutes:f,now:d})):g==="monthly"&&(ne=we(ne,S||n,X||o,{timeZone:c,offsetMinutes:f,now:d}));const Se=new Date().toISOString();if(!N())return;j(ne),R({from:S,to:X}),F("edge"),U(Se),Y?fe({rows:ne,from:S,to:X,mode:g,fetchedAt:Se}):p()}catch(J){if(!N())return;if(Y){const S=ie();if(S?.rows){let X=g==="daily"?ke(S.rows||[],S.from||n,S.to||o,{timeZone:c,offsetMinutes:f,now:d}):g==="hourly"?Ne(S.rows||[],S.from||n||S.day||o,{timeZone:c,offsetMinutes:f,now:d}):Array.isArray(S.rows)?S.rows:[];g==="hourly"?X=ve(X,{timeZone:c,offsetMinutes:f,now:d}):g==="monthly"&&(X=we(X,S.from||n||de(S.to||o,i),S.to||o,{timeZone:c,offsetMinutes:f,now:d})),j(X),R({from:S.from||n||(g==="monthly"?de(S.to||o,i):n),to:S.to||o}),F("cache"),U(S.fetchedAt||null),H(null)}else{j([]),R({from:n,to:o}),F("edge"),U(null);const X=J;H(X?.message||String(X))}}else{j([]),R({from:n,to:o}),F("edge"),U(null);const S=J;H(S?.message||String(S))}}finally{N()&&L(!1)}},[r,e,n,$,t,Y,g,i,ie,q,c,o,f,d,p,fe,b,C,m,k,_,A]);K.useEffect(()=>{if(h){L(!0);return}if(re){j(Array.isArray(y)?y:[]),R({from:Z,to:Q}),F("shared"),U(null),L(!1),H(null);return}if(!q&&!t&&!$&&!b&&!C){j([]),R({from:n,to:o}),H(null),L(!1),F("edge"),U(null);return}if(!Y)p(),j([]),R({from:n,to:o}),H(null),F("edge"),U(null);else{const N=ie();if(N?.rows){let E=g==="daily"?ke(N.rows||[],N.from||n,N.to||o,{timeZone:c,offsetMinutes:f,now:d}):g==="hourly"?Ne(N.rows||[],N.from||n||N.day||o,{timeZone:c,offsetMinutes:f,now:d}):Array.isArray(N.rows)?N.rows:[];g==="hourly"?E=ve(E,{timeZone:c,offsetMinutes:f,now:d}):g==="monthly"&&(E=we(E,N.from||n||de(N.to||o,i),N.to||o,{timeZone:c,offsetMinutes:f,now:d})),j(E),R({from:N.from||n||(g==="monthly"?de(N.to||o,i):n),to:N.to||o}),F("cache"),U(N.fetchedAt||null),H(null)}else j([]),R({from:n,to:o}),F("edge"),U(null),H(null)}L(!0),O()},[r,$,ie,O,re,Z,y,Q,q,t,Y,p,b,h]);const ee=$?"mock":w;return{rows:D,from:P.from||n,to:P.to||o,source:ee,fetchedAt:W,loading:z,error:ae,refresh:O}}function Mt(e){try{return new URL(e).host}catch{return null}}function ye(e){if(!e)return null;const r=String(e).trim(),t=r.split("-");if(t.length!==3)return null;const a=Number(t[0]),n=Number(t[1])-1,o=Number(t[2]);if(!Number.isFinite(a)||!Number.isFinite(n)||!Number.isFinite(o))return null;const i=new Date(Date.UTC(a,n,o));return Number.isFinite(i.getTime())&&_e(i)===r?i:null}function Ze(e,r){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+r))}const et=["total_tokens","billable_total_tokens","input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens","conversation_count"];function ke(e,r,t,{timeZone:a,offsetMinutes:n,now:o}={}){const i=ye(r),l=ye(t);if(!i||!l||l<i)return Array.isArray(e)?e:[];const c=o instanceof Date&&Number.isFinite(o.getTime())?o:new Date,f=qe({timeZone:a,offsetMinutes:n,date:c}),d=ye(f),y=d?d.getTime():c.getTime(),u=new Map;for(const m of e||[])m?.day&&u.set(m.day,m);const x=[];for(let m=i;m<=l;m=Ze(m,1)){const k=_e(m),h=u.get(k),_=m.getTime()>y;if(h){x.push({...h,missing:!1,future:_});continue}x.push({day:k,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!_,future:_})}return x}function Dt(e,r){const t=r?null:0;return{hour:e,total_tokens:t,billable_total_tokens:t,input_tokens:t,cached_input_tokens:t,cache_creation_input_tokens:t,output_tokens:t,reasoning_output_tokens:t,conversation_count:t,missing:!1,future:r}}function $t(e){if(!e||typeof e!="object")return!1;const r=e.models;return r&&typeof r=="object"&&Object.keys(r).length>0?!1:et.every(t=>e[t]==null)}function Et(e,r,t){const a={...e,hour:r,missing:!1,future:t};if(!t&&$t(e))for(const n of et)a[n]=0;return a}function Ft(e,r){const t=r===30?48:24,a=[];for(let n=0;n<t;n++){const o=Math.floor(n*r/60),i=n*r%60;a.push(`${e}T${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:00`)}return a}function At(e,r,{timeZone:t,offsetMinutes:a}={}){const n=Ft(e,r);if(!t||typeof Intl>"u"||!Intl.DateTimeFormat)return n;const o=ye(e);if(!o)return n;const i=o.getUTCFullYear()*1e4+(o.getUTCMonth()+1)*100+o.getUTCDate(),l=o.getTime()-2160*60*1e3,c=Ze(o,2).getTime()+2160*60*1e3,f=[],d=new Set;for(let y=l;y<=c;y+=1800*1e3){const u=xe({timeZone:t,offsetMinutes:a,now:new Date(y)});if(!u||u.dayNum!==i||r===60&&u.minute!==0||r===30&&u.minute!==0&&u.minute!==30)continue;const x=`${e}T${String(u.hour).padStart(2,"0")}:${String(u.minute).padStart(2,"0")}:00`;d.has(x)||(d.add(x),f.push(x))}return f.length>0?f:n}function Ne(e,r,{timeZone:t,offsetMinutes:a,now:n}={}){if(!r)return Array.isArray(e)?e:[];const o=r.trim().slice(0,10),i=xe({timeZone:t,offsetMinutes:a,now:n}),l=i?i.dayNum:void 0;let c=!1;for(const x of e||[]){const m=x?.hour||x?.label||"",k=he(m,l);if(k&&k.slot%2!==0){c=!0;break}}const f=c?30:60,d=new Map;for(const x of e||[]){const m=x?.hour||x?.label||"",k=he(m,l);k&&d.set(k.slot,x)}const y=[],u=At(o,f,{timeZone:t,offsetMinutes:a});for(let x=0;x<u.length;x++){const m=u[x],k=he(m,l),h=k?k.slot:c?x:x*2,_=d.get(h);let C=!1;if(i){const M=i.year*1e4+i.month*100+i.day,D=k?.dayNum??Number(o.replace(/-/g,""));if(D>M)C=!0;else if(D===M){const j=i.hour*2+(i.minute>=30?1:0);C=h>j}}_?y.push(Et(_,m,C)):y.push(Dt(m,C))}return y}function ve(e,{timeZone:r,offsetMinutes:t,now:a}={}){if(!Array.isArray(e))return[];const n=xe({timeZone:r,offsetMinutes:t,now:a});return n?e.map(o=>{const i=o?.hour||o?.label||"",l=he(i,n.dayNum);if(!l)return{...o,future:!1};const c=l.dayNum!==null&&l.dayNum>n.dayNum||(l.dayNum===null||l.dayNum===n.dayNum)&&l.slot>n.slot;return{...o,future:!!c}}):e}function de(e,r){const t=je(String(e||"").slice(0,7));return t?_e(new Date(Date.UTC(t.year,t.month-r,1))):null}function we(e,r,t,a={}){const n=je(String(r||"").slice(0,7)),o=je(String(t||"").slice(0,7));if(!n||!o)return Array.isArray(e)?e:[];const i=n.year*12+n.month-1,l=o.year*12+o.month-1;if(l<i)return Array.isArray(e)?e:[];const c=xe(a),f=c.year*12+c.month-1,d=new Map((e||[]).map(u=>[u?.month,u])),y=[];for(let u=i;u<=l;u++){const x=`${Math.floor(u/12)}-${String(u%12+1).padStart(2,"0")}`,m=u>f,k=d.get(x);if(k&&!(k.future&&k.total_tokens==null))y.push({...k,missing:!1,future:m});else{const h=m?null:0;y.push({month:x,total_tokens:h,billable_total_tokens:h,input_tokens:h,cached_input_tokens:h,cache_creation_input_tokens:h,output_tokens:h,reasoning_output_tokens:h,conversation_count:h,missing:!1,future:m})}}return y}function xe({timeZone:e,offsetMinutes:r,now:t}={}){const a=t instanceof Date&&Number.isFinite(t.getTime())?t:new Date;if(e&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const u=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(a).reduce((C,M)=>(M.type&&M.value&&(C[M.type]=M.value),C),{}),x=Number(u.year),m=Number(u.month),k=Number(u.day),h=Number(u.hour),_=Number(u.minute);if(Number.isFinite(x)&&Number.isFinite(m)&&Number.isFinite(k)&&Number.isFinite(h)&&Number.isFinite(_)){const C=h*2+(_>=30?1:0);return{year:x,month:m,day:k,hour:h,minute:_,dayNum:x*1e4+m*100+k,slot:C}}}catch{}if(Number.isFinite(r)){const d=new Date(a.getTime()+r*60*1e3),y=d.getUTCFullYear(),u=d.getUTCMonth()+1,x=d.getUTCDate(),m=d.getUTCHours(),k=d.getUTCMinutes(),h=m*2+(k>=30?1:0);return{year:y,month:u,day:x,hour:m,minute:k,dayNum:y*1e4+u*100+x,slot:h}}const n=a.getFullYear(),o=a.getMonth()+1,i=a.getDate(),l=a.getHours(),c=a.getMinutes(),f=l*2+(c>=30?1:0);return{year:n,month:o,day:i,hour:l,minute:c,dayNum:n*1e4+o*100+i,slot:f}}function he(e,r){if(!e)return null;const t=String(e).trim();if(t.includes("T")){const[a,n]=t.split("T");if(!a||!n)return null;const o=a.split("-");if(o.length!==3)return null;const i=Number(o[0]),l=Number(o[1]),c=Number(o[2]);if(!Number.isFinite(i)||!Number.isFinite(l)||!Number.isFinite(c))return null;const f=n.split(":"),d=Number(f[0]),y=Number(f[1]);if(!Number.isFinite(d)||d<0||d>23||!Number.isFinite(y)||y<0||y>59)return null;const u=d*2+(y>=30?1:0);return{dayNum:i*1e4+l*100+c,slot:u}}else{let a=NaN,n=0;if(/^\d{1,2}$/.test(t))a=Number(t);else if(/^\d{1,2}:\d{2}(:\d{2})?$/.test(t)){const i=t.split(":");a=Number(i[0]),n=Number(i[1])}if(!Number.isFinite(a)||a<0||a>23||!Number.isFinite(n)||n<0||n>59)return null;const o=a*2+(n>=30?1:0);return{dayNum:r||null,slot:o}}}function je(e){if(!e)return null;const t=String(e).trim().split("-");if(t.length!==2)return null;const a=Number(t[0]),n=Number(t[1]);return!Number.isFinite(a)||!Number.isFinite(n)||n<1||n>12?null:{year:a,month:n}}function Rt(e){return e==="day"?"hourly":e==="total"?"monthly":"daily"}function zt(e){return!!e&&!e.missing&&!e.future}function Pt(e){const r=e?.billable_total_tokens??e?.total_tokens??e?.value,t=Number(r);return Number.isFinite(t)&&t>=0?t:0}function Ut(e){const r=e?.total_tokens??e?.billable_total_tokens??e?.value,t=Number(r);return Number.isFinite(t)&&t>=0?t:0}function Lt(e){const r=Array.isArray(e)?e.filter(zt):[];let t=0,a=0,n=0,o=0,i=!1,l=0,c=-1,f=null;for(const d of r){const y=Ut(d),u=Pt(d);t+=y,a+=u;const x=Number(d?.conversation_count);Number.isFinite(x)&&x>0&&(n+=x);const m=Number(d?.total_cost_usd);Number.isFinite(m)&&(i=!0,o+=m),u>0&&(l+=1),u>c&&(c=u,f=d)}return{totalTokens:t,billableTokens:a,conversationCount:n,totalCostUsd:i?o:null,bucketCount:r.length,activeBuckets:l,peak:f&&c>0?{value:c,label:f.hour||f.day||f.month||""}:null}}function ue(e){return String(e).padStart(2,"0")}function tt(e){return typeof e=="string"&&e.trim()?e:"en-US"}function nt(e){const r=String(e||""),t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(r);if(!t)return null;const[,a,n,o]=t,i=new Date(Date.UTC(Number(a),Number(n)-1,Number(o)));return i.getUTCFullYear()!==Number(a)||i.getUTCMonth()+1!==Number(n)||i.getUTCDate()!==Number(o)?null:i}function se(e,r,t=!0){const a=nt(e);if(!a||typeof Intl>"u"||!Intl.DateTimeFormat)return String(e||"");try{return new Intl.DateTimeFormat(tt(r),{...t?{year:"numeric"}:{},month:"short",day:"numeric",timeZone:"UTC"}).format(a)}catch{return String(e||"")}}function pe(e,r){const t=String(e||""),a=/^(\d{4})-(\d{2})(?:-\d{2})?$/.exec(t);if(!a)return t;const n=new Date(Date.UTC(Number(a[1]),Number(a[2])-1,1));if(n.getUTCFullYear()!==Number(a[1])||n.getUTCMonth()+1!==Number(a[2]))return t;try{return new Intl.DateTimeFormat(tt(r),{year:"numeric",month:"short",timeZone:"UTC"}).format(n)}catch{return t}}function Ht(e,r){const t=nt(e);return t?(t.setUTCDate(t.getUTCDate()+r),`${t.getUTCFullYear()}-${ue(t.getUTCMonth()+1)}-${ue(t.getUTCDate())}`):e}function Le(e,r,t){if(!e)return"";if(r==="hourly"){const n=String(e.hour||e.label||""),o=/^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})/.exec(n);if(!o)return n;const[,i,l,c]=o,d=Number(l)*60+Number(c)+30,y=Math.floor(d/60)%24,u=d%60,x=se(i,t);if(d>=1440){const m=se(Ht(i,1),t);return`${x} ${l}:${c}–${m} ${ue(y)}:${ue(u)}`}return`${x} ${l}:${c}–${ue(y)}:${ue(u)}`}if(r==="monthly"){const n=String(e.month||e.label||"");return pe(n,t)}const a=String(e.day||e.label||"");return se(a,t)}function It(e,r,t,a){if(!e||!r)return null;const n=String(e),o=String(r);return t==="hourly"&&n===o?{start:`${se(n,a)} · 00:00`,end:"24:00"}:t==="monthly"?{start:pe(n,a),end:pe(o,a)}:{start:se(n,a),end:se(o,a)}}function Bt(e){if(!e||e.activeBuckets===0)return"trend.zoom.insight.empty";const r=e.totalTokens||0;return r<1e7?"trend.zoom.insight.calm":r<5e8?"trend.zoom.insight.steady":r<5e9?"trend.zoom.insight.heavy":"trend.zoom.insight.massive"}function Ot(e,r,t){if(!e)return"";if(r==="hourly"){const n=/T(\d{2}:\d{2})/.exec(String(e.hour||e.label||""));return n?n[1]:""}if(r==="monthly")return pe(String(e.month||e.label||""),t);const a=String(e.day||e.label||"");return se(a,t,!1)}const Yt=[{period:"day",labelKey:"trend.zoom.gran.30min"},{period:"month",labelKey:"trend.zoom.gran.day"},{period:"total",labelKey:"trend.zoom.gran.month"}],Kt=24,ce="#10b981";function He(e){return e==="day"?"day":e==="total"?"total":"month"}function Te(e,r){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e||""));if(!t)return e;const a=new Date(Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3])));a.setUTCDate(a.getUTCDate()+r);const n=a.getUTCFullYear(),o=String(a.getUTCMonth()+1).padStart(2,"0"),i=String(a.getUTCDate()).padStart(2,"0");return`${n}-${o}-${i}`}function Gt(e,r){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e||""));if(!t)return e;const a=new Date(Date.UTC(Number(t[1]),Number(t[2])-1+r,Number(t[3]))),n=a.getUTCFullYear(),o=String(a.getUTCMonth()+1).padStart(2,"0"),i=String(a.getUTCDate()).padStart(2,"0");return`${n}-${o}-${i}`}function Xt(e,r){const t=/^(\d{4})-(\d{2})/.exec(String(e||"")),a=/^(\d{4})-(\d{2})/.exec(String(r||""));if(!t||!a)return Kt;const n=Number(a[1])*12+Number(a[2])-(Number(t[1])*12+Number(t[2]))+1;return Math.max(1,n)}function Ie(e,r){return r?e==="total"?{from:Gt(r,-23),to:r}:{from:Te(r,-29),to:r}:{from:null,to:null}}function Wt(e){const r=/^\d{4}-(\d{2}-\d{2})T(\d{2}:\d{2})/.exec(String(e||""));return r?`${r[1]} ${r[2]}`:e||""}function ge({label:e,value:r,sub:t,title:a}){return s.jsxs("div",{className:"flex flex-col gap-1.5 group",children:[s.jsx("span",{className:"text-[9px] font-bold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500",children:e}),s.jsx("span",{title:a,className:"text-xl font-black font-mono text-zinc-900 dark:text-zinc-50 tracking-tight leading-none tabular-nums transition-transform duration-200 group-hover:-translate-y-[1px]",children:r}),t?s.jsx("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono tabular-nums",children:t}):null]})}function qt({zoomConfig:e,period:r,from:t,to:a,timeZoneLabel:n,onClose:o,renderChart:i}){const{currency:l,rate:c}=Qe(),{formatTokensTooltip:f}=Ve(),d=g=>kt(g),y=v.useMemo(()=>qe({timeZone:e?.timeZone,offsetMinutes:e?.tzOffsetMinutes,date:e?.now||new Date})||a||t||null,[e?.timeZone,e?.tzOffsetMinutes,e?.now,a,t]),[u,x]=v.useState(()=>He(r)),[m,k]=v.useState(y),[h,_]=v.useState(()=>Ie(He(r),y)),[C,M]=v.useState(!1),[D,j]=v.useState(!1),[P,R]=v.useState(!1),w=v.useRef(!1),F=y,W=g=>{x(g),g!=="day"&&_(Ie(g,y))},U=v.useMemo(()=>u==="day"?{from:m,to:m,months:void 0}:u==="total"?{from:void 0,to:h.to,months:Xt(h.from,h.to)}:{from:h.from,to:h.to,months:void 0},[u,m,h]),{rows:z,from:L,to:ae,loading:H}=St({...e,period:u,from:U.from,to:U.to,months:U.months}),$=v.useMemo(()=>Lt(z),[z]),q=v.useCallback(()=>{w.current||(w.current=!0,o())},[o]),Y=v.useCallback(()=>R(!0),[]),re=g=>{g.target===g.currentTarget&&P&&q()};if(v.useEffect(()=>{if(!P)return;const g=window.setTimeout(q,250);return()=>window.clearTimeout(g)},[q,P]),v.useEffect(()=>{const g=I=>{I.key==="Escape"&&Y()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[Y]),typeof document>"u")return null;const Z=u==="day"&&!!m,Q=u==="day"&&!!m&&(!F||m<F),te=$.totalCostUsd!=null?Je($.totalCostUsd,{currency:l,rate:c}):null;return s.jsxs("div",{onAnimationEnd:re,onClick:g=>{g.target===g.currentTarget&&Y()},className:V("fixed inset-0 z-50 flex items-center justify-center p-3 md:p-6 backdrop-blur-md bg-black/15 dark:bg-black/40",P?"animate-tt-fade-out":"animate-tt-fade-in"),children:[s.jsx("style",{children:`
1
+ import{r as K,W as lt,aA as ct,aB as Me,aC as ut,aD as dt,aE as ft,aF as mt,aG as gt,aH as yt,aI as ht,aJ as _e,aK as qe,V as v,az as Je,j as s,X as pt,c as T,y as V,aL as xt,aM as bt,n as kt,h as Nt}from"./__vite-browser-external-CbhiyufG.js";import{m as vt}from"./react-Dt52_FiQ.js";import{u as Qe}from"./useCurrency-CW5GHWIB.js";import{u as Ve}from"./useTokenFormat-DntK8yNR.js";import{D as De}from"./DateRangePopover-CyAT0F7i.js";import{u as wt}from"./use-latest-request-guard-BZnnoQct.js";import{T as jt,M as Tt}from"./terminal-FK6txO2c.js";import{P as $e,a as Ee,b as Fe,c as Ae,d as Re}from"./PopoverPopup-IQrgeWzz.js";import{u as _t}from"./use-reduced-motion-Bpc6LGag.js";function ze(e,r,t){if(!(typeof window>"u"))try{const a=window.localStorage.getItem(e),n=a?JSON.parse(a):[],o=Array.isArray(n)?n.filter(c=>typeof c=="string"&&c!==e):[],i=[r,...o.filter(c=>c!==r)],l=i.splice(t);for(const c of l)window.localStorage.removeItem(c);window.localStorage.setItem(e,JSON.stringify(i))}catch{}}const Ct=24,Pe="tokentracker.trend-cache-index",Ue=24;function St({baseUrl:e,accessToken:r,guestAllowed:t=!1,period:a,from:n,to:o,months:i=Ct,cacheKey:l,timeZone:c,tzOffsetMinutes:f,now:d,sharedRows:y,sharedRange:u,accountView:x=!1,accountAccessToken:m=null,accountRevision:k=0,accountViewResolving:h=!1,deviceId:_=null}={}){const C=!!(x&&m),M=C?"cloud":"local",[D,j]=K.useState([]),[P,R]=K.useState(()=>({from:n,to:o})),[w,F]=K.useState("edge"),[W,U]=K.useState(null),[z,L]=K.useState(!1),[ae,H]=K.useState(null),$=lt(),q=ct(r),Y=!t&&!$,re=Array.isArray(y),Z=u?.from||n,Q=u?.to||o,te=K.useRef({sharedEnabled:re,sharedRows:y,sharedFrom:Z,sharedTo:Q});te.current={sharedEnabled:re,sharedRows:y,sharedFrom:Z,sharedTo:Q};const g=K.useMemo(()=>a==="day"?"hourly":a==="total"?"monthly":"daily",[a]),I=(()=>{if(!l)return null;const N=Mt(e)||"default",E=ht({timeZone:c,offsetMinutes:f}),B=_||"all";if(g==="hourly")return`tokentracker.trend.${l}.${M}.${N}.hourly.${o||n||"day"}.${E}.${B}`;if(g==="monthly")return`tokentracker.trend.${l}.${M}.${N}.monthly.${i}.${o||"today"}.${E}.${B}`;const oe=`${n||""}.${o||""}`;return`tokentracker.trend.${l}.${M}.${N}.daily.${oe}.${E}.${B}`})(),ie=K.useCallback(()=>{if(!I||typeof window>"u")return null;try{const N=window.localStorage.getItem(I);if(!N)return null;const E=JSON.parse(N);return!E||!Array.isArray(E.rows)?null:(ze(Pe,I,Ue),E)}catch{return null}},[I]),fe=K.useCallback(N=>{if(!(!I||typeof window>"u"))try{window.localStorage.setItem(I,JSON.stringify(N)),ze(Pe,I,Ue)}catch{}},[I]),p=K.useCallback(()=>{if(!(!I||typeof window>"u"))try{window.localStorage.removeItem(I)}catch{}},[I]),b=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),A=wt([e,g,n,o,i,M,r,m,k,_,c,f,re,y,Z,Q,t,$,Y,h,q,b]),G=K.useRef(M);K.useEffect(()=>{G.current!==M&&(G.current=M,j([]),R({from:n,to:o}),F("edge"),U(null),H(null),L(!0))},[M]);const O=K.useCallback(async()=>{const N=A(),{sharedEnabled:E,sharedRows:B,sharedFrom:oe,sharedTo:le}=te.current;if(E){j(Array.isArray(B)?B:[]),R({from:oe,to:le}),F("shared"),U(null),L(!1),H(null);return}const me=await Me(r),Ce=C?await Me(m):null;if(!N()||!me&&!$&&!b&&!C)return;if(C&&!Ce){H("Your session expired. Please sign in again to view account data."),L(!1);return}const be=C?Ce:me,ot=C?ut:dt,st=C?ft:mt,it=C?gt:yt;L(!0),H(null);try{let J;g==="hourly"?J=await ot({baseUrl:e,accessToken:be,day:o||n,device:_,timeZone:c,tzOffsetMinutes:f}):g==="monthly"?J=await st({baseUrl:e,accessToken:be,months:i,to:o,device:_,timeZone:c,tzOffsetMinutes:f}):J=await it({baseUrl:e,accessToken:be,from:n,to:o,device:_,timeZone:c,tzOffsetMinutes:f});let S=J?.from||n||J?.day||null;const X=J?.to||o||J?.day||null;g==="monthly"&&!S&&(S=de(X,i));let ne=Array.isArray(J?.data)?J.data:[];g==="daily"?ne=ke(ne,S||n,X||o,{timeZone:c,offsetMinutes:f,now:d}):g==="hourly"?(ne=Ne(ne,S||n||J?.day,{timeZone:c,offsetMinutes:f,now:d}),ne=ve(ne,{timeZone:c,offsetMinutes:f,now:d})):g==="monthly"&&(ne=we(ne,S||n,X||o,{timeZone:c,offsetMinutes:f,now:d}));const Se=new Date().toISOString();if(!N())return;j(ne),R({from:S,to:X}),F("edge"),U(Se),Y?fe({rows:ne,from:S,to:X,mode:g,fetchedAt:Se}):p()}catch(J){if(!N())return;if(Y){const S=ie();if(S?.rows){let X=g==="daily"?ke(S.rows||[],S.from||n,S.to||o,{timeZone:c,offsetMinutes:f,now:d}):g==="hourly"?Ne(S.rows||[],S.from||n||S.day||o,{timeZone:c,offsetMinutes:f,now:d}):Array.isArray(S.rows)?S.rows:[];g==="hourly"?X=ve(X,{timeZone:c,offsetMinutes:f,now:d}):g==="monthly"&&(X=we(X,S.from||n||de(S.to||o,i),S.to||o,{timeZone:c,offsetMinutes:f,now:d})),j(X),R({from:S.from||n||(g==="monthly"?de(S.to||o,i):n),to:S.to||o}),F("cache"),U(S.fetchedAt||null),H(null)}else{j([]),R({from:n,to:o}),F("edge"),U(null);const X=J;H(X?.message||String(X))}}else{j([]),R({from:n,to:o}),F("edge"),U(null);const S=J;H(S?.message||String(S))}}finally{N()&&L(!1)}},[r,e,n,$,t,Y,g,i,ie,q,c,o,f,d,p,fe,b,C,m,k,_,A]);K.useEffect(()=>{if(h){L(!0);return}if(re){j(Array.isArray(y)?y:[]),R({from:Z,to:Q}),F("shared"),U(null),L(!1),H(null);return}if(!q&&!t&&!$&&!b&&!C){j([]),R({from:n,to:o}),H(null),L(!1),F("edge"),U(null);return}if(!Y)p(),j([]),R({from:n,to:o}),H(null),F("edge"),U(null);else{const N=ie();if(N?.rows){let E=g==="daily"?ke(N.rows||[],N.from||n,N.to||o,{timeZone:c,offsetMinutes:f,now:d}):g==="hourly"?Ne(N.rows||[],N.from||n||N.day||o,{timeZone:c,offsetMinutes:f,now:d}):Array.isArray(N.rows)?N.rows:[];g==="hourly"?E=ve(E,{timeZone:c,offsetMinutes:f,now:d}):g==="monthly"&&(E=we(E,N.from||n||de(N.to||o,i),N.to||o,{timeZone:c,offsetMinutes:f,now:d})),j(E),R({from:N.from||n||(g==="monthly"?de(N.to||o,i):n),to:N.to||o}),F("cache"),U(N.fetchedAt||null),H(null)}else j([]),R({from:n,to:o}),F("edge"),U(null),H(null)}L(!0),O()},[r,$,ie,O,re,Z,y,Q,q,t,Y,p,b,h]);const ee=$?"mock":w;return{rows:D,from:P.from||n,to:P.to||o,source:ee,fetchedAt:W,loading:z,error:ae,refresh:O}}function Mt(e){try{return new URL(e).host}catch{return null}}function ye(e){if(!e)return null;const r=String(e).trim(),t=r.split("-");if(t.length!==3)return null;const a=Number(t[0]),n=Number(t[1])-1,o=Number(t[2]);if(!Number.isFinite(a)||!Number.isFinite(n)||!Number.isFinite(o))return null;const i=new Date(Date.UTC(a,n,o));return Number.isFinite(i.getTime())&&_e(i)===r?i:null}function Ze(e,r){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+r))}const et=["total_tokens","billable_total_tokens","input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens","conversation_count"];function ke(e,r,t,{timeZone:a,offsetMinutes:n,now:o}={}){const i=ye(r),l=ye(t);if(!i||!l||l<i)return Array.isArray(e)?e:[];const c=o instanceof Date&&Number.isFinite(o.getTime())?o:new Date,f=qe({timeZone:a,offsetMinutes:n,date:c}),d=ye(f),y=d?d.getTime():c.getTime(),u=new Map;for(const m of e||[])m?.day&&u.set(m.day,m);const x=[];for(let m=i;m<=l;m=Ze(m,1)){const k=_e(m),h=u.get(k),_=m.getTime()>y;if(h){x.push({...h,missing:!1,future:_});continue}x.push({day:k,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!_,future:_})}return x}function Dt(e,r){const t=r?null:0;return{hour:e,total_tokens:t,billable_total_tokens:t,input_tokens:t,cached_input_tokens:t,cache_creation_input_tokens:t,output_tokens:t,reasoning_output_tokens:t,conversation_count:t,missing:!1,future:r}}function $t(e){if(!e||typeof e!="object")return!1;const r=e.models;return r&&typeof r=="object"&&Object.keys(r).length>0?!1:et.every(t=>e[t]==null)}function Et(e,r,t){const a={...e,hour:r,missing:!1,future:t};if(!t&&$t(e))for(const n of et)a[n]=0;return a}function Ft(e,r){const t=r===30?48:24,a=[];for(let n=0;n<t;n++){const o=Math.floor(n*r/60),i=n*r%60;a.push(`${e}T${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}:00`)}return a}function At(e,r,{timeZone:t,offsetMinutes:a}={}){const n=Ft(e,r);if(!t||typeof Intl>"u"||!Intl.DateTimeFormat)return n;const o=ye(e);if(!o)return n;const i=o.getUTCFullYear()*1e4+(o.getUTCMonth()+1)*100+o.getUTCDate(),l=o.getTime()-2160*60*1e3,c=Ze(o,2).getTime()+2160*60*1e3,f=[],d=new Set;for(let y=l;y<=c;y+=1800*1e3){const u=xe({timeZone:t,offsetMinutes:a,now:new Date(y)});if(!u||u.dayNum!==i||r===60&&u.minute!==0||r===30&&u.minute!==0&&u.minute!==30)continue;const x=`${e}T${String(u.hour).padStart(2,"0")}:${String(u.minute).padStart(2,"0")}:00`;d.has(x)||(d.add(x),f.push(x))}return f.length>0?f:n}function Ne(e,r,{timeZone:t,offsetMinutes:a,now:n}={}){if(!r)return Array.isArray(e)?e:[];const o=r.trim().slice(0,10),i=xe({timeZone:t,offsetMinutes:a,now:n}),l=i?i.dayNum:void 0;let c=!1;for(const x of e||[]){const m=x?.hour||x?.label||"",k=he(m,l);if(k&&k.slot%2!==0){c=!0;break}}const f=c?30:60,d=new Map;for(const x of e||[]){const m=x?.hour||x?.label||"",k=he(m,l);k&&d.set(k.slot,x)}const y=[],u=At(o,f,{timeZone:t,offsetMinutes:a});for(let x=0;x<u.length;x++){const m=u[x],k=he(m,l),h=k?k.slot:c?x:x*2,_=d.get(h);let C=!1;if(i){const M=i.year*1e4+i.month*100+i.day,D=k?.dayNum??Number(o.replace(/-/g,""));if(D>M)C=!0;else if(D===M){const j=i.hour*2+(i.minute>=30?1:0);C=h>j}}_?y.push(Et(_,m,C)):y.push(Dt(m,C))}return y}function ve(e,{timeZone:r,offsetMinutes:t,now:a}={}){if(!Array.isArray(e))return[];const n=xe({timeZone:r,offsetMinutes:t,now:a});return n?e.map(o=>{const i=o?.hour||o?.label||"",l=he(i,n.dayNum);if(!l)return{...o,future:!1};const c=l.dayNum!==null&&l.dayNum>n.dayNum||(l.dayNum===null||l.dayNum===n.dayNum)&&l.slot>n.slot;return{...o,future:!!c}}):e}function de(e,r){const t=je(String(e||"").slice(0,7));return t?_e(new Date(Date.UTC(t.year,t.month-r,1))):null}function we(e,r,t,a={}){const n=je(String(r||"").slice(0,7)),o=je(String(t||"").slice(0,7));if(!n||!o)return Array.isArray(e)?e:[];const i=n.year*12+n.month-1,l=o.year*12+o.month-1;if(l<i)return Array.isArray(e)?e:[];const c=xe(a),f=c.year*12+c.month-1,d=new Map((e||[]).map(u=>[u?.month,u])),y=[];for(let u=i;u<=l;u++){const x=`${Math.floor(u/12)}-${String(u%12+1).padStart(2,"0")}`,m=u>f,k=d.get(x);if(k&&!(k.future&&k.total_tokens==null))y.push({...k,missing:!1,future:m});else{const h=m?null:0;y.push({month:x,total_tokens:h,billable_total_tokens:h,input_tokens:h,cached_input_tokens:h,cache_creation_input_tokens:h,output_tokens:h,reasoning_output_tokens:h,conversation_count:h,missing:!1,future:m})}}return y}function xe({timeZone:e,offsetMinutes:r,now:t}={}){const a=t instanceof Date&&Number.isFinite(t.getTime())?t:new Date;if(e&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const u=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(a).reduce((C,M)=>(M.type&&M.value&&(C[M.type]=M.value),C),{}),x=Number(u.year),m=Number(u.month),k=Number(u.day),h=Number(u.hour),_=Number(u.minute);if(Number.isFinite(x)&&Number.isFinite(m)&&Number.isFinite(k)&&Number.isFinite(h)&&Number.isFinite(_)){const C=h*2+(_>=30?1:0);return{year:x,month:m,day:k,hour:h,minute:_,dayNum:x*1e4+m*100+k,slot:C}}}catch{}if(Number.isFinite(r)){const d=new Date(a.getTime()+r*60*1e3),y=d.getUTCFullYear(),u=d.getUTCMonth()+1,x=d.getUTCDate(),m=d.getUTCHours(),k=d.getUTCMinutes(),h=m*2+(k>=30?1:0);return{year:y,month:u,day:x,hour:m,minute:k,dayNum:y*1e4+u*100+x,slot:h}}const n=a.getFullYear(),o=a.getMonth()+1,i=a.getDate(),l=a.getHours(),c=a.getMinutes(),f=l*2+(c>=30?1:0);return{year:n,month:o,day:i,hour:l,minute:c,dayNum:n*1e4+o*100+i,slot:f}}function he(e,r){if(!e)return null;const t=String(e).trim();if(t.includes("T")){const[a,n]=t.split("T");if(!a||!n)return null;const o=a.split("-");if(o.length!==3)return null;const i=Number(o[0]),l=Number(o[1]),c=Number(o[2]);if(!Number.isFinite(i)||!Number.isFinite(l)||!Number.isFinite(c))return null;const f=n.split(":"),d=Number(f[0]),y=Number(f[1]);if(!Number.isFinite(d)||d<0||d>23||!Number.isFinite(y)||y<0||y>59)return null;const u=d*2+(y>=30?1:0);return{dayNum:i*1e4+l*100+c,slot:u}}else{let a=NaN,n=0;if(/^\d{1,2}$/.test(t))a=Number(t);else if(/^\d{1,2}:\d{2}(:\d{2})?$/.test(t)){const i=t.split(":");a=Number(i[0]),n=Number(i[1])}if(!Number.isFinite(a)||a<0||a>23||!Number.isFinite(n)||n<0||n>59)return null;const o=a*2+(n>=30?1:0);return{dayNum:r||null,slot:o}}}function je(e){if(!e)return null;const t=String(e).trim().split("-");if(t.length!==2)return null;const a=Number(t[0]),n=Number(t[1]);return!Number.isFinite(a)||!Number.isFinite(n)||n<1||n>12?null:{year:a,month:n}}function Rt(e){return e==="day"?"hourly":e==="total"?"monthly":"daily"}function zt(e){return!!e&&!e.missing&&!e.future}function Pt(e){const r=e?.billable_total_tokens??e?.total_tokens??e?.value,t=Number(r);return Number.isFinite(t)&&t>=0?t:0}function Ut(e){const r=e?.total_tokens??e?.billable_total_tokens??e?.value,t=Number(r);return Number.isFinite(t)&&t>=0?t:0}function Lt(e){const r=Array.isArray(e)?e.filter(zt):[];let t=0,a=0,n=0,o=0,i=!1,l=0,c=-1,f=null;for(const d of r){const y=Ut(d),u=Pt(d);t+=y,a+=u;const x=Number(d?.conversation_count);Number.isFinite(x)&&x>0&&(n+=x);const m=Number(d?.total_cost_usd);Number.isFinite(m)&&(i=!0,o+=m),u>0&&(l+=1),u>c&&(c=u,f=d)}return{totalTokens:t,billableTokens:a,conversationCount:n,totalCostUsd:i?o:null,bucketCount:r.length,activeBuckets:l,peak:f&&c>0?{value:c,label:f.hour||f.day||f.month||""}:null}}function ue(e){return String(e).padStart(2,"0")}function tt(e){return typeof e=="string"&&e.trim()?e:"en-US"}function nt(e){const r=String(e||""),t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(r);if(!t)return null;const[,a,n,o]=t,i=new Date(Date.UTC(Number(a),Number(n)-1,Number(o)));return i.getUTCFullYear()!==Number(a)||i.getUTCMonth()+1!==Number(n)||i.getUTCDate()!==Number(o)?null:i}function se(e,r,t=!0){const a=nt(e);if(!a||typeof Intl>"u"||!Intl.DateTimeFormat)return String(e||"");try{return new Intl.DateTimeFormat(tt(r),{...t?{year:"numeric"}:{},month:"short",day:"numeric",timeZone:"UTC"}).format(a)}catch{return String(e||"")}}function pe(e,r){const t=String(e||""),a=/^(\d{4})-(\d{2})(?:-\d{2})?$/.exec(t);if(!a)return t;const n=new Date(Date.UTC(Number(a[1]),Number(a[2])-1,1));if(n.getUTCFullYear()!==Number(a[1])||n.getUTCMonth()+1!==Number(a[2]))return t;try{return new Intl.DateTimeFormat(tt(r),{year:"numeric",month:"short",timeZone:"UTC"}).format(n)}catch{return t}}function Ht(e,r){const t=nt(e);return t?(t.setUTCDate(t.getUTCDate()+r),`${t.getUTCFullYear()}-${ue(t.getUTCMonth()+1)}-${ue(t.getUTCDate())}`):e}function Le(e,r,t){if(!e)return"";if(r==="hourly"){const n=String(e.hour||e.label||""),o=/^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})/.exec(n);if(!o)return n;const[,i,l,c]=o,d=Number(l)*60+Number(c)+30,y=Math.floor(d/60)%24,u=d%60,x=se(i,t);if(d>=1440){const m=se(Ht(i,1),t);return`${x} ${l}:${c}–${m} ${ue(y)}:${ue(u)}`}return`${x} ${l}:${c}–${ue(y)}:${ue(u)}`}if(r==="monthly"){const n=String(e.month||e.label||"");return pe(n,t)}const a=String(e.day||e.label||"");return se(a,t)}function It(e,r,t,a){if(!e||!r)return null;const n=String(e),o=String(r);return t==="hourly"&&n===o?{start:`${se(n,a)} · 00:00`,end:"24:00"}:t==="monthly"?{start:pe(n,a),end:pe(o,a)}:{start:se(n,a),end:se(o,a)}}function Bt(e){if(!e||e.activeBuckets===0)return"trend.zoom.insight.empty";const r=e.totalTokens||0;return r<1e7?"trend.zoom.insight.calm":r<5e8?"trend.zoom.insight.steady":r<5e9?"trend.zoom.insight.heavy":"trend.zoom.insight.massive"}function Ot(e,r,t){if(!e)return"";if(r==="hourly"){const n=/T(\d{2}:\d{2})/.exec(String(e.hour||e.label||""));return n?n[1]:""}if(r==="monthly")return pe(String(e.month||e.label||""),t);const a=String(e.day||e.label||"");return se(a,t,!1)}const Yt=[{period:"day",labelKey:"trend.zoom.gran.30min"},{period:"month",labelKey:"trend.zoom.gran.day"},{period:"total",labelKey:"trend.zoom.gran.month"}],Kt=24,ce="#10b981";function He(e){return e==="day"?"day":e==="total"?"total":"month"}function Te(e,r){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e||""));if(!t)return e;const a=new Date(Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3])));a.setUTCDate(a.getUTCDate()+r);const n=a.getUTCFullYear(),o=String(a.getUTCMonth()+1).padStart(2,"0"),i=String(a.getUTCDate()).padStart(2,"0");return`${n}-${o}-${i}`}function Gt(e,r){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e||""));if(!t)return e;const a=new Date(Date.UTC(Number(t[1]),Number(t[2])-1+r,Number(t[3]))),n=a.getUTCFullYear(),o=String(a.getUTCMonth()+1).padStart(2,"0"),i=String(a.getUTCDate()).padStart(2,"0");return`${n}-${o}-${i}`}function Xt(e,r){const t=/^(\d{4})-(\d{2})/.exec(String(e||"")),a=/^(\d{4})-(\d{2})/.exec(String(r||""));if(!t||!a)return Kt;const n=Number(a[1])*12+Number(a[2])-(Number(t[1])*12+Number(t[2]))+1;return Math.max(1,n)}function Ie(e,r){return r?e==="total"?{from:Gt(r,-23),to:r}:{from:Te(r,-29),to:r}:{from:null,to:null}}function Wt(e){const r=/^\d{4}-(\d{2}-\d{2})T(\d{2}:\d{2})/.exec(String(e||""));return r?`${r[1]} ${r[2]}`:e||""}function ge({label:e,value:r,sub:t,title:a}){return s.jsxs("div",{className:"flex flex-col gap-1.5 group",children:[s.jsx("span",{className:"text-[9px] font-bold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500",children:e}),s.jsx("span",{title:a,className:"text-xl font-black font-mono text-zinc-900 dark:text-zinc-50 tracking-tight leading-none tabular-nums transition-transform duration-200 group-hover:-translate-y-[1px]",children:r}),t?s.jsx("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono tabular-nums",children:t}):null]})}function qt({zoomConfig:e,period:r,from:t,to:a,timeZoneLabel:n,onClose:o,renderChart:i}){const{currency:l,rate:c}=Qe(),{formatTokensTooltip:f}=Ve(),d=g=>kt(g),y=v.useMemo(()=>qe({timeZone:e?.timeZone,offsetMinutes:e?.tzOffsetMinutes,date:e?.now||new Date})||a||t||null,[e?.timeZone,e?.tzOffsetMinutes,e?.now,a,t]),[u,x]=v.useState(()=>He(r)),[m,k]=v.useState(y),[h,_]=v.useState(()=>Ie(He(r),y)),[C,M]=v.useState(!1),[D,j]=v.useState(!1),[P,R]=v.useState(!1),w=v.useRef(!1),F=y,W=g=>{x(g),g!=="day"&&_(Ie(g,y))},U=v.useMemo(()=>u==="day"?{from:m,to:m,months:void 0}:u==="total"?{from:void 0,to:h.to,months:Xt(h.from,h.to)}:{from:h.from,to:h.to,months:void 0},[u,m,h]),{rows:z,from:L,to:ae,loading:H}=St({...e,period:u,from:U.from,to:U.to,months:U.months}),$=v.useMemo(()=>Lt(z),[z]),q=v.useCallback(()=>{w.current||(w.current=!0,o())},[o]),Y=v.useCallback(()=>R(!0),[]),re=g=>{g.target===g.currentTarget&&P&&q()};if(v.useEffect(()=>{if(!P)return;const g=window.setTimeout(q,250);return()=>window.clearTimeout(g)},[q,P]),v.useEffect(()=>{const g=I=>{I.key==="Escape"&&Y()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[Y]),typeof document>"u")return null;const Z=u==="day"&&!!m,Q=u==="day"&&!!m&&(!F||m<F),te=$.totalCostUsd!=null?Je($.totalCostUsd,{currency:l,rate:c}):null;return s.jsxs("div",{onAnimationEnd:re,onClick:g=>{g.target===g.currentTarget&&Y()},className:V("fixed inset-0 z-50 flex items-center justify-center p-3 md:p-6 backdrop-blur-md bg-black/15 dark:bg-black/40",P?"animate-tt-fade-out":"animate-tt-fade-in"),children:[s.jsx("style",{children:`
2
2
  @keyframes tt-fade-in { from { opacity: 0; } to { opacity: 1; } }
3
3
  @keyframes tt-fade-out { from { opacity: 1; } to { opacity: 0; } }
4
4
  @keyframes tt-modal-entrance {
@@ -1 +1 @@
1
- import{j as e,c as a,I as R,am as E,r as b,t as $,V as O,y as W}from"./__vite-browser-external-BXwSXUpN.js";import{S as F}from"./Select-Dcg7FYAt.js";import{u as K}from"./use-native-settings-BSx7lGEK.js";import{T as D}from"./Controls-BJAwM2gB.js";import{F as N,S as G,a as z}from"./FadeIn-BEieTXMD.js";import{A as H}from"./arrow-up-right-CzeEeXRz.js";import{D as U}from"./download-BSyGLtfW.js";import"./chevron-down-BzkceD4z.js";import"./check-C--D8Lze.js";import"./SelectItemText-4vuj6xMs.js";import"./composite-7DhFi6TA.js";import"./usePositioner-DnCQwlVT.js";import"./Card-C-UuIN42.js";import"./react-BMJ2wuz1.js";import"./use-reduced-motion-C6zOHbfR.js";const V=["todayTokens","todayCost"],x="none",T=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"},{id:"codexCredits",label:"Codex Credit Limit",shortLabel:"Cx Cred",category:"limits"},{id:"codexSpark5h",label:"Codex Spark 5h Limit",shortLabel:"Cx Spark 5h",category:"limits"},{id:"codexSpark7d",label:"Codex Spark 7d Limit",shortLabel:"Cx Spark 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaudeWeekly",label:"Antigravity Claude 7d Limit",shortLabel:"Ag Cl 7d",category:"limits"},{id:"antigravityClaude5h",label:"Antigravity Claude 5h Limit",shortLabel:"Ag Cl 5h",category:"limits"},{id:"antigravityGeminiWeekly",label:"Antigravity Gemini 7d Limit",shortLabel:"Ag Gm 7d",category:"limits"},{id:"antigravityGemini5h",label:"Antigravity Gemini 5h Limit",shortLabel:"Ag Gm 5h",category:"limits"}];function S(t,i=T,r=2){const s=new Set(i.map(n=>n.id)),o=new Set,l=Array.isArray(t)?t.filter(n=>n===x?!0:!s.has(n)||o.has(n)?!1:(o.add(n),!0)):[];return(l.length>0?l:V).slice(0,Math.max(1,Number(r)||2))}const X=264,Y=124,g="ui-rounded, -apple-system, system-ui",C=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],Z={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function q(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function y({size:t="sm",children:i}){const r=t==="lg",s=r?560:264,o=r?32:22;return e.jsx("div",{className:W("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",r?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:s,aspectRatio:`${X} / ${Y}`,borderRadius:o},children:i})})}function J({size:t="sm"}){const i="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",r=`${i} L264,124 L0,124 Z`,s=`sparkArea-${t}`;return e.jsx(y,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:a("widgets.preview.today")}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:a("widgets.preview.seven_days")}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$673.61"}),e.jsx("path",{d:r,fill:`url(#${s})`,stroke:"none"}),e.jsx("path",{d:i,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const _=(()=>{const r=[];for(let s=0;s<26;s++)for(let o=0;o<7;o++){const l=Math.sin((s+1)*12.9898+(o+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(l-Math.floor(l))*100);r.push({w:s,d:o,v:c})}return r})();function A(t,i){return t<18?i?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function Q(){return e.jsx(y,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:_.map(l=>e.jsx("rect",{x:l.w*(7.5+1.2),y:l.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(l.v,!0)},`d-${l.w}-${l.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:_.map(l=>e.jsx("rect",{x:l.w*(7.5+1.2),y:l.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(l.v,!1)},`l-${l.w}-${l.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:g,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:a("widgets.preview.heatmap_summary",{days:202})})]})})}function ee(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],i=22,r=28,s=14,o=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((l,c)=>{const n=r+c*i,u=C[c%C.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:u}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:l.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:g,children:l.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:g,children:[l.pct,"%"]}),e.jsx("rect",{x:s,y:n+4,width:o,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:s,y:n+4,width:Math.max(o*(l.pct/100),4),height:"2.8",rx:"1.4",fill:u})]},l.name)})})})}function te(){const t=[{label:`${a("limits.provider.claude")} · ${a("limits.label.claude_7d")}`,source:"claude",reset:a("widgets.preview.reset_days",{days:1}),pct:61},{label:`${a("limits.provider.claude")} · ${a("limits.label.claude_5h")}`,source:"claude",reset:a("widgets.preview.reset_hours_minutes",{hours:4,minutes:28}),pct:4},{label:a("limits.provider.cursor"),source:"cursor",reset:a("widgets.preview.reset_days",{days:25}),pct:51},{label:`${a("limits.provider.codex")} · ${a("limits.label.codex_7d")}`,source:"codex",reset:a("widgets.preview.reset_days",{days:1}),pct:32}],i=22,r=28,s=14,o=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((l,c)=>{const n=r+c*i,u=Z[l.source],p=q(l.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:u}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:l.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:l.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:g,children:[l.pct,"%"]}),e.jsx("rect",{x:s,y:n+4,width:o,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:s,y:n+4,width:Math.max(o*(l.pct/100),4),height:"2.8",rx:"1.4",fill:p})]},l.label)})})})}function ae(t){switch(t.category){case"none":return"";case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ie(t,i){switch(t){case x:return a("menubar.metric.none");case"todayTokens":return a("menubar.metric.today_tokens");case"todayCost":return a("menubar.metric.today_cost");case"last7dTokens":return a("menubar.metric.last_7d_tokens");case"totalTokens":return a("menubar.metric.total_tokens");case"totalCost":return a("menubar.metric.total_cost");case"claude5h":return a("menubar.metric.claude_5h");case"claude7d":return a("menubar.metric.claude_7d");case"codex5h":return a("menubar.metric.codex_5h");case"codex7d":return a("menubar.metric.codex_7d");case"codexCredits":return a("menubar.metric.codex_credits");case"codexSpark5h":return a("menubar.metric.codex_spark_5h");case"codexSpark7d":return a("menubar.metric.codex_spark_7d");default:return i}}function se(t,i){const r=new Set(i.map(o=>o.id)),s=t.filter(o=>o===x||r.has(o));for(const o of i){if(s.length>=2)break;o.id!==x&&(s.includes(o.id)||s.push(o.id))}return s.slice(0,2)}function re({slotConfigs:t,showStats:i}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),i?t.filter(({item:r})=>r?.category!=="none").map(({slot:r,item:s},o)=>e.jsxs(O.Fragment,{children:[o>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:W("flex min-w-[52px] flex-col items-center justify-center py-1.5",o===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:s?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:s?.shortLabel||a("widgets.preview.metric")})]})]},r)):null]})})}function le({slot:t,value:i,options:r,disabled:s,onChange:o}){const l=t===0?a("menubar.slot.primary"):a("menubar.slot.secondary");return e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:l}),e.jsx(F,{value:i,disabled:s,ariaLabel:l,onValueChange:c=>o(t,c),options:r.map(c=>({value:c.id,label:c.displayLabel})),matchTriggerWidth:!0,className:"w-full px-3 py-2 text-sm font-medium"})]})}function w({label:t,hint:i,checked:r,disabled:s,onChange:o}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(D,{checked:r,disabled:s,onChange:o,ariaLabel:t})]})}function oe({label:t,hint:i,value:r,options:s,disabled:o,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(F,{value:r,disabled:o,ariaLabel:t,onValueChange:l,options:s,className:"shrink-0 px-3 py-2 text-sm font-medium"})]})}function ne(){const{available:t,settings:i,setSetting:r}=K(),s=b.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:T).map(m=>({...m,displayLabel:ie(m.id,m.label),previewValue:ae(m)})),[i?.menuBarAvailableItems]),o=Number(i?.menuBarMaxItems)||2,l=b.useMemo(()=>S(i?.menuBarItems,s,o),[s,o,i?.menuBarItems]),c=b.useMemo(()=>se(l,s),[s,l]),n=i?.showStats!==!1,u=d=>{r("menuBarItems",S(d,s,o))},p=(d,m)=>{const h=[...c];m!==x&&h[d===0?1:0]===m||(h[d]=m,u(h))},k=[0,1].map(d=>{const m=c[d]||s[d]?.id||"",L=c[d===0?1:0],I=s.filter(f=>f.id===x||f.id===m||f.id!==L),P=s.find(f=>f.id===m);return{slot:d,currentValue:m,options:I,item:P}}),B=["clawd","bot","cat","pet","static"].includes(i?.menuBarIconStyle)?i.menuBarIconStyle:"clawd",j=i?.toastOnReset!==!1,v=i?.confettiOnReset!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(re,{slotConfigs:k,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:k.map(({slot:d,currentValue:m,options:h})=>e.jsx(le,{slot:d,value:m,options:h,disabled:!t||!n,onChange:p},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(w,{label:a("settings.menubar.showStats"),hint:t?a("settings.menubar.showStatsHint"):a("menubar.native_only"),checked:n,disabled:!t,onChange:()=>r("showStats",!n)}),e.jsx(oe,{label:a("settings.menubar.iconStyle"),hint:a("settings.menubar.iconStyleHint"),value:B,disabled:!t,options:[{value:"clawd",label:a("settings.menubar.iconStyle.clawd")},{value:"bot",label:a("settings.menubar.iconStyle.bot")},{value:"cat",label:a("settings.menubar.iconStyle.cat")},{value:"pet",label:a("settings.menubar.iconStyle.pet")},{value:"static",label:a("settings.menubar.iconStyle.static")}],onChange:d=>r("menuBarIconStyle",d)}),e.jsx(w,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),checked:j,disabled:!t,onChange:()=>r("toastOnReset",!j)}),e.jsx(w,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),checked:v,disabled:!t,onChange:()=>r("confettiOnReset",!v)})]})]})}function ce(){const[t,i]=b.useState("loading");return b.useEffect(()=>{if(typeof window>"u")return;if($()){i("native");return}const r=(navigator.userAgent||"").toLowerCase(),s=/mac/.test(r)&&!/iphone|ipad/.test(r);i(s?"mac-web":"other")},[]),t}function de(){const t=ce();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>R("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[a("widgets.cta.open_gallery"),e.jsx(H,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/xiufengsun/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(U,{className:"h-4 w-4","aria-hidden":"true"}),a("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(E,{className:"h-4 w-4","aria-hidden":"true"}),a("widgets.cta.macos_only")]})}const me=[{id:"summary",Preview:J,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:Q,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:ee,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:te,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function ge({Preview:t,nameKey:i,descKey:r}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:a(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:a(r)})]})]})}function M({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:a(t)})}function Ae(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(N,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(de,{})})]})}),e.jsx(N,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":a("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(M,{titleKey:"widgets.menubar.section.title"}),e.jsx(ne,{})]})}),e.jsxs("section",{"aria-label":a("widgets.gallery.section.title"),children:[e.jsx(M,{titleKey:"widgets.gallery.section.title"}),e.jsx(G,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:me.map(({id:t,Preview:i,nameKey:r,descKey:s})=>e.jsx(z,{children:e.jsx(ge,{Preview:i,nameKey:r,descKey:s})},t))})})]})]})})})}export{Ae as WidgetsPage};
1
+ import{j as e,c as a,I as R,am as E,r as b,t as $,V as O,y as W}from"./__vite-browser-external-CbhiyufG.js";import{S as F}from"./Select-KHVnbrwD.js";import{u as K}from"./use-native-settings-DHS101SR.js";import{T as D}from"./Controls-DsJLsMpr.js";import{F as N,S as G,a as z}from"./FadeIn-CgGVCeA7.js";import{A as H}from"./arrow-up-right-COoZfksW.js";import{D as U}from"./download-CrDgjohg.js";import"./chevron-down-Di_xdF9P.js";import"./check-D_enaDhp.js";import"./SelectItemText-BqAFvX8b.js";import"./composite-CUbvhoGL.js";import"./usePositioner-BQgBHX5s.js";import"./Card-D_SqQIBC.js";import"./react-Dt52_FiQ.js";import"./use-reduced-motion-Bpc6LGag.js";const V=["todayTokens","todayCost"],x="none",T=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"},{id:"codexCredits",label:"Codex Credit Limit",shortLabel:"Cx Cred",category:"limits"},{id:"codexSpark5h",label:"Codex Spark 5h Limit",shortLabel:"Cx Spark 5h",category:"limits"},{id:"codexSpark7d",label:"Codex Spark 7d Limit",shortLabel:"Cx Spark 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaudeWeekly",label:"Antigravity Claude 7d Limit",shortLabel:"Ag Cl 7d",category:"limits"},{id:"antigravityClaude5h",label:"Antigravity Claude 5h Limit",shortLabel:"Ag Cl 5h",category:"limits"},{id:"antigravityGeminiWeekly",label:"Antigravity Gemini 7d Limit",shortLabel:"Ag Gm 7d",category:"limits"},{id:"antigravityGemini5h",label:"Antigravity Gemini 5h Limit",shortLabel:"Ag Gm 5h",category:"limits"}];function S(t,i=T,r=2){const s=new Set(i.map(n=>n.id)),o=new Set,l=Array.isArray(t)?t.filter(n=>n===x?!0:!s.has(n)||o.has(n)?!1:(o.add(n),!0)):[];return(l.length>0?l:V).slice(0,Math.max(1,Number(r)||2))}const X=264,Y=124,g="ui-rounded, -apple-system, system-ui",C=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],Z={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function q(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function y({size:t="sm",children:i}){const r=t==="lg",s=r?560:264,o=r?32:22;return e.jsx("div",{className:W("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",r?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:s,aspectRatio:`${X} / ${Y}`,borderRadius:o},children:i})})}function J({size:t="sm"}){const i="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",r=`${i} L264,124 L0,124 Z`,s=`sparkArea-${t}`;return e.jsx(y,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:a("widgets.preview.today")}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:a("widgets.preview.seven_days")}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$673.61"}),e.jsx("path",{d:r,fill:`url(#${s})`,stroke:"none"}),e.jsx("path",{d:i,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const _=(()=>{const r=[];for(let s=0;s<26;s++)for(let o=0;o<7;o++){const l=Math.sin((s+1)*12.9898+(o+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(l-Math.floor(l))*100);r.push({w:s,d:o,v:c})}return r})();function A(t,i){return t<18?i?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function Q(){return e.jsx(y,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:_.map(l=>e.jsx("rect",{x:l.w*(7.5+1.2),y:l.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(l.v,!0)},`d-${l.w}-${l.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:_.map(l=>e.jsx("rect",{x:l.w*(7.5+1.2),y:l.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(l.v,!1)},`l-${l.w}-${l.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:g,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:a("widgets.preview.heatmap_summary",{days:202})})]})})}function ee(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],i=22,r=28,s=14,o=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((l,c)=>{const n=r+c*i,u=C[c%C.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:u}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:l.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:g,children:l.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:g,children:[l.pct,"%"]}),e.jsx("rect",{x:s,y:n+4,width:o,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:s,y:n+4,width:Math.max(o*(l.pct/100),4),height:"2.8",rx:"1.4",fill:u})]},l.name)})})})}function te(){const t=[{label:`${a("limits.provider.claude")} · ${a("limits.label.claude_7d")}`,source:"claude",reset:a("widgets.preview.reset_days",{days:1}),pct:61},{label:`${a("limits.provider.claude")} · ${a("limits.label.claude_5h")}`,source:"claude",reset:a("widgets.preview.reset_hours_minutes",{hours:4,minutes:28}),pct:4},{label:a("limits.provider.cursor"),source:"cursor",reset:a("widgets.preview.reset_days",{days:25}),pct:51},{label:`${a("limits.provider.codex")} · ${a("limits.label.codex_7d")}`,source:"codex",reset:a("widgets.preview.reset_days",{days:1}),pct:32}],i=22,r=28,s=14,o=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((l,c)=>{const n=r+c*i,u=Z[l.source],p=q(l.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:u}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:l.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:l.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:g,children:[l.pct,"%"]}),e.jsx("rect",{x:s,y:n+4,width:o,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:s,y:n+4,width:Math.max(o*(l.pct/100),4),height:"2.8",rx:"1.4",fill:p})]},l.label)})})})}function ae(t){switch(t.category){case"none":return"";case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ie(t,i){switch(t){case x:return a("menubar.metric.none");case"todayTokens":return a("menubar.metric.today_tokens");case"todayCost":return a("menubar.metric.today_cost");case"last7dTokens":return a("menubar.metric.last_7d_tokens");case"totalTokens":return a("menubar.metric.total_tokens");case"totalCost":return a("menubar.metric.total_cost");case"claude5h":return a("menubar.metric.claude_5h");case"claude7d":return a("menubar.metric.claude_7d");case"codex5h":return a("menubar.metric.codex_5h");case"codex7d":return a("menubar.metric.codex_7d");case"codexCredits":return a("menubar.metric.codex_credits");case"codexSpark5h":return a("menubar.metric.codex_spark_5h");case"codexSpark7d":return a("menubar.metric.codex_spark_7d");default:return i}}function se(t,i){const r=new Set(i.map(o=>o.id)),s=t.filter(o=>o===x||r.has(o));for(const o of i){if(s.length>=2)break;o.id!==x&&(s.includes(o.id)||s.push(o.id))}return s.slice(0,2)}function re({slotConfigs:t,showStats:i}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),i?t.filter(({item:r})=>r?.category!=="none").map(({slot:r,item:s},o)=>e.jsxs(O.Fragment,{children:[o>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:W("flex min-w-[52px] flex-col items-center justify-center py-1.5",o===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:s?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:s?.shortLabel||a("widgets.preview.metric")})]})]},r)):null]})})}function le({slot:t,value:i,options:r,disabled:s,onChange:o}){const l=t===0?a("menubar.slot.primary"):a("menubar.slot.secondary");return e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:l}),e.jsx(F,{value:i,disabled:s,ariaLabel:l,onValueChange:c=>o(t,c),options:r.map(c=>({value:c.id,label:c.displayLabel})),matchTriggerWidth:!0,className:"w-full px-3 py-2 text-sm font-medium"})]})}function w({label:t,hint:i,checked:r,disabled:s,onChange:o}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(D,{checked:r,disabled:s,onChange:o,ariaLabel:t})]})}function oe({label:t,hint:i,value:r,options:s,disabled:o,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(F,{value:r,disabled:o,ariaLabel:t,onValueChange:l,options:s,className:"shrink-0 px-3 py-2 text-sm font-medium"})]})}function ne(){const{available:t,settings:i,setSetting:r}=K(),s=b.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:T).map(m=>({...m,displayLabel:ie(m.id,m.label),previewValue:ae(m)})),[i?.menuBarAvailableItems]),o=Number(i?.menuBarMaxItems)||2,l=b.useMemo(()=>S(i?.menuBarItems,s,o),[s,o,i?.menuBarItems]),c=b.useMemo(()=>se(l,s),[s,l]),n=i?.showStats!==!1,u=d=>{r("menuBarItems",S(d,s,o))},p=(d,m)=>{const h=[...c];m!==x&&h[d===0?1:0]===m||(h[d]=m,u(h))},k=[0,1].map(d=>{const m=c[d]||s[d]?.id||"",L=c[d===0?1:0],I=s.filter(f=>f.id===x||f.id===m||f.id!==L),P=s.find(f=>f.id===m);return{slot:d,currentValue:m,options:I,item:P}}),B=["clawd","bot","cat","pet","static"].includes(i?.menuBarIconStyle)?i.menuBarIconStyle:"clawd",j=i?.toastOnReset!==!1,v=i?.confettiOnReset!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(re,{slotConfigs:k,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:k.map(({slot:d,currentValue:m,options:h})=>e.jsx(le,{slot:d,value:m,options:h,disabled:!t||!n,onChange:p},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(w,{label:a("settings.menubar.showStats"),hint:t?a("settings.menubar.showStatsHint"):a("menubar.native_only"),checked:n,disabled:!t,onChange:()=>r("showStats",!n)}),e.jsx(oe,{label:a("settings.menubar.iconStyle"),hint:a("settings.menubar.iconStyleHint"),value:B,disabled:!t,options:[{value:"clawd",label:a("settings.menubar.iconStyle.clawd")},{value:"bot",label:a("settings.menubar.iconStyle.bot")},{value:"cat",label:a("settings.menubar.iconStyle.cat")},{value:"pet",label:a("settings.menubar.iconStyle.pet")},{value:"static",label:a("settings.menubar.iconStyle.static")}],onChange:d=>r("menuBarIconStyle",d)}),e.jsx(w,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),checked:j,disabled:!t,onChange:()=>r("toastOnReset",!j)}),e.jsx(w,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),checked:v,disabled:!t,onChange:()=>r("confettiOnReset",!v)})]})]})}function ce(){const[t,i]=b.useState("loading");return b.useEffect(()=>{if(typeof window>"u")return;if($()){i("native");return}const r=(navigator.userAgent||"").toLowerCase(),s=/mac/.test(r)&&!/iphone|ipad/.test(r);i(s?"mac-web":"other")},[]),t}function de(){const t=ce();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>R("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[a("widgets.cta.open_gallery"),e.jsx(H,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/xiufengsun/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(U,{className:"h-4 w-4","aria-hidden":"true"}),a("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(E,{className:"h-4 w-4","aria-hidden":"true"}),a("widgets.cta.macos_only")]})}const me=[{id:"summary",Preview:J,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:Q,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:ee,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:te,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function ge({Preview:t,nameKey:i,descKey:r}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:a(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:a(r)})]})]})}function M({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:a(t)})}function Ae(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(N,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(de,{})})]})}),e.jsx(N,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":a("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(M,{titleKey:"widgets.menubar.section.title"}),e.jsx(ne,{})]})}),e.jsxs("section",{"aria-label":a("widgets.gallery.section.title"),children:[e.jsx(M,{titleKey:"widgets.gallery.section.title"}),e.jsx(G,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:me.map(({id:t,Preview:i,nameKey:r,descKey:s})=>e.jsx(z,{children:e.jsx(ge,{Preview:i,nameKey:r,descKey:s})},t))})})]})]})})})}export{Ae as WidgetsPage};
@@ -1 +1 @@
1
- import{r as x,j as e,c as s,h as j,i as f}from"./__vite-browser-external-BXwSXUpN.js";function c(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":f(a,{decimals:2}):"0"}function o({children:a,accent:d=!1,className:n=""}){const l="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",p=d?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${l} ${p} ${n}`,children:a})}function N(){const[a,d]=x.useState(null),[n,l]=x.useState("loading"),[p,y]=x.useState("");if(x.useEffect(()=>{let t=!1;const g=new URLSearchParams(window.location.search).get("year"),k=g?`/functions/tokentracker-wrapped?year=${encodeURIComponent(g)}`:"/functions/tokentracker-wrapped";return fetch(k).then(async r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}).then(r=>{t||(d(r),l(r.totals&&r.totals.tokens>0?"ready":"empty"))}).catch(r=>{t||(y(String(r?.message||r)),l("error"))}),()=>{t=!0}},[]),n==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:s("wrapped.loading")})});if(n==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(o,{children:e.jsx("p",{className:"text-red-600 dark:text-red-300",children:s("wrapped.error",{error:p})})})});if(n==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(o,{children:e.jsx("p",{className:"text-oai-gray-500",children:s("wrapped.empty",{command:"tracker sync"})})})});const m=t=>`${(t*100).toFixed(0)}%`,u=j(),i=[];if(a.top.models.length>0){const t=a.top.models[0];i.push(s("wrapped.highlight.model",{model:t.model,percent:(t.share*100).toFixed(0)}))}if(a.top.days.length>0){const t=a.top.days[0];i.push(s("wrapped.highlight.day",{day:t.day,tokens:c(t.tokens)}))}return a.peak_hour&&i.push(s("wrapped.highlight.hour",{hour:String(a.peak_hour.hour).padStart(2,"0")})),a.longest_streak?.days>=2&&i.push(s("wrapped.highlight.streak",{days:a.longest_streak.days})),a.totals.sources>=4&&i.push(s("wrapped.highlight.tools",{count:a.totals.sources})),e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.kicker")}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(o,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:s("wrapped.total_tokens")}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:c(a.totals.tokens)}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:s("wrapped.summary",{conversations:a.totals.conversations.toLocaleString(u),days:a.totals.active_days,tools:a.totals.sources})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_tools")}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[c(t.tokens)," · ",m(t.share)]})]},t.source))})]}),e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_models")}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[c(t.tokens)," · ",m(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(o,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.peak_hour")}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:s("wrapped.tokens",{count:c(a.peak_hour.tokens)})})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(o,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.longest_streak")}),e.jsx("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:s("wrapped.days",{count:a.longest_streak.days})}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_days")}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:c(t.tokens)})]},t.day))})]}),i.length>0&&e.jsxs(o,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:s("wrapped.highlights")}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:i.map((t,h)=>e.jsxs("li",{className:"text-base",children:["· ",t]},h))})]}),e.jsx("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:s("wrapped.footer",{command:"tracker wrapped --json"})})]})})}export{N as default};
1
+ import{r as x,j as e,c as s,h as j,i as f}from"./__vite-browser-external-CbhiyufG.js";function c(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":f(a,{decimals:2}):"0"}function o({children:a,accent:d=!1,className:n=""}){const l="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",p=d?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${l} ${p} ${n}`,children:a})}function N(){const[a,d]=x.useState(null),[n,l]=x.useState("loading"),[p,y]=x.useState("");if(x.useEffect(()=>{let t=!1;const g=new URLSearchParams(window.location.search).get("year"),k=g?`/functions/tokentracker-wrapped?year=${encodeURIComponent(g)}`:"/functions/tokentracker-wrapped";return fetch(k).then(async r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}).then(r=>{t||(d(r),l(r.totals&&r.totals.tokens>0?"ready":"empty"))}).catch(r=>{t||(y(String(r?.message||r)),l("error"))}),()=>{t=!0}},[]),n==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:s("wrapped.loading")})});if(n==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(o,{children:e.jsx("p",{className:"text-red-600 dark:text-red-300",children:s("wrapped.error",{error:p})})})});if(n==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(o,{children:e.jsx("p",{className:"text-oai-gray-500",children:s("wrapped.empty",{command:"tracker sync"})})})});const m=t=>`${(t*100).toFixed(0)}%`,u=j(),i=[];if(a.top.models.length>0){const t=a.top.models[0];i.push(s("wrapped.highlight.model",{model:t.model,percent:(t.share*100).toFixed(0)}))}if(a.top.days.length>0){const t=a.top.days[0];i.push(s("wrapped.highlight.day",{day:t.day,tokens:c(t.tokens)}))}return a.peak_hour&&i.push(s("wrapped.highlight.hour",{hour:String(a.peak_hour.hour).padStart(2,"0")})),a.longest_streak?.days>=2&&i.push(s("wrapped.highlight.streak",{days:a.longest_streak.days})),a.totals.sources>=4&&i.push(s("wrapped.highlight.tools",{count:a.totals.sources})),e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.kicker")}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(o,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:s("wrapped.total_tokens")}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:c(a.totals.tokens)}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:s("wrapped.summary",{conversations:a.totals.conversations.toLocaleString(u),days:a.totals.active_days,tools:a.totals.sources})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_tools")}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[c(t.tokens)," · ",m(t.share)]})]},t.source))})]}),e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_models")}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[c(t.tokens)," · ",m(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(o,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.peak_hour")}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:s("wrapped.tokens",{count:c(a.peak_hour.tokens)})})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(o,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.longest_streak")}),e.jsx("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:s("wrapped.days",{count:a.longest_streak.days})}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_days")}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:c(t.tokens)})]},t.day))})]}),i.length>0&&e.jsxs(o,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:s("wrapped.highlights")}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:i.map((t,h)=>e.jsxs("li",{className:"text-base",children:["· ",t]},h))})]}),e.jsx("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:s("wrapped.footer",{command:"tracker wrapped --json"})})]})})}export{N as default};