tokentracker-cli 0.64.0 → 0.64.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{ActivityHeatmap-DjMtMPit.js → ActivityHeatmap-CrW1u40M.js} +1 -1
- package/dashboard/dist/assets/{Card-CD9YpCAv.js → Card-Cg-6DDbN.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-Bl8jvnt-.js +19 -0
- package/dashboard/dist/assets/{DevicePage-DA74Sryo.js → DevicePage-C78nzmZm.js} +1 -1
- package/dashboard/dist/assets/{DialogTitle-DDp9MHUJ.js → DialogTitle-COVyZQVB.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CBspmJ4G.js → FadeIn-RZKrtHup.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-BDgq5Gx4.js → HeaderGithubStar-B1gFlLrg.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-L1GKKx8L.js → IpCheckPage-RrZDmOFh.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-BxI6zHR6.js → LandingPage-CV9EvgTg.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-DHKVlkOF.js → LeaderboardAvatar-_tiTs_tT.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-C8JB9MuB.js → LeaderboardPage-2tltO9IR.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfileModal-CpciUHf2.js → LeaderboardProfileModal-BiQREZ6Z.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-c2Pg5hum.js → LeaderboardProfilePage-DU43hEuh.js} +3 -3
- package/dashboard/dist/assets/{LimitsPage-DkqHHv2V.js → LimitsPage-C7xuyH5P.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-CVAJM9pw.js → LocalOnlyNotice-Dvcf7F9s.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-L9n2F1t8.js → LoginPage-UlbsYFKJ.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-B883Co46.js → PopoverPopup-BsBKLiJu.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-dcb-XQ_8.js → ResetPasswordPage-BuKemqhr.js} +1 -1
- package/dashboard/dist/assets/{Select-Dn_eH-Cb.js → Select-9oplHX46.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-BBymhOah.js → SelectItemText-CnL08w_W.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-CeqgABWP.js +1 -0
- package/dashboard/dist/assets/{SkillsPage-BKBEMpDa.js → SkillsPage-CW6aD8GD.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-ByTWGppP.js → WidgetsPage-DtOkMdxK.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-BzBYot91.js → WrappedPage-DPAz_bit.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-7x6sZdXn.js → agent-logos-uSGgZshc.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-NtrFTgFM.js → arrow-up-right-9sot4sNP.js} +1 -1
- package/dashboard/dist/assets/{download-DBI1zmF1.js → download-3O0nnnqv.js} +1 -1
- package/dashboard/dist/assets/{info-WyXjj_mj.js → info-CfCBZRtQ.js} +1 -1
- package/dashboard/dist/assets/{main-sjN9-3PX.js → main-C5qSiLnL.js} +31 -13
- package/dashboard/dist/assets/{main-iuBgdxqX.css → main-DWsITcdg.css} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-D_3UqeaO.js → use-limits-display-prefs-Bh7PFn6x.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-BIZTMAe_.js → use-native-settings-MKCjJWeQ.js} +1 -1
- package/dashboard/dist/assets/use-quality-per-dollar-pref-D-m9WqCz.js +1 -0
- package/dashboard/dist/assets/{use-usage-limits-DyrBGYy1.js → use-usage-limits-CCu4bGI4.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-BJEllMZE.js → useCurrency-BZmZ49MO.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-Bim1sAXp.js → useScrollLock-BdBmNNmw.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/lib/local-api.js +25 -0
- package/src/lib/outcomes-engine.js +230 -0
- package/src/lib/pricing/curated-overrides.json +4 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/DashboardPage-Djhg-yJL.js +0 -19
- package/dashboard/dist/assets/SettingsPage-DpP5jrlC.js +0 -1
- package/dashboard/dist/assets/pencil-zlgm1deI.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as v,r as l,ar as X,al as q,aO as L,j as n,m as O,U as ee,V as y,G as s,Y as te,ay as ne,aP as ae,aC as ie,aD as se,aE as P,aQ as oe,aR as re,W as le,R as ce,S as ue,T as de,a4 as ge,aS as he,aT as pe,a0 as me,aU as be,K as fe,aV as xe,aW as ye,aX as ve,aY as je,aZ as Ne,a_ as ke,a$ as Se,aj as we}from"./main-sjN9-3PX.js";import{b as G,l as E,u as Ce,L as A}from"./use-limits-display-prefs-D_3UqeaO.js";import{S as j,T as N,a as b,b as _,u as D}from"./use-native-settings-BIZTMAe_.js";import{P as Le}from"./pencil-zlgm1deI.js";import{C as Ge}from"./useScrollLock-Bim1sAXp.js";import{u as Ee}from"./useCurrency-BJEllMZE.js";import{S as T}from"./Select-Dn_eH-Cb.js";import{I as Ae}from"./info-WyXjj_mj.js";import{D as Ie}from"./download-DBI1zmF1.js";import"./Card-CD9YpCAv.js";import"./SelectItemText-BBymhOah.js";const Oe=[["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"}]],Pe=v("activity",Oe);const _e=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],De=v("copy",_e);const Te=[["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"}]],Ue=v("grip-vertical",Te);const Me=[["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"}]],Re=v("languages",Me);const Fe=[["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"}]],He=v("log-out",Fe),$e=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach($e);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const Be=l.createContext(null);function ze(){const e=l.useRef(!1);return X(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ve(){const e=ze(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>q.postRender(i),[i]),t]}const U=e=>e===!0,We=e=>U(e===!0)||e==="id",Ze=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(Be),[r,c]=Ve(),u=l.useRef(null),g=i.id||o;u.current===null&&(We(a)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:U(a)&&i.group||I()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:h,children:e})},Ke="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Ye({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:y("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:n.jsx("span",{className:y("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Je({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},m=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},x=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Ze,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const p=a[d]!==!1,k=r===d;return n.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:f,onDrop:x,className:y("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",k&&"opacity-40"),style:{cursor:k?"grabbing":"grab"},children:[n.jsx(Ue,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),G(d)?n.jsx(ee,{provider:G(d),size:18,className:y("pointer-events-none",Ke)}):null,n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:E(d)}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx(Ye,{checked:p,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${E(d)}`})})]},d)})})})}function Qe(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function Xe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function qe(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function et(e,t,a){const[i,o]=l.useState(()=>ne()),r=t&&a&&ae(),c=l.useCallback(async()=>{const u=!i;if(ie(u),o(u),!!u)try{await se(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function tt(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[f,x]=l.useState(!1),[d,p]=l.useState(""),[k,S]=l.useState(!1),[H,C]=l.useState(""),[$,B]=l.useState(""),[z,V]=l.useState(!1),[W,Z]=l.useState(null),K=l.useMemo(()=>Qe(e),[e]),Y=l.useMemo(()=>Xe(e),[e]),J=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:h,displayName:K,editingGithub:z,editingName:f,email:Y,githubError:W,githubInput:$,githubUrl:H,loadSetters:Q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:V,setEditingName:x,setGithubError:Z,setGithubInput:B,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:k,userId:J}}function nt(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await P({getAccessToken:e});if(!i||!o)return;const r=await oe({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function at(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await P({getAccessToken:e});if(!c)return!1;const u=await re({accessToken:c,...a});return r?.(u),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function it(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function st(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function ot(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function rt(e,t,a){const i=l.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await t({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),a?.()}})},[t,e,a]),o=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function lt(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=qe(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function ct(){const e=te(),t=tt(e.user),a=et(e.getAccessToken,e.enabled,e.signedIn);nt(e.getAccessToken,e.signedIn,t.loadSetters);const i=at(e.getAccessToken,t),o=ot(t,i),r=rt(t,i,e.refreshDisplayName),c=lt(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:t.userId,name:it(t,{...o,...r}),github:st(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function M({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,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:i}),n.jsx("button",{type:"button",onClick:t,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:s("settings.account.cancel")})]})}function ut({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!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:s("settings.account.displayName")}),n.jsx(M,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function dt({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&a(),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:s("settings.account.githubUrlPlaceholder")}),n.jsx(M,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function R({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,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:[n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function F({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function gt({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(N,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function ht({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:f,startEditingName:x}=e,d=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(F,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(ut,{nameInput:u,setEditingName:m,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:n.jsx(gt,{name:e})})}function pt({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f,showGithubOn:x,startEditingGithub:d}=e;return n.jsx(F,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(dt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{label:s("settings.account.edit"),onClick:d}),n.jsx(N,{checked:x,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function mt(){const{openLoginModal:e}=le();return n.jsx(j,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.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:s("settings.account.signIn")})]})})}function bt({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(ht,{name:e}),n.jsx(pt,{github:t})]})}function ft(){const e=ct();return e.enabled?e.signedIn?n.jsxs(j,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(yt,{onSignOut:e.signOut}),children:[n.jsx(xt,{userId:e.userId}),n.jsx(vt,{settings:e}),n.jsx(jt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(Nt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(mt,{}):null}function xt({userId:e}){const[t,a]=ce.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),a(!0),globalThis.setTimeout(()=>a(!1),1200)}catch{a(!1)}};return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),n.jsxs("button",{type:"button",onClick:i,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":s("settings.account.copyUserId"),children:[t?n.jsx(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}):n.jsx(De,{className:"h-3.5 w-3.5","aria-hidden":!0}),t?s("settings.account.copied"):s("settings.account.copy")]})]})}function yt({onSignOut:e}){return n.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:[n.jsx(He,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function vt({settings:e}){return e.showLocalCloudSync?n.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(N,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function jt({checked:e,disabled:t,onChange:a}){return n.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(N,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function Nt({visible:e,name:t,github:a}){return n.jsx(ue,{initial:!1,children:e?n.jsx(O.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:n.jsx(bt,{name:t,github:a})},"public-profile-fields"):null})}function kt(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:he},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:pe},{value:"system",label:s("settings.appearance.theme.system"),Icon:me}]}function St(){return[{value:xe,label:s("settings.appearance.language.system")},{value:ye,label:s("settings.appearance.language.english")},{value:ve,label:s("settings.appearance.language.chinese")},{value:je,label:s("settings.appearance.language.traditional_chinese")},{value:Ne,label:s("settings.appearance.language.japanese")},{value:ke,label:s("settings.appearance.language.korean")}]}function wt(e){if(!e)return null;try{const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString()}catch{return null}}function Ct(e,t){const a=s(`settings.appearance.currency.rate_source.${e}`),i=wt(t),o=i?s("settings.appearance.currency.rate_updated",{when:i}):s("settings.appearance.currency.rate_never");return`${a} · ${o}`}function Lt({locale:e,setLocale:t}){const a=St();return n.jsx(T,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:n.jsx(Re,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function Gt({currency:e,setCurrency:t}){const a=be().map(i=>({value:i.code,label:s(i.labelKey)}));return n.jsx(T,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Et({currency:e,rate:t,rateSource:a,rateFetchedAt:i}){if(e===fe)return n.jsx(n.Fragment,{children:s("settings.appearance.currency.hint")});const o=Ct(a,i);return n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{children:`1 USD = ${t.toFixed(4)} ${e}`}),n.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:n.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function At(){const{theme:e,setTheme:t}=de(),{locale:a,setLocale:i}=ge(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ee();return n.jsxs(j,{title:s("settings.section.appearance"),children:[n.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(_,{options:kt(),value:e,onChange:t})}),n.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(Lt,{locale:a,setLocale:i})}),n.jsx(b,{label:s("settings.appearance.currency.label"),hint:n.jsx(Et,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:n.jsx(Gt,{currency:o,setCurrency:g})})]})}function It(){const{available:e,settings:t,setSetting:a,runAction:i}=D();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,u=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(j,{title:s("settings.section.menubar"),children:[r?n.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(N,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("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:[n.jsx(Se,{className:y("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("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:[n.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Ot(){const{available:e,settings:t,runAction:a}=D(),i=e&&t?.version;return n.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[i?n.jsxs(n.Fragment,{children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),n.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,n.jsxs("a",{href:we,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:[n.jsx(Pe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function Pt({prefs:e}){return n.jsx(_,{options:[{value:A.USED,label:s("limits.settings.display_mode_used")},{value:A.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Vt(){const e=Ce();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(At,{}),n.jsx(It,{}),n.jsx(ft,{}),n.jsx(j,{title:s("settings.section.limits"),action:n.jsx(Pt,{prefs:e}),children:n.jsx(Je,{prefs:e})})]}),n.jsx(Ot,{})]})})})}export{Vt as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as a}from"./main-sjN9-3PX.js";const c=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],o=a("pencil",c);export{o as P};
|