tokentracker-cli 0.5.89 → 0.5.91

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 (26) hide show
  1. package/dashboard/dist/assets/main-CHSJgtKj.js +5156 -0
  2. package/dashboard/dist/assets/main-DI4xYfKR.css +1 -0
  3. package/dashboard/dist/index.html +2 -2
  4. package/dashboard/dist/share.html +2 -2
  5. package/package.json +1 -1
  6. package/dashboard/dist/assets/Card-CnqcfvmO.js +0 -1
  7. package/dashboard/dist/assets/DashboardPage-CL9LvAb4.js +0 -1
  8. package/dashboard/dist/assets/FadeIn-DnSCeL3V.js +0 -1
  9. package/dashboard/dist/assets/IpCheckPage-BzBH9Pzc.js +0 -1
  10. package/dashboard/dist/assets/LeaderboardPage--a89meL8.js +0 -5
  11. package/dashboard/dist/assets/LeaderboardProfilePage-CPlgciKL.js +0 -1
  12. package/dashboard/dist/assets/LimitsPage-gI3NxbAg.js +0 -2
  13. package/dashboard/dist/assets/PopoverPopup-DSxDP7iu.js +0 -12
  14. package/dashboard/dist/assets/ProviderIcon-CXJvW9mJ.js +0 -1
  15. package/dashboard/dist/assets/SettingsPage-CSBDnXij.js +0 -1
  16. package/dashboard/dist/assets/SkillsPage-ZSajczMn.js +0 -1
  17. package/dashboard/dist/assets/WidgetsPage-COk7qbro.js +0 -1
  18. package/dashboard/dist/assets/chevron-down-DoncrDIk.js +0 -1
  19. package/dashboard/dist/assets/download-DjhGgU2Q.js +0 -1
  20. package/dashboard/dist/assets/leaderboard-columns-eCqUMOqF.js +0 -1
  21. package/dashboard/dist/assets/main-BkcFhXuV.js +0 -5141
  22. package/dashboard/dist/assets/main-DDHZqhEq.css +0 -1
  23. package/dashboard/dist/assets/refresh-cw-BvjQfCG5.js +0 -1
  24. package/dashboard/dist/assets/use-limits-display-prefs-D8X45HMo.js +0 -1
  25. package/dashboard/dist/assets/use-native-settings-BHpLvxeC.js +0 -1
  26. package/dashboard/dist/assets/use-usage-limits-B6fyz2im.js +0 -1
