tokentracker-cli 0.24.8 → 0.25.1

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 (52) hide show
  1. package/dashboard/dist/assets/ActivityHeatmap-CB0rCGvm.js +42 -0
  2. package/dashboard/dist/assets/{Card-Bm2ZOfFA.js → Card-BfKA33l_.js} +1 -1
  3. package/dashboard/dist/assets/DashboardPage-u0vbeset.js +1 -0
  4. package/dashboard/dist/assets/{DevicePage-CtqTSoxC.js → DevicePage-9mF2GYDM.js} +1 -1
  5. package/dashboard/dist/assets/DialogTitle-BilvePW_.js +12 -0
  6. package/dashboard/dist/assets/{FadeIn-BGmXw8rD.js → FadeIn-DIUOdWDR.js} +1 -1
  7. package/dashboard/dist/assets/{HeaderGithubStar-7oF7WLZx.js → HeaderGithubStar-jwgY8DT_.js} +1 -1
  8. package/dashboard/dist/assets/{IpCheckPage-DLGIFtxp.js → IpCheckPage-BAJ9oJk5.js} +4 -4
  9. package/dashboard/dist/assets/{LandingPage-DblVIECc.js → LandingPage-Bi7T_UG3.js} +1 -1
  10. package/dashboard/dist/assets/LeaderboardAvatar-DK4zB40R.js +1 -0
  11. package/dashboard/dist/assets/LeaderboardPage-BMLXmGUV.js +6 -0
  12. package/dashboard/dist/assets/LeaderboardProfileModal-DgDySCa4.js +32 -0
  13. package/dashboard/dist/assets/LeaderboardProfilePage-BoI-B3yY.js +1 -0
  14. package/dashboard/dist/assets/LimitsPage-DFntRPF-.js +2 -0
  15. package/dashboard/dist/assets/LocalOnlyNotice-kpOEyGcQ.js +1 -0
  16. package/dashboard/dist/assets/LoginPage-J437b8fG.js +1 -0
  17. package/dashboard/dist/assets/PopoverPopup-CETYhElJ.js +1 -0
  18. package/dashboard/dist/assets/{ProviderIcon-CyeZHlvD.js → ProviderIcon-GLSK86ul.js} +1 -1
  19. package/dashboard/dist/assets/SettingsPage-Ce-EIZCo.js +1 -0
  20. package/dashboard/dist/assets/SkillsPage-BCg2tPe8.js +1 -0
  21. package/dashboard/dist/assets/WidgetsPage-B8eoNh1B.js +1 -0
  22. package/dashboard/dist/assets/{WrappedPage-Ci0XyXL_.js → WrappedPage-57yACpcn.js} +1 -1
  23. package/dashboard/dist/assets/arrow-up-right-kKTEYa77.js +1 -0
  24. package/dashboard/dist/assets/check-BwEiSCgu.js +1 -0
  25. package/dashboard/dist/assets/{chevron-down-BTjZUclo.js → chevron-down-CYErdTR9.js} +1 -1
  26. package/dashboard/dist/assets/{download-TnEyNsSy.js → download-CSjtsR81.js} +1 -1
  27. package/dashboard/dist/assets/{info-8F30IXmF.js → info-Y0vVD3FZ.js} +1 -1
  28. package/dashboard/dist/assets/{main-Ch22JpOj.js → main-CrjJx0KR.js} +47 -18
  29. package/dashboard/dist/assets/main-CvieAP2Q.css +1 -0
  30. package/dashboard/dist/assets/{use-limits-display-prefs-Rfcf8uOp.js → use-limits-display-prefs-Csc65P9G.js} +1 -1
  31. package/dashboard/dist/assets/use-native-settings-BeIgnIwx.js +1 -0
  32. package/dashboard/dist/assets/{use-reduced-motion-lvUJO2cx.js → use-reduced-motion-DZ7zH0oK.js} +1 -1
  33. package/dashboard/dist/assets/{use-usage-limits-BDH7ZuiN.js → use-usage-limits-ClpyKC2F.js} +1 -1
  34. package/dashboard/dist/assets/{useCurrency-9qQotA-7.js → useCurrency-M999w0v1.js} +1 -1
  35. package/dashboard/dist/index.html +2 -2
  36. package/dashboard/dist/share.html +2 -2
  37. package/package.json +1 -1
  38. package/src/lib/local-api.js +13 -1
  39. package/src/lib/pricing/seed-snapshot.json +1 -1
  40. package/dashboard/dist/assets/DashboardPage-BCwneqYv.js +0 -42
  41. package/dashboard/dist/assets/LeaderboardPage-BSIiXBXB.js +0 -5
  42. package/dashboard/dist/assets/LeaderboardProfilePage-rnzMxGm7.js +0 -1
  43. package/dashboard/dist/assets/LimitsPage-BIIloMLr.js +0 -2
  44. package/dashboard/dist/assets/LoginPage-K0pFbm2P.js +0 -1
  45. package/dashboard/dist/assets/PopoverPopup-CdYV60oX.js +0 -12
  46. package/dashboard/dist/assets/SettingsPage-CwNF9bwF.js +0 -1
  47. package/dashboard/dist/assets/SkillsPage-DJtcsqCs.js +0 -1
  48. package/dashboard/dist/assets/WidgetsPage-DnQgY7YQ.js +0 -1
  49. package/dashboard/dist/assets/check-CDwpiGWn.js +0 -1
  50. package/dashboard/dist/assets/leaderboard-columns-C6mnviZx.js +0 -1
  51. package/dashboard/dist/assets/main-D_iR1XAB.css +0 -1
  52. package/dashboard/dist/assets/use-native-settings-7r5luMxr.js +0 -1
