tokentracker-cli 0.81.3 → 0.82.0

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 (85) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-DiSoAalB.js → AchievementBadge-D6iPEEbz.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-DI_cvzqy.js → AchievementsPage-Jry355YE.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-ClWZZNvc.js → AchievementsSection-ah-kG00E.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-DpQeG_6H.js → BadgeDetailModal-FyvUrVvF.js} +1 -1
  5. package/dashboard/dist/assets/{Card-B0hyofoy.js → Card-C3nLScju.js} +1 -1
  6. package/dashboard/dist/assets/{ClawdAnimated-DZJGQ3-9.js → ClawdAnimated-CLHhE26z.js} +1 -1
  7. package/dashboard/dist/assets/{CommunityStatsModal-Dcikt0kT.js → CommunityStatsModal-DA3PHLV5.js} +1 -1
  8. package/dashboard/dist/assets/{ConfirmModal-DCfRP4oI.js → ConfirmModal-CTDarLrD.js} +1 -1
  9. package/dashboard/dist/assets/DashboardPage-DZIiWc3Y.js +1 -0
  10. package/dashboard/dist/assets/{DevicePage-De6KuFaJ.js → DevicePage-CyXjUO8W.js} +1 -1
  11. package/dashboard/dist/assets/DialogDescription-ahxSNUcB.js +1 -0
  12. package/dashboard/dist/assets/DialogTitle-z86PHHyk.js +1 -0
  13. package/dashboard/dist/assets/{FadeIn-DZoN7vbQ.js → FadeIn-BDWtfIsO.js} +1 -1
  14. package/dashboard/dist/assets/{HeaderGithubStar-C9HQnEsI.js → HeaderGithubStar-DE1USQbb.js} +1 -1
  15. package/dashboard/dist/assets/{IpCheckPage-82zniXwO.js → IpCheckPage-B2SkgT0P.js} +1 -1
  16. package/dashboard/dist/assets/{LandingPage-Df9fdR0n.js → LandingPage-PU5gxsfY.js} +14 -14
  17. package/dashboard/dist/assets/{LeaderboardAvatar-CjfEgoR8.js → LeaderboardAvatar-CaOV_hFE.js} +1 -1
  18. package/dashboard/dist/assets/{LeaderboardPage-BdbE6Nhj.js → LeaderboardPage-B0JtEyRP.js} +2 -2
  19. package/dashboard/dist/assets/{LeaderboardProfileModal-CDTK21dp.js → LeaderboardProfileModal-DtNEbVH8.js} +3 -3
  20. package/dashboard/dist/assets/{LeaderboardProfilePage-B6QWnwB1.js → LeaderboardProfilePage-DRklax3-.js} +3 -3
  21. package/dashboard/dist/assets/LimitsPage-Dg0cJa40.js +4 -0
  22. package/dashboard/dist/assets/{LocalOnlyNotice-DOcSDrOy.js → LocalOnlyNotice-si9PMKya.js} +1 -1
  23. package/dashboard/dist/assets/{LoginPage-WY_sRA7I.js → LoginPage-DgLwhXKo.js} +1 -1
  24. package/dashboard/dist/assets/{PetPage-CNbgNE6f.js → PetPage-DEZbjk99.js} +1 -1
  25. package/dashboard/dist/assets/{PopoverPopup-Cv525-dF.js → PopoverPopup-DX7v1XfE.js} +1 -1
  26. package/dashboard/dist/assets/ResetPasswordPage-C6NvRO-Q.js +1 -0
  27. package/dashboard/dist/assets/{Select-3HkgkO8y.js → Select-CH2xVU8X.js} +1 -1
  28. package/dashboard/dist/assets/{SelectItemText-Bz8FAKEv.js → SelectItemText-CCW6JeeN.js} +1 -1
  29. package/dashboard/dist/assets/SettingsPage-Cm3uT11D.js +1 -0
  30. package/dashboard/dist/assets/{SkillsPage-Dnz3eGcE.js → SkillsPage-CljRL6yF.js} +1 -1
  31. package/dashboard/dist/assets/{TrendMonitor-OopQ06B8.js → TrendMonitor-DM1_WNfw.js} +2 -2
  32. package/dashboard/dist/assets/WidgetsPage-mJ1j6hly.js +1 -0
  33. package/dashboard/dist/assets/{WrappedPage-Dbd-8EKD.js → WrappedPage-Dz71ln4t.js} +1 -1
  34. package/dashboard/dist/assets/__vite-browser-external-C7JwykID.css +1 -0
  35. package/dashboard/dist/assets/{__vite-browser-external-CxN2E6q5.js → __vite-browser-external-Eoyj4eG-.js} +47 -18
  36. package/dashboard/dist/assets/agent-logos-D3K_ZRUj.js +1 -0
  37. package/dashboard/dist/assets/{arrow-up-right-CGnVz9Km.js → arrow-up-right-CT4-gmOS.js} +1 -1
  38. package/dashboard/dist/assets/{check-CkI3WNti.js → check-B87_qvAg.js} +1 -1
  39. package/dashboard/dist/assets/{copy-Bh3g2_O-.js → copy-Dtr68epm.js} +1 -1
  40. package/dashboard/dist/assets/{download-BITw7nKX.js → download-DaWsA_Gj.js} +1 -1
  41. package/dashboard/dist/assets/{flame-ByAsnNar.js → flame-vLBOq0X0.js} +1 -1
  42. package/dashboard/dist/assets/{format-tokens-Cu8JtuN4.js → format-tokens-C6Pidz3s.js} +1 -1
  43. package/dashboard/dist/assets/{icons-D9OB0N43.js → icons-BaaYJxUN.js} +1 -1
  44. package/dashboard/dist/assets/{info-Mu2CLf-A.js → info-B46Qt16h.js} +1 -1
  45. package/dashboard/dist/assets/limits-providers-13af4PEg.js +1 -0
  46. package/dashboard/dist/assets/{link-2-CSlVaUw9.js → link-2-DeN6MJpT.js} +1 -1
  47. package/dashboard/dist/assets/{loader-circle-CYck0YaS.js → loader-circle-ByEuaaSw.js} +1 -1
  48. package/dashboard/dist/assets/{provider-display-BB925tPa.js → provider-display-CKbOKeV4.js} +1 -1
  49. package/dashboard/dist/assets/{terminal-4YysOnTe.js → terminal-DyicX7lG.js} +1 -1
  50. package/dashboard/dist/assets/{trash-2-C8-ZfrZG.js → trash-2-CVCC3DtQ.js} +1 -1
  51. package/dashboard/dist/assets/{use-community-stats-Cxt-otko.js → use-community-stats-CExk3D6G.js} +1 -1
  52. package/dashboard/dist/assets/use-limits-display-prefs-CRl4uU95.js +1 -0
  53. package/dashboard/dist/assets/{use-native-settings-DbdPXxGf.js → use-native-settings-Bi6E9dsE.js} +1 -1
  54. package/dashboard/dist/assets/{use-ordered-list-BZMM-iIj.js → use-ordered-list-Dk0p2otw.js} +1 -1
  55. package/dashboard/dist/assets/use-session-efficiency-pref-YAG-OYIh.js +1 -0
  56. package/dashboard/dist/assets/{use-transform-CuAoUb8H.js → use-transform-lflyghWN.js} +1 -1
  57. package/dashboard/dist/assets/use-usage-limits-DJXvJ25Q.js +1 -0
  58. package/dashboard/dist/assets/{useCurrency-CpDnFC0N.js → useCurrency-BtHtcsO5.js} +1 -1
  59. package/dashboard/dist/assets/{useScrollLock-Vyaif-7C.js → useScrollLock-C2C-Yazq.js} +1 -1
  60. package/dashboard/dist/assets/{useTokenFormat-B8FrUarf.js → useTokenFormat-BdD057ih.js} +1 -1
  61. package/dashboard/dist/assets/{zap-CdeKJ6HL.js → zap-DWWma29E.js} +1 -1
  62. package/dashboard/dist/index.html +2 -2
  63. package/dashboard/dist/share.html +2 -2
  64. package/package.json +1 -1
  65. package/src/cli.js +6 -0
  66. package/src/commands/sessions.js +29 -0
  67. package/src/lib/context-health.js +124 -0
  68. package/src/lib/git-outcomes.js +147 -0
  69. package/src/lib/local-api.js +45 -3
  70. package/src/lib/outcomes-engine.js +23 -0
  71. package/src/lib/pricing/seed-snapshot.json +1 -1
  72. package/src/lib/session-analytics.js +612 -0
  73. package/src/lib/usage-limits.js +21 -0
  74. package/dashboard/dist/assets/DashboardPage-DBajsWEp.js +0 -1
  75. package/dashboard/dist/assets/DialogDescription-uQ4gVIv9.js +0 -1
  76. package/dashboard/dist/assets/DialogTitle-BvElfi0r.js +0 -1
  77. package/dashboard/dist/assets/LimitsPage-f0L0d15j.js +0 -4
  78. package/dashboard/dist/assets/ResetPasswordPage-vrcj6bBP.js +0 -1
  79. package/dashboard/dist/assets/SettingsPage-CVldAt69.js +0 -1
  80. package/dashboard/dist/assets/WidgetsPage-4dWjZkc9.js +0 -1
  81. package/dashboard/dist/assets/__vite-browser-external-CQxW1DuO.css +0 -1
  82. package/dashboard/dist/assets/agent-logos-CT9fumzx.js +0 -1
  83. package/dashboard/dist/assets/use-limits-display-prefs-BUFZh6fe.js +0 -1
  84. package/dashboard/dist/assets/use-quality-per-dollar-pref-DXoW5A0_.js +0 -1
  85. package/dashboard/dist/assets/use-usage-limits-BEc3QMzR.js +0 -1