@@ -1 +0,0 @@
1
- import{r as l,b as Y,f as J,al as G,D as n,e as S,H as P,a7 as x,B as s,O as Q,ab as X,am as ee,ac as te,ad as ne,ae as A,an as ae,ao as ie,N as oe,P as se,C as re,T as le,ap as ce,aq as ue,ar as D,as as de,at as ge,au as he}from"./main-BkcFhXuV.js";import{L as be,a as L,u as me}from"./use-limits-display-prefs-D8X45HMo.js";import{S as v,T as k,a as f,b as E,u as _}from"./use-native-settings-BHpLvxeC.js";import{R as pe}from"./refresh-cw-BvjQfCG5.js";import{D as fe}from"./download-DjhGgU2Q.js";import"./Card-CnqcfvmO.js";const ye=e=>!e.isLayoutDirty&&e.willUpdate(!1);function O(){const e=new Set,t=new WeakMap,a=()=>e.forEach(ye);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 xe=l.createContext(null);function ve(){const e=l.useRef(!1);return Y(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ke(){const e=ve(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>J.postRender(i),[i]),t]}const T=e=>e===!0,je=e=>T(e===!0)||e==="id",Ne=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(G),o=l.useContext(xe),[r,c]=ke(),d=l.useRef(null),g=i.id||o;d.current===null&&(je(a)&&g&&(t=t?g+"-"+t:g),d.current={id:t,group:T(a)&&i.group||O()});const h=l.useMemo(()=>({...d.current,forceRender:r}),[c]);return n.jsx(G.Provider,{value:h,children:e})};const Se=[["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"}]],we=S("grip-vertical",Se);const Ce=[["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"}]],I=S("languages",Ce);const Ge=[["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"}]],Le=S("log-out",Ge);const Ee=[["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"}]],Oe=S("pencil",Ee),Ie=new Set(["cursor","kiro","copilot"]);function Pe({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:x("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:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Ae({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[d,g]=l.useState(null),h=u=>b=>{c(u),b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("text/plain",u)},m=u=>b=>{b.preventDefault(),b.dataTransfer.dropEffect="move",r&&r!==u&&d!==u&&(g(u),o(r,u))},p=()=>{c(null),g(null)},y=u=>{u.preventDefault(),c(null),g(null)};return n.jsx(Ne,{children:n.jsx("div",{className:"flex flex-col",children:t.map(u=>{const b=a[u]!==!1,j=r===u;return n.jsxs(P.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(u),onDragOver:m(u),onDragEnd:p,onDrop:y,className:x("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",j&&"opacity-40"),style:{cursor:j?"grabbing":"grab"},children:[n.jsx(we,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),n.jsx("img",{src:be[u],alt:"",width:18,height:18,className:x("h-[18px] w-[18px] shrink-0 pointer-events-none",Ie.has(u)&&"dark:invert"),draggable:!1}),n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:L[u]}),n.jsx("div",{onMouseDown:N=>N.stopPropagation(),draggable:!1,children:n.jsx(Pe,{checked:b,onChange:()=>i(u),ariaLabel:`${s("limits.settings.toggle_visible")}: ${L[u]}`})})]},u)})})})}function De(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 _e(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function Te(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 Me(e,t,a){const[i,o]=l.useState(()=>X()),r=t&&a&&ee(),c=l.useCallback(async()=>{const d=!i;if(te(d),o(d),!!d)try{await ne(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function Ue(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[d,g]=l.useState(!1),[h,m]=l.useState(null),[p,y]=l.useState(!1),[u,b]=l.useState(""),[j,N]=l.useState(!1),[B,C]=l.useState(""),[H,F]=l.useState(""),[z,$]=l.useState(!1),[V,Z]=l.useState(null),W=l.useMemo(()=>De(e),[e]),K=l.useMemo(()=>_e(e),[e]),q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:N}),[]);return{anonymousOn:i,customDisplayName:h,displayName:W,editingGithub:z,editingName:p,email:K,githubError:V,githubInput:H,githubUrl:B,loadSetters:q,nameInput:u,profileLoading:r,profileSaving:d,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:$,setEditingName:y,setGithubError:Z,setGithubInput:F,setGithubUrl:C,setNameInput:b,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:N,showGithubOn:j}}function Re(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await A({getAccessToken:e});if(!i||!o)return;const r=await ae({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 Be(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 A({getAccessToken:e});if(!c)return!1;const d=await ie({accessToken:c,...a});return r?.(d),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function He(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 Fe(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 ze(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 $e(e,t){const a=l.useCallback(async()=>{const o=e.nameInput.trim().slice(0,50);o&&await t({display_name:o},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(o),e.setEditingName(!1)}})},[t,e]),i=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:a,startEditingName:i}}function Ve(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=Te(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 Ze(){const e=Q(),t=Ue(e.user),a=Me(e.getAccessToken,e.enabled,e.signedIn);Re(e.getAccessToken,e.signedIn,t.loadSetters);const i=Be(e.getAccessToken,t),o=ze(t,i),r=$e(t,i),c=Ve(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,name:He(t,{...o,...r}),github:Fe(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 We({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 Ke({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:d=>{c(d.target.value),e&&r(null)},onKeyDown:d=>{d.key==="Enter"&&a(),d.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 U({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(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function R({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 qe({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(U,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function Ye({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:d,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:p,startEditingName:y}=e,u=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(R,{label:s("settings.account.displayName"),editing:o,hint:u,editor:n.jsx(We,{nameInput:d,setEditingName:m,setNameInput:p,profileSaving:h,handleSaveName:c}),actions:n.jsx(qe,{name:e})})}function Je({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:d,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:p,showGithubOn:y,startEditingGithub:u}=e;return n.jsx(R,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(Ke,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:p}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(U,{label:s("settings.account.edit"),onClick:u}),n.jsx(k,{checked:y,onChange:c,disabled:d||g,ariaLabel:s("settings.account.githubUrl")})]})})}function Qe(){const{openLoginModal:e}=oe();return n.jsx(v,{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 Xe({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(Ye,{name:e}),n.jsx(Je,{github:t})]})}function et(){const e=Ze();return e.enabled?e.signedIn?n.jsxs(v,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(tt,{onSignOut:e.signOut}),children:[n.jsx(nt,{settings:e}),n.jsx(at,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(it,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(Qe,{}):null}function tt({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(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function nt({settings:e}){return e.showLocalCloudSync?n.jsx(f,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function at({checked:e,disabled:t,onChange:a}){return n.jsx(f,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function it({visible:e,name:t,github:a}){return n.jsx(se,{initial:!1,children:e?n.jsx(P.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(Xe,{name:t,github:a})},"public-profile-fields"):null})}function ot(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:ce},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:ue},{value:"system",label:s("settings.appearance.theme.system"),Icon:D}]}function st(){return[{value:de,label:s("settings.appearance.language.system"),Icon:D},{value:ge,label:s("settings.appearance.language.english"),Icon:I},{value:he,label:s("settings.appearance.language.chinese"),Icon:I}]}function rt(){const{theme:e,setTheme:t}=re(),{locale:a,setLocale:i}=le();return n.jsxs(v,{title:s("settings.section.appearance"),children:[n.jsx(f,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(E,{options:ot(),value:e,onChange:t})}),n.jsx(f,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(E,{options:st(),value:a,onChange:i})})]})}function lt(){const{available:e,settings:t,setSetting:a,runAction:i}=_();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,d=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(v,{title:s("settings.section.menubar"),children:[r?n.jsx(f,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(f,{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(pe,{className:x("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(f,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:d,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(fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function ct(){const{available:e,settings:t,runAction:a}=_();return!e||!t?.version?null:n.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[11px] text-oai-gray-500 dark:text-oai-gray-500",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"})]})}function pt(){const e=me();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(rt,{}),n.jsx(lt,{}),n.jsx(et,{}),n.jsx(v,{title:s("settings.section.limits"),children:n.jsx(Ae,{prefs:e})})]}),n.jsx(ct,{})]})})})}export{pt as SettingsPage};
@@ -1 +0,0 @@
1
- import{e as Je,r,av as J,aw as xe,ax as zt,ay as Pt,az as ot,aA as Pe,aB as Ot,aC as On,D as s,a6 as on,aD as At,aE as an,aF as ln,E as cn,F as Fe,aG as Wt,a7 as xt,aH as An,B as A,R as Ln}from"./main-BkcFhXuV.js";import{A as Ut,s as ve,l as at,m as He,n as Be,o as qt,p as un,q as Ue,r as Vn,t as Dn,v as _n,w as Un,x as Kt,y as Fn,z as nt,c as Ce,C as St,E as Hn,F as dn,G as Bn,H as $n,I as ze,J as fn,K as se,L as mn,M as zn,S as Wn,N as F,O as qn,Q as Ft,R as Kn,T as Yn,U as Gn,V as Xn,W as Jn,X as Qn,Y as Ht,Z as Zn,_ as Lt,$ as er,a0 as tr,a1 as nr,a2 as rr,a3 as sr,a4 as or,a5 as ar,a6 as ir,a7 as gn,a8 as lr,a9 as cr,aa as ur,ab as dr,ac as fr,ad as pn,ae as mr,af as gr,ag as Ct,u as pr,D as hr,b as xr,d as yr,e as br,f as wr,g as kr,B as Ve,P as vr,h as Rr,i as Sr,j as Cr,k as Ir}from"./PopoverPopup-DSxDP7iu.js";import{C as Mr}from"./Card-CnqcfvmO.js";import{P as Vt}from"./ProviderIcon-CXJvW9mJ.js";import{R as Nr}from"./refresh-cw-BvjQfCG5.js";import{C as hn}from"./chevron-down-DoncrDIk.js";import{D as jr}from"./download-DjhGgU2Q.js";const Er=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ye=Je("check",Er);const Tr=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Pr=Je("external-link",Tr);const Or=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ge=Je("loader-circle",Or);const Ar=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xn=Je("plus",Ar);const Lr=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Yt=Je("search",Lr);const Vr=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Dr=Je("trash-2",Vr);function _r(e){const t=r.useRef(!0);t.current&&(t.current=!1,e())}function Gt({controlled:e,default:t,name:n,state:o="value"}){const{current:d}=r.useRef(e!==void 0),[a,i]=r.useState(t),l=d?e:a,y=r.useCallback(h=>{d||i(h)},[]);return[l,y]}function ft(e,t,n){return Math.floor(e/t)!==n}function rt(e,t){return t<0||t>=e.current.length}function It(e,t){return we(e,{disabledIndices:t})}function Xt(e,t){return we(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function we(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:o,amount:d=1}={}){let a=t;do a+=n?-d:d;while(a>=0&&a<=e.current.length-1&&st(e,a,o));return a}function Ur(e,{event:t,orientation:n,loopFocus:o,rtl:d,cols:a,disabledIndices:i,minIndex:l,maxIndex:y,prevIndex:h,stopEvent:f=!1}){let m=h;const x=[],N={};let b=!1;{let c=null,I=-1;e.current.forEach((p,k)=>{if(p==null)return;const T=p.closest('[role="row"]');T&&(b=!0),(T!==c||I===-1)&&(c=T,I+=1,x[I]=[]),x[I].push(k),N[k]=I})}const w=b&&x.length>0&&x.some(c=>c.length!==a);function E(c){if(!w||h===-1)return;const I=N[h];if(I==null)return;const p=x[I].indexOf(h);let k=c==="up"?I-1:I+1;o&&(k<0?k=x.length-1:k>=x.length&&(k=0));const T=new Set;for(;k>=0&&k<x.length&&!T.has(k);){T.add(k);const D=x[k];if(D.length===0){k=c==="up"?k-1:k+1;continue}const Q=Math.min(p,D.length-1);for(let L=Q;L>=0;L-=1){const oe=D[L];if(!st(e,oe,i))return oe}k=c==="up"?k-1:k+1,o&&(k<0?k=x.length-1:k>=x.length&&(k=0))}}if(t.key===Ut){const c=E("up");if(c!==void 0)f&&ve(t),m=c;else{if(f&&ve(t),h===-1)m=y;else if(m=we(e,{startingIndex:m,amount:a,decrement:!0,disabledIndices:i}),o&&(h-a<l||m<0)){const I=h%a,p=y%a,k=y-(p-I);p===I?m=y:m=p>I?k:k-a}rt(e,m)&&(m=h)}}if(t.key===at){const c=E("down");c!==void 0?(f&&ve(t),m=c):(f&&ve(t),h===-1?m=l:(m=we(e,{startingIndex:h,amount:a,disabledIndices:i}),o&&h+a>y&&(m=we(e,{startingIndex:h%a-a,amount:a,disabledIndices:i}))),rt(e,m)&&(m=h))}if(n==="both"){const c=qt(h/a);t.key===(d?He:Be)&&(f&&ve(t),h%a!==a-1?(m=we(e,{startingIndex:h,disabledIndices:i}),o&&ft(m,a,c)&&(m=we(e,{startingIndex:h-h%a-1,disabledIndices:i}))):o&&(m=we(e,{startingIndex:h-h%a-1,disabledIndices:i})),ft(m,a,c)&&(m=h)),t.key===(d?Be:He)&&(f&&ve(t),h%a!==0?(m=we(e,{startingIndex:h,decrement:!0,disabledIndices:i}),o&&ft(m,a,c)&&(m=we(e,{startingIndex:h+(a-h%a),decrement:!0,disabledIndices:i}))):o&&(m=we(e,{startingIndex:h+(a-h%a),decrement:!0,disabledIndices:i})),ft(m,a,c)&&(m=h));const I=qt(y/a)===c;rt(e,m)&&(o&&I?m=t.key===(d?Be:He)?y:we(e,{startingIndex:h-h%a-1,disabledIndices:i}):m=h)}return m}function Fr(e,t,n){const o=[];let d=0;return e.forEach(({width:a,height:i},l)=>{let y=!1;for(n&&(d=0);!y;){const h=[];for(let f=0;f<a;f+=1)for(let m=0;m<i;m+=1)h.push(d+f+m*t);d%t+a<=t&&h.every(f=>o[f]==null)?(h.forEach(f=>{o[f]=l}),y=!0):d+=1}}),[...o]}function Hr(e,t,n,o,d){if(e===-1)return-1;const a=n.indexOf(e),i=t[e];switch(d){case"tl":return a;case"tr":return i?a+i.width-1:a;case"bl":return i?a+(i.height-1)*o:a;case"br":return n.lastIndexOf(e);default:return-1}}function Br(e,t){return t.flatMap((n,o)=>e.includes(n)?[o]:[])}function st(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const o=e.current[t];return o?o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true":!1}const $r="Escape";function bt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function mt(e,t){return bt(t,e===Ut||e===at,e===He||e===Be)}function Mt(e,t,n){return bt(t,e===at,n?e===He:e===Be)||e==="Enter"||e===" "||e===""}function zr(e,t,n){return bt(t,n?e===He:e===Be,e===at)}function Wr(e,t,n,o){const d=n?e===Be:e===He,a=e===Ut;return t==="both"||t==="horizontal"&&o&&o>1?e===$r:bt(t,d,a)}function qr(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),d=n.useState("floatingElement"),a=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:l,activeIndex:y,onNavigate:h=()=>{},enabled:f=!0,selectedIndex:m=null,allowEscape:x=!1,loopFocus:N=!1,nested:b=!1,rtl:w=!1,virtual:E=!1,focusItemOnOpen:c="auto",focusItemOnHover:I=!0,openOnArrowKeyDown:p=!0,disabledIndices:k=void 0,orientation:T="vertical",parentOrientation:D,cols:Q=1,scrollItemIntoView:L=!0,itemSizes:oe,dense:pe=!1,id:_,resetOnPointerLeave:Y=!0,externalTree:G}=t,X=un(d),ne=Ue(X),q=Vn(),Z=Dn(G);J(()=>{i.current.orientation=T},[i,T]);const S=_n(a),B=r.useRef(c),R=r.useRef(m??-1),M=r.useRef(null),ue=r.useRef(!0),O=xe(g=>{h(R.current===-1?null:R.current,g)}),he=r.useRef(O),re=r.useRef(!!d),P=r.useRef(o),W=r.useRef(!1),ae=r.useRef(!1),ye=Ue(k),H=Ue(o),de=Ue(L),ee=Ue(m),fe=Ue(Y),u=xe(()=>{function g(le){E?Z?.events.emit("virtualfocus",le):Un(le,{sync:W.current,preventScroll:!0})}const U=l.current[R.current],C=ae.current;U&&g(U),(W.current?le=>le():requestAnimationFrame)(()=>{const le=l.current[R.current]||U;if(!le)return;U||g(le);const me=de.current;me&&j&&(C||!ue.current)&&le.scrollIntoView?.(typeof me=="boolean"?{block:"nearest",inline:"nearest"}:me)})});J(()=>{f&&(o&&d?(R.current=m??-1,B.current&&m!=null&&(ae.current=!0,O())):re.current&&(R.current=-1,he.current()))},[f,o,d,m,O]),J(()=>{if(f){if(!o){W.current=!1;return}if(d)if(y==null){if(W.current=!1,ee.current!=null)return;if(re.current&&(R.current=-1,u()),(!P.current||!re.current)&&B.current&&(M.current!=null||B.current===!0&&M.current==null)){let g=0;const U=()=>{l.current[0]==null?(g<2&&(g?requestAnimationFrame:queueMicrotask)(U),g+=1):(R.current=M.current==null||Mt(M.current,T,w)||b?It(l):Xt(l),M.current=null,O())};U()}}else rt(l,y)||(R.current=y,u(),ae.current=!1)}},[f,o,d,y,ee,b,l,T,w,O,u,ye]),J(()=>{if(!f||d||!Z||E||!re.current)return;const g=Z.nodesRef.current,U=g.find(le=>le.id===q)?.context?.elements.floating,C=Kt(Fn(d)),te=g.some(le=>le.context&&nt(le.context.elements.floating,C));U&&!te&&ue.current&&U.focus({preventScroll:!0})},[f,d,Z,q,E]),J(()=>{he.current=O,P.current=o,re.current=!!d}),J(()=>{o||(M.current=null,B.current=c)},[o,c]);const v=y!=null,j=r.useMemo(()=>{function g(C){if(!H.current)return;const te=l.current.indexOf(C.currentTarget);te!==-1&&R.current!==te&&(R.current=te,O(C))}return{onFocus(C){W.current=!0,g(C)},onClick:({currentTarget:C})=>C.focus({preventScroll:!0}),onMouseMove(C){W.current=!0,ae.current=!1,I&&g(C)},onPointerLeave(C){if(!H.current||!ue.current||C.pointerType==="touch")return;W.current=!0;const te=C.relatedTarget;!I||l.current.includes(te)||fe.current&&(R.current=-1,O(C),E||ne.current?.focus({preventScroll:!0}))}}},[H,ne,I,l,O,fe,E]),$=r.useCallback(()=>D??Z?.nodesRef.current.find(g=>g.id===q)?.context?.dataRef?.current.orientation,[q,Z,D]),K=xe(g=>{if(ue.current=!1,W.current=!0,g.which===229||!H.current&&g.currentTarget===ne.current)return;if(b&&Wr(g.key,T,w,Q)){mt(g.key,$())||ve(g),n.setOpen(!1,Ce(St,g.nativeEvent)),zt(a)&&(E?Z?.events.emit("virtualfocus",a):a.focus());return}const U=R.current,C=It(l,k),te=Xt(l,k);if(S||(g.key==="Home"&&(ve(g),R.current=C,O(g)),g.key==="End"&&(ve(g),R.current=te,O(g))),Q>1){const le=oe||Array.from({length:l.current.length},()=>({width:1,height:1})),me=Fr(le,Q,pe),be=me.findIndex(Re=>Re!=null&&!st(l,Re,k)),ke=me.reduce((Re,Me,_e)=>Me!=null&&!st(l,Me,k)?_e:Re,-1),De=me[Ur({current:me.map(Re=>Re!=null?l.current[Re]:null)},{event:g,orientation:T,loopFocus:N,rtl:w,cols:Q,disabledIndices:Br([...(typeof k!="function"?k:null)||l.current.map((Re,Me)=>st(l,Me,k)?Me:void 0),void 0],me),minIndex:be,maxIndex:ke,prevIndex:Hr(R.current>te?C:R.current,le,me,Q,g.key===at?"bl":g.key===(w?He:Be)?"tr":"tl"),stopEvent:!0})];if(De!=null&&(R.current=De,O(g)),T==="both")return}if(mt(g.key,T)){if(ve(g),o&&!E&&Kt(g.currentTarget.ownerDocument)===g.currentTarget){R.current=Mt(g.key,T,w)?C:te,O(g);return}Mt(g.key,T,w)?N?U>=te?x&&U!==l.current.length?R.current=-1:(W.current=!1,R.current=C):R.current=we(l,{startingIndex:U,disabledIndices:k}):R.current=Math.min(te,we(l,{startingIndex:U,disabledIndices:k})):N?U<=C?x&&U!==-1?R.current=l.current.length:(W.current=!1,R.current=te):R.current=we(l,{startingIndex:U,decrement:!0,disabledIndices:k}):R.current=Math.max(C,we(l,{startingIndex:U,decrement:!0,disabledIndices:k})),rt(l,R.current)&&(R.current=-1),O(g)}}),ie=r.useMemo(()=>E&&o&&v&&{"aria-activedescendant":`${_}-${y}`},[E,o,v,_,y]),ce=r.useMemo(()=>({"aria-orientation":T==="both"?void 0:T,...S?{}:ie,onKeyDown(g){if(g.key==="Tab"&&g.shiftKey&&o&&!E){const U=Hn(g.nativeEvent);if(U&&!nt(ne.current,U))return;ve(g),n.setOpen(!1,Ce(dn,g.nativeEvent)),zt(a)&&a.focus();return}K(g)},onPointerMove(){ue.current=!0}}),[ie,K,ne,T,S,n,o,E,a]),Ie=r.useMemo(()=>{function g(C){c==="auto"&&Bn(C.nativeEvent)&&(B.current=!E)}function U(C){B.current=c,c==="auto"&&$n(C.nativeEvent)&&(B.current=!0)}return{onKeyDown(C){const te=n.select("open");ue.current=!1;const le=C.key.startsWith("Arrow"),me=zr(C.key,$(),w),be=mt(C.key,T),ke=(b?me:be)||C.key==="Enter"||C.key.trim()==="";if(E&&te)return K(C);if(!(!te&&!p&&le)){if(ke){const De=mt(C.key,$());M.current=b&&De?null:C.key}if(b){me&&(ve(C),te?(R.current=It(l,ye.current),O(C)):n.setOpen(!0,Ce(St,C.nativeEvent,C.currentTarget)));return}be&&(ee.current!=null&&(R.current=ee.current),ve(C),!te&&p?n.setOpen(!0,Ce(St,C.nativeEvent,C.currentTarget)):K(C),te&&O(C))}},onFocus(C){n.select("open")&&!E&&(R.current=-1,O(C))},onPointerDown:U,onPointerEnter:U,onMouseDown:g,onClick:g}},[K,ye,c,l,b,O,n,p,T,$,w,ee,E]),Ee=r.useMemo(()=>({...ie,...Ie}),[ie,Ie]);return r.useMemo(()=>f?{reference:Ee,floating:ce,item:j,trigger:Ie}:{},[f,Ee,ce,Ie,j])}function Kr(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),d=n.context.dataRef,{listRef:a,activeIndex:i,onMatch:l,onTypingChange:y,enabled:h=!0,findMatch:f=null,resetMs:m=750,ignoreKeys:x=Pt,selectedIndex:N=null}=t,b=ze(),w=r.useRef(""),E=r.useRef(N??i??-1),c=r.useRef(null);J(()=>{o&&(b.clear(),c.current=null,w.current="")},[o,b]),J(()=>{o&&w.current===""&&(E.current=N??i??-1)},[o,N,i]);const I=xe(D=>{D?d.current.typing||(d.current.typing=D,y?.(D)):d.current.typing&&(d.current.typing=D,y?.(D))}),p=xe(D=>{function Q(Y,G,X){const ne=f?f(G,X):G.find(q=>q?.toLocaleLowerCase().indexOf(X.toLocaleLowerCase())===0);return ne?Y.indexOf(ne):-1}const L=a.current;if(w.current.length>0&&w.current[0]!==" "&&(Q(L,L,w.current)===-1?I(!1):D.key===" "&&ve(D)),L==null||x.includes(D.key)||D.key.length!==1||D.ctrlKey||D.metaKey||D.altKey)return;o&&D.key!==" "&&(ve(D),I(!0)),L.every(Y=>Y?Y[0]?.toLocaleLowerCase()!==Y[1]?.toLocaleLowerCase():!0)&&w.current===D.key&&(w.current="",E.current=c.current),w.current+=D.key,b.start(m,()=>{w.current="",E.current=c.current,I(!1)});const pe=E.current,_=Q(L,[...L.slice((pe||0)+1),...L.slice(0,(pe||0)+1)],w.current);_!==-1?(l?.(_),c.current=_):D.key!==" "&&(w.current="",I(!1))}),k=r.useMemo(()=>({onKeyDown:p}),[p]),T=r.useMemo(()=>({onKeyDown:p,onKeyUp(D){D.key===" "&&I(!1)}}),[p,I]);return r.useMemo(()=>h?{reference:k,floating:T}:{},[h,k,T])}const yn=r.createContext(null),bn=r.createContext(null);function $e(){const e=r.useContext(yn);if(e===null)throw new Error(ot(60));return e}function wn(){const e=r.useContext(bn);if(e===null)throw new Error(ot(61));return e}let Jt=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Yr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Gr={valid(e){return e===null?null:e?{[Jt.valid]:""}:{[Jt.invalid]:""}}},Xr=r.createContext({invalid:void 0,name:void 0,validityData:{state:Yr,errors:[],error:"",value:"",initialValue:null},setValidityData:Pe,disabled:void 0,touched:!1,setTouched:Pe,dirty:!1,setDirty:Pe,filled:!1,setFilled:Pe,focused:!1,setFocused:Pe,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=Ot)=>e,getInputValidationProps:(e=Ot)=>e,inputRef:{current:null},commit:async()=>{}}});function Bt(e=!0){const t=r.useContext(Xr);if(t.setValidityData===Pe&&!e)throw new Error(ot(28));return t}const Jr=r.createContext({controlId:void 0,setControlId:Pe,labelId:void 0,setLabelId:Pe,messageIds:[],setMessageIds:Pe,getDescriptionProps:e=>e});function kn(){return r.useContext(Jr)}function vn(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:d,setControlId:a}=kn(),i=fn(t);return J(()=>{if(!(!n&&!t||a===Pe)){if(n){const l=o?.current;On(l)&&l.closest("label")!=null?a(t??null):a(d??i)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,o,d,a,n,i]),d??i}const Qr=(e,t)=>Object.is(e,t);function Xe(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Nt(e,t,n){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Xe(o,t,n))}function Dt(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Xe(o,t,n))}function Zr(e,t,n){return e.filter(o=>!Xe(o,t,n))}function _t(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Rn(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function es(e){if(!Array.isArray(e))return e!=null&&!("null"in e);if(Rn(e)){for(const t of e)for(const n of t.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(const t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function ts(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return _t(e)}function Ke(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?_t(e.value):_t(e)}function Sn(e,t,n){function o(){return ts(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const d=Rn(t)?t.flatMap(a=>a.items):t;if(e==null||typeof e!="object"){const a=d.find(i=>i.value===e);return a&&a.label!=null?a.label:o()}if("value"in e){const a=d.find(i=>i&&i.value===e.value);if(a&&a.label!=null)return a.label}}return o()}function ns(e,t,n){return e.reduce((o,d,a)=>(a>0&&o.push(", "),o.push(s.jsx(r.Fragment,{children:Sn(d,t,n)},a)),o),[])}const V={id:se(e=>e.id),modal:se(e=>e.modal),multiple:se(e=>e.multiple),items:se(e=>e.items),itemToStringLabel:se(e=>e.itemToStringLabel),itemToStringValue:se(e=>e.itemToStringValue),isItemEqualToValue:se(e=>e.isItemEqualToValue),value:se(e=>e.value),hasSelectedValue:se(e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Ke(t,o)!==""}),hasNullItemLabel:se((e,t)=>t?es(e.items):!1),open:se(e=>e.open),mounted:se(e=>e.mounted),forceMount:se(e=>e.forceMount),transitionStatus:se(e=>e.transitionStatus),openMethod:se(e=>e.openMethod),activeIndex:se(e=>e.activeIndex),selectedIndex:se(e=>e.selectedIndex),isActive:se((e,t)=>e.activeIndex===t),isSelected:se((e,t,n)=>{const o=e.isItemEqualToValue,d=e.value;return e.multiple?Array.isArray(d)&&d.some(a=>Xe(a,n,o)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Xe(d,n,o)}),isSelectedByFocus:se((e,t)=>e.selectedIndex===t),popupProps:se(e=>e.popupProps),triggerProps:se(e=>e.triggerProps),triggerElement:se(e=>e.triggerElement),positionerElement:se(e=>e.positionerElement),listElement:se(e=>e.listElement),scrollUpArrowVisible:se(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:se(e=>e.scrollDownArrowVisible),hasScrollArrows:se(e=>e.hasScrollArrows)},rs=r.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Pe,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Cn(){return r.useContext(rs)}function ss(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function os(e){const{enabled:t=!0,value:n,id:o,name:d,controlRef:a,commit:i}=e,{formRef:l}=Cn(),{invalid:y,markedDirtyRef:h,validityData:f,setValidityData:m}=Bt(),x=xe(e.getValue);J(()=>{if(!t)return;let N=n;N===void 0&&(N=x()),f.initialValue===null&&N!==null&&m(b=>({...b,initialValue:N}))},[t,m,n,f.initialValue,x]),J(()=>{!t||!o||l.current.fields.set(o,{getValue:x,name:d,controlRef:a,validityData:ss(f,y),validate(N=!0){let b=n;b===void 0&&(b=x()),h.current=!0,N?on.flushSync(()=>i(b)):i(b)}})},[i,a,t,l,x,o,y,h,d,f,n]),J(()=>{const N=l.current.fields;return()=>{o&&N.delete(o)}},[l,o])}function as(e,t){const n=r.useRef(e),o=xe(t);J(()=>{n.current!==e&&o(n.current)},[e,o]),J(()=>{n.current=e},[e])}function is(e){const{id:t,value:n,defaultValue:o=null,onValueChange:d,open:a,defaultOpen:i=!1,onOpenChange:l,name:y,disabled:h=!1,readOnly:f=!1,required:m=!1,modal:x=!0,actionsRef:N,inputRef:b,onOpenChangeComplete:w,items:E,multiple:c=!1,itemToStringLabel:I,itemToStringValue:p,isItemEqualToValue:k=Qr,highlightItemOnHover:T=!0,children:D}=e,{clearErrors:Q}=Cn(),{setDirty:L,setTouched:oe,setFocused:pe,shouldValidateOnChange:_,validityData:Y,setFilled:G,name:X,disabled:ne,validation:q,validationMode:Z}=Bt(),S=vn({id:t}),B=ne||h,R=X??y,[M,ue]=Gt({controlled:n,default:c?o??Pt:o,name:"Select",state:"value"}),[O,he]=Gt({controlled:a,default:i,name:"Select",state:"open"}),re=r.useRef([]),P=r.useRef([]),W=r.useRef(null),ae=r.useRef(null),ye=r.useRef(0),H=r.useRef(null),de=r.useRef([]),ee=r.useRef(!1),fe=r.useRef(!1),u=r.useRef(null),v=r.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),j=r.useRef(!1),{mounted:$,setMounted:K,transitionStatus:ie}=mn(O),{openMethod:ce,triggerProps:Ie,reset:Ee}=zn(O),g=At(()=>new Wn({id:S,modal:x,multiple:c,itemToStringLabel:I,itemToStringValue:p,isItemEqualToValue:k,value:M,open:O,mounted:$,transitionStatus:ie,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,U=F(g,V.activeIndex),C=F(g,V.selectedIndex),te=F(g,V.triggerElement),le=F(g,V.positionerElement),me=r.useMemo(()=>c&&Array.isArray(M)&&M.length===0?"":Ke(M,p),[c,M,p]),be=r.useMemo(()=>c&&Array.isArray(M)?M.map(z=>Ke(z,p)):Ke(M,p),[c,M,p]),ke=Ue(g.state.triggerElement);os({id:S,commit:q.commit,value:M,controlRef:ke,name:R,getValue:()=>be});const De=r.useRef(M);J(()=>{M!==De.current&&g.set("forceMount",!0)},[g,M]),J(()=>{G(c?Array.isArray(M)&&M.length>0:M!=null)},[c,M,G]),J(function(){if(O)return;const ge=de.current;if(c){const je=Array.isArray(M)?M:[];if(je.length===0){g.set("selectedIndex",null);return}const Se=je[je.length-1],dt=Dt(ge,Se,k);g.set("selectedIndex",dt===-1?null:dt);return}const Ne=Dt(ge,M,k);g.set("selectedIndex",Ne===-1?null:Ne)},[c,O,M,de,k,g]),as(M,()=>{Q(R),L(M!==Y.initialValue),_()?q.commit(M):q.commit(M,!0)});const Re=xe((z,ge)=>{if(l?.(z,ge),!ge.isCanceled&&(he(z),!z&&(ge.reason===dn||ge.reason===qn)&&(oe(!0),pe(!1),Z==="onBlur"&&q.commit(M)),!z&&g.state.activeIndex!==null)){const Ne=re.current[g.state.activeIndex];queueMicrotask(()=>{Ne?.setAttribute("tabindex","-1")})}}),Me=xe(()=>{K(!1),g.set("activeIndex",null),Ee(),w?.(!1)});Ft({enabled:!N,open:O,ref:W,onComplete(){O||Me()}}),r.useImperativeHandle(N,()=>({unmount:Me}),[Me]);const _e=xe((z,ge)=>{d?.(z,ge),!ge.isCanceled&&ue(z)}),Oe=xe(()=>{const z=g.state.listElement||W.current;if(!z)return;const ge=z.scrollTop,Ne=z.scrollTop+z.clientHeight,je=ge>1,Se=Ne<z.scrollHeight-1;g.state.scrollUpArrowVisible!==je&&g.set("scrollUpArrowVisible",je),g.state.scrollDownArrowVisible!==Se&&g.set("scrollDownArrowVisible",Se)}),Ae=Kn({open:O,onOpenChange:Re,elements:{reference:te,floating:le}}),it=Yn(Ae,{enabled:!f&&!B,event:"mousedown"}),Ze=Gn(Ae,{bubbles:!1}),Le=qr(Ae,{enabled:!f&&!B,listRef:re,activeIndex:U,selectedIndex:C,disabledIndices:Pt,onNavigate(z){z===null&&!O||g.set("activeIndex",z)},focusItemOnHover:!1}),kt=Kr(Ae,{enabled:!f&&!B&&(O||!c),listRef:P,activeIndex:U,selectedIndex:C,onMatch(z){O?g.set("activeIndex",z):_e(de.current[z],Ce("none"))},onTypingChange(z){ee.current=z}}),{getReferenceProps:We,getFloatingProps:qe,getItemProps:lt}=Xn([it,Ze,Le,kt]),et=r.useMemo(()=>an(We(),Ie,S?{id:S}:Ot),[We,Ie,S]);_r(()=>{g.update({popupProps:qe(),triggerProps:et})}),J(()=>{g.update({id:S,modal:x,multiple:c,value:M,open:O,mounted:$,transitionStatus:ie,popupProps:qe(),triggerProps:et,items:E,itemToStringLabel:I,itemToStringValue:p,isItemEqualToValue:k,openMethod:ce})},[g,S,x,c,M,O,$,ie,qe,et,E,I,p,k,ce]);const ct=r.useMemo(()=>({store:g,name:R,required:m,disabled:B,readOnly:f,multiple:c,itemToStringLabel:I,itemToStringValue:p,highlightItemOnHover:T,setValue:_e,setOpen:Re,listRef:re,popupRef:W,scrollHandlerRef:ae,handleScrollArrowVisibility:Oe,scrollArrowsMountedCountRef:ye,getItemProps:lt,events:Ae.context.events,valueRef:H,valuesRef:de,labelsRef:P,typingRef:ee,selectionRef:v,selectedItemTextRef:u,validation:q,onOpenChangeComplete:w,keyboardActiveRef:fe,alignItemWithTriggerActiveRef:j,initialValueRef:De}),[g,R,m,B,f,c,I,p,T,_e,Re,lt,Ae.context.events,q,w,Oe]),ut=ln(b,q.inputRef),vt=c&&Array.isArray(M)&&M.length>0,Rt=r.useMemo(()=>!c||!Array.isArray(M)||!R?null:M.map(z=>{const ge=Ke(z,p);return s.jsx("input",{type:"hidden",name:R,value:ge},ge)}),[c,M,R,p]);return s.jsx(yn.Provider,{value:ct,children:s.jsxs(bn.Provider,{value:Ae,children:[D,s.jsx("input",{...q.getInputValidationProps({onFocus(){g.state.triggerElement?.focus({focusVisible:!0})},onChange(z){if(z.nativeEvent.defaultPrevented)return;const ge=z.target.value,Ne=Ce(Ht,z.nativeEvent);function je(){if(c)return;const Se=de.current.find(dt=>Ke(dt,p).toLowerCase()===ge.toLowerCase());Se!=null&&(L(Se!==Y.initialValue),_e(Se,Ne),_()&&q.commit(Se))}g.set("forceMount",!0),queueMicrotask(je)}}),name:c?void 0:R,value:me,disabled:B,required:m&&!vt,readOnly:f,ref:ut,style:R?Jn:Qn,tabIndex:-1,"aria-hidden":!0}),Rt]})})}function ls(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),o=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||o.content!=="none"))return t;const a=parseFloat(n.width)||0,i=parseFloat(n.height)||0,l=parseFloat(o.width)||0,y=parseFloat(o.height)||0,h=Math.max(t.width,a,l),f=Math.max(t.height,i,y),m=h-t.width,x=f-t.height;return{left:t.left-m/2,right:t.right+m/2,top:t.top-x/2,bottom:t.bottom+x/2}}const gt=2,cs=400,Qt=200,us={...Zn,...Gr,value:()=>null},ds=r.forwardRef(function(t,n){const{render:o,className:d,id:a,disabled:i=!1,nativeButton:l=!0,...y}=t,{setTouched:h,setFocused:f,validationMode:m,state:x,disabled:N}=Bt(),{labelId:b}=kn(),{store:w,setOpen:E,selectionRef:c,validation:I,readOnly:p,required:k,alignItemWithTriggerActiveRef:T,disabled:D,keyboardActiveRef:Q}=$e(),L=N||D||i,oe=F(w,V.open),pe=F(w,V.value),_=F(w,V.triggerProps),Y=F(w,V.positionerElement),G=F(w,V.listElement),X=F(w,V.id),ne=F(w,V.hasSelectedValue),q=!ne&&oe,Z=F(w,V.hasNullItemLabel,q),S=a??X;vn({id:S});const B=Ue(Y),R=r.useRef(null),{getButtonProps:M,buttonRef:ue}=cn({disabled:L,native:l}),O=xe(ee=>{w.set("triggerElement",ee)}),he=ln(n,R,ue,O),re=ze(),P=ze(),W=ze(),ae=ze();r.useEffect(()=>{if(oe)return!(ne||Z)?W.start(cs,()=>{c.current.allowUnselectedMouseUp=!0,c.current.allowSelectedMouseUp=!0}):ae.start(Qt,()=>{c.current.allowUnselectedMouseUp=!0,W.start(Qt,()=>{c.current.allowSelectedMouseUp=!0})}),()=>{W.clear(),ae.clear()};c.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},P.clear()},[oe,ne,Z,c,P,W,ae]);const ye=r.useMemo(()=>G?.id??un(Y)?.id,[G,Y]),H=an(_,{id:S,role:"combobox","aria-expanded":oe?"true":"false","aria-haspopup":"listbox","aria-controls":oe?ye:void 0,"aria-labelledby":b,"aria-readonly":p||void 0,"aria-required":k||void 0,tabIndex:L?-1:0,ref:he,onFocus(ee){f(!0),oe&&T.current&&E(!1,Ce(Ht,ee.nativeEvent)),re.start(0,()=>{w.set("forceMount",!0)})},onBlur(ee){nt(Y,ee.relatedTarget)||(h(!0),f(!1),m==="onBlur"&&I.commit(pe))},onPointerMove(){Q.current=!1},onKeyDown(){Q.current=!0},onMouseDown(ee){if(oe)return;const fe=Lt(ee.currentTarget);function u(v){if(!R.current)return;const j=v.target;if(nt(R.current,j)||nt(B.current,j)||j===R.current)return;const $=ls(R.current);v.clientX>=$.left-gt&&v.clientX<=$.right+gt&&v.clientY>=$.top-gt&&v.clientY<=$.bottom+gt||E(!1,Ce(er,v))}P.start(0,()=>{fe.addEventListener("mouseup",u,{once:!0})})}},I.getValidationProps,y,M);H.role="combobox";const de=r.useMemo(()=>({...x,open:oe,disabled:L,value:pe,readOnly:p,placeholder:!ne}),[x,oe,L,pe,p,ne]);return Fe("button",t,{ref:[n,R],state:de,stateAttributesMapping:us,props:H})}),fs={value:()=>null},ms=r.forwardRef(function(t,n){const{className:o,render:d,children:a,placeholder:i,...l}=t,{store:y,valueRef:h}=$e(),f=F(y,V.value),m=F(y,V.items),x=F(y,V.itemToStringLabel),N=F(y,V.hasSelectedValue),b=!N&&i!=null&&a==null,w=F(y,V.hasNullItemLabel,b),E=r.useMemo(()=>({value:f,placeholder:!N}),[f,N]);let c=null;return typeof a=="function"?c=a(f):a!=null?c=a:!N&&i!=null&&!w?c=i:Array.isArray(f)?c=ns(f,m,x):c=Sn(f,m,x),Fe("span",t,{state:E,ref:[n,h],props:[{children:c},l],stateAttributesMapping:fs})}),gs=r.forwardRef(function(t,n){const{className:o,render:d,...a}=t,{store:i}=$e(),l=F(i,V.open),y=r.useMemo(()=>({open:l}),[l]);return Fe("span",t,{state:y,ref:n,props:[{"aria-hidden":!0,children:"▼"},a],stateAttributesMapping:tr})}),ps=r.createContext(void 0),hs=r.forwardRef(function(t,n){const{store:o}=$e(),d=F(o,V.mounted),a=F(o,V.forceMount);return d||a?s.jsx(ps.Provider,{value:!0,children:s.jsx(nr,{ref:n,...t})}):null}),In=r.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function xs(){return r.useContext(In)}function ys(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:d}=e,a=xe(d),i=r.useRef(0),l=At(ws).current,y=At(bs).current,[h,f]=r.useState(0),m=r.useRef(h),x=xe((c,I)=>{y.set(c,I??null),m.current+=1,f(m.current)}),N=xe(c=>{y.delete(c),m.current+=1,f(m.current)}),b=r.useMemo(()=>{const c=new Map;return Array.from(y.keys()).filter(p=>p.isConnected).sort(ks).forEach((p,k)=>{const T=y.get(p)??{};c.set(p,{...T,index:k})}),c},[y,h]);J(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const c=new MutationObserver(I=>{const p=new Set,k=T=>p.has(T)?p.delete(T):p.add(T);I.forEach(T=>{T.removedNodes.forEach(k),T.addedNodes.forEach(k)}),p.size===0&&(m.current+=1,f(m.current))});return b.forEach((I,p)=>{p.parentElement&&c.observe(p.parentElement,{childList:!0})}),()=>{c.disconnect()}},[b]),J(()=>{m.current===h&&(n.current.length!==b.size&&(n.current.length=b.size),o&&o.current.length!==b.size&&(o.current.length=b.size),i.current=b.size),a(b)},[a,b,n,o,h]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{o&&(o.current=[])},[o]);const w=xe(c=>(l.add(c),()=>{l.delete(c)}));J(()=>{l.forEach(c=>c(b))},[l,b]);const E=r.useMemo(()=>({register:x,unregister:N,subscribeMapChange:w,elementsRef:n,labelsRef:o,nextIndexRef:i}),[x,N,w,n,o,i]);return s.jsx(In.Provider,{value:E,children:t})}function bs(){return new Map}function ws(){return new Set}function ks(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Mn=r.createContext(void 0);function vs(){const e=r.useContext(Mn);if(!e)throw new Error(ot(59));return e}function yt(e,t){e&&Object.assign(e.style,t)}const Rs={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Ss={position:"fixed"},Cs=r.forwardRef(function(t,n){const{anchor:o,positionMethod:d="absolute",className:a,render:i,side:l="bottom",align:y="center",sideOffset:h=0,alignOffset:f=0,collisionBoundary:m="clipping-ancestors",collisionPadding:x,arrowPadding:N=5,sticky:b=!1,disableAnchorTracking:w,alignItemWithTrigger:E=!0,collisionAvoidance:c=rr,...I}=t,{store:p,listRef:k,labelsRef:T,alignItemWithTriggerActiveRef:D,selectedItemTextRef:Q,valuesRef:L,initialValueRef:oe,popupRef:pe,setValue:_}=$e(),Y=wn(),G=F(p,V.open),X=F(p,V.mounted),ne=F(p,V.modal),q=F(p,V.value),Z=F(p,V.openMethod),S=F(p,V.positionerElement),B=F(p,V.triggerElement),R=F(p,V.isItemEqualToValue),M=r.useRef(null),ue=r.useRef(null),[O,he]=r.useState(E),re=X&&O&&Z!=="touch";!X&&O!==E&&he(E),J(()=>{X||(V.scrollUpArrowVisible(p.state)&&p.set("scrollUpArrowVisible",!1),V.scrollDownArrowVisible(p.state)&&p.set("scrollDownArrowVisible",!1))},[p,X]),r.useImperativeHandle(D,()=>re),sr((re||ne)&&G&&Z!=="touch",B);const P=or({anchor:o,floatingRootContext:Y,positionMethod:d,mounted:X,side:l,sideOffset:h,align:y,alignOffset:f,arrowPadding:N,collisionBoundary:m,collisionPadding:x,sticky:b,disableAnchorTracking:w??re,collisionAvoidance:c,keepMounted:!0}),W=re?"none":P.side,ae=re?Ss:P.positionerStyles,ye=r.useMemo(()=>{const j={};return G||(j.pointerEvents="none"),{role:"presentation",hidden:!X,style:{...ae,...j}}},[G,X,ae]),H=r.useMemo(()=>({open:G,side:W,align:P.align,anchorHidden:P.anchorHidden}),[G,W,P.align,P.anchorHidden]),de=xe(j=>{p.set("positionerElement",j)}),ee=Fe("div",t,{ref:[n,de],state:H,stateAttributesMapping:gn,props:[ye,I]}),fe=r.useRef(0),u=xe(j=>{if(j.size===0&&fe.current===0||L.current.length===0)return;const $=fe.current;if(fe.current=j.size,j.size===$)return;const K=Ce(Ht);if($!==0&&!p.state.multiple&&q!==null&&Dt(L.current,q,R)===-1){const ce=oe.current,Ee=ce!=null&&Nt(L.current,ce,R)?ce:null;_(Ee,K),Ee===null&&(p.set("selectedIndex",null),Q.current=null)}if($!==0&&p.state.multiple&&Array.isArray(q)){const ie=q.filter(ce=>Nt(L.current,ce,R));(ie.length!==q.length||ie.some(ce=>!Nt(q,ce,R)))&&(_(ie,K),ie.length===0&&(p.set("selectedIndex",null),Q.current=null))}if(G&&re){p.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ie={height:""};yt(S,ie),yt(pe.current,ie)}}),v=r.useMemo(()=>({...P,side:W,alignItemWithTriggerActive:re,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:M,scrollDownArrowRef:ue}),[P,W,re,he]);return s.jsx(ys,{elementsRef:k,labelsRef:T,onMapChange:u,children:s.jsxs(Mn.Provider,{value:v,children:[X&&ne&&s.jsx(ar,{inert:ir(!G),cutout:B}),ee]})})});function Nn(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const pt="base-ui-disable-scrollbar",Zt={className:pt,getElement(e){return s.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}};function Is(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Ms=r.createContext(void 0),Ns={disableStyleElements:!1};function js(){return r.useContext(Ms)??Ns}const Es={...gn,...pn},Ts=r.forwardRef(function(t,n){const{render:o,className:d,...a}=t,{store:i,popupRef:l,onOpenChangeComplete:y,setOpen:h,valueRef:f,selectedItemTextRef:m,keyboardActiveRef:x,multiple:N,handleScrollArrowVisibility:b,scrollHandlerRef:w,highlightItemOnHover:E}=$e(),{side:c,align:I,alignItemWithTriggerActive:p,setControlledAlignItemWithTrigger:k,scrollDownArrowRef:T,scrollUpArrowRef:D}=vs(),Q=lr()!=null,L=wn(),{nonce:oe,disableStyleElements:pe}=js(),_=ze(),Y=F(i,V.id),G=F(i,V.open),X=F(i,V.mounted),ne=F(i,V.popupProps),q=F(i,V.transitionStatus),Z=F(i,V.triggerElement),S=F(i,V.positionerElement),B=F(i,V.listElement),R=r.useRef(0),M=r.useRef(!1),ue=r.useRef(0),O=r.useRef(!1),he=r.useRef({}),re=cr(),P=xe(H=>{if(!S||!l.current||!O.current)return;if(M.current||!p){b();return}const de=S.style.top==="0px",ee=S.style.bottom==="0px",fe=S.getBoundingClientRect().height,u=Lt(S),v=getComputedStyle(S),j=parseFloat(v.marginTop),$=parseFloat(v.marginBottom),K=en(getComputedStyle(l.current)),ie=u.documentElement.clientHeight-j-$,ce=H.scrollTop,Ie=H.scrollHeight,Ee=H.clientHeight,g=Ie-Ee;let U=0,C=null,te=!1;if(de){const le=g-ce,me=fe+le,be=Math.min(me,ie);U=be,be!==ie?C=g:te=!0}else if(ee){const le=ce-0,me=fe+le,be=Math.min(me,ie),ke=me-ie;U=be,be!==ie?C=0:(te=!0,ce<g&&(C=ce-(le-ke)))}U!==0&&(S.style.height=`${U}px`),C!=null&&(H.scrollTop=C),(te||U>=K)&&(M.current=!0),b()});r.useImperativeHandle(w,()=>P,[P]),Ft({open:G,ref:l,onComplete(){G&&y?.(!0)}});const W=r.useMemo(()=>({open:G,transitionStatus:q,side:c,align:I}),[G,q,c,I]);J(()=>{!S||!l.current||Object.keys(he.current).length||(he.current={top:S.style.top||"0",left:S.style.left||"0",right:S.style.right,height:S.style.height,bottom:S.style.bottom,minHeight:S.style.minHeight,maxHeight:S.style.maxHeight,marginTop:S.style.marginTop,marginBottom:S.style.marginBottom})},[l,S]),J(()=>{G||p||(O.current=!1,M.current=!1,R.current=0,ue.current=0,yt(S,he.current))},[G,p,S,l]),J(()=>{const H=l.current;if(!(!G||!Z||!S||!H||i.state.transitionStatus==="ending")){if(!p){O.current=!0,re.request(b),H.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const de=Os(H);H.style.removeProperty("--transform-origin");try{const ee=getComputedStyle(S),fe=getComputedStyle(H),u=Lt(Z),v=Wt(S),j=Z.getBoundingClientRect(),$=S.getBoundingClientRect(),K=j.left,ie=j.height,ce=B||H,Ie=ce.scrollHeight,Ee=parseFloat(fe.borderBottomWidth),g=parseFloat(ee.marginTop)||10,U=parseFloat(ee.marginBottom)||10,C=parseFloat(ee.minHeight)||100,te=en(fe),le=5,me=5,be=20,ke=u.documentElement.clientHeight-g-U,De=u.documentElement.clientWidth,Re=ke-j.bottom+ie,Me=m.current,_e=f.current;let Oe,Ae=0,it=0;if(Me&&_e){const z=_e.getBoundingClientRect();Oe=Me.getBoundingClientRect();const ge=z.left-K,Ne=Oe.left-$.left,je=z.top-j.top+z.height/2,Se=Oe.top-$.top+Oe.height/2;Ae=ge-Ne,it=Se-je}const Ze=Re+it+U+Ee;let Le=Math.min(ke,Ze);const kt=ke-g-U,We=Ze-Le,qe=Math.max(le,K+Ae),lt=De-me,et=Math.max(0,qe+$.width-lt);S.style.left=`${qe-et}px`,S.style.height=`${Le}px`,S.style.maxHeight="auto",S.style.marginTop=`${g}px`,S.style.marginBottom=`${U}px`,H.style.height="100%";const ct=ce.scrollHeight-ce.clientHeight,ut=We>=ct;ut&&(Le=Math.min(ke,$.height)-(We-ct));const vt=j.top<be||j.bottom>ke-be||Le<Math.min(Ie,C),Rt=(v.visualViewport?.scale??1)!==1&&ur;if(vt||Rt){O.current=!0,yt(S,he.current),on.flushSync(()=>k(!1));return}if(ut){const z=Math.max(0,ke-Ze);S.style.top=$.height>=kt?"0":`${z}px`,S.style.height=`${Le}px`,ce.scrollTop=ce.scrollHeight-ce.clientHeight,R.current=Math.max(C,Le)}else S.style.bottom="0",R.current=Math.max(C,Le),ce.scrollTop=We;if(Oe){const z=$.top,ge=$.height,Ne=Oe.top+Oe.height/2,je=ge>0?(Ne-z)/ge*100:50,Se=Is(je,0,100);H.style.setProperty("--transform-origin",`50% ${Se}%`)}(R.current===ke||Le>=te)&&(M.current=!0),b(),setTimeout(()=>{O.current=!0})}finally{de()}})}},[i,G,S,Z,f,m,l,b,p,k,re,T,D,B]),r.useEffect(()=>{if(!p||!S||!G)return;const H=Wt(S);function de(ee){h(!1,Ce(fr,ee))}return H.addEventListener("resize",de),()=>{H.removeEventListener("resize",de)}},[h,p,S,G]);const ae={...B?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":N||void 0,id:`${Y}-list`},onKeyDown(H){x.current=!0,Q&&gr.has(H.key)&&H.stopPropagation()},onMouseMove(){x.current=!1},onPointerLeave(H){if(!E||Nn(H)||H.pointerType==="touch")return;const de=H.currentTarget;_.start(0,()=>{i.set("activeIndex",null),de.focus({preventScroll:!0})})},onScroll(H){B||w.current?.(H.currentTarget)},...p&&{style:B?{height:"100%"}:Rs}},ye=Fe("div",t,{ref:[n,l],state:W,stateAttributesMapping:Es,props:[ne,ae,mr(q),{className:!B&&p?Zt.className:void 0},a]});return s.jsxs(r.Fragment,{children:[!pe&&Zt.getElement(oe),s.jsx(dr,{context:L,modal:!1,disabled:!X,restoreFocus:!0,children:ye})]})});function en(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const tn={transform:"none",scale:"1",translate:"0 0"};function Ps(e,t,n){n?e.setProperty(t,n):e.removeProperty(t)}function Os(e){const{style:t}=e,n={},o=Object.keys(tn);for(const d of o)n[d]=t.getPropertyValue(d),t.setProperty(d,tn[d]);return()=>{for(const d of o)Ps(t,d,n[d])}}let jn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function As(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:d,index:a}=e,{register:i,unregister:l,subscribeMapChange:y,elementsRef:h,labelsRef:f,nextIndexRef:m}=xs(),x=r.useRef(-1),[N,b]=r.useState(a??(d===jn.GuessFromOrder?()=>{if(x.current===-1){const c=m.current;m.current+=1,x.current=c}return x.current}:-1)),w=r.useRef(null),E=r.useCallback(c=>{if(w.current=c,N!==-1&&c!==null&&(h.current[N]=c,f)){const I=t!==void 0;f.current[N]=I?t:o?.current?.textContent??c.textContent}},[N,h,f,t,o]);return J(()=>{if(a!=null)return;const c=w.current;if(c)return i(c,n),()=>{l(c)}},[a,i,l,n]),J(()=>{if(a==null)return y(c=>{const I=w.current?c.get(w.current)?.index:null;I!=null&&b(I)})},[a,y,b]),r.useMemo(()=>({ref:E,index:N}),[N,E])}const En=r.createContext(void 0);function $t(){const e=r.useContext(En);if(!e)throw new Error(ot(57));return e}const jt=r.memo(r.forwardRef(function(t,n){const{render:o,className:d,value:a=null,label:i,disabled:l=!1,nativeButton:y=!1,...h}=t,f=r.useRef(null),m=As({label:i,textRef:f,indexGuessBehavior:jn.GuessFromOrder}),{store:x,getItemProps:N,setOpen:b,setValue:w,selectionRef:E,typingRef:c,valuesRef:I,keyboardActiveRef:p,multiple:k,highlightItemOnHover:T}=$e(),D=ze(),Q=F(x,V.isActive,m.index),L=F(x,V.isSelected,m.index,a),oe=F(x,V.isSelectedByFocus,m.index),pe=F(x,V.isItemEqualToValue),_=m.index,Y=_!==-1,G=r.useRef(null),X=Ue(_);J(()=>{if(!Y)return;const P=I.current;return P[_]=a,()=>{delete P[_]}},[Y,_,a,I]),J(()=>{if(!Y)return;const P=x.state.value;let W=P;k&&Array.isArray(P)&&P.length>0&&(W=P[P.length-1]),W!==void 0&&Xe(W,a,pe)&&x.set("selectedIndex",_)},[Y,_,k,pe,x,a]);const ne=r.useMemo(()=>({disabled:l,selected:L,highlighted:Q}),[l,L,Q]),q=N({active:Q,selected:L});q.onFocus=void 0,q.id=void 0;const Z=r.useRef(null),S=r.useRef("mouse"),B=r.useRef(!1),{getButtonProps:R,buttonRef:M}=cn({disabled:l,focusableWhenDisabled:!0,native:y});function ue(P){const W=x.state.value;if(k){const ae=Array.isArray(W)?W:[],ye=L?Zr(ae,a,pe):[...ae,a];w(ye,Ce(Ct,P))}else w(a,Ce(Ct,P)),b(!1,Ce(Ct,P))}const O={role:"option","aria-selected":L,tabIndex:Q?0:-1,onFocus(){x.set("activeIndex",_)},onMouseEnter(){!p.current&&x.state.selectedIndex===null&&x.set("activeIndex",_)},onMouseMove(){T&&x.set("activeIndex",_)},onMouseLeave(P){!T||p.current||Nn(P)||D.start(0,()=>{x.state.activeIndex===_&&x.set("activeIndex",null)})},onTouchStart(){E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(P){Z.current=P.key,x.set("activeIndex",_)},onClick(P){B.current=!1,!(P.type==="keydown"&&Z.current===null)&&(l||Z.current===" "&&c.current||S.current!=="touch"&&!Q||(Z.current=null,ue(P.nativeEvent)))},onPointerEnter(P){S.current=P.pointerType},onPointerDown(P){S.current=P.pointerType,B.current=!0},onMouseUp(P){if(l)return;if(B.current){B.current=!1;return}const W=!E.current.allowSelectedMouseUp&&L,ae=!E.current.allowUnselectedMouseUp&&!L;W||ae||S.current!=="touch"&&!Q||ue(P.nativeEvent)}},he=Fe("div",t,{ref:[M,n,m.ref,G],state:ne,props:[q,O,h,R]}),re=r.useMemo(()=>({selected:L,indexRef:X,textRef:f,selectedByFocus:oe,hasRegistered:Y}),[L,X,f,oe,Y]);return s.jsx(En.Provider,{value:re,children:he})})),Et=r.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:d}=$t();return o||d?s.jsx(Ls,{...t,ref:n}):null}),Ls=r.memo(r.forwardRef((e,t)=>{const{render:n,className:o,keepMounted:d,...a}=e,{selected:i}=$t(),l=r.useRef(null),{transitionStatus:y,setMounted:h}=mn(i),f=r.useMemo(()=>({selected:i,transitionStatus:y}),[i,y]),m=Fe("span",e,{ref:[t,l],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:pn});return Ft({open:i,ref:l,onComplete(){i||h(!1)}}),m})),Tt=r.memo(r.forwardRef(function(t,n){const{indexRef:o,textRef:d,selectedByFocus:a,hasRegistered:i}=$t(),{selectedItemTextRef:l}=$e(),{className:y,render:h,...f}=t,m=r.useCallback(N=>{if(!N||!i)return;const b=l.current===null||!l.current.isConnected;(a||b&&o.current===0)&&(l.current=N)},[l,o,a,i]);return Fe("div",t,{ref:[m,n,d],props:f})})),Vs=r.forwardRef(function(t,n){const{render:o,className:d,id:a,...i}=t,{store:l}=pr(),y=fn(a);return l.useSyncedValueWithCleanup("descriptionElementId",y),Fe("p",t,{ref:n,props:[{id:y},i]})});function Ds({open:e,title:t,description:n,confirmLabel:o,cancelLabel:d,destructive:a=!1,busy:i=!1,onConfirm:l,onCancel:y}){return s.jsx(hr,{open:e,onOpenChange:h=>{!h&&!i&&y?.()},children:s.jsxs(xr,{children:[s.jsx(yr,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),s.jsx(br,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:s.jsxs(wr,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[s.jsx(kr,{className:"text-base font-semibold text-oai-black dark:text-white",children:t}),n?s.jsx(Vs,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:n}):null,s.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[s.jsx(Ve,{type:"button",variant:"secondary",size:"sm",disabled:i,onClick:()=>y?.(),children:d}),s.jsx(Ve,{type:"button",size:"sm",disabled:i,onClick:()=>l?.(),className:xt(a&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:o})]})]})})]})})}function Tn({value:e,onChange:t,placeholder:n,disabled:o=!1,type:d="text",label:a,error:i,className:l="",...y}){const x=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${o?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${i?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${l}`;return s.jsxs("div",{className:"w-full",children:[a&&s.jsx("label",{className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:a}),s.jsx("input",{type:d,value:e,onChange:t,placeholder:n,disabled:o,className:x,...y}),i&&s.jsx("p",{className:"mt-1.5 text-sm text-oai-error",children:i})]})}const Pn="tokentracker-skills";async function wt(e){const t=new URL(`/functions/${Pn}`,window.location.origin);if(e)for(const[d,a]of Object.entries(e))a!=null&&a!==""&&t.searchParams.set(d,String(a));const n=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(o?.error||`Request failed with HTTP ${n.status}`);return o}async function Qe(e){const t=await An(),n=await fetch(`/functions/${Pn}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...t},cache:"no-store",body:JSON.stringify(e)}),o=await n.json().catch(()=>null);if(!n.ok||o?.ok===!1)throw new Error(o?.error||`Request failed with HTTP ${n.status}`);return o}function _s(){return wt({mode:"installed"})}function Us(e={}){return wt({mode:"discover",...e.force?{force:1}:{}})}function Fs(e,t=0,n=20){return wt({mode:"search",q:e,offset:t,limit:n})}function Hs(){return wt({mode:"repos"})}function Bs(e,t){return Qe({action:"install",skill:e,targets:t})}function $s(e){return Qe({action:"uninstall",id:e})}function zs(e){return Qe({action:"restore",id:e})}function Ws(e,t){return Qe({action:"delete_local",directory:e,targets:t||[]})}function qs(e){return Qe({action:"add_repo",repo:e})}function Ks(e,t){return Qe({action:"remove_repo",owner:e,name:t})}const nn=["claude","codex"],tt="all",Te="skillssh";function ht(e){return`${e.repoOwner||"local"}/${e.repoName||"local"}:${e.directory}`}function rn(e){return`install:${ht(e)}`}function sn(e){return`remove:${e.id||e.directory}`}const Ys={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Gs=Ln.memo(function({skill:t,installed:n,installing:o,allTargets:d,defaultTargets:a,onInstall:i}){const[l,y]=r.useState(()=>(a||[]).filter(b=>d.some(w=>w.id===b))),h=b=>{y(w=>w.includes(b)?w.filter(E=>E!==b):[...w,b])},f=t.repoOwner&&t.repoName?`${t.repoOwner}/${t.repoName}`:null,m=t.installs!=null?A("skills.card.installs",{count:Number(t.installs||0).toLocaleString()}):null,x=[f,m].filter(Boolean).join(" · "),N=l.length?l.map(b=>d.find(w=>w.id===b)?.label||b).join(", "):A("skills.action.choose_targets");return s.jsxs(Mr,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[t.readmeUrl?s.jsxs("a",{href:t.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:t.readmeUrl,children:[s.jsx("span",{className:"truncate",children:t.name||t.directory}),s.jsx(Pr,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):s.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:t.name||t.directory}),x?s.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:x}):null]}),n?s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-emerald-50 px-2 py-1 text-xs font-medium text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300",children:[s.jsx(Ye,{className:"h-3 w-3","aria-hidden":!0}),A("skills.card.installed")]}):null]}),t.description?s.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t.description}):null,s.jsx("div",{className:"mt-auto pt-5",children:n?s.jsxs(Ve,{type:"button",size:"sm",disabled:!0,className:"w-full",children:[s.jsx(Ye,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),A("skills.card.installed")]}):s.jsxs("div",{className:"flex",children:[s.jsxs(Ve,{type:"button",size:"sm",onClick:()=>i(t,l),disabled:o||l.length===0,className:"flex-1 !rounded-r-none",title:N,children:[o?s.jsx(Ge,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(jr,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),l.length>1?A("skills.action.install_to",{count:l.length}):A("skills.action.install")]}),s.jsxs(vr,{children:[s.jsx(Rr,{disabled:o,"aria-label":A("skills.action.choose_targets"),title:N,className:"inline-flex h-8 items-center justify-center rounded-r-md border-l border-white/20 bg-oai-black px-2 text-white hover:bg-oai-gray-800 disabled:cursor-not-allowed disabled:opacity-60 dark:border-oai-black/20 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:s.jsx(hn,{className:"h-3.5 w-3.5","aria-hidden":!0})}),s.jsx(Sr,{children:s.jsx(Cr,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:s.jsxs(Ir,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[s.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:A("skills.target.menu_label")}),d.map(b=>{const w=l.includes(b.id);return s.jsxs("button",{type:"button",onClick:()=>h(b.id),className:xt("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm",w?"bg-oai-gray-100 dark:bg-oai-gray-800":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900"),children:[s.jsx(Vt,{provider:b.id,size:16,className:w?"":"grayscale opacity-40"}),s.jsx("span",{className:"flex-1 text-left",children:b.label}),w?s.jsx(Ye,{className:"h-3.5 w-3.5 text-emerald-500","aria-hidden":!0}):null]},b.id)})]})})})]})]})})]})});function Xs({repos:e,repoInput:t,onRepoInput:n,busyKey:o,onAdd:d,onRemove:a}){return s.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[s.jsx(Tn,{value:t,onChange:i=>n(i.target.value),placeholder:A("skills.repo.placeholder"),className:"min-w-0 flex-1"}),s.jsxs(Ve,{type:"button",variant:"secondary",size:"md",onClick:d,disabled:o==="repo:add",className:"shrink-0 whitespace-nowrap",children:[o==="repo:add"?s.jsx(Ge,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):s.jsx(xn,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),A("skills.repo.add")]})]}),e.length?s.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(i=>{const l=o===`repo:${i.owner}/${i.name}`;return s.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[i.owner,"/",i.name]}),s.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i.branch})]}),s.jsxs(Ve,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:()=>a(i),className:"shrink-0",children:[l?s.jsx(Ge,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(Dr,{className:"h-3.5 w-3.5","aria-hidden":!0}),s.jsx("span",{className:"sr-only",children:A("skills.repo.remove")})]})]},`${i.owner}/${i.name}`)})}):null]})}function Js(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function ao(){const[e,t]=r.useState(Js),[n,o]=r.useState({skills:[],targets:[]}),[d,a]=r.useState([]),[i,l]=r.useState([]),[y,h]=r.useState([]),[f,m]=r.useState(tt),[x,N]=r.useState(""),[b,w]=r.useState(""),[E,c]=r.useState(""),[I,p]=r.useState(!1),[k,T]=r.useState(""),[D,Q]=r.useState(!0),[L,oe]=r.useState(!1),[pe,_]=r.useState(""),[Y,G]=r.useState(null),[X,ne]=r.useState(null),q=r.useMemo(()=>{const u=new Set;for(const v of n.skills||[])u.add(ht(v).toLowerCase()),v.repoOwner&&v.repoName&&u.add(`${v.repoOwner}/${v.repoName}:${v.sourceDirectory||v.directory}`.toLowerCase());return u},[n.skills]),Z=r.useCallback(async()=>{const u=await _s();o({skills:u.skills||[],targets:u.targets||[]})},[]),S=r.useCallback(async()=>{const u=await Hs();h(u.repos||[])},[]),B=r.useCallback(async({force:u=!1}={})=>{oe(!0);try{const v=await Us({force:u});a(v.skills||[])}finally{oe(!1)}},[]),R=r.useCallback(async()=>{Q(!0),_("");try{await Promise.all([Z(),S()])}catch(u){_(u?.message||A("skills.error.generic"))}finally{Q(!1)}},[Z,S]),M=r.useCallback(async()=>{await R(),e==="browse"&&f!==Te&&B({force:!0}).catch(u=>_(u?.message||A("skills.error.generic")))},[B,R,f,e]);r.useEffect(()=>{R()},[R]),r.useEffect(()=>{e==="browse"&&f!==Te&&d.length===0&&B().catch(u=>_(u?.message||A("skills.error.generic")))},[d.length,B,f,e]),r.useEffect(()=>{if(!X)return;const u=setTimeout(()=>ne(v=>v?.key===X.key?null:v),X.ttlMs||5e3);return()=>clearTimeout(u)},[X]),r.useEffect(()=>{const u=setTimeout(()=>w(x),200);return()=>clearTimeout(u)},[x]),r.useEffect(()=>{if(typeof window>"u")return;const u=new URLSearchParams(window.location.search),v=u.get("tab");if(e==="my"){if(!v)return;u.delete("tab")}else{if(v===e)return;u.set("tab",e)}const j=u.toString(),$=`${window.location.pathname}${j?`?${j}`:""}${window.location.hash}`;window.history.replaceState({},"",$)},[e]);const ue=async(u,v)=>{T(u),_("");try{await v(),await Z()}catch(j){_(j?.message||A("skills.error.generic"))}finally{T("")}},O=(u,v)=>{const j=(v&&v.length?v:nn).filter($=>(n.targets||[]).some(K=>K.id===$));ue(rn(u),async()=>{await Bs(u,j);const $=j.map(K=>(n.targets||[]).find(ie=>ie.id===K)?.label||K).join(", ");ne({key:`${Date.now()}:install:${ht(u)}`,message:A("skills.toast.installed",{name:u.name||u.directory,targets:$||A("skills.target.none")}),ttlMs:4e3})})},he=()=>{const u=Y;u&&(G(null),ue(sn(u),async()=>{let v=null;u.managed?v=await $s(u.id):await Ws(u.directory,u.targets||[]);const j=!!(v?.trashed&&u.managed&&u.id);ne({key:`${Date.now()}:${u.id||u.directory}`,message:A("skills.toast.removed",{name:u.name||u.directory}),undo:j?async()=>{try{await zs(u.id),await Z(),ne(null)}catch($){_($?.message||A("skills.error.generic"))}}:null,ttlMs:5e3})}))},re=async()=>{const u=x.trim();if(!(u.length<2)){T("search"),_("");try{const v=await Fs(u);l(v.skills||[])}catch(v){_(v?.message||A("skills.error.generic"))}finally{T("")}}},P=async()=>{const u=E.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[v,j]=u.split("/");if(!v||!j){_(A("skills.repo.invalid"));return}await ue("repo:add",async()=>{await qs({owner:v,name:j,branch:"main",enabled:!0}),c(""),await S(),await B()})},W=async u=>{await ue(`repo:${u.owner}/${u.name}`,async()=>{await Ks(u.owner,u.name),await S(),await B()})},ae=n.targets||[];n.skills;const ye=r.useMemo(()=>{const u=f===Te?i:d,v=f===Te||f===tt?u:u.filter(K=>`${K.repoOwner}/${K.repoName}`===f),j=b.trim().toLowerCase();return(f===Te||!j?v:v.filter(K=>(K.name||"").toLowerCase().includes(j)||(K.directory||"").toLowerCase().includes(j)||(K.description||"").toLowerCase().includes(j))).map(K=>({...K,installed:q.has(ht(K).toLowerCase())}))},[b,d,q,i,f]),H=s.jsx("div",{className:"flex h-64 items-center justify-center",children:s.jsx(Ge,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),de=s.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[s.jsx(Ge,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),s.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:A("skills.browse.loading_hint")})]}),ee=(u,v=null)=>s.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[s.jsx("p",{children:A(u)}),v]});let fe;if(D)fe=H;else if(e==="my")fe=s.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[ae.length>0?s.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:s.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...ae,...ae].map((u,v)=>s.jsx("span",{className:"shrink-0 px-3",children:s.jsx(Vt,{provider:u.id,size:30})},`b-${v}`))})}),s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:s.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...ae,...ae].map((u,v)=>s.jsx("span",{className:"shrink-0 px-3",children:s.jsx(Vt,{provider:u.id,size:30})},`c-${v}`))})}),s.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20",style:{background:"linear-gradient(to right, var(--oai-white) 0%, transparent 100%)"}}),s.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20",style:{background:"linear-gradient(to left, var(--oai-white) 0%, transparent 100%)"}})]}):null,s.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:A("skills.empty.my")}),s.jsx(Ve,{type:"button",size:"sm",onClick:()=>t("browse"),children:A("skills.empty.my_cta")})]});else{const u=f===Te,v=y.length===0&&!u;let j;v?j=s.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:s.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:A("skills.browse.empty_sources")})}):L&&!u?j=de:u&&x.trim().length<2?j=s.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:A("skills.browse.hint_skillssh")}):ye.length?j=s.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:ye.map(K=>s.jsx("div",{style:Ys,children:s.jsx(Gs,{skill:K,installed:!!K.installed,installing:k===rn(K),allTargets:ae,defaultTargets:nn,onInstall:O})},K.id||K.key))}):u?j=ee("skills.empty.search"):j=ee("skills.empty.browse");const $=v||I?s.jsx("div",{className:"mb-5",children:s.jsx(Xs,{repos:y,repoInput:E,onRepoInput:c,busyKey:k,onAdd:P,onRemove:W})}):null;fe=s.jsxs(s.Fragment,{children:[$,j]})}return s.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[s.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:s.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[s.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[s.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:A("skills.page.title")}),s.jsxs(Ve,{type:"button",variant:"secondary",size:"sm",onClick:M,disabled:D||L,children:[s.jsx(Nr,{className:xt("mr-1.5 h-3.5 w-3.5",(D||L)&&"animate-spin"),"aria-hidden":!0}),A("skills.action.refresh")]})]}),s.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",A("skills.tab.my")],["browse",A("skills.tab.browse")]].map(([u,v])=>s.jsx("button",{type:"button","aria-pressed":e===u,onClick:()=>t(u),className:xt("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",e===u?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:v},u))}),pe?s.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:pe}):null,e==="browse"?s.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row",children:[s.jsxs(is,{value:f,onValueChange:m,children:[s.jsxs(ds,{"aria-label":A("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[s.jsx(ms,{children:u=>u===tt?A("skills.source.all"):u===Te?A("skills.source.skillssh"):u}),s.jsx(gs,{className:"text-oai-gray-400",children:s.jsx(hn,{className:"h-4 w-4","aria-hidden":!0})})]}),s.jsx(hs,{children:s.jsx(Cs,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:s.jsxs(Ts,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[s.jsxs(jt,{value:tt,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[s.jsx(Tt,{children:A("skills.source.all")}),s.jsx(Et,{children:s.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),y.map(u=>{const v=`${u.owner}/${u.name}`;return s.jsxs(jt,{value:v,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[s.jsx(Tt,{children:v}),s.jsx(Et,{children:s.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},v)}),s.jsxs(jt,{value:Te,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[s.jsx(Tt,{children:A("skills.source.skillssh")}),s.jsx(Et,{children:s.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]})})})]}),s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Yt,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),s.jsx(Tn,{value:x,onChange:u=>N(u.target.value),onKeyDown:u=>{u.key==="Enter"&&f===Te&&re()},placeholder:f===Te?A("skills.browse.placeholder_skillssh"):f===tt?A("skills.browse.placeholder_all"):A("skills.browse.placeholder_repo",{repo:f}),className:"pl-9"})]}),f===Te?s.jsxs(Ve,{type:"button",onClick:re,disabled:x.trim().length<2||k==="search",children:[k==="search"?s.jsx(Ge,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):s.jsx(Yt,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),A("skills.action.search")]}):null,s.jsxs(Ve,{type:"button",variant:"secondary",size:"sm",onClick:()=>p(u=>!u),"aria-expanded":I,className:"!h-10 shrink-0 whitespace-nowrap",children:[s.jsx(xn,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),A("skills.browse.manage_sources"),s.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:y.length})]})]}):null,fe]})}),s.jsx(Ds,{open:!!Y,title:A("skills.confirm.remove_title",{name:Y?.name||Y?.directory||""}),description:Y?Y.managed?A("skills.confirm.remove_managed"):A("skills.confirm.remove_local"):"",confirmLabel:A("skills.action.remove"),cancelLabel:A("shared.action.cancel"),destructive:!0,busy:k===sn(Y||{}),onCancel:()=>G(null),onConfirm:he}),X?s.jsx("div",{className:"pointer-events-none fixed inset-x-0 bottom-6 z-[90] flex justify-center px-4",children:s.jsxs("div",{className:"pointer-events-auto flex max-w-md items-center gap-3 rounded-full bg-oai-black px-4 py-2 text-sm text-white shadow-lg dark:bg-white dark:text-oai-black",children:[s.jsx("span",{children:X.message}),X.undo?s.jsx("button",{type:"button",onClick:X.undo,className:"rounded-full px-2 py-0.5 text-xs font-semibold uppercase tracking-wide hover:bg-white/10 dark:hover:bg-oai-black/10",children:A("shared.action.undo")}):null]})}):null]})}export{ao as SkillsPage};
@@ -1 +0,0 @@
1
- import{e as T,D as e,B as n,a$ as I,ar as B,r as u,b0 as D,R as E,a7 as b}from"./main-BkcFhXuV.js";import{u as $,T as z}from"./use-native-settings-BHpLvxeC.js";import{F as v,S as P,a as R}from"./FadeIn-DnSCeL3V.js";import{D as H}from"./download-DjhGgU2Q.js";import{C as O}from"./chevron-down-DoncrDIk.js";import"./Card-CnqcfvmO.js";const K=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],G=T("arrow-up-right",K),U=["todayTokens","todayCost"],A=[{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"}];function N(t,i=A,s=2){const a=new Set(i.map(o=>o.id)),l=new Set,r=Array.isArray(t)?t.filter(o=>!a.has(o)||l.has(o)?!1:(l.add(o),!0)):[];return(r.length>0?r:U).slice(0,Math.max(1,Number(s)||2))}const X=264,Y=124,x="ui-rounded, -apple-system, system-ui",S=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],V={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Z(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function y({size:t="sm",children:i}){const s=t==="lg",a=s?560:264,l=s?32:22;return e.jsx("div",{className:b("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",s?"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:a,aspectRatio:`${X} / ${Y}`,borderRadius:l},children:i})})}function q({size:t="sm"}){const i="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",s=`${i} L264,124 L0,124 Z`,a=`sparkArea-${t}`;return e.jsx(y,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:a,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:s,fill:`url(#${a})`,stroke:"none"}),e.jsx("path",{d:i,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const C=(()=>{const s=[];for(let a=0;a<26;a++)for(let l=0;l<7;l++){const r=Math.sin((a+1)*12.9898+(l+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(r-Math.floor(r))*100);s.push({w:a,d:l,v:c})}return s})();function M(t,i){return t<18?i?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function J(){return e.jsx(y,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:M(r.v,!0)},`d-${r.w}-${r.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:M(r.v,!1)},`l-${r.w}-${r.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 Q(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],i=22,s=28,a=14,l=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const o=s+c*i,g=S[c%S.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.name}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:x,children:r.value}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:x,children:[r.pct,"%"]}),e.jsx("rect",{x:a,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:o+4,width:Math.max(l*(r.pct/100),4),height:"2.8",rx:"1.4",fill:g})]},r.name)})})})}function ee(){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}],i=22,s=28,a=14,l=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const o=s+c*i,g=V[r.source],p=Z(r.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.label}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:x,children:r.reset}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:x,children:[r.pct,"%"]}),e.jsx("rect",{x:a,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:o+4,width:Math.max(l*(r.pct/100),4),height:"2.8",rx:"1.4",fill:p})]},r.label)})})})}function te(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ae(t,i){switch(t){case"todayTokens":return n("menubar.metric.today_tokens");case"todayCost":return n("menubar.metric.today_cost");case"last7dTokens":return n("menubar.metric.last_7d_tokens");case"totalTokens":return n("menubar.metric.total_tokens");case"totalCost":return n("menubar.metric.total_cost");case"claude5h":return n("menubar.metric.claude_5h");case"claude7d":return n("menubar.metric.claude_7d");case"codex5h":return n("menubar.metric.codex_5h");case"codex7d":return n("menubar.metric.codex_7d");default:return i}}function ie(t,i){const s=new Set(i.map(l=>l.id)),a=t.filter(l=>s.has(l));for(const l of i){if(a.length>=2)break;a.includes(l.id)||a.push(l.id)}return a.slice(0,2)}function re({slotConfigs:t,showStats:i}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),i?t.map(({slot:s,item:a},l)=>e.jsxs(E.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:b("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:a?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:a?.shortLabel||"Metric"})]})]},s)):null]})})}function se({slot:t,value:i,options:s,disabled:a,onChange:l}){const r=t===0?n("menubar.slot.primary"):n("menubar.slot.secondary");return e.jsxs("label",{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:r}),e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:i,disabled:a,"aria-label":r,onChange:c=>l(t,c.target.value),className:b("w-full appearance-none rounded-lg border border-oai-gray-200 bg-white px-3 py-2 pr-9 text-sm font-medium text-oai-black transition-colors hover:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700",a&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800"),children:s.map(c=>e.jsx("option",{value:c.id,children:c.displayLabel},c.id))}),e.jsx(O,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":"true"})]})]})}function _({label:t,hint:i,checked:s,disabled:a,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(z,{checked:s,disabled:a,onChange:l,ariaLabel:t})]})}function le(){const{available:t,settings:i,setSetting:s}=$(),a=u.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:A).map(m=>({...m,displayLabel:ae(m.id,m.label),previewValue:te(m)})),[i?.menuBarAvailableItems]),l=Number(i?.menuBarMaxItems)||2,r=u.useMemo(()=>N(i?.menuBarItems,a,l),[a,l,i?.menuBarItems]),c=u.useMemo(()=>ie(r,a),[a,r]),o=i?.showStats!==!1,g=d=>{s("menuBarItems",N(d,a,l))},p=(d,m)=>{const h=[...c];h[d===0?1:0]!==m&&(h[d]=m,g(h))},w=[0,1].map(d=>{const m=c[d]||a[d]?.id||"",j=c[d===0?1:0],W=a.filter(f=>f.id===m||f.id!==j),F=a.find(f=>f.id===m);return{slot:d,currentValue:m,options:W,item:F}}),k=i?.animatedIcon!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(re,{slotConfigs:w,showStats:o}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:w.map(({slot:d,currentValue:m,options:h})=>e.jsx(se,{slot:d,value:m,options:h,disabled:!t||!o,onChange:p},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(_,{label:n("settings.menubar.showStats"),hint:t?n("settings.menubar.showStatsHint"):n("menubar.native_only"),checked:o,disabled:!t,onChange:()=>s("showStats",!o)}),e.jsx(_,{label:n("settings.menubar.animatedIcon"),hint:n("settings.menubar.animatedIconHint"),checked:k,disabled:!t,onChange:()=>s("animatedIcon",!k)})]})]})}function ne(){const[t,i]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(D()){i("native");return}const s=(navigator.userAgent||"").toLowerCase(),a=/mac/.test(s)&&!/iphone|ipad/.test(s);i(a?"mac-web":"other")},[]),t}function oe(){const t=ne();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>I("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:[n("widgets.cta.open_gallery"),e.jsx(G,{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(H,{className:"h-4 w-4","aria-hidden":"true"}),n("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(B,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.macos_only")]})}const ce=[{id:"summary",Preview:q,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:J,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:Q,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:ee,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function de({Preview:t,nameKey:i,descKey:s}){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:n(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:n(s)})]})]})}function L({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:n(t)})}function ye(){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(v,{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:n("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(oe,{})})]})}),e.jsx(v,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":n("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(L,{titleKey:"widgets.menubar.section.title"}),e.jsx(le,{})]})}),e.jsxs("section",{"aria-label":n("widgets.gallery.section.title"),children:[e.jsx(L,{titleKey:"widgets.gallery.section.title"}),e.jsx(P,{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:i,nameKey:s,descKey:a})=>e.jsx(R,{children:e.jsx(de,{Preview:i,nameKey:s,descKey:a})},t))})})]})]})})})}export{ye as WidgetsPage};
@@ -1 +0,0 @@
1
- import{e as o}from"./main-BkcFhXuV.js";const e=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],c=o("chevron-down",e);export{c as C};
@@ -1 +0,0 @@
1
- import{e as o}from"./main-BkcFhXuV.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],d=o("download",a);export{d as D};
@@ -1 +0,0 @@
1
- import{R as c,D as n,a7 as i}from"./main-BkcFhXuV.js";function y(e){let r=0;const o=String(e??"");for(let a=0;a<o.length;a+=1)r=Math.imul(31,r)+o.charCodeAt(a)|0;return Math.abs(r)%360}function m(e){const r=String(e??"").trim();if(!r)return"?";const o=r.split(/\s+/).filter(Boolean);if(o.length>=2){const a=o[0][0]||"",t=o[1][0]||"";return`${a}${t}`.toUpperCase()}return r.slice(0,2).toUpperCase()}const g={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base"};function h({avatarUrl:e,displayName:r,seed:o,size:a="md",className:t}){const d=g[a]||g.md,p=y(o??r??""),s=typeof e=="string"?e.trim():"",[b,l]=c.useState(!1);return c.useEffect(()=>{l(!1)},[s]),s&&!b?n.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>l(!0),className:i("rounded-full object-cover ring-1 ring-white/10",d,t)}):n.jsx("div",{className:i("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",d,t),style:{backgroundColor:`hsl(${p} 42% 34%)`},"aria-hidden":!0,children:m(r)})}const u=new Set(["/brand-logos/cursor.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function w({iconSrc:e,label:r}){return n.jsxs("span",{className:"inline-flex items-center gap-3",children:[e?n.jsx("img",{src:e,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${u.has(e)?"dark:invert":""}`}):null,n.jsx("span",{className:"whitespace-nowrap",children:r})]})}const x=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:null},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],f="sticky left-0 z-40 w-[72px] min-w-[72px] max-w-[72px] bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",_="sticky left-[71px] z-40 min-w-[200px] max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",v="sticky left-[71px] z-40 min-w-[6rem] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4";function K(e){return i("sticky left-0 z-30 w-[72px] min-w-[72px] max-w-[72px] px-4 py-4 whitespace-nowrap",e?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function T(e){return i("sticky left-[71px] z-30 hover:z-50 min-w-[200px] max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 min-w-0",e?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function S(e){return i("sticky left-[71px] z-30 min-w-[6rem] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 whitespace-nowrap","bg-white dark:bg-oai-gray-950")}export{f as L,_ as a,x as b,T as c,w as d,h as e,S as f,v as g,K as l};