@@ -0,0 +1 @@
1
+ import{c as v,r as l,b as Q,f as J,an as L,C as n,D as A,S as x,B as s,U as X,ad as ee,ao as te,ae as ne,af as ae,ag as P,ap as ie,aq as se,T as oe,R as re,P as le,Q as ce,Y as ue,ar as de,as as ge,at as D,au as he,av as pe,aw as me,ax as be,H as fe,ay as ye}from"./main-CrjJx0KR.js";import{L as xe,a as G,u as ve}from"./use-limits-display-prefs-Csc65P9G.js";import{S as k,T as j,a as b,b as I,u as _}from"./use-native-settings-BeIgnIwx.js";import{C as ke}from"./check-BwEiSCgu.js";import{u as je}from"./useCurrency-M999w0v1.js";import{C as Ne}from"./chevron-down-CYErdTR9.js";import{I as Se}from"./info-Y0vVD3FZ.js";import{D as we}from"./download-CSjtsR81.js";import"./Card-BfKA33l_.js";const Ce=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Le=v("copy",Ce);const Ge=[["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"}]],Ie=v("grip-vertical",Ge);const Ee=[["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"}]],E=v("languages",Ee);const Oe=[["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"}]],Ae=v("log-out",Oe);const Pe=[["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"}]],De=v("pencil",Pe),_e=e=>!e.isLayoutDirty&&e.willUpdate(!1);function O(){const e=new Set,t=new WeakMap,i=()=>e.forEach(_e);return{add:a=>{e.add(a),t.set(a,a.addEventListener("willUpdate",i))},remove:a=>{e.delete(a);const o=t.get(a);o&&(o(),t.delete(a)),i()},dirty:i}}const Te=l.createContext(null);function Me(){const e=l.useRef(!1);return Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Ue(){const e=Me(),[t,i]=l.useState(0),a=l.useCallback(()=>{e.current&&i(t+1)},[t]);return[l.useCallback(()=>J.postRender(a),[a]),t]}const T=e=>e===!0,Re=e=>T(e===!0)||e==="id",Fe=({children:e,id:t,inherit:i=!0})=>{const a=l.useContext(L),o=l.useContext(Te),[r,c]=Ue(),u=l.useRef(null),g=a.id||o;u.current===null&&(Re(i)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:T(i)&&a.group||O()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:h,children:e})},He=new Set(["cursor","kiro","copilot","kimi"]);function $e({checked:e,onChange:t,ariaLabel:i}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,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 Be({prefs:e}){const{order:t,visibility:i,toggle:a,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},m=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},y=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Fe,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const p=i[d]!==!1,N=r===d;return n.jsxs(A.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:f,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",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[n.jsx(Ie,{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:xe[d],alt:"",width:18,height:18,className:x("h-[18px] w-[18px] shrink-0 pointer-events-none",He.has(d)&&"dark:invert"),draggable:!1}),n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:G[d]}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx($e,{checked:p,onChange:()=>a(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${G[d]}`})})]},d)})})})}function ze(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},a=t.full_name||t.name||i.name||t.user_name||t.preferred_username;return typeof a=="string"&&a.trim()?a.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function Ve(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function Ze(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const i=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),a=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||a?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function We(e,t,i){const[a,o]=l.useState(()=>ee()),r=t&&i&&te(),c=l.useCallback(async()=>{const u=!a;if(ne(u),o(u),!!u)try{await ae(()=>e())}catch(g){w("cloud sync",g)}},[a,e]);return{cloudSyncOn:a,handleCloudSyncToggle:c,showLocalCloudSync:r}}function Ke(e){const[t,i]=l.useState(!1),[a,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[f,y]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[F,C]=l.useState(""),[H,$]=l.useState(""),[B,z]=l.useState(!1),[V,Z]=l.useState(null),W=l.useMemo(()=>ze(e),[e]),K=l.useMemo(()=>Ve(e),[e]),Y=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:i,setShowGithubOn:S}),[]);return{anonymousOn:a,customDisplayName:h,displayName:W,editingGithub:B,editingName:f,email:K,githubError:V,githubInput:H,githubUrl:F,loadSetters:q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:z,setEditingName:y,setGithubError:Z,setGithubInput:$,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:S,showGithubOn:N,userId:Y}}function Ye(e,t,i){l.useEffect(()=>{if(!t)return;let a=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await P({getAccessToken:e});if(!a||!o)return;const r=await ie({accessToken:o});if(!a)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{a&&i.setProfileLoading(!1)}})(),()=>{a=!1}},[e,t,i])}function qe(e,t){return l.useCallback(async(i,{label:a,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await P({getAccessToken:e});if(!c)return!1;const u=await se({accessToken:c,...i});return r?.(u),!0}catch(c){return o?o(c):w(a||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function Qe(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 Je(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 Xe(e,t){const i=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:i}}function et(e,t){const i=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]),a=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:a}}function tt(e,t){const i=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]),a=l.useCallback(async()=>{const r=Ze(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:a,handleShowGithubToggle:i,startEditingGithub:o}}function nt(){const e=X(),t=Ke(e.user),i=We(e.getAccessToken,e.enabled,e.signedIn);Ye(e.getAccessToken,e.signedIn,t.loadSetters);const a=qe(e.getAccessToken,t),o=Xe(t,a),r=et(t,a),c=tt(t,a);return{...e,...i,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:t.userId,name:Qe(t,{...o,...r}),github:Je(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function M({disabled:e,onCancel:t,onSave:i,saveLabel:a=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:a}),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 at({nameInput:e,setEditingName:t,setNameInput:i,profileSaving:a,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>i(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:a||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:a?s("settings.account.saving"):void 0})]})}function it({githubError:e,githubInput:t,handleSaveGithub:i,profileSaving:a,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),n.jsx(M,{disabled:a,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:a?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:i,title:a}){return n.jsxs("button",{type:"button",onClick:i,disabled:e,title:a,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(De,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function R({actions:e,editing:t,editor:i,hint:a,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?i:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a})]}),t?null:e]})})}function st({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(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function ot({name:e}){const{anonymousOn:t,customDisplayName:i,displayName:a,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:f,startEditingName:y}=e,d=t?s("settings.account.displayNameAnonymousHint"):i||a;return n.jsx(R,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(at,{nameInput:u,setEditingName:m,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:n.jsx(st,{name:e})})}function rt({github:e}){const{editingGithub:t,githubError:i,githubInput:a,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f,showGithubOn:y,startEditingGithub:d}=e;return n.jsx(R,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(it,{githubError:i,githubInput:a,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(U,{label:s("settings.account.edit"),onClick:d}),n.jsx(j,{checked:y,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function lt(){const{openLoginModal:e}=oe();return n.jsx(k,{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 ct({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(ot,{name:e}),n.jsx(rt,{github:t})]})}function ut(){const e=nt();return e.enabled?e.signedIn?n.jsxs(k,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(gt,{onSignOut:e.signOut}),children:[n.jsx(dt,{userId:e.userId}),n.jsx(ht,{settings:e}),n.jsx(pt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(mt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(lt,{}):null}function dt({userId:e}){const[t,i]=re.useState(!1);if(!e)return null;const a=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),n.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":s("settings.account.copyUserId"),children:[t?n.jsx(ke,{className:"h-3.5 w-3.5","aria-hidden":!0}):n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}),t?s("settings.account.copied"):s("settings.account.copy")]})]})}function gt({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(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function ht({settings:e}){return e.showLocalCloudSync?n.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function pt({checked:e,disabled:t,onChange:i}){return n.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(j,{checked:e,onChange:i,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function mt({visible:e,name:t,github:i}){return n.jsx(le,{initial:!1,children:e?n.jsx(A.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(ct,{name:t,github:i})},"public-profile-fields"):null})}function bt(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:de},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:ge},{value:"system",label:s("settings.appearance.theme.system"),Icon:D}]}function ft(){return[{value:he,label:s("settings.appearance.language.system"),Icon:D},{value:pe,label:s("settings.appearance.language.english"),Icon:E},{value:me,label:s("settings.appearance.language.chinese"),Icon:E}]}function yt(e){if(!e)return null;try{const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString()}catch{return null}}function xt(e,t){const i=s(`settings.appearance.currency.rate_source.${e}`),a=yt(t),o=a?s("settings.appearance.currency.rate_updated",{when:a}):s("settings.appearance.currency.rate_never");return`${i} · ${o}`}function vt({currency:e,setCurrency:t}){const i=be();return n.jsxs("div",{className:"relative inline-flex",children:[n.jsx("select",{value:e,onChange:a=>t(a.target.value),"aria-label":s("settings.appearance.currency.label"),className:x("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-3 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500","dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:bg-oai-gray-800"),children:i.map(a=>n.jsx("option",{value:a.code,children:s(a.labelKey)},a.code))}),n.jsx(Ne,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function kt({currency:e,rate:t,rateSource:i,rateFetchedAt:a}){if(e===fe)return n.jsx(n.Fragment,{children:s("settings.appearance.currency.hint")});const o=xt(i,a);return n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{children:`1 USD = ${t.toFixed(4)} ${e}`}),n.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:n.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function jt(){const{theme:e,setTheme:t}=ce(),{locale:i,setLocale:a}=ue(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=je();return n.jsxs(k,{title:s("settings.section.appearance"),children:[n.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(I,{options:bt(),value:e,onChange:t})}),n.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(I,{options:ft(),value:i,onChange:a})}),n.jsx(b,{label:s("settings.appearance.currency.label"),hint:n.jsx(kt,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:n.jsx(vt,{currency:o,setCurrency:g})})]})}function Nt(){const{available:e,settings:t,setSetting:i,runAction:a}=_();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,u=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(k,{title:s("settings.section.menubar"),children:[r?n.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>a("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(ye,{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(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>a("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(we,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function St(){const{available:e,settings:t,runAction:i}=_();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:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"})]})}function Dt(){const e=ve();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(jt,{}),n.jsx(Nt,{}),n.jsx(ut,{}),n.jsx(k,{title:s("settings.section.limits"),children:n.jsx(Be,{prefs:e})})]}),n.jsx(St,{})]})})})}export{Dt as SettingsPage};
@@ -0,0 +1 @@
1
+ import{c as St,r as n,C as r,a9 as yr,I as Ve,S as Ue,X as Nt,B as S,P as Qr,D as rr,aB as Zr,h as en,ay as tn,R as rn}from"./main-CrjJx0KR.js";import{L as nn}from"./LocalOnlyNotice-kpOEyGcQ.js";import{C as an}from"./Card-BfKA33l_.js";import{A as Wt,s as Me,i as lt,j as Be,k as ze,l as br,m as $e,n as sn,o as on,p as ee,q as ln,r as Ne,t as cn,v as nr,w as dn,x as st,c as Ee,y as At,z as ar,B as un,C as wr,E as fn,F as gn,G as Ge,H as Ft,I as Xe,N as Le,J as yt,K as bt,L as mn,M as fe,O as qt,P as hn,Q as $t,R as B,S as Rt,T as pn,U as xn,V as Gt,W as Yt,X as kr,Y as vr,Z as Ct,_ as yn,$ as bn,a as De,a0 as wn,a1 as Ht,a2 as kn,a3 as vn,a4 as jn,a5 as Sn,a6 as Nn,a7 as Rn,a8 as Cn,a9 as jr,aa as In,ab as sr,ac as Mn,ad as En,ae as Tn,af as Xt,ag as Pn,ah as _t,u as On,D as An,d as _n,e as Ln,f as Vn,g as Dn,h as Fn}from"./DialogTitle-BilvePW_.js";import{I as $n}from"./info-Y0vVD3FZ.js";import{P as tt}from"./ProviderIcon-GLSK86ul.js";import{C as Ye}from"./check-BwEiSCgu.js";import{f as or,e as Hn,g as Un,u as Jt,h as Bn,i as zn,j as Kn,L as Ke,P as Wn,a as qn,b as Gn,c as Yn,d as Xn,C as Jn}from"./PopoverPopup-CETYhElJ.js";import{u as Qn}from"./use-reduced-motion-DZ7zH0oK.js";import{C as Sr}from"./chevron-down-CYErdTR9.js";import{D as Zn}from"./download-CSjtsR81.js";import"./arrow-up-right-kKTEYa77.js";const ea=[["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"}]],Ut=St("external-link",ea);const ta=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Nr=St("plus",ta);const ra=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ir=St("search",ra);const na=[["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"}]],Rr=St("trash-2",na);function aa(e){const t=n.useRef(!0);t.current&&(t.current=!1,e())}function Bt({controlled:e,default:t,name:a,state:s="value"}){const{current:u}=n.useRef(e!==void 0),[o,c]=n.useState(t),l=u?e:o,p=n.useCallback(y=>{u||c(y)},[]);return[l,p]}function gt(e,t,a){return Math.floor(e/t)!==a}function ot(e,t){return t<0||t>=e.current.length}function Lt(e,t){return Ie(e,{disabledIndices:t})}function lr(e,t){return Ie(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Ie(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:s,amount:u=1}={}){let o=t;do o+=a?-u:u;while(o>=0&&o<=e.current.length-1&&it(e,o,s));return o}function sa(e,{event:t,orientation:a,loopFocus:s,rtl:u,cols:o,disabledIndices:c,minIndex:l,maxIndex:p,prevIndex:y,stopEvent:f=!1}){let m=y;const h=[],T={};let x=!1;{let d=null,E=-1;e.current.forEach((b,j)=>{if(b==null)return;const A=b.closest('[role="row"]');A&&(x=!0),(A!==d||E===-1)&&(d=A,E+=1,h[E]=[]),h[E].push(j),T[j]=E})}const k=x&&h.length>0&&h.some(d=>d.length!==o);function M(d){if(!k||y===-1)return;const E=T[y];if(E==null)return;const b=h[E].indexOf(y);let j=d==="up"?E-1:E+1;s&&(j<0?j=h.length-1:j>=h.length&&(j=0));const A=new Set;for(;j>=0&&j<h.length&&!A.has(j);){A.add(j);const L=h[j];if(L.length===0){j=d==="up"?j-1:j+1;continue}const Q=Math.min(b,L.length-1);for(let _=Q;_>=0;_-=1){const te=L[_];if(!it(e,te,c))return te}j=d==="up"?j-1:j+1,s&&(j<0?j=h.length-1:j>=h.length&&(j=0))}}if(t.key===Wt){const d=M("up");if(d!==void 0)f&&Me(t),m=d;else{if(f&&Me(t),y===-1)m=p;else if(m=Ie(e,{startingIndex:m,amount:o,decrement:!0,disabledIndices:c}),s&&(y-o<l||m<0)){const E=y%o,b=p%o,j=p-(b-E);b===E?m=p:m=b>E?j:j-o}ot(e,m)&&(m=y)}}if(t.key===lt){const d=M("down");d!==void 0?(f&&Me(t),m=d):(f&&Me(t),y===-1?m=l:(m=Ie(e,{startingIndex:y,amount:o,disabledIndices:c}),s&&y+o>p&&(m=Ie(e,{startingIndex:y%o-o,amount:o,disabledIndices:c}))),ot(e,m)&&(m=y))}if(a==="both"){const d=or(y/o);t.key===(u?Be:ze)&&(f&&Me(t),y%o!==o-1?(m=Ie(e,{startingIndex:y,disabledIndices:c}),s&&gt(m,o,d)&&(m=Ie(e,{startingIndex:y-y%o-1,disabledIndices:c}))):s&&(m=Ie(e,{startingIndex:y-y%o-1,disabledIndices:c})),gt(m,o,d)&&(m=y)),t.key===(u?ze:Be)&&(f&&Me(t),y%o!==0?(m=Ie(e,{startingIndex:y,decrement:!0,disabledIndices:c}),s&&gt(m,o,d)&&(m=Ie(e,{startingIndex:y+(o-y%o),decrement:!0,disabledIndices:c}))):s&&(m=Ie(e,{startingIndex:y+(o-y%o),decrement:!0,disabledIndices:c})),gt(m,o,d)&&(m=y));const E=or(p/o)===d;ot(e,m)&&(s&&E?m=t.key===(u?ze:Be)?p:Ie(e,{startingIndex:y-y%o-1,disabledIndices:c}):m=y)}return m}function oa(e,t,a){const s=[];let u=0;return e.forEach(({width:o,height:c},l)=>{let p=!1;for(a&&(u=0);!p;){const y=[];for(let f=0;f<o;f+=1)for(let m=0;m<c;m+=1)y.push(u+f+m*t);u%t+o<=t&&y.every(f=>s[f]==null)?(y.forEach(f=>{s[f]=l}),p=!0):u+=1}}),[...s]}function ia(e,t,a,s,u){if(e===-1)return-1;const o=a.indexOf(e),c=t[e];switch(u){case"tl":return o;case"tr":return c?o+c.width-1:o;case"bl":return c?o+(c.height-1)*s:o;case"br":return a.lastIndexOf(e);default:return-1}}function la(e,t){return t.flatMap((a,s)=>e.includes(a)?[s]:[])}function it(e,t,a){if(typeof a=="function")return a(t);if(a)return a.includes(t);const s=e.current[t];return s?s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true":!1}const ca="Escape";function It(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function mt(e,t){return It(t,e===Wt||e===lt,e===Be||e===ze)}function Vt(e,t,a){return It(t,e===lt,a?e===Be:e===ze)||e==="Enter"||e===" "||e===""}function da(e,t,a){return It(t,a?e===Be:e===ze,e===lt)}function ua(e,t,a,s){const u=a?e===ze:e===Be,o=e===Wt;return t==="both"||t==="horizontal"&&s&&s>1?e===ca:It(t,u,o)}function fa(e,t){const a="rootStore"in e?e.rootStore:e,s=a.useState("open"),u=a.useState("floatingElement"),o=a.useState("domReferenceElement"),c=a.context.dataRef,{listRef:l,activeIndex:p,onNavigate:y=()=>{},enabled:f=!0,selectedIndex:m=null,allowEscape:h=!1,loopFocus:T=!1,nested:x=!1,rtl:k=!1,virtual:M=!1,focusItemOnOpen:d="auto",focusItemOnHover:E=!0,openOnArrowKeyDown:b=!0,disabledIndices:j=void 0,orientation:A="vertical",parentOrientation:L,cols:Q=1,scrollItemIntoView:_=!0,itemSizes:te,dense:ye=!1,id:X,resetOnPointerLeave:Z=!0,externalTree:K}=t,ge=br(u),W=$e(ge),D=sn(),ae=on(K);ee(()=>{c.current.orientation=A},[c,A]);const R=ln(o),H=n.useRef(d),C=n.useRef(m??-1),v=n.useRef(null),de=n.useRef(!0),P=Ne(g=>{y(C.current===-1?null:C.current,g)}),oe=n.useRef(P),J=n.useRef(!!u),I=n.useRef(s),U=n.useRef(!1),be=n.useRef(!1),ke=$e(j),F=$e(s),xe=$e(_),re=$e(m),we=$e(Z),me=Ne(()=>{function g(i){M?ae?.events.emit("virtualfocus",i):cn(i,{sync:U.current,preventScroll:!0})}const V=l.current[C.current],N=be.current;V&&g(V),(U.current?i=>i():requestAnimationFrame)(()=>{const i=l.current[C.current]||V;if(!i)return;V||g(i);const w=xe.current;w&&q&&(N||!de.current)&&i.scrollIntoView?.(typeof w=="boolean"?{block:"nearest",inline:"nearest"}:w)})});ee(()=>{f&&(s&&u?(C.current=m??-1,H.current&&m!=null&&(be.current=!0,P())):J.current&&(C.current=-1,oe.current()))},[f,s,u,m,P]),ee(()=>{if(f){if(!s){U.current=!1;return}if(u)if(p==null){if(U.current=!1,re.current!=null)return;if(J.current&&(C.current=-1,me()),(!I.current||!J.current)&&H.current&&(v.current!=null||H.current===!0&&v.current==null)){let g=0;const V=()=>{l.current[0]==null?(g<2&&(g?requestAnimationFrame:queueMicrotask)(V),g+=1):(C.current=v.current==null||Vt(v.current,A,k)||x?Lt(l):lr(l),v.current=null,P())};V()}}else ot(l,p)||(C.current=p,me(),be.current=!1)}},[f,s,u,p,re,x,l,A,k,P,me,ke]),ee(()=>{if(!f||u||!ae||M||!J.current)return;const g=ae.nodesRef.current,V=g.find(i=>i.id===D)?.context?.elements.floating,N=nr(dn(u)),G=g.some(i=>i.context&&st(i.context.elements.floating,N));V&&!G&&de.current&&V.focus({preventScroll:!0})},[f,u,ae,D,M]),ee(()=>{oe.current=P,I.current=s,J.current=!!u}),ee(()=>{s||(v.current=null,H.current=d)},[s,d]);const ue=p!=null,q=n.useMemo(()=>{function g(N){if(!F.current)return;const G=l.current.indexOf(N.currentTarget);G!==-1&&C.current!==G&&(C.current=G,P(N))}return{onFocus(N){U.current=!0,g(N)},onClick:({currentTarget:N})=>N.focus({preventScroll:!0}),onMouseMove(N){U.current=!0,be.current=!1,E&&g(N)},onPointerLeave(N){if(!F.current||!de.current||N.pointerType==="touch")return;U.current=!0;const G=N.relatedTarget;!E||l.current.includes(G)||we.current&&(C.current=-1,P(N),M||W.current?.focus({preventScroll:!0}))}}},[F,W,E,l,P,we,M]),ne=n.useCallback(()=>L??ae?.nodesRef.current.find(g=>g.id===D)?.context?.dataRef?.current.orientation,[D,ae,L]),ve=Ne(g=>{if(de.current=!1,U.current=!0,g.which===229||!F.current&&g.currentTarget===W.current)return;if(x&&ua(g.key,A,k,Q)){mt(g.key,ne())||Me(g),a.setOpen(!1,Ee(At,g.nativeEvent)),ar(o)&&(M?ae?.events.emit("virtualfocus",o):o.focus());return}const V=C.current,N=Lt(l,j),G=lr(l,j);if(R||(g.key==="Home"&&(Me(g),C.current=N,P(g)),g.key==="End"&&(Me(g),C.current=G,P(g))),Q>1){const i=te||Array.from({length:l.current.length},()=>({width:1,height:1})),w=oa(i,Q,ye),O=w.findIndex(ce=>ce!=null&&!it(l,ce,j)),Y=w.reduce((ce,pe,Re)=>pe!=null&&!it(l,pe,j)?Re:ce,-1),le=w[sa({current:w.map(ce=>ce!=null?l.current[ce]:null)},{event:g,orientation:A,loopFocus:T,rtl:k,cols:Q,disabledIndices:la([...(typeof j!="function"?j:null)||l.current.map((ce,pe)=>it(l,pe,j)?pe:void 0),void 0],w),minIndex:O,maxIndex:Y,prevIndex:ia(C.current>G?N:C.current,i,w,Q,g.key===lt?"bl":g.key===(k?Be:ze)?"tr":"tl"),stopEvent:!0})];if(le!=null&&(C.current=le,P(g)),A==="both")return}if(mt(g.key,A)){if(Me(g),s&&!M&&nr(g.currentTarget.ownerDocument)===g.currentTarget){C.current=Vt(g.key,A,k)?N:G,P(g);return}Vt(g.key,A,k)?T?V>=G?h&&V!==l.current.length?C.current=-1:(U.current=!1,C.current=N):C.current=Ie(l,{startingIndex:V,disabledIndices:j}):C.current=Math.min(G,Ie(l,{startingIndex:V,disabledIndices:j})):T?V<=N?h&&V!==-1?C.current=l.current.length:(U.current=!1,C.current=G):C.current=Ie(l,{startingIndex:V,decrement:!0,disabledIndices:j}):C.current=Math.max(N,Ie(l,{startingIndex:V,decrement:!0,disabledIndices:j})),ot(l,C.current)&&(C.current=-1),P(g)}}),se=n.useMemo(()=>M&&s&&ue&&{"aria-activedescendant":`${X}-${p}`},[M,s,ue,X,p]),ie=n.useMemo(()=>({"aria-orientation":A==="both"?void 0:A,...R?{}:se,onKeyDown(g){if(g.key==="Tab"&&g.shiftKey&&s&&!M){const V=un(g.nativeEvent);if(V&&!st(W.current,V))return;Me(g),a.setOpen(!1,Ee(wr,g.nativeEvent)),ar(o)&&o.focus();return}ve(g)},onPointerMove(){de.current=!0}}),[se,ve,W,A,R,a,s,M,o]),Ce=n.useMemo(()=>{function g(N){d==="auto"&&fn(N.nativeEvent)&&(H.current=!M)}function V(N){H.current=d,d==="auto"&&gn(N.nativeEvent)&&(H.current=!0)}return{onKeyDown(N){const G=a.select("open");de.current=!1;const i=N.key.startsWith("Arrow"),w=da(N.key,ne(),k),O=mt(N.key,A),Y=(x?w:O)||N.key==="Enter"||N.key.trim()==="";if(M&&G)return ve(N);if(!(!G&&!b&&i)){if(Y){const le=mt(N.key,ne());v.current=x&&le?null:N.key}if(x){w&&(Me(N),G?(C.current=Lt(l,ke.current),P(N)):a.setOpen(!0,Ee(At,N.nativeEvent,N.currentTarget)));return}O&&(re.current!=null&&(C.current=re.current),Me(N),!G&&b?a.setOpen(!0,Ee(At,N.nativeEvent,N.currentTarget)):ve(N),G&&P(N))}},onFocus(N){a.select("open")&&!M&&(C.current=-1,P(N))},onPointerDown:V,onPointerEnter:V,onMouseDown:g,onClick:g}},[ve,ke,d,l,x,P,a,b,A,ne,k,re,M]),he=n.useMemo(()=>({...se,...Ce}),[se,Ce]);return n.useMemo(()=>f?{reference:he,floating:ie,item:q,trigger:Ce}:{},[f,he,ie,Ce,q])}function ga(e,t){const a="rootStore"in e?e.rootStore:e,s=a.useState("open"),u=a.context.dataRef,{listRef:o,activeIndex:c,onMatch:l,onTypingChange:p,enabled:y=!0,findMatch:f=null,resetMs:m=750,ignoreKeys:h=Ft,selectedIndex:T=null}=t,x=Ge(),k=n.useRef(""),M=n.useRef(T??c??-1),d=n.useRef(null);ee(()=>{s&&(x.clear(),d.current=null,k.current="")},[s,x]),ee(()=>{s&&k.current===""&&(M.current=T??c??-1)},[s,T,c]);const E=Ne(L=>{L?u.current.typing||(u.current.typing=L,p?.(L)):u.current.typing&&(u.current.typing=L,p?.(L))}),b=Ne(L=>{function Q(Z,K,ge){const W=f?f(K,ge):K.find(D=>D?.toLocaleLowerCase().indexOf(ge.toLocaleLowerCase())===0);return W?Z.indexOf(W):-1}const _=o.current;if(k.current.length>0&&k.current[0]!==" "&&(Q(_,_,k.current)===-1?E(!1):L.key===" "&&Me(L)),_==null||h.includes(L.key)||L.key.length!==1||L.ctrlKey||L.metaKey||L.altKey)return;s&&L.key!==" "&&(Me(L),E(!0)),_.every(Z=>Z?Z[0]?.toLocaleLowerCase()!==Z[1]?.toLocaleLowerCase():!0)&&k.current===L.key&&(k.current="",M.current=d.current),k.current+=L.key,x.start(m,()=>{k.current="",M.current=d.current,E(!1)});const ye=M.current,X=Q(_,[..._.slice((ye||0)+1),..._.slice(0,(ye||0)+1)],k.current);X!==-1?(l?.(X),d.current=X):L.key!==" "&&(k.current="",E(!1))}),j=n.useMemo(()=>({onKeyDown:b}),[b]),A=n.useMemo(()=>({onKeyDown:b,onKeyUp(L){L.key===" "&&E(!1)}}),[b,E]);return n.useMemo(()=>y?{reference:j,floating:A}:{},[y,j,A])}const Cr=n.createContext(null),Ir=n.createContext(null);function We(){const e=n.useContext(Cr);if(e===null)throw new Error(Xe(60));return e}function Mr(){const e=n.useContext(Ir);if(e===null)throw new Error(Xe(61));return e}let cr=(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 ma={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Qt={valid(e){return e===null?null:e?{[cr.valid]:""}:{[cr.invalid]:""}}},ha=n.createContext({invalid:void 0,name:void 0,validityData:{state:ma,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,touched:!1,setTouched:Le,dirty:!1,setDirty:Le,filled:!1,setFilled:Le,focused:!1,setFocused:Le,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=yt)=>e,getInputValidationProps:(e=yt)=>e,inputRef:{current:null},commit:async()=>{}}});function Mt(e=!0){const t=n.useContext(ha);if(t.setValidityData===Le&&!e)throw new Error(Xe(28));return t}const pa=n.createContext({controlId:void 0,setControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function Zt(){return n.useContext(pa)}function Er(e={}){const{id:t,implicit:a=!1,controlRef:s}=e,{controlId:u,setControlId:o}=Zt(),c=bt(t);return ee(()=>{if(!(!a&&!t||o===Le)){if(a){const l=s?.current;mn(l)&&l.closest("label")!=null?o(t??null):o(u??c)}else t&&o(t);return()=>{t&&o(void 0)}}},[t,s,u,o,a,c]),u??c}const xa=(e,t)=>Object.is(e,t);function rt(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function Dt(e,t,a){return!e||e.length===0?!1:e.some(s=>s===void 0?!1:rt(s,t,a))}function zt(e,t,a){return!e||e.length===0?-1:e.findIndex(s=>s===void 0?!1:rt(s,t,a))}function ya(e,t,a){return e.filter(s=>!rt(s,t,a))}function Kt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function ba(e){if(!Array.isArray(e))return e!=null&&!("null"in e);if(Tr(e)){for(const t of e)for(const a of t.items)if(a&&a.value==null&&a.label!=null)return!0;return!1}for(const t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function wa(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 Kt(e)}function et(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Kt(e.value):Kt(e)}function Pr(e,t,a){function s(){return wa(e,a)}if(a&&e!=null)return a(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??s();if(Array.isArray(t)){const u=Tr(t)?t.flatMap(o=>o.items):t;if(e==null||typeof e!="object"){const o=u.find(c=>c.value===e);return o&&o.label!=null?o.label:s()}if("value"in e){const o=u.find(c=>c&&c.value===e.value);if(o&&o.label!=null)return o.label}}return s()}function ka(e,t,a){return e.reduce((s,u,o)=>(o>0&&s.push(", "),s.push(r.jsx(n.Fragment,{children:Pr(u,t,a)},o)),s),[])}const $={id:fe(e=>e.id),modal:fe(e=>e.modal),multiple:fe(e=>e.multiple),items:fe(e=>e.items),itemToStringLabel:fe(e=>e.itemToStringLabel),itemToStringValue:fe(e=>e.itemToStringValue),isItemEqualToValue:fe(e=>e.isItemEqualToValue),value:fe(e=>e.value),hasSelectedValue:fe(e=>{const{value:t,multiple:a,itemToStringValue:s}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:et(t,s)!==""}),hasNullItemLabel:fe((e,t)=>t?ba(e.items):!1),open:fe(e=>e.open),mounted:fe(e=>e.mounted),forceMount:fe(e=>e.forceMount),transitionStatus:fe(e=>e.transitionStatus),openMethod:fe(e=>e.openMethod),activeIndex:fe(e=>e.activeIndex),selectedIndex:fe(e=>e.selectedIndex),isActive:fe((e,t)=>e.activeIndex===t),isSelected:fe((e,t,a)=>{const s=e.isItemEqualToValue,u=e.value;return e.multiple?Array.isArray(u)&&u.some(o=>rt(o,a,s)):e.selectedIndex===t&&e.selectedIndex!==null?!0:rt(u,a,s)}),isSelectedByFocus:fe((e,t)=>e.selectedIndex===t),popupProps:fe(e=>e.popupProps),triggerProps:fe(e=>e.triggerProps),triggerElement:fe(e=>e.triggerElement),positionerElement:fe(e=>e.positionerElement),listElement:fe(e=>e.listElement),scrollUpArrowVisible:fe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:fe(e=>e.scrollDownArrowVisible),hasScrollArrows:fe(e=>e.hasScrollArrows)},va=n.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function er(){return n.useContext(va)}function ja(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Or(e){const{enabled:t=!0,value:a,id:s,name:u,controlRef:o,commit:c}=e,{formRef:l}=er(),{invalid:p,markedDirtyRef:y,validityData:f,setValidityData:m}=Mt(),h=Ne(e.getValue);ee(()=>{if(!t)return;let T=a;T===void 0&&(T=h()),f.initialValue===null&&T!==null&&m(x=>({...x,initialValue:T}))},[t,m,a,f.initialValue,h]),ee(()=>{!t||!s||l.current.fields.set(s,{getValue:h,name:u,controlRef:o,validityData:ja(f,p),validate(T=!0){let x=a;x===void 0&&(x=h()),y.current=!0,T?yr.flushSync(()=>c(x)):c(x)}})},[c,o,t,l,h,s,p,y,u,f,a]),ee(()=>{const T=l.current.fields;return()=>{s&&T.delete(s)}},[l,s])}function Ar(e,t){const a=n.useRef(e),s=Ne(t);ee(()=>{a.current!==e&&s(a.current)},[e,s]),ee(()=>{a.current=e},[e])}function _r(e){const{id:t,value:a,defaultValue:s=null,onValueChange:u,open:o,defaultOpen:c=!1,onOpenChange:l,name:p,disabled:y=!1,readOnly:f=!1,required:m=!1,modal:h=!0,actionsRef:T,inputRef:x,onOpenChangeComplete:k,items:M,multiple:d=!1,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:j=xa,highlightItemOnHover:A=!0,children:L}=e,{clearErrors:Q}=er(),{setDirty:_,setTouched:te,setFocused:ye,shouldValidateOnChange:X,validityData:Z,setFilled:K,name:ge,disabled:W,validation:D,validationMode:ae}=Mt(),R=Er({id:t}),H=W||y,C=ge??p,[v,de]=Bt({controlled:a,default:d?s??Ft:s,name:"Select",state:"value"}),[P,oe]=Bt({controlled:o,default:c,name:"Select",state:"open"}),J=n.useRef([]),I=n.useRef([]),U=n.useRef(null),be=n.useRef(null),ke=n.useRef(0),F=n.useRef(null),xe=n.useRef([]),re=n.useRef(!1),we=n.useRef(!1),me=n.useRef(null),ue=n.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),q=n.useRef(!1),{mounted:ne,setMounted:ve,transitionStatus:se}=qt(P),{openMethod:ie,triggerProps:Ce,reset:he}=hn(P),g=$t(()=>new yn({id:R,modal:h,multiple:d,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:j,value:v,open:P,mounted:ne,transitionStatus:se,items:M,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,V=B(g,$.activeIndex),N=B(g,$.selectedIndex),G=B(g,$.triggerElement),i=B(g,$.positionerElement),w=n.useMemo(()=>d&&Array.isArray(v)&&v.length===0?"":et(v,b),[d,v,b]),O=n.useMemo(()=>d&&Array.isArray(v)?v.map(z=>et(z,b)):et(v,b),[d,v,b]),Y=$e(g.state.triggerElement);Or({id:R,commit:D.commit,value:v,controlRef:Y,name:C,getValue:()=>O});const le=n.useRef(v);ee(()=>{v!==le.current&&g.set("forceMount",!0)},[g,v]),ee(()=>{K(d?Array.isArray(v)&&v.length>0:v!=null)},[d,v,K]),ee(function(){if(P)return;const je=xe.current;if(d){const _e=Array.isArray(v)?v:[];if(_e.length===0){g.set("selectedIndex",null);return}const Te=_e[_e.length-1],ft=zt(je,Te,j);g.set("selectedIndex",ft===-1?null:ft);return}const Ae=zt(je,v,j);g.set("selectedIndex",Ae===-1?null:Ae)},[d,P,v,xe,j,g]),Ar(v,()=>{Q(C),_(v!==Z.initialValue),X()?D.commit(v):D.commit(v,!0)});const ce=Ne((z,je)=>{if(l?.(z,je),!je.isCanceled&&(oe(z),!z&&(je.reason===wr||je.reason===bn)&&(te(!0),ye(!1),ae==="onBlur"&&D.commit(v)),!z&&g.state.activeIndex!==null)){const Ae=J.current[g.state.activeIndex];queueMicrotask(()=>{Ae?.setAttribute("tabindex","-1")})}}),pe=Ne(()=>{ve(!1),g.set("activeIndex",null),he(),k?.(!1)});Rt({enabled:!T,open:P,ref:U,onComplete(){P||pe()}}),n.useImperativeHandle(T,()=>({unmount:pe}),[pe]);const Re=Ne((z,je)=>{u?.(z,je),!je.isCanceled&&de(z)}),Se=Ne(()=>{const z=g.state.listElement||U.current;if(!z)return;const je=z.scrollTop,Ae=z.scrollTop+z.clientHeight,_e=je>1,Te=Ae<z.scrollHeight-1;g.state.scrollUpArrowVisible!==_e&&g.set("scrollUpArrowVisible",_e),g.state.scrollDownArrowVisible!==Te&&g.set("scrollDownArrowVisible",Te)}),Oe=Hn({open:P,onOpenChange:ce,elements:{reference:G,floating:i}}),Je=Un(Oe,{enabled:!f&&!H,event:"mousedown"}),nt=pn(Oe,{bubbles:!1}),Fe=fa(Oe,{enabled:!f&&!H,listRef:J,activeIndex:V,selectedIndex:N,disabledIndices:Ft,onNavigate(z){z===null&&!P||g.set("activeIndex",z)},focusItemOnHover:!1}),Tt=ga(Oe,{enabled:!f&&!H&&(P||!d),listRef:I,activeIndex:V,selectedIndex:N,onMatch(z){P?g.set("activeIndex",z):Re(xe.current[z],Ee("none"))},onTypingChange(z){re.current=z}}),{getReferenceProps:Qe,getFloatingProps:Ze,getItemProps:ct}=xn([Je,nt,Fe,Tt]),at=n.useMemo(()=>Gt(Qe(),Ce,R?{id:R}:yt),[Qe,Ce,R]);aa(()=>{g.update({popupProps:Ze(),triggerProps:at})}),ee(()=>{g.update({id:R,modal:h,multiple:d,value:v,open:P,mounted:ne,transitionStatus:se,popupProps:Ze(),triggerProps:at,items:M,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:j,openMethod:ie})},[g,R,h,d,v,P,ne,se,Ze,at,M,E,b,j,ie]);const dt=n.useMemo(()=>({store:g,name:C,required:m,disabled:H,readOnly:f,multiple:d,itemToStringLabel:E,itemToStringValue:b,highlightItemOnHover:A,setValue:Re,setOpen:ce,listRef:J,popupRef:U,scrollHandlerRef:be,handleScrollArrowVisibility:Se,scrollArrowsMountedCountRef:ke,getItemProps:ct,events:Oe.context.events,valueRef:F,valuesRef:xe,labelsRef:I,typingRef:re,selectionRef:ue,selectedItemTextRef:me,validation:D,onOpenChangeComplete:k,keyboardActiveRef:we,alignItemWithTriggerActiveRef:q,initialValueRef:le}),[g,C,m,H,f,d,E,b,A,Re,ce,ct,Oe.context.events,D,k,Se]),ut=Yt(x,D.inputRef),Pt=d&&Array.isArray(v)&&v.length>0,Ot=n.useMemo(()=>!d||!Array.isArray(v)||!C?null:v.map(z=>{const je=et(z,b);return r.jsx("input",{type:"hidden",name:C,value:je},je)}),[d,v,C,b]);return r.jsx(Cr.Provider,{value:dt,children:r.jsxs(Ir.Provider,{value:Oe,children:[L,r.jsx("input",{...D.getInputValidationProps({onFocus(){g.state.triggerElement?.focus({focusVisible:!0})},onChange(z){if(z.nativeEvent.defaultPrevented)return;const je=z.target.value,Ae=Ee(Ct,z.nativeEvent);function _e(){if(d)return;const Te=xe.current.find(ft=>et(ft,b).toLowerCase()===je.toLowerCase());Te!=null&&(_(Te!==Z.initialValue),Re(Te,Ae),X()&&D.commit(Te))}g.set("forceMount",!0),queueMicrotask(_e)}}),name:d?void 0:C,value:w,disabled:H,required:m&&!Pt,readOnly:f,ref:ut,style:C?kr:vr,tabIndex:-1,"aria-hidden":!0}),Ot]})})}function Sa(e){const t=e.getBoundingClientRect(),a=window.getComputedStyle(e,"::before"),s=window.getComputedStyle(e,"::after");if(!(a.content!=="none"||s.content!=="none"))return t;const o=parseFloat(a.width)||0,c=parseFloat(a.height)||0,l=parseFloat(s.width)||0,p=parseFloat(s.height)||0,y=Math.max(t.width,o,l),f=Math.max(t.height,c,p),m=y-t.width,h=f-t.height;return{left:t.left-m/2,right:t.right+m/2,top:t.top-h/2,bottom:t.bottom+h/2}}const ht=2,Na=400,dr=200,Ra={...wn,...Qt,value:()=>null},Lr=n.forwardRef(function(t,a){const{render:s,className:u,id:o,disabled:c=!1,nativeButton:l=!0,...p}=t,{setTouched:y,setFocused:f,validationMode:m,state:h,disabled:T}=Mt(),{labelId:x}=Zt(),{store:k,setOpen:M,selectionRef:d,validation:E,readOnly:b,required:j,alignItemWithTriggerActiveRef:A,disabled:L,keyboardActiveRef:Q}=We(),_=T||L||c,te=B(k,$.open),ye=B(k,$.value),X=B(k,$.triggerProps),Z=B(k,$.positionerElement),K=B(k,$.listElement),ge=B(k,$.id),W=B(k,$.hasSelectedValue),D=!W&&te,ae=B(k,$.hasNullItemLabel,D),R=o??ge;Er({id:R});const H=$e(Z),C=n.useRef(null),{getButtonProps:v,buttonRef:de}=Jt({disabled:_,native:l}),P=Ne(re=>{k.set("triggerElement",re)}),oe=Yt(a,C,de,P),J=Ge(),I=Ge(),U=Ge(),be=Ge();n.useEffect(()=>{if(te)return!(W||ae)?U.start(Na,()=>{d.current.allowUnselectedMouseUp=!0,d.current.allowSelectedMouseUp=!0}):be.start(dr,()=>{d.current.allowUnselectedMouseUp=!0,U.start(dr,()=>{d.current.allowSelectedMouseUp=!0})}),()=>{U.clear(),be.clear()};d.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},I.clear()},[te,W,ae,d,I,U,be]);const ke=n.useMemo(()=>K?.id??br(Z)?.id,[K,Z]),F=Gt(X,{id:R,role:"combobox","aria-expanded":te?"true":"false","aria-haspopup":"listbox","aria-controls":te?ke:void 0,"aria-labelledby":x,"aria-readonly":b||void 0,"aria-required":j||void 0,tabIndex:_?-1:0,ref:oe,onFocus(re){f(!0),te&&A.current&&M(!1,Ee(Ct,re.nativeEvent)),J.start(0,()=>{k.set("forceMount",!0)})},onBlur(re){st(Z,re.relatedTarget)||(y(!0),f(!1),m==="onBlur"&&E.commit(ye))},onPointerMove(){Q.current=!1},onKeyDown(){Q.current=!0},onMouseDown(re){if(te)return;const we=Ht(re.currentTarget);function me(ue){if(!C.current)return;const q=ue.target;if(st(C.current,q)||st(H.current,q)||q===C.current)return;const ne=Sa(C.current);ue.clientX>=ne.left-ht&&ue.clientX<=ne.right+ht&&ue.clientY>=ne.top-ht&&ue.clientY<=ne.bottom+ht||M(!1,Ee(kn,ue))}I.start(0,()=>{we.addEventListener("mouseup",me,{once:!0})})}},E.getValidationProps,p,v);F.role="combobox";const xe=n.useMemo(()=>({...h,open:te,disabled:_,value:ye,readOnly:b,placeholder:!W}),[h,te,_,ye,b,W]);return De("button",t,{ref:[a,C],state:xe,stateAttributesMapping:Ra,props:F})}),Ca={value:()=>null},Vr=n.forwardRef(function(t,a){const{className:s,render:u,children:o,placeholder:c,...l}=t,{store:p,valueRef:y}=We(),f=B(p,$.value),m=B(p,$.items),h=B(p,$.itemToStringLabel),T=B(p,$.hasSelectedValue),x=!T&&c!=null&&o==null,k=B(p,$.hasNullItemLabel,x),M=n.useMemo(()=>({value:f,placeholder:!T}),[f,T]);let d=null;return typeof o=="function"?d=o(f):o!=null?d=o:!T&&c!=null&&!k?d=c:Array.isArray(f)?d=ka(f,m,h):d=Pr(f,m,h),De("span",t,{state:M,ref:[a,y],props:[{children:d},l],stateAttributesMapping:Ca})}),Dr=n.forwardRef(function(t,a){const{className:s,render:u,...o}=t,{store:c}=We(),l=B(c,$.open),p=n.useMemo(()=>({open:l}),[l]);return De("span",t,{state:p,ref:a,props:[{"aria-hidden":!0,children:"▼"},o],stateAttributesMapping:vn})}),Ia=n.createContext(void 0),Fr=n.forwardRef(function(t,a){const{store:s}=We(),u=B(s,$.mounted),o=B(s,$.forceMount);return u||o?r.jsx(Ia.Provider,{value:!0,children:r.jsx(jn,{ref:a,...t})}):null}),$r=n.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Ma(){return n.useContext($r)}function Ea(e){const{children:t,elementsRef:a,labelsRef:s,onMapChange:u}=e,o=Ne(u),c=n.useRef(0),l=$t(Pa).current,p=$t(Ta).current,[y,f]=n.useState(0),m=n.useRef(y),h=Ne((d,E)=>{p.set(d,E??null),m.current+=1,f(m.current)}),T=Ne(d=>{p.delete(d),m.current+=1,f(m.current)}),x=n.useMemo(()=>{const d=new Map;return Array.from(p.keys()).filter(b=>b.isConnected).sort(Oa).forEach((b,j)=>{const A=p.get(b)??{};d.set(b,{...A,index:j})}),d},[p,y]);ee(()=>{if(typeof MutationObserver!="function"||x.size===0)return;const d=new MutationObserver(E=>{const b=new Set,j=A=>b.has(A)?b.delete(A):b.add(A);E.forEach(A=>{A.removedNodes.forEach(j),A.addedNodes.forEach(j)}),b.size===0&&(m.current+=1,f(m.current))});return x.forEach((E,b)=>{b.parentElement&&d.observe(b.parentElement,{childList:!0})}),()=>{d.disconnect()}},[x]),ee(()=>{m.current===y&&(a.current.length!==x.size&&(a.current.length=x.size),s&&s.current.length!==x.size&&(s.current.length=x.size),c.current=x.size),o(x)},[o,x,a,s,y]),ee(()=>()=>{a.current=[]},[a]),ee(()=>()=>{s&&(s.current=[])},[s]);const k=Ne(d=>(l.add(d),()=>{l.delete(d)}));ee(()=>{l.forEach(d=>d(x))},[l,x]);const M=n.useMemo(()=>({register:h,unregister:T,subscribeMapChange:k,elementsRef:a,labelsRef:s,nextIndexRef:c}),[h,T,k,a,s,c]);return r.jsx($r.Provider,{value:M,children:t})}function Ta(){return new Map}function Pa(){return new Set}function Oa(e,t){const a=e.compareDocumentPosition(t);return a&Node.DOCUMENT_POSITION_FOLLOWING||a&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:a&Node.DOCUMENT_POSITION_PRECEDING||a&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Hr=n.createContext(void 0);function Aa(){const e=n.useContext(Hr);if(!e)throw new Error(Xe(59));return e}function wt(e,t){e&&Object.assign(e.style,t)}const _a={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},La={position:"fixed"},Ur=n.forwardRef(function(t,a){const{anchor:s,positionMethod:u="absolute",className:o,render:c,side:l="bottom",align:p="center",sideOffset:y=0,alignOffset:f=0,collisionBoundary:m="clipping-ancestors",collisionPadding:h,arrowPadding:T=5,sticky:x=!1,disableAnchorTracking:k,alignItemWithTrigger:M=!0,collisionAvoidance:d=Sn,...E}=t,{store:b,listRef:j,labelsRef:A,alignItemWithTriggerActiveRef:L,selectedItemTextRef:Q,valuesRef:_,initialValueRef:te,popupRef:ye,setValue:X}=We(),Z=Mr(),K=B(b,$.open),ge=B(b,$.mounted),W=B(b,$.modal),D=B(b,$.value),ae=B(b,$.openMethod),R=B(b,$.positionerElement),H=B(b,$.triggerElement),C=B(b,$.isItemEqualToValue),v=n.useRef(null),de=n.useRef(null),[P,oe]=n.useState(M),J=ge&&P&&ae!=="touch";!ge&&P!==M&&oe(M),ee(()=>{ge||($.scrollUpArrowVisible(b.state)&&b.set("scrollUpArrowVisible",!1),$.scrollDownArrowVisible(b.state)&&b.set("scrollDownArrowVisible",!1))},[b,ge]),n.useImperativeHandle(L,()=>J),Nn((J||W)&&K&&ae!=="touch",H);const I=Bn({anchor:s,floatingRootContext:Z,positionMethod:u,mounted:ge,side:l,sideOffset:y,align:p,alignOffset:f,arrowPadding:T,collisionBoundary:m,collisionPadding:h,sticky:x,disableAnchorTracking:k??J,collisionAvoidance:d,keepMounted:!0}),U=J?"none":I.side,be=J?La:I.positionerStyles,ke=n.useMemo(()=>{const q={};return K||(q.pointerEvents="none"),{role:"presentation",hidden:!ge,style:{...be,...q}}},[K,ge,be]),F=n.useMemo(()=>({open:K,side:U,align:I.align,anchorHidden:I.anchorHidden}),[K,U,I.align,I.anchorHidden]),xe=Ne(q=>{b.set("positionerElement",q)}),re=De("div",t,{ref:[a,xe],state:F,stateAttributesMapping:jr,props:[ke,E]}),we=n.useRef(0),me=Ne(q=>{if(q.size===0&&we.current===0||_.current.length===0)return;const ne=we.current;if(we.current=q.size,q.size===ne)return;const ve=Ee(Ct);if(ne!==0&&!b.state.multiple&&D!==null&&zt(_.current,D,C)===-1){const ie=te.current,he=ie!=null&&Dt(_.current,ie,C)?ie:null;X(he,ve),he===null&&(b.set("selectedIndex",null),Q.current=null)}if(ne!==0&&b.state.multiple&&Array.isArray(D)){const se=D.filter(ie=>Dt(_.current,ie,C));(se.length!==D.length||se.some(ie=>!Dt(D,ie,C)))&&(X(se,ve),se.length===0&&(b.set("selectedIndex",null),Q.current=null))}if(K&&J){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const se={height:""};wt(R,se),wt(ye.current,se)}}),ue=n.useMemo(()=>({...I,side:U,alignItemWithTriggerActive:J,setControlledAlignItemWithTrigger:oe,scrollUpArrowRef:v,scrollDownArrowRef:de}),[I,U,J,oe]);return r.jsx(Ea,{elementsRef:j,labelsRef:A,onMapChange:me,children:r.jsxs(Hr.Provider,{value:ue,children:[ge&&W&&r.jsx(Rn,{inert:Cn(!K),cutout:H}),re]})})});function Br(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",ur={className:pt,getElement(e){return r.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}};function Va(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}const Da=n.createContext(void 0),Fa={disableStyleElements:!1};function $a(){return n.useContext(Da)??Fa}const Ha={...jr,...Xt},zr=n.forwardRef(function(t,a){const{render:s,className:u,...o}=t,{store:c,popupRef:l,onOpenChangeComplete:p,setOpen:y,valueRef:f,selectedItemTextRef:m,keyboardActiveRef:h,multiple:T,handleScrollArrowVisibility:x,scrollHandlerRef:k,highlightItemOnHover:M}=We(),{side:d,align:E,alignItemWithTriggerActive:b,setControlledAlignItemWithTrigger:j,scrollDownArrowRef:A,scrollUpArrowRef:L}=Aa(),Q=zn()!=null,_=Mr(),{nonce:te,disableStyleElements:ye}=$a(),X=Ge(),Z=B(c,$.id),K=B(c,$.open),ge=B(c,$.mounted),W=B(c,$.popupProps),D=B(c,$.transitionStatus),ae=B(c,$.triggerElement),R=B(c,$.positionerElement),H=B(c,$.listElement),C=n.useRef(0),v=n.useRef(!1),de=n.useRef(0),P=n.useRef(!1),oe=n.useRef({}),J=In(),I=Ne(F=>{if(!R||!l.current||!P.current)return;if(v.current||!b){x();return}const xe=R.style.top==="0px",re=R.style.bottom==="0px",we=R.getBoundingClientRect().height,me=Ht(R),ue=getComputedStyle(R),q=parseFloat(ue.marginTop),ne=parseFloat(ue.marginBottom),ve=fr(getComputedStyle(l.current)),se=me.documentElement.clientHeight-q-ne,ie=F.scrollTop,Ce=F.scrollHeight,he=F.clientHeight,g=Ce-he;let V=0,N=null,G=!1;if(xe){const i=g-ie,w=we+i,O=Math.min(w,se);V=O,O!==se?N=g:G=!0}else if(re){const i=ie-0,w=we+i,O=Math.min(w,se),Y=w-se;V=O,O!==se?N=0:(G=!0,ie<g&&(N=ie-(i-Y)))}V!==0&&(R.style.height=`${V}px`),N!=null&&(F.scrollTop=N),(G||V>=ve)&&(v.current=!0),x()});n.useImperativeHandle(k,()=>I,[I]),Rt({open:K,ref:l,onComplete(){K&&p?.(!0)}});const U=n.useMemo(()=>({open:K,transitionStatus:D,side:d,align:E}),[K,D,d,E]);ee(()=>{!R||!l.current||Object.keys(oe.current).length||(oe.current={top:R.style.top||"0",left:R.style.left||"0",right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[l,R]),ee(()=>{K||b||(P.current=!1,v.current=!1,C.current=0,de.current=0,wt(R,oe.current))},[K,b,R,l]),ee(()=>{const F=l.current;if(!(!K||!ae||!R||!F||c.state.transitionStatus==="ending")){if(!b){P.current=!0,J.request(x),F.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const xe=Ba(F);F.style.removeProperty("--transform-origin");try{const re=getComputedStyle(R),we=getComputedStyle(F),me=Ht(ae),ue=sr(R),q=ae.getBoundingClientRect(),ne=R.getBoundingClientRect(),ve=q.left,se=q.height,ie=H||F,Ce=ie.scrollHeight,he=parseFloat(we.borderBottomWidth),g=parseFloat(re.marginTop)||10,V=parseFloat(re.marginBottom)||10,N=parseFloat(re.minHeight)||100,G=fr(we),i=5,w=5,O=20,Y=me.documentElement.clientHeight-g-V,le=me.documentElement.clientWidth,ce=Y-q.bottom+se,pe=m.current,Re=f.current;let Se,Oe=0,Je=0;if(pe&&Re){const z=Re.getBoundingClientRect();Se=pe.getBoundingClientRect();const je=z.left-ve,Ae=Se.left-ne.left,_e=z.top-q.top+z.height/2,Te=Se.top-ne.top+Se.height/2;Oe=je-Ae,Je=Te-_e}const nt=ce+Je+V+he;let Fe=Math.min(Y,nt);const Tt=Y-g-V,Qe=nt-Fe,Ze=Math.max(i,ve+Oe),ct=le-w,at=Math.max(0,Ze+ne.width-ct);R.style.left=`${Ze-at}px`,R.style.height=`${Fe}px`,R.style.maxHeight="auto",R.style.marginTop=`${g}px`,R.style.marginBottom=`${V}px`,F.style.height="100%";const dt=ie.scrollHeight-ie.clientHeight,ut=Qe>=dt;ut&&(Fe=Math.min(Y,ne.height)-(Qe-dt));const Pt=q.top<O||q.bottom>Y-O||Fe<Math.min(Ce,N),Ot=(ue.visualViewport?.scale??1)!==1&&Mn;if(Pt||Ot){P.current=!0,wt(R,oe.current),yr.flushSync(()=>j(!1));return}if(ut){const z=Math.max(0,Y-nt);R.style.top=ne.height>=Tt?"0":`${z}px`,R.style.height=`${Fe}px`,ie.scrollTop=ie.scrollHeight-ie.clientHeight,C.current=Math.max(N,Fe)}else R.style.bottom="0",C.current=Math.max(N,Fe),ie.scrollTop=Qe;if(Se){const z=ne.top,je=ne.height,Ae=Se.top+Se.height/2,_e=je>0?(Ae-z)/je*100:50,Te=Va(_e,0,100);F.style.setProperty("--transform-origin",`50% ${Te}%`)}(C.current===Y||Fe>=G)&&(v.current=!0),x(),setTimeout(()=>{P.current=!0})}finally{xe()}})}},[c,K,R,ae,f,m,l,x,b,j,J,A,L,H]),n.useEffect(()=>{if(!b||!R||!K)return;const F=sr(R);function xe(re){y(!1,Ee(Tn,re))}return F.addEventListener("resize",xe),()=>{F.removeEventListener("resize",xe)}},[y,b,R,K]);const be={...H?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":T||void 0,id:`${Z}-list`},onKeyDown(F){h.current=!0,Q&&Pn.has(F.key)&&F.stopPropagation()},onMouseMove(){h.current=!1},onPointerLeave(F){if(!M||Br(F)||F.pointerType==="touch")return;const xe=F.currentTarget;X.start(0,()=>{c.set("activeIndex",null),xe.focus({preventScroll:!0})})},onScroll(F){H||k.current?.(F.currentTarget)},...b&&{style:H?{height:"100%"}:_a}},ke=De("div",t,{ref:[a,l],state:U,stateAttributesMapping:Ha,props:[W,be,Kn(D),{className:!H&&b?ur.className:void 0},o]});return r.jsxs(n.Fragment,{children:[!ye&&ur.getElement(te),r.jsx(En,{context:_,modal:!1,disabled:!ge,restoreFocus:!0,children:ke})]})});function fr(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const gr={transform:"none",scale:"1",translate:"0 0"};function Ua(e,t,a){a?e.setProperty(t,a):e.removeProperty(t)}function Ba(e){const{style:t}=e,a={},s=Object.keys(gr);for(const u of s)a[u]=t.getPropertyValue(u),t.setProperty(u,gr[u]);return()=>{for(const u of s)Ua(t,u,a[u])}}let Kr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function za(e={}){const{label:t,metadata:a,textRef:s,indexGuessBehavior:u,index:o}=e,{register:c,unregister:l,subscribeMapChange:p,elementsRef:y,labelsRef:f,nextIndexRef:m}=Ma(),h=n.useRef(-1),[T,x]=n.useState(o??(u===Kr.GuessFromOrder?()=>{if(h.current===-1){const d=m.current;m.current+=1,h.current=d}return h.current}:-1)),k=n.useRef(null),M=n.useCallback(d=>{if(k.current=d,T!==-1&&d!==null&&(y.current[T]=d,f)){const E=t!==void 0;f.current[T]=E?t:s?.current?.textContent??d.textContent}},[T,y,f,t,s]);return ee(()=>{if(o!=null)return;const d=k.current;if(d)return c(d,a),()=>{l(d)}},[o,c,l,a]),ee(()=>{if(o==null)return p(d=>{const E=k.current?d.get(k.current)?.index:null;E!=null&&x(E)})},[o,p,x]),n.useMemo(()=>({ref:M,index:T}),[T,M])}const Wr=n.createContext(void 0);function tr(){const e=n.useContext(Wr);if(!e)throw new Error(Xe(57));return e}const kt=n.memo(n.forwardRef(function(t,a){const{render:s,className:u,value:o=null,label:c,disabled:l=!1,nativeButton:p=!1,...y}=t,f=n.useRef(null),m=za({label:c,textRef:f,indexGuessBehavior:Kr.GuessFromOrder}),{store:h,getItemProps:T,setOpen:x,setValue:k,selectionRef:M,typingRef:d,valuesRef:E,keyboardActiveRef:b,multiple:j,highlightItemOnHover:A}=We(),L=Ge(),Q=B(h,$.isActive,m.index),_=B(h,$.isSelected,m.index,o),te=B(h,$.isSelectedByFocus,m.index),ye=B(h,$.isItemEqualToValue),X=m.index,Z=X!==-1,K=n.useRef(null),ge=$e(X);ee(()=>{if(!Z)return;const I=E.current;return I[X]=o,()=>{delete I[X]}},[Z,X,o,E]),ee(()=>{if(!Z)return;const I=h.state.value;let U=I;j&&Array.isArray(I)&&I.length>0&&(U=I[I.length-1]),U!==void 0&&rt(U,o,ye)&&h.set("selectedIndex",X)},[Z,X,j,ye,h,o]);const W=n.useMemo(()=>({disabled:l,selected:_,highlighted:Q}),[l,_,Q]),D=T({active:Q,selected:_});D.onFocus=void 0,D.id=void 0;const ae=n.useRef(null),R=n.useRef("mouse"),H=n.useRef(!1),{getButtonProps:C,buttonRef:v}=Jt({disabled:l,focusableWhenDisabled:!0,native:p});function de(I){const U=h.state.value;if(j){const be=Array.isArray(U)?U:[],ke=_?ya(be,o,ye):[...be,o];k(ke,Ee(_t,I))}else k(o,Ee(_t,I)),x(!1,Ee(_t,I))}const P={role:"option","aria-selected":_,tabIndex:Q?0:-1,onFocus(){h.set("activeIndex",X)},onMouseEnter(){!b.current&&h.state.selectedIndex===null&&h.set("activeIndex",X)},onMouseMove(){A&&h.set("activeIndex",X)},onMouseLeave(I){!A||b.current||Br(I)||L.start(0,()=>{h.state.activeIndex===X&&h.set("activeIndex",null)})},onTouchStart(){M.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(I){ae.current=I.key,h.set("activeIndex",X)},onClick(I){H.current=!1,!(I.type==="keydown"&&ae.current===null)&&(l||ae.current===" "&&d.current||R.current!=="touch"&&!Q||(ae.current=null,de(I.nativeEvent)))},onPointerEnter(I){R.current=I.pointerType},onPointerDown(I){R.current=I.pointerType,H.current=!0},onMouseUp(I){if(l)return;if(H.current){H.current=!1;return}const U=!M.current.allowSelectedMouseUp&&_,be=!M.current.allowUnselectedMouseUp&&!_;U||be||R.current!=="touch"&&!Q||de(I.nativeEvent)}},oe=De("div",t,{ref:[v,a,m.ref,K],state:W,props:[D,P,y,C]}),J=n.useMemo(()=>({selected:_,indexRef:ge,textRef:f,selectedByFocus:te,hasRegistered:Z}),[_,ge,f,te,Z]);return r.jsx(Wr.Provider,{value:J,children:oe})})),vt=n.forwardRef(function(t,a){const s=t.keepMounted??!1,{selected:u}=tr();return s||u?r.jsx(Ka,{...t,ref:a}):null}),Ka=n.memo(n.forwardRef((e,t)=>{const{render:a,className:s,keepMounted:u,...o}=e,{selected:c}=tr(),l=n.useRef(null),{transitionStatus:p,setMounted:y}=qt(c),f=n.useMemo(()=>({selected:c,transitionStatus:p}),[c,p]),m=De("span",e,{ref:[t,l],state:f,props:[{"aria-hidden":!0,children:"✔️"},o],stateAttributesMapping:Xt});return Rt({open:c,ref:l,onComplete(){c||y(!1)}}),m})),jt=n.memo(n.forwardRef(function(t,a){const{indexRef:s,textRef:u,selectedByFocus:o,hasRegistered:c}=tr(),{selectedItemTextRef:l}=We(),{className:p,render:y,...f}=t,m=n.useCallback(T=>{if(!T||!c)return;const x=l.current===null||!l.current.isConnected;(o||x&&s.current===0)&&(l.current=T)},[l,s,o,c]);return De("div",t,{ref:[m,a,u],props:f})})),Wa=n.forwardRef(function(t,a){const{render:s,className:u,id:o,...c}=t,{store:l}=On(),p=bt(o);return l.useSyncedValueWithCleanup("descriptionElementId",p),De("p",t,{ref:a,props:[{id:p},c]})});function qa({open:e,title:t,description:a,confirmLabel:s,cancelLabel:u,destructive:o=!1,busy:c=!1,onConfirm:l,onCancel:p}){return r.jsx(An,{open:e,onOpenChange:y=>{!y&&!c&&p?.()},children:r.jsxs(_n,{children:[r.jsx(Ln,{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"}),r.jsx(Vn,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:r.jsxs(Dn,{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:[r.jsx(Fn,{className:"text-base font-semibold text-oai-black dark:text-white",children:t}),a?r.jsx(Wa,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a}):null,r.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[r.jsx(Ve,{type:"button",variant:"secondary",size:"sm",disabled:c,onClick:()=>p?.(),children:u}),r.jsx(Ve,{type:"button",size:"sm",disabled:c,onClick:()=>l?.(),className:Ue(o&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:s})]})]})})]})})}function qr({id:e,value:t,onChange:a,placeholder:s,disabled:u=!1,type:o="text",label:c,error:l,className:p="",...y}){const f=n.useId(),m=e||f,h=l?`${m}-error`:void 0,M=`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 ${u?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${l?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${p}`;return r.jsxs("div",{className:"w-full",children:[c&&r.jsx("label",{htmlFor:m,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:c}),r.jsx("input",{id:m,type:o,value:t,onChange:a,placeholder:s,disabled:u,"aria-invalid":l?!0:void 0,"aria-describedby":h,className:M,...y}),l&&r.jsx("p",{id:h,className:"mt-1.5 text-sm text-oai-error",children:l})]})}const Ga="tt:hint:dismissed:";function Gr(e){return Ga+e}function Ya(e){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Gr(e))==="1"}catch{return!1}}function Xa({id:e,children:t,className:a,ariaLabel:s}){const[u,o]=n.useState(()=>Ya(e)),c=n.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(Gr(e),"1")}catch{}o(!0)},[e]);return u?null:r.jsxs("div",{role:"note","aria-label":s||S("hint.dismissible_aria"),className:Ue("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",a),children:[r.jsx("button",{type:"button",onClick:c,"aria-label":S("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:r.jsx(Nt,{className:"h-4 w-4","aria-hidden":"true"})}),r.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[r.jsx($n,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),r.jsx("div",{className:"min-w-0 flex-1",children:t})]})]})}let mr=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.indeterminate="data-indeterminate",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",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})({});function Yr(e){return n.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[mr.checked]:""}:{[mr.unchecked]:""}},...Qt}),[e.indeterminate])}const Ja=n.createContext({disabled:!1});function Qa(){return n.useContext(Ja)}const Za=n.createContext(void 0);function es(e=!0){const t=n.useContext(Za);if(t===void 0&&!e)throw new Error(Xe(3));return t}const Xr=n.createContext(void 0);function ts(){const e=n.useContext(Xr);if(e===void 0)throw new Error(Xe(14));return e}const rs="data-parent",ns=n.forwardRef(function(t,a){const{checked:s,className:u,defaultChecked:o=!1,disabled:c=!1,id:l,indeterminate:p=!1,inputRef:y,name:f,onCheckedChange:m,parent:h=!1,readOnly:T=!1,render:x,required:k=!1,uncheckedValue:M,value:d,nativeButton:E=!1,...b}=t,{clearErrors:j}=er(),{disabled:A,name:L,setDirty:Q,setFilled:_,setFocused:te,setTouched:ye,state:X,validationMode:Z,validityData:K,shouldValidateOnChange:ge,validation:W}=Mt(),D=Qa(),{labelId:ae,controlId:R,setControlId:H,getDescriptionProps:C}=Zt(),v=es(),de=v?.parent,P=de&&v.allValues,oe=A||D.disabled||v?.disabled||c,J=L??f,I=d??J,U=bt(),be=bt();let ke=R;P?ke=h?be:`${de.id}-${I}`:l&&(ke=l);let F={};P&&(h?F=v.parent.getParentProps():I&&(F=v.parent.getChildProps(I)));const xe=Ne(m),{checked:re=s,indeterminate:we=p,onCheckedChange:me,...ue}=F,q=v?.value,ne=v?.setValue,ve=v?.defaultValue,se=n.useRef(null),{getButtonProps:ie,buttonRef:Ce}=Jt({disabled:oe,native:E}),he=v?.validation??W,[g,V]=Bt({controlled:I&&q&&!h?q.includes(I):re,default:I&&ve&&!h?ve.includes(I):o,name:"Checkbox",state:"checked"});ee(()=>{if(H!==Le)return H(ke),()=>{H(void 0)}},[ke,v,H,h]),Or({enabled:!v,id:U,commit:he.commit,value:g,controlRef:se,name:J,getValue:()=>g});const N=n.useRef(null),G=Yt(y,N,he.inputRef);ee(()=>{N.current&&(N.current.indeterminate=we,g&&_(!0))},[g,we,_]),Ar(g,()=>{v&&!h||(j(J),_(g),Q(g!==K.initialValue),ge()?he.commit(g):he.commit(g,!0))});const i=Gt({checked:g,disabled:oe,name:h?void 0:J,id:E?void 0:ke??void 0,required:k,ref:G,style:J?kr:vr,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(pe){if(pe.nativeEvent.defaultPrevented)return;const Re=pe.target.checked,Se=Ee(Ct,pe.nativeEvent);if(me?.(Re,Se),xe(Re,Se),!Se.isCanceled&&(V(Re),I&&q&&ne&&!h)){const Oe=Re?[...q,I]:q.filter(Je=>Je!==I);ne(Oe,Se)}},onFocus(){se.current?.focus()}},d!==void 0?{value:(v?g&&d:d)||""}:yt,C,v?he.getValidationProps:he.getInputValidationProps),w=P?!!re:g,O=P&&we||p;n.useEffect(()=>{de&&I&&de.disabledStatesRef.current.set(I,oe)},[de,oe,I]);const Y=n.useMemo(()=>({...X,checked:w,disabled:oe,readOnly:T,required:k,indeterminate:O}),[X,w,oe,T,k,O]),le=Yr(Y),ce=De("span",t,{state:Y,ref:[Ce,se,a,v?.registerControlRef],props:[{id:E?ke??void 0:U,role:"checkbox","aria-checked":we?"mixed":g,"aria-readonly":T||void 0,"aria-required":k||void 0,"aria-labelledby":ae,[rs]:h?"":void 0,onFocus(){te(!0)},onBlur(){const pe=N.current;pe&&(ye(!0),te(!1),Z==="onBlur"&&he.commit(v?q:pe.checked))},onClick(pe){T||oe||(pe.preventDefault(),N.current?.click())}},C,he.getValidationProps,b,ue,ie],stateAttributesMapping:le});return r.jsxs(Xr.Provider,{value:Y,children:[ce,!g&&!v&&J&&!h&&M!==void 0&&r.jsx("input",{type:"hidden",name:J,value:M}),r.jsx("input",{...i})]})}),as=n.forwardRef(function(t,a){const{render:s,className:u,keepMounted:o=!1,...c}=t,l=ts(),p=l.checked||l.indeterminate,{transitionStatus:y,setMounted:f}=qt(p),m=n.useRef(null),h=n.useMemo(()=>({...l,transitionStatus:y}),[l,y]);Rt({open:p,ref:m,onComplete(){p||f(!1)}});const T=Yr(l),x=n.useMemo(()=>({...T,...Xt,...Qt}),[T]),k=o||p,M=De("span",t,{enabled:k,ref:[a,m],state:h,stateAttributesMapping:x,props:c});return k?M:null});function ss(e,t){return`target:${e}:${t}`}function os(e){return`remove:${e.id||e.directory}`}function is({skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o}){return r.jsx(Qr,{children:e?r.jsx(ls,{skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o},e.id||e.directory):null})}function ls({skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o}){const c=Qn(),l=n.useRef(null);n.useEffect(()=>{const x=M=>{M.key==="Escape"&&(M.stopPropagation(),s?.())},k=M=>{const d=M.target;d instanceof Element&&(l.current?.contains(d)||d.closest('[data-skill-row="1"]')||s?.())};return document.addEventListener("keydown",x),document.addEventListener("mousedown",k),()=>{document.removeEventListener("keydown",x),document.removeEventListener("mousedown",k)}},[s]);const p=e.name||e.directory,y=!!(e.repoOwner&&e.repoName),f=y?`https://github.com/${e.repoOwner}/${e.repoName}`:null,m=new Set(e.targets||[]),h=a===os(e),T=c?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return r.jsxs(r.Fragment,{children:[r.jsx(rr.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:c?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:c?0:.15},onClick:s,"aria-hidden":!0}),r.jsxs(rr.aside,{ref:l,role:"complementary","aria-label":p,initial:c?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:c?{opacity:0}:{opacity:0,x:24,scale:.98},transition:T,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[r.jsxs("header",{className:"flex items-start gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:p,children:p}),y?r.jsxs("a",{href:f,target:"_blank",rel:"noreferrer noopener",className:"mt-1 inline-flex max-w-full items-center gap-1 truncate text-xs text-oai-gray-500 transition-colors hover:text-oai-black hover:underline dark:text-oai-gray-400 dark:hover:text-white",title:f,children:[r.jsxs("span",{className:"truncate",children:[e.repoOwner,"/",e.repoName]}),r.jsx(Ut,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):r.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:e.directory,children:e.directory})]}),r.jsx("button",{type:"button",onClick:s,"aria-label":S("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:r.jsx(Nt,{className:"h-4 w-4","aria-hidden":!0})})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[e.description?r.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:e.description}):null,r.jsxs("section",{className:e.description?"mt-6":"",children:[r.jsx("h3",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.detail.sync_section_title")}),r.jsx("div",{className:"overflow-hidden rounded-xl bg-white/40 ring-1 ring-white/50 dark:bg-white/[0.02] dark:ring-white/10",children:(t||[]).map((x,k)=>{const M=m.has(x.id),d=a===ss(e.id,x.id),E=k===(t||[]).length-1,b=`skill-detail-sync-${e.id||e.directory}-${x.id}`;return r.jsxs("label",{htmlFor:b,className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 text-sm text-oai-black transition-colors hover:bg-white/40 dark:text-white dark:hover:bg-white/[0.04]"+(E?"":" border-b border-white/40 dark:border-white/[0.06]"),children:[r.jsx(ns,{id:b,checked:M,disabled:d,onCheckedChange:j=>u?.(e,x.id,!!j),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:r.jsx(as,{className:"flex items-center justify-center text-white dark:text-oai-black",children:r.jsx(Ye,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),r.jsx(tt,{provider:x.id,size:16}),r.jsx("span",{className:"flex-1",children:x.label}),d?r.jsx(Ke,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},x.id)})})]})]}),r.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[r.jsxs("button",{type:"button",onClick:()=>o?.(e),disabled:h,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[h?r.jsx(Ke,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":!0}),S("skills.detail.remove_button")]}),r.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.detail.remove_confirm_hint")})]})]})]})}const Jr="tokentracker-skills";async function Et(e){const t=new URL(`/functions/${Jr}`,window.location.origin);if(e)for(const[u,o]of Object.entries(e))o!=null&&o!==""&&t.searchParams.set(u,String(o));const a=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),s=await a.json().catch(()=>null);if(!a.ok)throw new Error(s?.error||`Request failed with HTTP ${a.status}`);return s}async function qe(e){const t=await Zr(),a=await fetch(`/functions/${Jr}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...t},cache:"no-store",body:JSON.stringify(e)}),s=await a.json().catch(()=>null);if(!a.ok||s?.ok===!1)throw new Error(s?.error||`Request failed with HTTP ${a.status}`);return s}function cs(){return Et({mode:"installed"})}function ds(e={}){return Et({mode:"discover",...e.force?{force:1}:{}})}function us(e,t=0,a=20){return Et({mode:"search",q:e,offset:t,limit:a})}function fs(){return Et({mode:"repos"})}function gs(e,t){return qe({action:"install",skill:e,targets:t})}function ms(e){return qe({action:"uninstall",id:e})}function hs(e){return qe({action:"restore",id:e})}function ps(e,t){return qe({action:"set_targets",id:e,targets:t})}function xs(e,t){return qe({action:"import_local",directory:e,targets:t})}function ys(e,t){return qe({action:"delete_local",directory:e,targets:t||[]})}function bs(e){return qe({action:"add_repo",repo:e})}function ws(e,t){return qe({action:"remove_repo",owner:e,name:t})}const ks=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),hr=["claude","codex"],vs={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},He="all",Pe="skillssh";function xt(e){return`${e.repoOwner||"local"}/${e.repoName||"local"}:${e.directory}`}function pr(e){return`install:${xt(e)}`}function xr(e){return`remove:${e.id||e.directory}`}function js(e,t){return`target:${e}:${t}`}function Ss({target:e}){return r.jsxs("span",{className:"inline-flex h-6 items-center gap-1.5 rounded-full bg-oai-gray-100 px-2 text-[11px] font-medium text-oai-gray-700 ring-1 ring-oai-gray-200/70 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:ring-oai-gray-700/70",children:[r.jsx("span",{className:Ue("flex h-3.5 w-3.5 items-center justify-center",vs[e.id]),"aria-hidden":!0,children:r.jsx(tt,{provider:e.id,size:14})}),e.label]})}function Ns({skill:e,targets:t}){const a=new Set(e.targets||[]),s=t.filter(o=>a.has(o.id));if(!s.length)return r.jsx("span",{className:"text-xs italic text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.target.synced_none")});const u=s.map(o=>o.label).join(", ");return r.jsx("div",{className:"flex flex-wrap gap-1","aria-label":S("skills.target.synced_summary",{targets:u}),children:s.map(o=>r.jsx(Ss,{target:o},o.id))})}function Rs({skill:e,targets:t,selected:a,onSelect:s}){const u=e.repoOwner&&e.repoName?`${e.repoOwner}/${e.repoName}`:null,o=u?`${e.directory} · ${u}`:e.directory,c=l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),s?.(e))};return r.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":a,"aria-label":S("skills.row.open_details",{name:e.name||e.directory}),onClick:()=>s?.(e),onKeyDown:c,className:Ue("flex cursor-pointer flex-col gap-3 rounded-md px-3 py-3 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 lg:flex-row lg:items-center lg:gap-4",a?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[r.jsxs("div",{className:"min-w-0 flex-1",title:o,children:[r.jsx("h2",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:e.name||e.directory}),e.description?r.jsx("p",{className:"mt-0.5 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e.description}):null]}),r.jsx("div",{className:"flex items-center gap-2 lg:gap-3",children:r.jsx(Ns,{skill:e,targets:t})}),r.jsx(Jn,{className:Ue("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",a&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]})}function Cs({agentFilter:e,agentOptions:t,onAgentFilter:a,filteredCount:s,totalCount:u,anyFilter:o,onClearFilters:c}){return r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[r.jsxs(_r,{value:e,onValueChange:a,children:[r.jsxs(Lr,{"aria-label":S("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[r.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[S("skills.filter.agent_label"),":"]}),r.jsx(Vr,{children:l=>l==="all"?S("skills.filter.agent_all"):t.find(p=>p.id===l)?.label||l}),r.jsx(Dr,{className:"text-oai-gray-400",children:r.jsx(Sr,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),r.jsx(Fr,{children:r.jsx(Ur,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:r.jsxs(zr,{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 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[r.jsxs(kt,{value:"all",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:[r.jsx(jt,{children:S("skills.filter.agent_all")}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),t.map(l=>r.jsxs(kt,{value:l.id,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:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tt,{provider:l.id,size:14}),r.jsx(jt,{children:l.label})]}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},l.id))]})})})]}),r.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.filter.result_count",{filtered:s,total:u})}),o?r.jsxs("button",{type:"button",onClick:c,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[r.jsx(Nt,{className:"h-3 w-3","aria-hidden":!0}),S("skills.filter.clear")]}):null]})}function Is({items:e,totalCount:t,targets:a,agentOptions:s,agentFilter:u,onAgentFilter:o,anyFilter:c,onClearFilters:l,selectedId:p,onSelect:y}){return r.jsxs("div",{children:[r.jsx(Cs,{agentFilter:u,agentOptions:s,onAgentFilter:o,filteredCount:e.length,totalCount:t,anyFilter:c,onClearFilters:l}),e.length===0?r.jsxs("div",{className:"flex flex-col items-center gap-3 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:[r.jsx("p",{children:S("skills.empty.no_match")}),r.jsx(Ve,{type:"button",variant:"secondary",size:"sm",onClick:l,children:S("skills.filter.clear")})]}):r.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(f=>r.jsx(Rs,{skill:f,targets:a,selected:p===(f.id||f.directory),onSelect:y},f.id||f.key))})]})}const Ms={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Es=rn.memo(function({skill:t,installed:a,installing:s,allTargets:u,defaultTargets:o,onInstall:c}){const[l,p]=n.useState(()=>(o||[]).filter(x=>u.some(k=>k.id===x))),y=x=>{p(k=>k.includes(x)?k.filter(M=>M!==x):[...k,x])},f=t.repoOwner&&t.repoName?`${t.repoOwner}/${t.repoName}`:null,m=f?`https://github.com/${t.repoOwner}/${t.repoName}`:null,h=t.installs!=null?S("skills.card.installs",{count:Number(t.installs||0).toLocaleString()}):null,T=l.length?l.map(x=>u.find(k=>k.id===x)?.label||x).join(", "):S("skills.action.choose_targets");return r.jsxs(an,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[t.readmeUrl?r.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:[r.jsx("span",{className:"truncate",children:t.name||t.directory}),r.jsx(Ut,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):r.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:t.name||t.directory}),f||h?r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[m?r.jsxs("a",{href:m,target:"_blank",rel:"noopener noreferrer",onClick:x=>x.stopPropagation(),className:"inline-flex items-center gap-1 truncate rounded text-oai-gray-500 hover:text-oai-black hover:underline focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",title:m,children:[r.jsx("span",{className:"truncate",children:f}),r.jsx(Ut,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,f&&h?r.jsx("span",{"aria-hidden":!0,children:"·"}):null,h?r.jsx("span",{className:"truncate",children:h}):null]}):null]}),a?r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-md bg-oai-black/[0.06] px-2 py-1 text-xs font-medium text-oai-gray-700 ring-1 ring-oai-black/10 dark:bg-white/[0.08] dark:text-oai-gray-200 dark:ring-white/10",children:[r.jsx(Ye,{className:"h-3 w-3","aria-hidden":!0}),S("skills.card.installed")]}):null]}),t.description?r.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,r.jsx("div",{className:"mt-auto pt-5",children:a?r.jsxs("div",{className:"inline-flex h-9 w-full items-center justify-center gap-1.5 rounded-md bg-oai-black/[0.04] text-sm font-medium text-oai-gray-700 ring-1 ring-inset ring-oai-black/[0.08] dark:bg-white/[0.05] dark:text-oai-gray-200 dark:ring-white/[0.08]",children:[r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0}),S("skills.card.installed")]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[r.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.card.targets_prefix")}),r.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:l.length?T:S("skills.target.none")}),r.jsxs(Wn,{children:[r.jsx(qn,{disabled:s,"aria-label":S("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:S("skills.card.targets_change")}),r.jsx(Gn,{children:r.jsx(Yn,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:r.jsxs(Xn,{className:"min-w-[220px] 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:[r.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:S("skills.target.menu_label")}),u.map(x=>{const k=l.includes(x.id);return r.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[r.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:k,onChange:()=>y(x.id)}),r.jsx(tt,{provider:x.id,size:16}),r.jsx("span",{className:"flex-1 text-left",children:x.label})]},x.id)})]})})})]})]}),r.jsxs(Ve,{type:"button",size:"sm",onClick:()=>c(t,l),disabled:s||l.length===0,className:"w-full",children:[s?r.jsx(Ke,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Zn,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),S("skills.action.install")]})]})})]})});function Ts({repos:e,repoInput:t,onRepoInput:a,busyKey:s,onAdd:u,onRemove:o}){return r.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:[r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[r.jsx(qr,{value:t,onChange:c=>a(c.target.value),placeholder:S("skills.repo.placeholder"),className:"min-w-0 flex-1"}),r.jsxs(Ve,{type:"button",variant:"secondary",size:"md",onClick:u,disabled:s==="repo:add",className:"shrink-0 whitespace-nowrap",children:[s==="repo:add"?r.jsx(Ke,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(Nr,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),S("skills.repo.add")]})]}),e.length?r.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(c=>{const l=s===`repo:${c.owner}/${c.name}`;return r.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[c.owner,"/",c.name]}),r.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:c.branch})]}),r.jsxs(Ve,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:()=>o(c),className:"shrink-0",children:[l?r.jsx(Ke,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":!0}),r.jsx("span",{className:"sr-only",children:S("skills.repo.remove")})]})]},`${c.owner}/${c.name}`)})}):null]})}function Ps(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function Ws(){const[e,t]=n.useState(Ps),[a,s]=n.useState({skills:[],targets:[]}),[u,o]=n.useState([]),[c,l]=n.useState([]),[p,y]=n.useState([]),[f,m]=n.useState(He),[h,T]=n.useState(""),[x,k]=n.useState(""),[M,d]=n.useState(""),[E,b]=n.useState(!1),[j,A]=n.useState("all"),[L,Q]=n.useState(null),[_,te]=n.useState(""),[ye,X]=n.useState(!0),[Z,K]=n.useState(!1),[ge,W]=n.useState(""),[D,ae]=n.useState(null),[R,H]=n.useState(null),C=n.useMemo(()=>{const i=new Set;for(const w of a.skills||[]){i.add(xt(w).toLowerCase()),w.repoOwner&&w.repoName&&i.add(`${w.repoOwner}/${w.repoName}:${w.sourceDirectory||w.directory}`.toLowerCase());const O=String(w.directory||"").split(/[\\/]/).pop().toLowerCase();O&&i.add(`dir:${O}`)}return i},[a.skills]),v=n.useCallback(async()=>{const i=await cs();s({skills:i.skills||[],targets:i.targets||[]})},[]),de=n.useCallback(async()=>{const i=await fs();y(i.repos||[])},[]),P=n.useCallback(async({force:i=!1}={})=>{K(!0);try{const w=await ds({force:i});o(w.skills||[])}finally{K(!1)}},[]),oe=n.useCallback(async()=>{X(!0),W("");try{await Promise.all([v(),de()])}catch(i){W(i?.message||S("skills.error.generic"))}finally{X(!1)}},[v,de]),J=n.useCallback(async()=>{await oe(),e==="browse"&&f!==Pe&&P({force:!0}).catch(i=>W(i?.message||S("skills.error.generic")))},[P,oe,f,e]);if(n.useEffect(()=>{oe()},[oe]),n.useEffect(()=>{e==="browse"&&f!==Pe&&u.length===0&&P().catch(i=>W(i?.message||S("skills.error.generic")))},[u.length,P,f,e]),n.useEffect(()=>{if(!R)return;const i=setTimeout(()=>H(w=>w?.key===R.key?null:w),R.ttlMs||5e3);return()=>clearTimeout(i)},[R]),n.useEffect(()=>{const i=setTimeout(()=>k(h),200);return()=>clearTimeout(i)},[h]),n.useEffect(()=>{if(typeof window>"u")return;const i=new URLSearchParams(window.location.search),w=i.get("tab");if(e==="my"){if(!w)return;i.delete("tab")}else{if(w===e)return;i.set("tab",e)}const O=i.toString(),Y=`${window.location.pathname}${O?`?${O}`:""}${window.location.hash}`;window.history.replaceState({},"",Y)},[e]),!ks&&!en())return r.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:r.jsx(nn,{})});const I=async(i,w)=>{te(i),W("");try{await w(),await v()}catch(O){W(O?.message||S("skills.error.generic"))}finally{te("")}},U=(i,w)=>{const O=(w&&w.length?w:hr).filter(Y=>(a.targets||[]).some(le=>le.id===Y));I(pr(i),async()=>{await gs(i,O);const Y=O.map(le=>(a.targets||[]).find(ce=>ce.id===le)?.label||le).join(", ");H({key:`${Date.now()}:install:${xt(i)}`,message:S("skills.toast.installed",{name:i.name||i.directory,targets:Y||S("skills.target.none")}),ttlMs:4e3})})},be=i=>{ae(i)},ke=()=>{const i=D;i&&(ae(null),I(xr(i),async()=>{let w=null;i.managed?w=await ms(i.id):await ys(i.directory,i.targets||[]);const O=!!(w?.trashed&&i.managed&&i.id);H({key:`${Date.now()}:${i.id||i.directory}`,message:S("skills.toast.removed",{name:i.name||i.directory}),undo:O?async()=>{try{await hs(i.id),await v(),H(null)}catch(Y){W(Y?.message||S("skills.error.generic"))}}:null,ttlMs:5e3})}))},F=(i,w,O)=>I(js(i.id,w),async()=>{const Y=new Set(i.targets||[]);O?Y.add(w):Y.delete(w),i.managed?await ps(i.id,Array.from(Y)):await xs(i.directory,Array.from(Y))}),xe=async()=>{const i=h.trim();if(!(i.length<2)){te("search"),W("");try{const w=await us(i);l(w.skills||[])}catch(w){W(w?.message||S("skills.error.generic"))}finally{te("")}}},re=async()=>{const i=M.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[w,O]=i.split("/");if(!w||!O){W(S("skills.repo.invalid"));return}await I("repo:add",async()=>{await bs({owner:w,name:O,branch:"main",enabled:!0}),d(""),await de(),await P()})},we=async i=>{await I(`repo:${i.owner}/${i.name}`,async()=>{await ws(i.owner,i.name),await de(),await P()})},me=a.targets||[],ue=a.skills||[],q=n.useMemo(()=>j==="all"?ue:ue.filter(i=>(i.targets||[]).includes(j)),[ue,j]),ne=j!=="all",ve=n.useMemo(()=>L&&ue.find(i=>(i.id||i.directory)===L)||null,[ue,L]),se=n.useCallback(()=>{A("all")},[]),ie=n.useCallback(i=>{Q(w=>{const O=i?.id||i?.directory||null;return w===O?null:O})},[]),Ce=n.useCallback(()=>Q(null),[]);n.useEffect(()=>{e!=="my"&&L&&Q(null)},[e,L]),n.useEffect(()=>{L&&!ve&&Q(null)},[ve,L]);const he=n.useMemo(()=>{const i=f===Pe?c:u,w=f===Pe||f===He?i:i.filter(le=>`${le.repoOwner}/${le.repoName}`===f),O=x.trim().toLowerCase();return(f===Pe||!O?w:w.filter(le=>(le.name||"").toLowerCase().includes(O)||(le.directory||"").toLowerCase().includes(O)||(le.description||"").toLowerCase().includes(O))).map(le=>{const ce=xt(le).toLowerCase(),pe=String(le.directory||"").split(/[\\/]/).pop().toLowerCase(),Re=pe?`dir:${pe}`:"";return{...le,installed:C.has(ce)||Re&&C.has(Re)}})},[x,u,C,c,f]),g=r.jsx("div",{className:"flex h-64 items-center justify-center",children:r.jsx(Ke,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),V=r.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[r.jsx(Ke,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),r.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.browse.loading_hint")})]}),N=(i,w=null)=>r.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:[r.jsx("p",{children:S(i)}),w]});let G;if(ye)G=g;else if(e==="my")G=ue.length?r.jsx(Is,{items:q,totalCount:ue.length,targets:me,agentOptions:me,agentFilter:j,onAgentFilter:A,anyFilter:ne,onClearFilters:se,selectedId:L,onSelect:ie}):r.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:[me.length>0?r.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[r.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:r.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...me,...me].map((i,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(tt,{provider:i.id,size:30})},`b-${w}`))})}),r.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:r.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...me,...me].map((i,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(tt,{provider:i.id,size:30})},`c-${w}`))})}),r.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),r.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.empty.my")}),r.jsx(Ve,{type:"button",size:"sm",onClick:()=>t("browse"),children:S("skills.empty.my_cta")})]});else{const i=f===Pe,w=p.length===0&&!i,O=!i&&(x.trim()!==""||f!==He),Y=()=>{T(""),m(He)},le=!w&&!Z&&(he.length>0||O)?r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[r.jsx("span",{children:S("skills.filter.result_count_browse",{count:he.length})}),O?r.jsxs("button",{type:"button",onClick:Y,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[r.jsx(Nt,{className:"h-3 w-3","aria-hidden":!0}),S("skills.filter.clear")]}):null]}):null;let ce;w?ce=r.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:r.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:S("skills.browse.empty_sources")})}):Z&&!i?ce=V:i&&h.trim().length<2?ce=r.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:S("skills.browse.hint_skillssh")}):he.length?ce=r.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:he.map(Se=>r.jsx("div",{style:Ms,children:r.jsx(Es,{skill:Se,installed:!!Se.installed,installing:_===pr(Se),allTargets:me,defaultTargets:hr,onInstall:U})},Se.id||Se.key))}):O?ce=N("skills.empty.no_match",r.jsx(Ve,{type:"button",variant:"secondary",size:"sm",onClick:Y,children:S("skills.filter.clear")})):i?ce=N("skills.empty.search"):ce=N("skills.empty.browse");const pe=w||E?r.jsx("div",{className:"mb-5",children:r.jsx(Ts,{repos:p,repoInput:M,onRepoInput:d,busyKey:_,onAdd:re,onRemove:we})}):null,Re=!E&&!i&&p.length<=1&&he.length>0?r.jsx(Xa,{id:"skills-browse-intro",className:"mt-6",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{children:S("skills.browse.add_repo_hint")}),r.jsx("button",{type:"button",onClick:()=>b(!0),className:"rounded font-medium text-oai-gray-700 underline decoration-dotted underline-offset-2 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-200 dark:hover:text-white",children:S("skills.browse.manage_sources")})]})}):null;G=r.jsxs(r.Fragment,{children:[pe,le,ce,Re]})}return r.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[r.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:r.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[r.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[r.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:S("skills.page.title")}),r.jsxs(Ve,{type:"button",variant:"secondary",size:"sm",onClick:J,disabled:ye||Z,children:[r.jsx(tn,{className:Ue("mr-1.5 h-3.5 w-3.5",(ye||Z)&&"animate-spin"),"aria-hidden":!0}),S("skills.action.refresh")]})]}),r.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",S("skills.tab.my")],["browse",S("skills.tab.browse")]].map(([i,w])=>r.jsx("button",{type:"button","aria-pressed":e===i,onClick:()=>t(i),className:Ue("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",e===i?"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:w},i))}),ge?r.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:ge}):null,e==="browse"?r.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[r.jsx("div",{role:"tablist","aria-label":S("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",S("skills.mode.repo")],["skillssh",S("skills.mode.skillssh")]].map(([i,w])=>{const O=i==="skillssh"==(f===Pe);return r.jsx("button",{type:"button",role:"tab","aria-selected":O,onClick:()=>{i==="skillssh"?m(Pe):f===Pe&&m(He)},className:Ue("rounded px-3 py-1 text-sm font-medium transition-colors",O?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:w},i)})}),f!==Pe?r.jsxs(_r,{value:f,onValueChange:m,children:[r.jsxs(Lr,{"aria-label":S("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-oai-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-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[r.jsx(Vr,{children:i=>i===He?S("skills.source.all"):i}),r.jsx(Dr,{className:"text-oai-gray-400",children:r.jsx(Sr,{className:"h-4 w-4","aria-hidden":!0})})]}),r.jsx(Fr,{children:r.jsx(Ur,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:r.jsxs(zr,{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:[r.jsxs(kt,{value:He,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:[r.jsx(jt,{children:S("skills.source.all")}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),p.map(i=>{const w=`${i.owner}/${i.name}`;return r.jsxs(kt,{value:w,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:[r.jsx(jt,{children:w}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},w)})]})})})]}):null,r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ir,{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}),r.jsx(qr,{type:"search",value:h,onChange:i=>T(i.target.value),onKeyDown:i=>{i.key==="Enter"&&f===Pe&&xe()},"aria-label":S("skills.action.search_aria"),placeholder:f===Pe?S("skills.browse.placeholder_skillssh"):f===He?S("skills.browse.placeholder_all"):S("skills.browse.placeholder_repo",{repo:f}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),f===Pe?r.jsxs(Ve,{type:"button",onClick:xe,disabled:h.trim().length<2||_==="search",className:"focus:!ring-oai-gray-400/30",children:[_==="search"?r.jsx(Ke,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(ir,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),S("skills.action.search")]}):r.jsxs(Ve,{type:"button",variant:"secondary",size:"sm",onClick:()=>b(i=>!i),"aria-expanded":E,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[r.jsx(Nr,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),S("skills.browse.manage_sources"),r.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:p.length})]})]}):null,G,r.jsx(is,{skill:ve,targets:me,busyKey:_,onClose:Ce,onToggleTarget:F,onRemove:be})]})}),r.jsx(qa,{open:!!D,title:S("skills.confirm.remove_title",{name:D?.name||D?.directory||""}),description:D?D.managed?S("skills.confirm.remove_managed"):S("skills.confirm.remove_local"):"",confirmLabel:S("skills.action.remove"),cancelLabel:S("shared.action.cancel"),destructive:!0,busy:_===xr(D||{}),onCancel:()=>ae(null),onConfirm:ke}),r.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"pointer-events-none fixed inset-x-0 bottom-6 z-[90] flex justify-center px-4",children:R?r.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:[r.jsx("span",{children:R.message}),R.undo?r.jsx("button",{type:"button",onClick:R.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:S("shared.action.undo")}):null]}):null})]})}export{Ws as SkillsPage};
@@ -0,0 +1 @@
1
+ import{C as e,B as o,aC as _,at as P,r as u,aD as I,R as B,S as p}from"./main-CrjJx0KR.js";import{u as D,T as E}from"./use-native-settings-BeIgnIwx.js";import{F as v,S as K,a as $}from"./FadeIn-DIUOdWDR.js";import{A as G}from"./arrow-up-right-kKTEYa77.js";import{D as z}from"./download-CSjtsR81.js";import{C as R}from"./chevron-down-CYErdTR9.js";import"./Card-BfKA33l_.js";import"./use-reduced-motion-DZ7zH0oK.js";const H=["todayTokens","todayCost"],F=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaude",label:"Antigravity Claude Limit",shortLabel:"Ag Cl",category:"limits"},{id:"antigravityGPro",label:"Antigravity Gemini Pro Limit",shortLabel:"Ag GPro",category:"limits"},{id:"antigravityFlash",label:"Antigravity Flash Limit",shortLabel:"Ag Fl",category:"limits"}];function N(t,i=F,s=2){const a=new Set(i.map(n=>n.id)),l=new Set,r=Array.isArray(t)?t.filter(n=>!a.has(n)||l.has(n)?!1:(l.add(n),!0)):[];return(r.length>0?r:H).slice(0,Math.max(1,Number(s)||2))}const O=264,U=124,g="ui-rounded, -apple-system, system-ui",L=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],X={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Y(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function b({size:t="sm",children:i}){const s=t==="lg",a=s?560:264,l=s?32:22;return e.jsx("div",{className:p("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:`${O} / ${U}`,borderRadius:l},children:i})})}function V({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(b,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id: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:g,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$673.61"}),e.jsx("path",{d: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 S(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 Z(){return e.jsx(b,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:C.map(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:S(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:S(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:g,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"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(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const n=s+c*i,h=L[c%L.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:g,children:r.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:g,children:[r.pct,"%"]}),e.jsx("rect",{x:a,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:n+4,width:Math.max(l*(r.pct/100),4),height:"2.8",rx:"1.4",fill:h})]},r.name)})})})}function J(){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(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const n=s+c*i,h=X[r.source],y=Y(r.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:r.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:g,children:[r.pct,"%"]}),e.jsx("rect",{x:a,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:n+4,width:Math.max(l*(r.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},r.label)})})})}function Q(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ee(t,i){switch(t){case"todayTokens":return o("menubar.metric.today_tokens");case"todayCost":return o("menubar.metric.today_cost");case"last7dTokens":return o("menubar.metric.last_7d_tokens");case"totalTokens":return o("menubar.metric.total_tokens");case"totalCost":return o("menubar.metric.total_cost");case"claude5h":return o("menubar.metric.claude_5h");case"claude7d":return o("menubar.metric.claude_7d");case"codex5h":return o("menubar.metric.codex_5h");case"codex7d":return o("menubar.metric.codex_7d");default:return i}}function te(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 ae({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(B.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:p("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 ie({slot:t,value:i,options:s,disabled:a,onChange:l}){const r=t===0?o("menubar.slot.primary"):o("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:p("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(R,{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 A({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(E,{checked:s,disabled:a,onChange:l,ariaLabel:t})]})}function re(){const{available:t,settings:i,setSetting:s}=D(),a=u.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:F).map(m=>({...m,displayLabel:ee(m.id,m.label),previewValue:Q(m)})),[i?.menuBarAvailableItems]),l=Number(i?.menuBarMaxItems)||2,r=u.useMemo(()=>N(i?.menuBarItems,a,l),[a,l,i?.menuBarItems]),c=u.useMemo(()=>te(r,a),[a,r]),n=i?.showStats!==!1,h=d=>{s("menuBarItems",N(d,a,l))},y=(d,m)=>{const x=[...c];x[d===0?1:0]!==m&&(x[d]=m,h(x))},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),T=a.find(f=>f.id===m);return{slot:d,currentValue:m,options:W,item:T}}),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(ae,{slotConfigs:w,showStats:n}),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:x})=>e.jsx(ie,{slot:d,value:m,options:x,disabled:!t||!n,onChange:y},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(A,{label:o("settings.menubar.showStats"),hint:t?o("settings.menubar.showStatsHint"):o("menubar.native_only"),checked:n,disabled:!t,onChange:()=>s("showStats",!n)}),e.jsx(A,{label:o("settings.menubar.animatedIcon"),hint:o("settings.menubar.animatedIconHint"),checked:k,disabled:!t,onChange:()=>s("animatedIcon",!k)})]})]})}function se(){const[t,i]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(I()){i("native");return}const s=(navigator.userAgent||"").toLowerCase(),a=/mac/.test(s)&&!/iphone|ipad/.test(s);i(a?"mac-web":"other")},[]),t}function le(){const t=se();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>_("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[o("widgets.cta.open_gallery"),e.jsx(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(z,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(P,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.macos_only")]})}const oe=[{id:"summary",Preview:V,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:Z,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:q,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:J,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function ne({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:o(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:o(s)})]})]})}function M({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:o(t)})}function be(){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:o("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(le,{})})]})}),e.jsx(v,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":o("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(M,{titleKey:"widgets.menubar.section.title"}),e.jsx(re,{})]})}),e.jsxs("section",{"aria-label":o("widgets.gallery.section.title"),children:[e.jsx(M,{titleKey:"widgets.gallery.section.title"}),e.jsx(K,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:oe.map(({id:t,Preview:i,nameKey:s,descKey:a})=>e.jsx($,{children:e.jsx(ne,{Preview:i,nameKey:s,descKey:a})},t))})})]})]})})})}export{be as WidgetsPage};
@@ -1 +1 @@
1
- import{r as l,C as e,F as y}from"./main-Ch22JpOj.js";function o(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":y(a,{decimals:2}):"0"}function r({children:a,accent:n=!1,className:i=""}){const c="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",d=n?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${c} ${d} ${i}`,children:a})}function u(){const[a,n]=l.useState(null),[i,c]=l.useState("loading"),[d,g]=l.useState("");if(l.useEffect(()=>{let t=!1;const h=new URLSearchParams(window.location.search).get("year"),p=h?`/functions/tokentracker-wrapped?year=${encodeURIComponent(h)}`:"/functions/tokentracker-wrapped";return fetch(p).then(async s=>{if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}).then(s=>{t||(n(s),c(s.totals&&s.totals.tokens>0?"ready":"empty"))}).catch(s=>{t||(g(String(s?.message||s)),c("error"))}),()=>{t=!0}},[]),i==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:"Loading…"})});if(i==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-red-600 dark:text-red-300",children:["Couldn't load Wrapped: ",d]})})});if(i==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-oai-gray-500",children:["No data for that year yet. Run ",e.jsx("code",{children:"tracker sync"})," first."]})})});const x=t=>`${(t*100).toFixed(0)}%`;return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"TokenTracker Wrapped"}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(r,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:"Total tokens"}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:o(a.totals.tokens)}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:["across ",e.jsx("strong",{children:a.totals.conversations.toLocaleString("en-US")})," conversations,"," ",e.jsx("strong",{children:a.totals.active_days})," active days, and"," ",e.jsx("strong",{children:a.totals.sources})," tools"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top tools"}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[o(t.tokens)," · ",x(t.share)]})]},t.source))})]}),e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top models"}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[o(t.tokens)," · ",x(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Peak hour"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[o(a.peak_hour.tokens)," tokens"]})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Longest streak"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[a.longest_streak.days," days"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top days"}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:o(t.tokens)})]},t.day))})]}),a.highlights.length>0&&e.jsxs(r,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:"Highlights"}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:a.highlights.map((t,m)=>e.jsxs("li",{className:"text-base",children:["· ",t]},m))})]}),e.jsxs("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:["Generated from local queue.jsonl · share with"," ",e.jsx("code",{className:"font-mono",children:"tracker wrapped --json"})]})]})})}export{u as default};
1
+ import{r as l,C as e,G as y}from"./main-CrjJx0KR.js";function o(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":y(a,{decimals:2}):"0"}function r({children:a,accent:n=!1,className:i=""}){const c="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",d=n?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${c} ${d} ${i}`,children:a})}function u(){const[a,n]=l.useState(null),[i,c]=l.useState("loading"),[d,g]=l.useState("");if(l.useEffect(()=>{let t=!1;const h=new URLSearchParams(window.location.search).get("year"),p=h?`/functions/tokentracker-wrapped?year=${encodeURIComponent(h)}`:"/functions/tokentracker-wrapped";return fetch(p).then(async s=>{if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}).then(s=>{t||(n(s),c(s.totals&&s.totals.tokens>0?"ready":"empty"))}).catch(s=>{t||(g(String(s?.message||s)),c("error"))}),()=>{t=!0}},[]),i==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:"Loading…"})});if(i==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-red-600 dark:text-red-300",children:["Couldn't load Wrapped: ",d]})})});if(i==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-oai-gray-500",children:["No data for that year yet. Run ",e.jsx("code",{children:"tracker sync"})," first."]})})});const x=t=>`${(t*100).toFixed(0)}%`;return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"TokenTracker Wrapped"}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(r,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:"Total tokens"}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:o(a.totals.tokens)}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:["across ",e.jsx("strong",{children:a.totals.conversations.toLocaleString("en-US")})," conversations,"," ",e.jsx("strong",{children:a.totals.active_days})," active days, and"," ",e.jsx("strong",{children:a.totals.sources})," tools"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top tools"}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[o(t.tokens)," · ",x(t.share)]})]},t.source))})]}),e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top models"}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[o(t.tokens)," · ",x(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Peak hour"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[o(a.peak_hour.tokens)," tokens"]})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Longest streak"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[a.longest_streak.days," days"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top days"}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:o(t.tokens)})]},t.day))})]}),a.highlights.length>0&&e.jsxs(r,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:"Highlights"}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:a.highlights.map((t,m)=>e.jsxs("li",{className:"text-base",children:["· ",t]},m))})]}),e.jsxs("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:["Generated from local queue.jsonl · share with"," ",e.jsx("code",{className:"font-mono",children:"tracker wrapped --json"})]})]})})}export{u as default};
@@ -0,0 +1 @@
1
+ import{c as o}from"./main-CrjJx0KR.js";const t=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],a=o("arrow-up-right",t);export{a as A};
@@ -0,0 +1 @@
1
+ import{c}from"./main-CrjJx0KR.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
@@ -1 +1 @@
1
- import{c as o}from"./main-Ch22JpOj.js";const n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],e=o("chevron-down",n);export{e as C};
1
+ import{c as o}from"./main-CrjJx0KR.js";const n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],e=o("chevron-down",n);export{e as C};
@@ -1 +1 @@
1
- import{c as o}from"./main-Ch22JpOj.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"}]],e=o("download",a);export{e as D};
1
+ import{c as o}from"./main-CrjJx0KR.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"}]],e=o("download",a);export{e as D};
@@ -1 +1 @@
1
- import{c}from"./main-Ch22JpOj.js";const o=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],t=c("info",o);export{t as I};
1
+ import{c}from"./main-CrjJx0KR.js";const o=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],t=c("info",o);export{t as I};