@@ -1,4 +0,0 @@
1
- import{j as i,b as R,c as n,ag as C,r as b,P as Y,ah as q,A as J,L as Q,ai as Z}from"./__vite-browser-external-CxN2E6q5.js";import{u as ee}from"./use-usage-limits-BEc3QMzR.js";import{L as p,a as te,l as v,b as ie,u as re}from"./use-limits-display-prefs-BUFZh6fe.js";import{C as D}from"./Card-B0hyofoy.js";import{F as ae}from"./FadeIn-DZoN7vbQ.js";import{L as ne}from"./LocalOnlyNotice-DOcSDrOy.js";import"./arrow-up-right-CGnVz9Km.js";import"./download-BITw7nKX.js";const oe=[3,2,3,3,2,2,3];function g({className:e}){return i.jsx("div",{className:R("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function le(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(g,{className:"h-3 w-12 shrink-0"}),i.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(g,{className:"h-3 w-[30px] shrink-0"}),i.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function se({bars:e,index:t}){const r=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(g,{className:R("h-4",r)})]}),Array.from({length:e},(o,a)=>i.jsx(le,{},a))]})}function de(){return i.jsx(D,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(g,{className:"h-3.5 w-28"}),oe.map((e,t)=>i.jsx(se,{bars:e,index:t},t))]})})}function ce(e,t){if(!(e>0))return null;const r=(e-t)/e;return Number.isFinite(r)?Math.min(Math.max(r,0),1):null}function ue(e,t,r=.03){return e>t+r}function me(e){const t=Math.max(0,Math.floor(e)),r=Math.floor(t/3600);return r>24?`${Math.floor(r/24)}d`:r>0?`${r}h`:`${Math.floor(t/60)}m`}function xe(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const r=t[e.windowSecondsField];return typeof r=="number"&&r>0?r:null}return null}function _(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function pe({usedPercent:e,windowSeconds:t,resetMs:r,mode:o,now:a=Date.now()}){const s=Math.min(Math.max(Number(e)||0,0),100)/100,d={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(r))return d;const c=Math.max(0,(r-a)/1e3),l=ce(t,c);if(l==null)return d;if(d.expectedPercent=Math.round(l*100),d.paceOver=ue(s,l),s>=.05){const u=o==="remaining"?1-l:l;d.pacePercent=u*100}if(l>.02&&s>0){const u=t*l,m=s/u,x=s/l;x>=1&&m>0?d.runsOutEta=me((1-s)/m):d.projectedEnd=Math.round(Math.min(x,1)*100)}return d}const E=100;function O(e){const t=Date.parse(e);return Number.isFinite(t)?t:null}function ye(e){return Math.max(0,Math.min(E,Math.round(e)))}function ge(e){return new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function he(e,t,r){if(e==null||e>=t)return E;const o=t-e,a=t-r;return ye(a/o*E)}function be(e){const t=e.available_count;return t===null?null:Number.isInteger(t)&&t>=0?t:void 0}function we(e,{now:t}={}){if(!e||typeof e!="object")return null;const r=be(e);if(r===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],a=t instanceof Date?t.getTime():Number(t??Date.now()),s=[];for(const d of o){const c=O(d?.expires_at);if(c==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:n("limits.codex_reset_bank.row_label",{index:l}),expiresAt:ge(c),expiresMs:c,percent:he(O(d?.granted_at),c,a)})}return r===0?null:s.length>0?{kind:"rows",availableCount:r??s.length,rows:s}:r>0?{kind:"count_only",availableCount:r,rows:[]}:null}const A={claude:{windows(e){const t=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(r=>({key:`scoped-${r.label}`,label:r.label,window:r,pctField:"utilization",resetField:"resets_at",windowSeconds:604800})):[];return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},...t]}},codex:{extra:"codex_meta",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"credits",labelKey:"limits.label.codex_credits",window:e.credit_window},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude-weekly",labelKey:"limits.label.antigravity_claude_weekly",window:e.primary_window},{key:"claude-5h",labelKey:"limits.label.antigravity_claude_5h",window:e.secondary_window},{key:"gemini-weekly",labelKey:"limits.label.antigravity_gemini_weekly",window:e.tertiary_window},{key:"gemini-5h",labelKey:"limits.label.antigravity_gemini_5h",window:e.quaternary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return e.plan_kind==="coding-plan"?[{key:"5h",labelKey:"limits.label.zcode_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.zcode_weekly",window:e.secondary_window},{key:"tools",labelKey:"limits.label.zcode_tools",window:e.tertiary_window}]:[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}}},fe="shrink-0 text-oai-black dark:text-oai-white";function _e(e){const t=_(e);if(!Number.isFinite(t))return null;const r=t-Date.now();if(r<=0)return n("shared.time.now");const o=Math.floor(r/6e4);if(o<60)return`${o}m`;const a=Math.floor(o/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function ke(e,t){const r=t===p.REMAINING?100-e:e;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function f(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function k(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function j(e){const t=Math.max(0,Math.min(100,Number(e)||0)),r=Math.round(t);return t>0&&r===0?n("limits.bar.sub_one_percent"):String(r)}function N(e){const t=Number(e);return Number.isFinite(t)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:t>=100?0:2}).format(t):null}function ve(e){if(!e||typeof e!="object")return null;const t=N(e.used_credits),r=N(e.limit_credits),o=N(e.remaining_credits);return!t||!r||!o?null:n("limits.codex_credits.detail",{used:t,limit:r,remaining:o})}function je(e,t){return pe({usedPercent:f(e.window,e.pctField),windowSeconds:xe(e,e.window),resetMs:_(k(e.window,e.resetField)),mode:t})}function T(e){return Number.isFinite(e)?new Intl.DateTimeFormat(C(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function Ne(e,t,r){const o=[$(e,t,r)],a=_(k(e.window,e.resetField)),s=T(a);if(s&&o.push(n("limits.hover.resets_at",{time:s})),e.key==="credits"){const d=ve(e.window);d&&o.push(d)}return o.join(`
2
- `)}function G({text:e}){return e?i.jsx("div",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 w-max max-w-[260px] -translate-x-1/2 whitespace-pre-line rounded-xl border border-oai-gray-200/50 dark:border-oai-gray-800/50 bg-white/90 dark:bg-oai-gray-900/90 backdrop-blur-md px-2.5 py-1.5 text-[10.5px] leading-snug text-oai-gray-700 dark:text-oai-gray-200 shadow-xl opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:e}):null}function Me({label:e,pct:t,reset:r,mode:o=p.USED,pacePercent:a=null,paceOver:s=!1,title:d=null}){const c=Math.max(0,Math.min(100,Number(t)||0)),l=o===p.REMAINING?100-c:c,u=Math.round(l),m=l>0&&u===0?Math.max(l,.35):l;let x=String(u);l>0&&u===0&&(x=n("limits.bar.sub_one_percent"));const h=a==null?null:Math.max(0,Math.min(100,a));return i.jsxs("div",{className:"group relative flex items-center gap-2",children:[i.jsx(G,{text:d}),i.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),i.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[i.jsx("div",{className:`${ke(l,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${m}%`,minWidth:l>0?"3px":0}}),h!=null&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${h}% - 3px)`,width:"6px"}}),i.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${h}% - 1px)`,width:"2px"}})]})]}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[x,"%"]}),r&&i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r})]})}function $(e,t,r){const o=e.label??n(e.labelKey),a=r===p.REMAINING,s=l=>a?100-l:l;if(t.expectedPercent==null){const l=Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0)),u=j(s(l));return a?n("limits.explain.remaining",{label:o,used:u}):n("limits.explain.used",{label:o,used:u})}if(t.paceOver){if(t.runsOutEta)return n("limits.explain.ahead_eta",{label:o,eta:t.runsOutEta});const l=j(s(t.projectedEnd??100));return n(a?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const d=Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0)),c=j(s(t.projectedEnd??d));return n(a?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:c})}function Ee({rows:e,mode:t}){if(e.length===0)return null;const r=t===p.REMAINING;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:o,pace:a})=>{const s=T(_(k(o.window,o.resetField)));return i.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[$(o,a,t),s?i.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",n("limits.hover.resets_at",{time:s})]}):null]},o.key)}),i.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:n(r?"limits.explain.body_remaining":"limits.explain.body")})]})}function Pe(e){if(!e)return null;const t=Date.now()-new Date(e).getTime();if(t<0)return null;const r=Math.floor(t/6e4);if(r<1)return n("shared.time.now");if(r<60)return n("shared.time.m_ago",{n:r});const o=Math.floor(r/60);if(o<24)return n("shared.time.h_ago",{n:o});const a=Math.floor(o/24);return n("shared.time.d_ago",{n:a})}function P({name:e,providerId:t,children:r,expandable:o=!1,expanded:a=!1,onToggle:s,badge:d=null}){const c=ie(t),l=i.jsxs("div",{className:"flex items-center gap-1.5",children:[c?i.jsx(Y,{provider:c,size:14,className:fe}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e}),d]});return o?i.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":a,onClick:s,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[l,r]}):i.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,r]})}const Se=te;function w({children:e,tone:t="neutral"}){const r=t==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:e})}function Ie({rows:e,mode:t,extra:r=null}){const o=e.length===0&&!r;return i.jsxs(i.Fragment,{children:[e.map(({spec:a,pace:s})=>i.jsx(Me,{label:a.label??n(a.labelKey),pct:f(a.window,a.pctField),reset:_e(k(a.window,a.resetField)),mode:t,pacePercent:s.pacePercent,paceOver:s.paceOver,title:Ne(a,s,t)},a.key)),o?i.jsx(w,{children:n("limits.status.no_data")}):null,r]})}function Fe(e){if(!Number.isFinite(e.expiresMs))return null;const t=Math.floor((e.expiresMs-Date.now())/864e5);return t<0?null:t===0?n("limits.reset_bank.hover_detail_today",{date:e.expiresAt}):n("limits.reset_bank.hover_detail",{date:e.expiresAt,days:t})}function Le({row:e}){const t=Math.max(0,Math.min(100,Number(e.percent)||0));return i.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[i.jsx(G,{text:Fe(e)}),i.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e.label}),i.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${t}%`,minWidth:t>0?"3px":0}})}),i.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:e.expiresAt})]})}function Oe({model:e}){const t=e.kind==="count_only"?n("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[i.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.codex_reset_bank.title")}),t?i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:t}):e.rows.map(r=>i.jsx(Le,{row:r},r.key))]})}function Ke(e,t){if(e==="codex_meta"){const r=we(t.reset_credits);return r?i.jsx(Oe,{model:r}):null}return e==="kimi_parallel"&&t.parallel_limit?i.jsx(w,{children:n("limits.label.kimi_parallel",{count:t.parallel_limit})}):e==="copilot_otel"&&!t.otel_has_files&&!t.otel_enabled?i.jsx(De,{defaultDir:t.otel_default_dir}):null}function Re(e,t,r,o,a,s,d=null){const c=A[e];if(!c)return null;const l=c.windows(t).filter(m=>m.window).map(m=>({spec:m,pace:je(m,o)})),u=Ke(c.extra,t);return i.jsxs(P,{name:r,providerId:e,expandable:l.length>0,expanded:a,onToggle:s,badge:d,children:[i.jsx(Ie,{mode:o,rows:l,extra:u}),a?i.jsx(Ee,{rows:l,mode:o}):null]},e)}function Ce(e,t,r,o,a){if(!A[e])return null;if(!t?.configured)return i.jsxs(P,{name:v(e),providerId:e,children:[i.jsx(w,{children:n("limits.status.not_connected")}),e==="opencodeGo"?i.jsx(K,{}):null]},e);if(t.error)return i.jsxs(P,{name:v(e),providerId:e,children:[i.jsx(w,{tone:"error",children:n("shared.error.prefix",{error:t.error})}),e==="opencodeGo"?i.jsx(K,{}):null]},e);const s=v(e),d=t.plan_label?`${s} ${t.plan_label}`:s;let c=null;if(e==="antigravity")if(t.cached){const l=Pe(t.cached_at);c=i.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:u=>u.stopPropagation(),children:[i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider bg-oai-gray-100 dark:bg-oai-gray-800 border border-oai-gray-200/50 dark:border-oai-gray-700/50 text-oai-gray-500 dark:text-oai-gray-400 leading-normal",children:[i.jsx("span",{className:"h-1 w-1 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"}),n("limits.label.antigravity_cached"),l?i.jsxs(i.Fragment,{children:[" · ",l]}):null]}),i.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[n("limits.tooltip.antigravity_cached"),i.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]})]})}else c=i.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:l=>l.stopPropagation(),children:[i.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider bg-emerald-500/10 dark:bg-emerald-500/15 border border-emerald-500/20 text-emerald-600 dark:text-emerald-400 leading-normal",children:[i.jsxs("span",{className:"relative flex h-1 w-1",children:[i.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),i.jsx("span",{className:"relative inline-flex rounded-full h-1 w-1 bg-emerald-500"})]}),n("limits.label.antigravity_live")]}),i.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[n("limits.tooltip.antigravity_live"),i.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]})]});return Re(e,t,d,r,o,a,c)}function De({defaultDir:e}){const[t,r]=b.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
3
- `),s=async d=>{d.stopPropagation();try{await navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:n("limits.copilot.otelHint.body")}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:a}),i.jsx("button",{type:"button",onClick:s,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:t?n("limits.copilot.otelHint.copied"):n("limits.copilot.otelHint.copy")})]})}function M({n:e,children:t}){return i.jsxs("li",{className:"flex gap-2.5",children:[i.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:e}),i.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:t})]})}function Ae(){return i.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function K(){const[e,t]=b.useState(!1),r=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
4
- `),o=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(r),t(!0),setTimeout(()=>t(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:n("limits.opencodeGo.setupHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:n("limits.opencodeGo.setupHint.subtitle")}),i.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[i.jsxs(M,{n:"1",children:[i.jsx("div",{children:n("limits.opencodeGo.setupHint.step1")}),i.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:a=>a.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[n("limits.opencodeGo.setupHint.cta"),i.jsx(Ae,{})]})]}),i.jsxs(M,{n:"2",children:[i.jsx("div",{children:n("limits.opencodeGo.setupHint.step2")}),i.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[i.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_workspace")}),i.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_cookie")})]})]}),i.jsxs(M,{n:"3",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{children:n("limits.opencodeGo.setupHint.step3")}),i.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?n("limits.opencodeGo.setupHint.copied"):n("limits.opencodeGo.setupHint.copy")})]}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:r}),i.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Te(e){const[t,r]=b.useState(0);return b.useLayoutEffect(()=>{const o=e.current;if(!o)return;const a=o.querySelectorAll("[data-limit-label]");let s=0,d=null;if(a.length>0)try{d=document.createElement("canvas").getContext("2d")}catch{d=null}if(d){const l=window.getComputedStyle(a[0]);d.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of a)s=Math.max(s,d.measureText(u.textContent).width)}const c=Math.ceil(s);r(l=>l===c?l:c)}),t}function Ge({claude:e,codex:t,cursor:r,gemini:o,kimi:a,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m,order:x,visibility:h,displayMode:H}){const z={claude:e,codex:t,cursor:r,gemini:o,kimi:a,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m},S=b.useRef(null),I=Te(S),[W,B]=b.useState(null),U=Array.isArray(x)&&x.length>0?x:Se,F=H===p.REMAINING?p.REMAINING:p.USED,V=F===p.REMAINING?n("limits.settings.display_mode_remaining"):n("limits.settings.display_mode_used"),L=U.filter(y=>!h||h[y]!==!1).map(y=>Ce(y,z[y],F,W===y,()=>B(X=>X===y?null:y))).filter(Boolean);return i.jsx(ae,{delay:.15,children:i.jsx(D,{children:i.jsxs("div",{ref:S,className:"flex flex-col gap-3",style:I>0?{"--tt-limits-label-w":`${I}px`}:void 0,children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[n("limits.panel.title"),n("limits.panel.mode_separator"),V]}),L.length>0?L:i.jsx(w,{children:n("limits.status.all_hidden")})]})})})}const $e=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function qe(){const e=q(),{data:t,error:r,isLoading:o}=ee(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),a=re();return!$e&&!J()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(ne,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("limits.page.subtitle")})]}),i.jsx(Q,{to:"/settings","aria-label":n("limits.page.openSettings"),title:n("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:i.jsx(Z,{className:"h-4 w-4","aria-hidden":!0})})]}),o?i.jsx(de,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:n("shared.error.prefix",{error:r})}):null,i.jsx(Ge,{claude:t?.claude,codex:t?.codex,cursor:t?.cursor,gemini:t?.gemini,kimi:t?.kimi,kiro:t?.kiro,grok:t?.grok,antigravity:t?.antigravity,copilot:t?.copilot,zcode:t?.zcode,opencodeGo:t?.opencodeGo,order:a.order,visibility:a.visibility,displayMode:a.displayMode})]})]})})})}export{qe as LimitsPage};
@@ -1 +0,0 @@
1
- import{e as d,f as m,r as t,j as e,L as l,c as o,h as x}from"./__vite-browser-external-CxN2E6q5.js";function n(s,a){for(const r of a){const i=s.get(r);if(typeof i=="string"&&i.trim())return i.trim()}return""}function u(){const[s]=d(),{enabled:a}=m(),r=t.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),i=t.useMemo(()=>n(s,["email"]),[s]),c=t.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:r?"reset_confirm":"reset_email",tokenFromUrl:r,initialEmail:i,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:o("login.cloud_only")})})]})}export{u as ResetPasswordPage};
@@ -1 +0,0 @@
1
- import{l as w,r as c,a4 as ne,a6 as ae,aM as G,j as t,v as M,P as ie,b as k,c as a,f as se,as as oe,aN as re,ax as le,ay as ce,aa as U,aO as ue,aP as de,W as ge,R as C,F as he,V as pe,aQ as F,m as I,aR as me,aS as be,M as fe,aT as xe,q as ye,aU as ve,aV as je,aW as ke,aX as Ne,aY as Se,aZ as we,a_ as Ce,L as Le,a$ as Ee,b0 as Ae,ao as P}from"./__vite-browser-external-CxN2E6q5.js";import{b as _,l as O,u as Ge,L as T}from"./use-limits-display-prefs-BUFZh6fe.js";import{a as N,T as j,b as f,S as L,u as R}from"./use-native-settings-DbdPXxGf.js";import{u as Ie,P as Pe}from"./use-quality-per-dollar-pref-DXoW5A0_.js";import{C as _e}from"./check-CkI3WNti.js";import{C as Oe}from"./copy-Bh3g2_O-.js";import{u as Te}from"./useCurrency-CpDnFC0N.js";import{u as De}from"./useTokenFormat-B8FrUarf.js";import{S as H}from"./Select-3HkgkO8y.js";import{I as Me}from"./info-Mu2CLf-A.js";import{C as Ue}from"./ConfirmModal-DCfRP4oI.js";import{A as Fe}from"./arrow-up-right-CGnVz9Km.js";import{D as Re}from"./download-BITw7nKX.js";import"./Card-B0hyofoy.js";import"./SelectItemText-Bz8FAKEv.js";import"./useScrollLock-Vyaif-7C.js";import"./DialogTitle-BvElfi0r.js";import"./DialogDescription-uQ4gVIv9.js";const He=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ve=w("activity",He);const $e=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Be=w("grip-vertical",$e);const ze=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],We=w("languages",ze);const Ze=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],qe=w("log-out",Ze),Ke=e=>!e.isLayoutDirty&&e.willUpdate(!1);function D(){const e=new Set,n=new WeakMap,i=()=>e.forEach(Ke);return{add:s=>{e.add(s),n.set(s,s.addEventListener("willUpdate",i))},remove:s=>{e.delete(s);const o=n.get(s);o&&(o(),n.delete(s)),i()},dirty:i}}const Ye=c.createContext(null);function Qe(){const e=c.useRef(!1);return ne(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Je(){const e=Qe(),[n,i]=c.useState(0),s=c.useCallback(()=>{e.current&&i(n+1)},[n]);return[c.useCallback(()=>ae.postRender(s),[s]),n]}const V=e=>e===!0,Xe=e=>V(e===!0)||e==="id",et=({children:e,id:n,inherit:i=!0})=>{const s=c.useContext(G),o=c.useContext(Ye),[r,l]=Je(),u=c.useRef(null),g=s.id||o;u.current===null&&(Xe(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:V(i)&&s.group||D()});const h=c.useMemo(()=>({...u.current,forceRender:r}),[l]);return t.jsx(G.Provider,{value:h,children:e})},tt="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function nt({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:k("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:k("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function at({prefs:e}){const{order:n,visibility:i,toggle:s,moveToward:o}=e,[r,l]=c.useState(null),[u,g]=c.useState(null),h=d=>m=>{l(d),m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("text/plain",d)},b=d=>m=>{m.preventDefault(),m.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},x=()=>{l(null),g(null)},y=d=>{d.preventDefault(),l(null),g(null)};return t.jsx(et,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const m=i[d]!==!1,p=r===d;return t.jsxs(M.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:b(d),onDragEnd:x,onDrop:y,className:k("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",p&&"opacity-40"),style:{cursor:p?"grabbing":"grab"},children:[t.jsx(Be,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),_(d)?t.jsx(ie,{provider:_(d),size:18,className:k("pointer-events-none",tt)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:O(d)}),t.jsx("div",{onMouseDown:v=>v.stopPropagation(),draggable:!1,children:t.jsx(nt,{checked:m,onChange:()=>s(d),ariaLabel:`${a("limits.settings.toggle_visible")}: ${O(d)}`})})]},d)})})})}function it(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},s=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof s=="string"&&s.trim()?s.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function st(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function ot(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),s=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||s?.[1];return o?`https://github.com/${o}`:null}function E(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function rt(e,n,i){const[s,o]=c.useState(()=>oe()),r=n&&i&&re(),l=c.useCallback(async()=>{const u=!s;if(le(u),o(u),!!u)try{await ce(()=>e())}catch(g){E("cloud sync",g)}},[s,e]);return{cloudSyncOn:s,handleCloudSyncToggle:l,showLocalCloudSync:r}}function lt(e){const[n,i]=c.useState(!1),[s,o]=c.useState(!1),[r,l]=c.useState(!1),[u,g]=c.useState(!1),[h,b]=c.useState(null),[x,y]=c.useState(!1),[d,m]=c.useState(""),[p,v]=c.useState(!1),[S,A]=c.useState(""),[W,Z]=c.useState(""),[q,K]=c.useState(!1),[Y,Q]=c.useState(null),J=c.useMemo(()=>it(e),[e]),X=c.useMemo(()=>st(e),[e]),ee=c.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),te=c.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:b,setGithubUrl:A,setProfileLoading:l,setPublicProfileOn:i,setShowGithubOn:v}),[]);return{anonymousOn:s,customDisplayName:h,displayName:J,editingGithub:q,editingName:x,email:X,githubError:Y,githubInput:W,githubUrl:S,loadSetters:te,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:b,setEditingGithub:K,setEditingName:y,setGithubError:Q,setGithubInput:Z,setGithubUrl:A,setNameInput:m,setProfileLoading:l,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:v,showGithubOn:p,userId:ee}}function ct(e,n,i){c.useEffect(()=>{if(!n)return;let s=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await U({getAccessToken:e});if(!s||!o)return;const r=await ue({accessToken:o});if(!s)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){E("load public profile",o)}finally{s&&i.setProfileLoading(!1)}})(),()=>{s=!1}},[e,n,i])}function ut(e,n){return c.useCallback(async(i,{label:s,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const l=await U({getAccessToken:e});if(!l)return!1;const u=await de({accessToken:l,...i});return r?.(u),!0}catch(l){return o?o(l):E(s||"mutate profile",l),!1}finally{n.setProfileSaving(!1)}},[e,n])}function dt(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function gt(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function ht(e,n){const i=c.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:c.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function pt(e,n,i){const s=c.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),i?.()}})},[n,e,i]),o=c.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:s,startEditingName:o}}function mt(e,n){const i=c.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),s=c.useCallback(async()=>{const r=ot(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(a("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||a("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=c.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:s,handleShowGithubToggle:i,startEditingGithub:o}}function bt(){const e=se(),n=lt(e.user),i=rt(e.getAccessToken,e.enabled,e.signedIn);ct(e.getAccessToken,e.signedIn,n.loadSetters);const s=ut(e.getAccessToken,n),o=ht(n,s),r=pt(n,s,e.refreshDisplayName),l=mt(n,s);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:dt(n,{...o,...r}),github:gt(n,l),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function $({disabled:e,onCancel:n,onSave:i,saveLabel:s=a("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:s}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function ft({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:s,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.displayName")}),t.jsx($,{disabled:s||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:s?a("settings.account.saving"):void 0})]})}function xt({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:s,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{l(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),t.jsx($,{disabled:s,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:s?a("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function B({disabled:e=!1,label:n,onClick:i,title:s}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:s,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Pe,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function z({actions:e,editing:n,editor:i,hint:s,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s})]}),n?null:e]})})}function yt({name:e}){const n=e.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(B,{disabled:e.anonymousOn,label:a("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function vt({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:s,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:b,setNameInput:x,startEditingName:y}=e,d=n?a("settings.account.displayNameAnonymousHint"):i||s;return t.jsx(z,{label:a("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(ft,{nameInput:u,setEditingName:b,setNameInput:x,profileSaving:h,handleSaveName:l}),actions:t.jsx(yt,{name:e})})}function jt({github:e}){const{editingGithub:n,githubError:i,githubInput:s,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:b,setGithubInput:x,showGithubOn:y,startEditingGithub:d}=e,{enabled:m,toggle:p}=Ie();return t.jsxs(t.Fragment,{children:[t.jsx(z,{label:a("settings.account.githubUrl"),editing:n,hint:o||a("settings.account.githubUrlHint"),editor:t.jsx(xt,{githubError:i,githubInput:s,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:b,setGithubInput:x}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(B,{label:a("settings.account.edit"),onClick:d}),t.jsx(j,{checked:y,onChange:l,disabled:u||g,ariaLabel:a("settings.account.githubUrl")})]})}),o&&t.jsx(f,{label:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:a("settings.labs.qpd.label")}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:a("qpd.card.badge")})]}),hint:a("settings.labs.qpd.hint"),control:t.jsx(j,{checked:m,onChange:p,ariaLabel:a("settings.labs.qpd.aria")})})]})}function kt(){const{openLoginModal:e}=ge();return t.jsx(N,{title:a("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function Nt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(vt,{name:e}),t.jsx(jt,{github:n})]})}function St(){const e=bt();return e.enabled?e.signedIn?t.jsxs(N,{title:a("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Ct,{onSignOut:e.signOut}),children:[t.jsx(wt,{userId:e.userId}),t.jsx(Lt,{settings:e}),t.jsx(Et,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(At,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(kt,{}):null}function wt({userId:e}){const[n,i]=C.useState(!1);if(!e)return null;const s=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[n?t.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?a("settings.account.copied"):a("settings.account.copy")]})]})}function Ct({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(qe,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function Lt({settings:e}){return e.showLocalCloudSync?t.jsx(f,{label:a("settings.account.cloudSync"),hint:a("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:a("settings.account.cloudSync")})}):null}function Et({checked:e,disabled:n,onChange:i}){return t.jsx(f,{label:a("settings.account.publicProfile"),hint:a("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:a("settings.account.publicProfile")})})}function At({visible:e,name:n,github:i}){return t.jsx(he,{initial:!1,children:e?t.jsx(M.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(Nt,{name:n,github:i})},"public-profile-fields"):null})}function Gt(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:me},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:be},{value:"system",label:a("settings.appearance.theme.system"),Icon:fe}]}function It(){return[{value:ve,label:a("settings.appearance.language.system")},{value:je,label:a("settings.appearance.language.english")},{value:ke,label:a("settings.appearance.language.chinese")},{value:Ne,label:a("settings.appearance.language.traditional_chinese")},{value:Se,label:a("settings.appearance.language.japanese")},{value:we,label:a("settings.appearance.language.korean")},{value:Ce,label:a("settings.appearance.language.german")}]}function Pt(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function _t(e,n){const i=a(`settings.appearance.currency.rate_source.${e}`),s=Pt(n),o=s?a("settings.appearance.currency.rate_updated",{when:s}):a("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Ot({locale:e,setLocale:n}){const i=It();return t.jsx(H,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(We,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function Tt({currency:e,setCurrency:n}){const i=xe().map(s=>({value:s.code,label:a(s.labelKey)}));return t.jsx(H,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Dt({currency:e,rate:n,rateSource:i,rateFetchedAt:s}){if(e===ye)return t.jsx(t.Fragment,{children:a("settings.appearance.currency.hint")});const o=_t(i,s);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx(Me,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Mt(){const{theme:e,setTheme:n}=pe(),{locale:i,setLocale:s}=F(),{currency:o,rate:r,rateSource:l,rateFetchedAt:u,setCurrency:g}=Te(),{mode:h,setMode:b}=De();return t.jsxs(N,{title:a("settings.section.appearance"),children:[t.jsx(f,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:t.jsx(L,{options:Gt(),value:e,onChange:n})}),t.jsx(f,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:t.jsx(Ot,{locale:i,setLocale:s})}),t.jsx(f,{label:a("settings.appearance.currency.label"),hint:t.jsx(Dt,{currency:o,rate:r,rateSource:l,rateFetchedAt:u}),control:t.jsx(Tt,{currency:o,setCurrency:g})}),t.jsx(f,{label:a("settings.appearance.token_format.label"),hint:a("settings.appearance.token_format.hint"),control:t.jsx(L,{options:[{value:I.COMPACT,label:a("settings.appearance.token_format.compact")},{value:I.FULL,label:a("settings.appearance.token_format.full")}],value:h,onChange:b})})]})}function Ut(){const{available:e,settings:n,setSetting:i,runAction:s}=R();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,l=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(N,{title:a("settings.section.menubar"),children:[t.jsx(f,{label:a("settings.menubar.appearance"),hint:a("settings.menubar.appearanceHint"),control:t.jsxs(Le,{to:"/widgets",className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[a("settings.menubar.appearanceLink"),t.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),r?t.jsx(f,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,t.jsx(f,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>s("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ee,{className:k("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),t.jsx(f,{label:a("settings.menubar.updates"),hint:l||void 0,control:t.jsxs("button",{type:"button",onClick:()=>s("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Re,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function Ft(e,n){function i(r){return r.replace(/^v/,"").split(".").map(Number)}const s=i(e),o=i(n);for(let r=0;r<Math.max(s.length,o.length);r++){const l=s[r]||0,u=o[r]||0;if(l<u)return!0;if(l>u)return!1}return!1}function Rt(){const{available:e,settings:n,runAction:i}=R(),s=e&&n?.version,[o,r]=C.useState(!1),[l,u]=C.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:g}=F(),h="0.81.3",b=async()=>{r(!0);try{const p=await fetch("https://api.github.com/repos/mm7894215/TokenTracker/releases/latest");if(!p.ok)throw new Error("Failed to fetch");const v=await p.json(),S=v.tag_name;Ft(h,S)?u({open:!0,latestVersion:S,htmlUrl:v.html_url}):P({title:a("settings.menubar.updates.upToDate")})}catch(p){console.error("Check updates failed:",p),P({title:a("settings.menubar.updates.failed")})}finally{r(!1)}},x=a("settings.menubar.updates.modalTitle"),y=a("settings.menubar.updates.modalDescription",{version:l.latestVersion}),d=a("settings.menubar.updates.modalConfirm"),m=a("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCombined",{barVersion:n.version,coreVersion:h})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:h})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:b,disabled:o,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:o?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Ae,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Ve,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),t.jsx(Ue,{open:l.open,title:x,description:y,confirmLabel:d,cancelLabel:m,onConfirm:()=>{window.open(l.htmlUrl,"_blank"),u(p=>({...p,open:!1}))},onCancel:()=>u(p=>({...p,open:!1}))})]})}function Ht({prefs:e}){return t.jsx(L,{options:[{value:T.USED,label:a("limits.settings.display_mode_used")},{value:T.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function rn(){const e=Ge();return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Mt,{}),t.jsx(Ut,{}),t.jsx(St,{}),t.jsx(N,{title:a("settings.section.limits"),action:t.jsx(Ht,{prefs:e}),children:t.jsx(at,{prefs:e})})]}),t.jsx(Rt,{})]})})})}export{rn as SettingsPage};
@@ -1 +0,0 @@
1
- import{j as e,c as o,K as P,M as I,r as u,G as K,R as D,b as M}from"./__vite-browser-external-CxN2E6q5.js";import{S as _}from"./Select-3HkgkO8y.js";import{u as E,T as G}from"./use-native-settings-DbdPXxGf.js";import{F as j,S as R,a as O}from"./FadeIn-DZoN7vbQ.js";import{A as $}from"./arrow-up-right-CGnVz9Km.js";import{D as z}from"./download-BITw7nKX.js";import"./SelectItemText-Bz8FAKEv.js";import"./useScrollLock-Vyaif-7C.js";import"./check-CkI3WNti.js";import"./Card-B0hyofoy.js";const H=["todayTokens","todayCost"],W=[{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 v(t,a=W,r=2){const i=new Set(a.map(n=>n.id)),l=new Set,s=Array.isArray(t)?t.filter(n=>!i.has(n)||l.has(n)?!1:(l.add(n),!0)):[];return(s.length>0?s:H).slice(0,Math.max(1,Number(r)||2))}const U=264,V=124,x="ui-rounded, -apple-system, system-ui",L=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],X={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Y(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function b({size:t="sm",children:a}){const r=t==="lg",i=r?560:264,l=r?32:22;return e.jsx("div",{className:M("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:i,aspectRatio:`${U} / ${V}`,borderRadius:l},children:a})})}function Z({size:t="sm"}){const a="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=`${a} L264,124 L0,124 Z`,i=`sparkArea-${t}`;return e.jsx(b,{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:i,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:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:x,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:x,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:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:x,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:x,children:"$673.61"}),e.jsx("path",{d:r,fill:`url(#${i})`,stroke:"none"}),e.jsx("path",{d:a,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const C=(()=>{const r=[];for(let i=0;i<26;i++)for(let l=0;l<7;l++){const s=Math.sin((i+1)*12.9898+(l+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(s-Math.floor(s))*100);r.push({w:i,d:l,v:c})}return r})();function S(t,a){return t<18?a?"#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(b,{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:C.map(s=>e.jsx("rect",{x:s.w*(7.5+1.2),y:s.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:S(s.v,!0)},`d-${s.w}-${s.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:C.map(s=>e.jsx("rect",{x:s.w*(7.5+1.2),y:s.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:S(s.v,!1)},`l-${s.w}-${s.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:x,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:"tokens · 202 active days"})]})})}function J(){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}],a=22,r=28,i=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((s,c)=>{const n=r+c*a,h=L[c%L.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:s.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:x,children:s.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:x,children:[s.pct,"%"]}),e.jsx("rect",{x:i,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:h})]},s.name)})})})}function Q(){const t=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],a=22,r=28,i=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((s,c)=>{const n=r+c*a,h=X[s.source],y=Y(s.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:s.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:x,children:s.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:x,children:[s.pct,"%"]}),e.jsx("rect",{x:i,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},s.label)})})})}function ee(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function te(t,a){switch(t){case"todayTokens":return o("menubar.metric.today_tokens");case"todayCost":return o("menubar.metric.today_cost");case"last7dTokens":return o("menubar.metric.last_7d_tokens");case"totalTokens":return o("menubar.metric.total_tokens");case"totalCost":return o("menubar.metric.total_cost");case"claude5h":return o("menubar.metric.claude_5h");case"claude7d":return o("menubar.metric.claude_7d");case"codex5h":return o("menubar.metric.codex_5h");case"codex7d":return o("menubar.metric.codex_7d");case"codexCredits":return o("menubar.metric.codex_credits");case"codexSpark5h":return o("menubar.metric.codex_spark_5h");case"codexSpark7d":return o("menubar.metric.codex_spark_7d");default:return a}}function ae(t,a){const r=new Set(a.map(l=>l.id)),i=t.filter(l=>r.has(l));for(const l of a){if(i.length>=2)break;i.includes(l.id)||i.push(l.id)}return i.slice(0,2)}function ie({slotConfigs:t,showStats:a}){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"})}),a?t.map(({slot:r,item:i},l)=>e.jsxs(D.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:M("flex min-w-[52px] flex-col items-center justify-center py-1.5",l===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:i?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:i?.shortLabel||"Metric"})]})]},r)):null]})})}function se({slot:t,value:a,options:r,disabled:i,onChange:l}){const s=t===0?o("menubar.slot.primary"):o("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:s}),e.jsx(_,{value:a,disabled:i,ariaLabel:s,onValueChange:c=>l(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 N({label:t,hint:a,checked:r,disabled:i,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}),a?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a}):null]}),e.jsx(G,{checked:r,disabled:i,onChange:l,ariaLabel:t})]})}function re({label:t,hint:a,value:r,options:i,disabled:l,onChange:s}){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}),a?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a}):null]}),e.jsx(_,{value:r,disabled:l,ariaLabel:t,onValueChange:s,options:i,className:"shrink-0 px-3 py-2 text-sm font-medium"})]})}function le(){const{available:t,settings:a,setSetting:r}=E(),i=u.useMemo(()=>(Array.isArray(a?.menuBarAvailableItems)?a.menuBarAvailableItems:W).map(m=>({...m,displayLabel:te(m.id,m.label),previewValue:ee(m)})),[a?.menuBarAvailableItems]),l=Number(a?.menuBarMaxItems)||2,s=u.useMemo(()=>v(a?.menuBarItems,i,l),[i,l,a?.menuBarItems]),c=u.useMemo(()=>ae(s,i),[i,s]),n=a?.showStats!==!1,h=d=>{r("menuBarItems",v(d,i,l))},y=(d,m)=>{const g=[...c];g[d===0?1:0]!==m&&(g[d]=m,h(g))},p=[0,1].map(d=>{const m=c[d]||i[d]?.id||"",w=c[d===0?1:0],F=i.filter(f=>f.id===m||f.id!==w),B=i.find(f=>f.id===m);return{slot:d,currentValue:m,options:F,item:B}}),T=["clawd","cat","pet","static"].includes(a?.menuBarIconStyle)?a.menuBarIconStyle:"clawd",k=a?.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(ie,{slotConfigs:p,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:p.map(({slot:d,currentValue:m,options:g})=>e.jsx(se,{slot:d,value:m,options:g,disabled:!t||!n,onChange:y},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(N,{label:o("settings.menubar.showStats"),hint:t?o("settings.menubar.showStatsHint"):o("menubar.native_only"),checked:n,disabled:!t,onChange:()=>r("showStats",!n)}),e.jsx(re,{label:o("settings.menubar.iconStyle"),hint:o("settings.menubar.iconStyleHint"),value:T,disabled:!t,options:[{value:"clawd",label:o("settings.menubar.iconStyle.clawd")},{value:"cat",label:o("settings.menubar.iconStyle.cat")},{value:"pet",label:o("settings.menubar.iconStyle.pet")},{value:"static",label:o("settings.menubar.iconStyle.static")}],onChange:d=>r("menuBarIconStyle",d)}),e.jsx(N,{label:o("settings.menubar.confettiOnReset"),hint:o("settings.menubar.confettiOnResetHint"),checked:k,disabled:!t,onChange:()=>r("confettiOnReset",!k)})]})]})}function oe(){const[t,a]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(K()){a("native");return}const r=(navigator.userAgent||"").toLowerCase(),i=/mac/.test(r)&&!/iphone|ipad/.test(r);a(i?"mac-web":"other")},[]),t}function ne(){const t=oe();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>P("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:[o("widgets.cta.open_gallery"),e.jsx($,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/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(z,{className:"h-4 w-4","aria-hidden":"true"}),o("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(I,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.macos_only")]})}const ce=[{id:"summary",Preview:Z,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:q,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:J,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:Q,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function de({Preview:t,nameKey:a,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:o(a)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:o(r)})]})]})}function A({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:o(t)})}function je(){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(j,{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:o("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(ne,{})})]})}),e.jsx(j,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":o("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(A,{titleKey:"widgets.menubar.section.title"}),e.jsx(le,{})]})}),e.jsxs("section",{"aria-label":o("widgets.gallery.section.title"),children:[e.jsx(A,{titleKey:"widgets.gallery.section.title"}),e.jsx(R,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:ce.map(({id:t,Preview:a,nameKey:r,descKey:i})=>e.jsx(O,{children:e.jsx(de,{Preview:a,nameKey:r,descKey:i})},t))})})]})]})})})}export{je as WidgetsPage};