tokentracker-cli 0.93.6 → 0.93.7

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 (120) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-DsAclDw6.js → AchievementBadge-DqvblIQY.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-D__EwC45.js → AchievementsPage-C-xm27pB.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-BAZNM3Cn.js → AchievementsSection-D8Oe2FGJ.js} +1 -1
  4. package/dashboard/dist/assets/BadgeDetailModal-BJOcOnHo.js +1 -0
  5. package/dashboard/dist/assets/{BotAnimated-CwrScgrI.js → BotAnimated-6fB046ld.js} +1 -1
  6. package/dashboard/dist/assets/{Card-D7GmLoqP.js → Card-BKbWtBaL.js} +1 -1
  7. package/dashboard/dist/assets/{ClawdAnimated-BEXgb5J_.js → ClawdAnimated-DbpeAldp.js} +2 -2
  8. package/dashboard/dist/assets/{CommandPalette-B9Mn3Qt2.js → CommandPalette-Jte7TBon.js} +1 -1
  9. package/dashboard/dist/assets/CommunityStatsModal-DDm7tCXO.js +1 -0
  10. package/dashboard/dist/assets/ConfirmModal-CrIjcrpZ.js +1 -0
  11. package/dashboard/dist/assets/{Controls-DxnaHBzv.js → Controls-BWJtMkIy.js} +1 -1
  12. package/dashboard/dist/assets/DashboardPage-Bcq4EwG5.js +1 -0
  13. package/dashboard/dist/assets/{DevicePage-4yTYf29M.js → DevicePage-C9NcPZGX.js} +1 -1
  14. package/dashboard/dist/assets/{DialogClose-BbderFCY.js → DialogClose-CY-LguUG.js} +1 -1
  15. package/dashboard/dist/assets/DialogDescription-DPyhpdeR.js +1 -0
  16. package/dashboard/dist/assets/DialogTitle-BkAmJrQ_.js +1 -0
  17. package/dashboard/dist/assets/{FadeIn-BFLojPGG.js → FadeIn-U-bxcM-y.js} +1 -1
  18. package/dashboard/dist/assets/{HeaderGithubStar-CPBNn61n.js → HeaderGithubStar-4HUCxVhg.js} +1 -1
  19. package/dashboard/dist/assets/{HoverTooltip-DbxnLj8e.js → HoverTooltip-BXcXOCs8.js} +1 -1
  20. package/dashboard/dist/assets/{IpCheckPage-CfPtXAAF.js → IpCheckPage-Cppkc-gE.js} +1 -1
  21. package/dashboard/dist/assets/{LandingPage-CocswfFj.js → LandingPage-D3KXfYKE.js} +2 -2
  22. package/dashboard/dist/assets/{LeaderboardAvatar-iZLxxZX-.js → LeaderboardAvatar-CdsHg6L0.js} +1 -1
  23. package/dashboard/dist/assets/LeaderboardPage-niat0TZW.js +2 -0
  24. package/dashboard/dist/assets/{LeaderboardProfileModal-BWu8jbBW.js → LeaderboardProfileModal-DgjhhEbB.js} +3 -3
  25. package/dashboard/dist/assets/{LeaderboardProfilePage-B77gOTzr.js → LeaderboardProfilePage-CZej8gpc.js} +1 -1
  26. package/dashboard/dist/assets/LimitsPage-BXzzX87I.js +5 -0
  27. package/dashboard/dist/assets/LocalOnlyNotice-DQswDMSD.js +1 -0
  28. package/dashboard/dist/assets/{LoginCard-D592L-fh.js → LoginCard-glPyVqYh.js} +1 -1
  29. package/dashboard/dist/assets/{LoginModal-C7Qm7CVf.js → LoginModal-slsdEXC7.js} +1 -1
  30. package/dashboard/dist/assets/{LoginPage-DkYw5ZQK.js → LoginPage-DX5QT917.js} +1 -1
  31. package/dashboard/dist/assets/PetPage-B8U3CJwt.js +1 -0
  32. package/dashboard/dist/assets/PopoverPopup-BVPcQAio.js +1 -0
  33. package/dashboard/dist/assets/{ProviderIcon-d0_vhIkS.js → ProviderIcon-CljIacVj.js} +1 -1
  34. package/dashboard/dist/assets/{ResetPasswordPage-UDNlpFVu.js → ResetPasswordPage-DTBmQk2y.js} +1 -1
  35. package/dashboard/dist/assets/SegmentedControl-C6npelCT.js +1 -0
  36. package/dashboard/dist/assets/{Select-Z2xTQ55f.js → Select-D1elkRBG.js} +1 -1
  37. package/dashboard/dist/assets/SelectItemText-3N-hvYuD.js +1 -0
  38. package/dashboard/dist/assets/{ServiceStatusPage-Cfr-QDZ7.js → ServiceStatusPage-C5ZK9X2o.js} +1 -1
  39. package/dashboard/dist/assets/{SessionsPage-nHPj6IAt.js → SessionsPage-CJ0JvE8-.js} +2 -2
  40. package/dashboard/dist/assets/SettingsPage-C32uYzqG.js +2 -0
  41. package/dashboard/dist/assets/SkillsPage-Cwkevv29.js +1 -0
  42. package/dashboard/dist/assets/{TokenGalaxy-CjAY6rey.js → TokenGalaxy-a1-E6_jp.js} +1 -1
  43. package/dashboard/dist/assets/ToolbarRootContext-Cm5cQb9Z.js +1 -0
  44. package/dashboard/dist/assets/{TrendMonitor-DAAlILwJ.js → TrendMonitor-DoNDyarF.js} +1 -1
  45. package/dashboard/dist/assets/WidgetsPage-QMTmKnRl.js +1 -0
  46. package/dashboard/dist/assets/{WrappedPage-ByYzOeZ-.js → WrappedPage-C9rJcY2o.js} +1 -1
  47. package/dashboard/dist/assets/{__vite-browser-external-HdCplPKs.js → __vite-browser-external-CsbVaBbw.js} +3 -3
  48. package/dashboard/dist/assets/__vite-browser-external-D95WhsZe.css +1 -0
  49. package/dashboard/dist/assets/{agent-logos-BW-ajJ7p.js → agent-logos-B39DKy3X.js} +1 -1
  50. package/dashboard/dist/assets/{arrow-up-right-CA5IJkqo.js → arrow-up-right-Cw5mMBik.js} +1 -1
  51. package/dashboard/dist/assets/{check-BBjF3bSm.js → check-DrQztnq1.js} +1 -1
  52. package/dashboard/dist/assets/{chevron-right-DCvGp9iJ.js → chevron-right-CEelysET.js} +1 -1
  53. package/dashboard/dist/assets/{useScrollLock-BUVUIPTX.js → composite-MhgOkYfv.js} +1 -1
  54. package/dashboard/dist/assets/{copy-ahF8LGeu.js → copy-Bouz-qQR.js} +1 -1
  55. package/dashboard/dist/assets/{download-DBm8dmvt.js → download-BugS2cl5.js} +1 -1
  56. package/dashboard/dist/assets/{external-link-C1sJSL7J.js → external-link-Ceqto-f4.js} +1 -1
  57. package/dashboard/dist/assets/{flame-B6xukEYd.js → flame-B67y0kLz.js} +1 -1
  58. package/dashboard/dist/assets/{format-tokens-6TqXlT3q.js → format-tokens-CR8njNJs.js} +1 -1
  59. package/dashboard/dist/assets/{icons-pGe_pInY.js → icons-DFj5ctTx.js} +1 -1
  60. package/dashboard/dist/assets/{index-Chb8mb2X.js → index-Bx6EP36K.js} +1 -1
  61. package/dashboard/dist/assets/{index-I9O8xChC.js → index-CrymIhtC.js} +1 -1
  62. package/dashboard/dist/assets/{index-RPV0zdZ9.js → index-ZGfRrxuq.js} +1 -1
  63. package/dashboard/dist/assets/{info-DBfJv0yu.js → info-C6XoktLa.js} +1 -1
  64. package/dashboard/dist/assets/{limits-providers-DPQsdVq5.js → limits-providers-B9L6hIZT.js} +1 -1
  65. package/dashboard/dist/assets/{link-2-DNEARrPY.js → link-2-DKG2j43e.js} +1 -1
  66. package/dashboard/dist/assets/{loader-circle-BCFHUr8X.js → loader-circle-DB2txq05.js} +1 -1
  67. package/dashboard/dist/assets/{maximize-2-1EmlA2R-.js → maximize-2-3-dz0brp.js} +1 -1
  68. package/dashboard/dist/assets/{modifiers.esm-DGXFSuEq.js → modifiers.esm-D0KjKi1o.js} +1 -1
  69. package/dashboard/dist/assets/{monitor-smartphone-DsPPhvsT.js → monitor-smartphone-Ds8H_QW9.js} +1 -1
  70. package/dashboard/dist/assets/plus-BDsmAe4Z.js +1 -0
  71. package/dashboard/dist/assets/{provider-display-C20LtBC5.js → provider-display-DRz643iD.js} +1 -1
  72. package/dashboard/dist/assets/{react-B4FPJgs_.js → react-D3Afmy9b.js} +1 -1
  73. package/dashboard/dist/assets/{search-mkIFPKzW.js → search-CO2Xf-Kg.js} +1 -1
  74. package/dashboard/dist/assets/{skills-api-D24vlu2H.js → skills-api-C1BZuUIq.js} +1 -1
  75. package/dashboard/dist/assets/{sortable.esm-BNDcP0sW.js → sortable.esm-DutNEc4F.js} +1 -1
  76. package/dashboard/dist/assets/store-a-oUpY-g.js +1 -0
  77. package/dashboard/dist/assets/{terminal-BxVMmvEx.js → terminal-DAePk67T.js} +1 -1
  78. package/dashboard/dist/assets/{trash-2-crt9lDvj.js → trash-2-bnFmtRSG.js} +1 -1
  79. package/dashboard/dist/assets/{use-community-stats-CTB_uHWV.js → use-community-stats-PJBeXyek.js} +1 -1
  80. package/dashboard/dist/assets/{use-limits-display-prefs-DXXZpjGY.js → use-limits-display-prefs-Blvn-7CB.js} +1 -1
  81. package/dashboard/dist/assets/{use-ordered-list-BVNb5QWU.js → use-ordered-list-BaVvCzZ9.js} +1 -1
  82. package/dashboard/dist/assets/use-reduced-motion-f51jgK_S.js +1 -0
  83. package/dashboard/dist/assets/{use-session-efficiency-pref-Di8nY6Lr.js → use-session-efficiency-pref-COTG-zJs.js} +1 -1
  84. package/dashboard/dist/assets/{use-transform-Dx9C2nBC.js → use-transform-BQEPyChL.js} +1 -1
  85. package/dashboard/dist/assets/use-usage-limits-LR2gHJJn.js +1 -0
  86. package/dashboard/dist/assets/{useCurrency-7dkDciam.js → useCurrency-CeqKrzFz.js} +1 -1
  87. package/dashboard/dist/assets/{useTokenFormat-DFSIAsAb.js → useTokenFormat-D0IMlZlO.js} +1 -1
  88. package/dashboard/dist/assets/{zap-Png-VJSP.js → zap-BBn6G5_E.js} +1 -1
  89. package/dashboard/dist/index.html +2 -2
  90. package/dashboard/dist/ip-check.html +2 -2
  91. package/dashboard/dist/leaderboard.html +2 -2
  92. package/dashboard/dist/share.html +2 -2
  93. package/package.json +1 -1
  94. package/src/lib/cursor-config.js +182 -1
  95. package/src/lib/fs.js +12 -3
  96. package/src/lib/local-api.js +57 -0
  97. package/src/lib/pricing/seed-snapshot.json +1 -1
  98. package/src/lib/subscription-manager.js +293 -0
  99. package/src/lib/usage-limits.js +35 -4
  100. package/dashboard/dist/assets/BadgeDetailModal-Dgeer5oB.js +0 -1
  101. package/dashboard/dist/assets/CommunityStatsModal-eJ_a1FMd.js +0 -1
  102. package/dashboard/dist/assets/ConfirmModal-CumOr2J1.js +0 -1
  103. package/dashboard/dist/assets/DashboardPage-BpRRXCRr.js +0 -1
  104. package/dashboard/dist/assets/DialogDescription-C5Ujj254.js +0 -1
  105. package/dashboard/dist/assets/DialogTitle-6epeLIn0.js +0 -1
  106. package/dashboard/dist/assets/LeaderboardPage-yqauB4Q1.js +0 -2
  107. package/dashboard/dist/assets/LimitsPage-C9NeIcft.js +0 -5
  108. package/dashboard/dist/assets/LocalOnlyNotice-HPXWU8TT.js +0 -1
  109. package/dashboard/dist/assets/PetPage-BOhvAJp4.js +0 -1
  110. package/dashboard/dist/assets/PopoverPopup-BK9aqQn1.js +0 -1
  111. package/dashboard/dist/assets/SegmentedControl-DE5m1pTf.js +0 -1
  112. package/dashboard/dist/assets/SelectItemText-Daq-XRZg.js +0 -1
  113. package/dashboard/dist/assets/SettingsPage-NvxUG_9m.js +0 -2
  114. package/dashboard/dist/assets/SkillsPage-zFbZa42f.js +0 -1
  115. package/dashboard/dist/assets/ToolbarRootContext-DnC8LT_8.js +0 -1
  116. package/dashboard/dist/assets/WidgetsPage-CXsfi-mq.js +0 -1
  117. package/dashboard/dist/assets/__vite-browser-external-CiR9-j4L.css +0 -1
  118. package/dashboard/dist/assets/store-B2nqaAqP.js +0 -1
  119. package/dashboard/dist/assets/use-reduced-motion-aSaQtoJu.js +0 -1
  120. package/dashboard/dist/assets/use-usage-limits-D9vQFB1H.js +0 -1
@@ -1 +0,0 @@
1
- import{m as Ra,r as i,V as ct,z as ga,j as e,X as De,c as r,e as ae,aF as da,ay as ut,aI as mt,y as gt,aJ as ya,aK as xt,aL as ht,Z as pt,aM as ft,aN as yt,aO as bt,aP as kt,A as wt,aQ as vt,aA as jt,az as Nt,aR as Ct,a4 as St,a as _t,aS as Rt,aq as It,J as Lt,B as J,R as Pt,d as Dt,a5 as Pe}from"./__vite-browser-external-HdCplPKs.js";import{L as Bt}from"./LocalOnlyNotice-HPXWU8TT.js";import{C as Tt}from"./Card-D7GmLoqP.js";import{C as ba}from"./ConfirmModal-CumOr2J1.js";import{S as Et,I as xa}from"./SegmentedControl-DE5m1pTf.js";import{I as Ia}from"./info-DBfJv0yu.js";import{P as Ne}from"./ProviderIcon-d0_vhIkS.js";import{m as ka}from"./react-B4FPJgs_.js";import{u as Ot}from"./useCurrency-7dkDciam.js";import{E as ca}from"./external-link-C1sJSL7J.js";import{L as te}from"./loader-circle-BCFHUr8X.js";import{M as La}from"./monitor-smartphone-DsPPhvsT.js";import{C as Be}from"./check-BBjF3bSm.js";import{T as ha}from"./trash-2-crt9lDvj.js";import{A as At}from"./index-I9O8xChC.js";import{u as $t}from"./use-reduced-motion-aSaQtoJu.js";import{u as Mt,s as Ut,k as Ft,l as zt,m as Kt,n as Vt,o as qt,p as Wt,S as Pa,c as Da,d as Ba,e as Ta,f as Ea,g as Oa,h as Ye,j as Ze,i as ea}from"./SelectItemText-Daq-XRZg.js";import{t as Ht,u as ua,m as Gt}from"./useScrollLock-BUVUIPTX.js";import{u as Qt,C as pa}from"./ToolbarRootContext-DnC8LT_8.js";import{g as Jt,a as Xt,p as Yt,m as Zt,b as er,d as ar,c as tr,e as rr,f as sr,s as nr,i as wa,u as va,h as ja,r as ir,j as Na,k as Ca,l as or,n as lr}from"./skills-api-D24vlu2H.js";import{F as dr}from"./flame-B6xukEYd.js";import{S as ma}from"./search-mkIFPKzW.js";import{D as Aa}from"./download-DBm8dmvt.js";import{C as cr}from"./chevron-right-DCvGp9iJ.js";import{P as $a,a as Ma,b as Ua,c as Fa,d as za}from"./PopoverPopup-BK9aqQn1.js";import"./arrow-up-right-CA5IJkqo.js";import"./DialogTitle-6epeLIn0.js";import"./store-B2nqaAqP.js";import"./DialogDescription-C5Ujj254.js";const ur=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Ka=Ra("circle-arrow-up",ur);const mr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Va=Ra("plus",mr),qa=i.forwardRef(function(s,d){const{render:o,className:h,style:x,...g}=s,{store:c}=Mt(),k={open:ct(c,Ut.open)};return ga("span",s,{state:k,ref:d,props:[{"aria-hidden":!0,children:"▼"},g],stateAttributesMapping:Ht})}),gr="tt:hint:dismissed:";function Wa(a){return gr+a}function xr(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Wa(a))==="1"}catch{return!1}}function hr({id:a,children:s,className:d,ariaLabel:o}){const[h,x]=i.useState(()=>xr(a)),g=i.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(Wa(a),"1")}catch{}x(!0)},[a]);return h?null:e.jsxs("div",{role:"note","aria-label":o||r("hint.dismissible_aria"),className:ae("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",d),children:[e.jsx("button",{type:"button",onClick:g,"aria-label":r("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:e.jsx(De,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(Ia,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:s})]})]})}function pr(a){if(!a)return null;for(const s of a.elements){const d=s.tagName;if(d==="BUTTON"||d==="INPUT"){const o=s;if(o.type==="submit")return o}}return null}function Ha(a){return{checked(s){return a.indeterminate?{}:s?{"data-checked":""}:{"data-unchecked":""}},...Ft}}const fr=i.createContext({disabled:!1});function yr(){return i.useContext(fr)}function br(a,s,d,o=!0,h){const[x,g]=i.useState(),c=ua(h?`${h}-label`:void 0),y=a??s??x;return da(()=>{const k=a||s||!o?void 0:kr(d.current,c);x!==k&&g(k)}),y}function kr(a,s){const d=wr(a);if(d)return!d.id&&s&&(d.id=s),d.id||void 0}function wr(a){if(!a)return;const s=a.parentElement;if(s&&s.tagName==="LABEL")return s;const d=a.id;if(d){const h=a.nextElementSibling;if(h&&h.htmlFor===d)return h}const o=a.labels;return o&&o[0]}const vr=i.createContext(void 0);function jr(){return i.useContext(vr)}const Ga=i.createContext(void 0);function Nr(){const a=i.useContext(Ga);if(a===void 0)throw new Error(ut(14));return a}const Cr="data-parent",Sr=i.forwardRef(function(s,d){const{checked:o,className:h,defaultChecked:x=!1,"aria-labelledby":g,disabled:c=!1,form:y,id:k,indeterminate:p=!1,inputRef:C,name:R,onCheckedChange:u,parent:w=!1,readOnly:m=!1,render:S,required:L=!1,uncheckedValue:A,value:$,nativeButton:F=!1,style:de,...D}=s,{clearErrors:Ce}=zt(),{disabled:he,name:pe,setDirty:_,setFilled:E,setFocused:M,setTouched:T,state:X,validationMode:W,validityData:Se,validation:Te}=Kt(),Ve=yr(),{labelId:Ee,controlId:qe,registerControlId:re,getDescriptionProps:O}=Vt(),N=jr(),H=N?.allValues===void 0?void 0:N.parent,se=H!==void 0,B=he||Ve.disabled||N?.disabled||c,z=pe??R,I=$??z,_e=ua(),Oe=ua();let K=k||qe;se&&(w?K=Oe:I!==void 0?K=`${H.id}-${I}`:K||=Oe);let Re={};se&&(w?Re=H.getParentProps():I!==void 0&&(Re=H.getChildProps(I)));const{checked:fe=o,indeterminate:ta=p,onCheckedChange:Ae,...We}=Re,ye=N?.value,ne=i.useRef(null),ce=mt(()=>Symbol()),ue=i.useRef(!1),{getButtonProps:Ie,buttonRef:me}=gt({disabled:B,native:F}),Y=N?.validation??Te,[P,Le]=qt({controlled:I!==void 0&&ye!==void 0&&!w?ye.includes(I):fe,default:x,name:"Checkbox",state:"checked"}),ge=se?!!fe:P,be=se&&ta||p;da(()=>{re!==ya&&(ue.current=!0,re(ce.current,K))},[K,re,ce]),i.useEffect(()=>{const b=ce.current;return()=>{!ue.current||re===ya||(ue.current=!1,re(b,void 0))}},[re,ce]),Wt(ne,_e,P,void 0,!N&&!B,R);const Z=i.useRef(null),$e=Y.registerInput,G=N?I:void 0,ra=i.useCallback(b=>$e(b,{controlRef:ne,value:G}),[$e,G]),sa=xt(C,Z,w?void 0:ra),na=br(g,Ee,Z,!F,K??void 0);da(()=>{Z.current&&(Z.current.indeterminate=be,P&&E(!0))},[P,be,E]),Qt(P,()=>{N||(Ce(z),E(P),_(P!==Se.initialValue),Y.change(P))});const He=ht({checked:P,disabled:B,form:y,name:w?void 0:z,id:F?void 0:K??void 0,required:L,ref:sa,style:z?bt:kt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(m){b.preventDefault();return}const Q=b.currentTarget.checked,ie=wt(vt,b.nativeEvent);if(u?.(Q,ie),!ie.isCanceled&&(Ae?.(Q,ie),!ie.isCanceled&&(Le(Q),I!==void 0&&N!==void 0&&!w&&!se))){const oe=Q?[...N.value,I]:N.value.filter(we=>we!==I);N.setValue(oe,ie)}},onClick(b){b.stopPropagation()},onFocus(){ne.current?.focus()}},$!==void 0?{value:(N?P&&$:$)||""}:pt,O,b=>Y.getValidationProps(B,b));i.useEffect(()=>{if(!H||I===void 0)return;const b=H.disabledStatesRef.current;return b.set(I,B),()=>{b.delete(I)}},[H,B,I]);const ke=i.useMemo(()=>({...X,checked:ge,disabled:B,readOnly:m,required:L,indeterminate:be}),[X,ge,B,m,L,be]),ia=Ha(ke),Ge=ga("span",s,{state:ke,ref:[me,ne,d],props:[{id:F?K??void 0:_e,role:"checkbox","aria-checked":be?"mixed":ge,"aria-readonly":m||void 0,"aria-required":L||void 0,"aria-labelledby":na,[Cr]:w?"":void 0,onFocus(){B||M(!0)},onBlur(){const b=Z.current;b&&(T(!0),M(!1),W==="onBlur"&&Y.commit(N?ye:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const Q=Z.current?.form??null,ie=b.currentTarget,oe=b.nativeEvent,we=b.preventDefault,Me=oe.preventDefault;let Ue=!1;b.preventDefault=()=>{Ue=!0,we.call(b)},oe.preventDefault=()=>{Ue=!0,Me.call(oe)},Me.call(oe),yt(ie).queueMicrotask(()=>{b.preventDefault=we,oe.preventDefault=Me,Ue||pr(Q)?.click()})},onClick(b){if(m||B)return;b.preventDefault();const Q=Z.current;Q&&ft(Q,b)}},D,We,Ie,O,b=>Y.getValidationProps(B,b)],stateAttributesMapping:ia});return e.jsxs(Ga.Provider,{value:ke,children:[Ge,!P&&!N&&z&&!w&&A!==void 0&&e.jsx("input",{type:"hidden",form:y,name:z,value:A,disabled:B}),e.jsx("input",{...He,suppressHydrationWarning:!0})]})}),_r=i.forwardRef(function(s,d){const{render:o,className:h,style:x,keepMounted:g=!1,...c}=s,y=Nr(),k=y.checked||y.indeterminate,{mounted:p,transitionStatus:C,setMounted:R}=Gt(k),u=i.useRef(null),w={...y,transitionStatus:C};jt({open:k,ref:u,onComplete(){k||R(!1)}});const S={...Ha(y),...Nt},L=g||p,A=ga("span",s,{ref:[d,u],state:w,stateAttributesMapping:S,props:c});return L?A:null});function Rr(a,s){return`target:${a}:${s}`}function Ir(a){return`remove:${a.id||a.directory}`}function Qa(a){if(!a)return null;const s=new Date(a).getTime();return Number.isFinite(s)?Math.floor((Date.now()-s)/864e5):null}function Lr(a){const s=Qa(a);if(s==null)return null;if(s<=0)return r("skills.usage.today");if(s<30)return r("skills.usage.days_ago",{days:s});const d=Math.max(1,Math.floor(s/30));return r("skills.usage.months_ago",{months:d})}function Pr(a){const s=Qa(a);return s==null?"bg-oai-gray-300 dark:bg-oai-gray-600":s<=7?"bg-emerald-500":s<=30?"bg-amber-500":"bg-oai-gray-300 dark:bg-oai-gray-600"}function oa({label:a,children:s}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[e.jsx("dt",{className:"flex items-center gap-1 text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"text-right font-medium tabular-nums text-oai-black dark:text-white",children:s})]})}function Dr({skill:a,targets:s,busyKey:d,usage:o,hasUpdate:h,updating:x,onUpdate:g,onClose:c,onToggleTarget:y,onRemove:k}){return e.jsx(At,{children:a?e.jsx(Br,{skill:a,targets:s,busyKey:d,usage:o,hasUpdate:h,updating:x,onUpdate:g,onClose:c,onToggleTarget:y,onRemove:k},a.id||a.directory):null})}function Br({skill:a,targets:s,busyKey:d,usage:o,hasUpdate:h,updating:x,onUpdate:g,onClose:c,onToggleTarget:y,onRemove:k}){const p=$t(),{currency:C,rate:R}=Ot(),u=i.useRef(null);i.useEffect(()=>{const _=M=>{M.key==="Escape"&&(M.stopPropagation(),c?.())},E=M=>{const T=M.target;T instanceof Element&&(u.current?.contains(T)||T.closest('[data-skill-row="1"]')||c?.())};return document.addEventListener("keydown",_),document.addEventListener("pointerdown",E),()=>{document.removeEventListener("keydown",_),document.removeEventListener("pointerdown",E)}},[c]);const w=a.name||a.directory,m=!!(a.repoOwner&&a.repoName),S=m?`https://github.com/${a.repoOwner}/${a.repoName}`:null,L=new Set(a.targets||[]),A=!!(a.readOnly||a.remote),$=!!a.remote,F=Array.isArray(a.deviceSources)?a.deviceSources:[],de=!$&&(!A||L.has("claude")),D=d===Ir(a),Ce=Lr(o?.lastUsedAt),he=!!(o&&o.invocations>0),pe=p?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(ka.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:p?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:p?0:.15},onClick:c,"aria-hidden":!0}),e.jsxs(ka.aside,{ref:u,role:"complementary","aria-label":w,initial:p?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:p?{opacity:0}:{opacity:0,x:24,scale:.98},transition:pe,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:[e.jsxs("header",{className:"flex items-center 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:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:w,children:w}),m?e.jsxs("a",{href:S,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:S,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(ca,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==w?e.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:a.directory,children:a.directory}):null]}),e.jsx("button",{type:"button",onClick:c,"aria-label":r("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:e.jsx(De,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[h?e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-xl bg-sky-50/80 px-3 py-2.5 ring-1 ring-sky-200 dark:bg-sky-950/30 dark:ring-sky-800/60",children:[e.jsx(Ka,{className:"h-4 w-4 shrink-0 text-sky-600 dark:text-sky-300","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 text-xs text-sky-800 dark:text-sky-200",children:r("skills.update.available")}),e.jsxs("button",{type:"button",onClick:()=>g?.(a),disabled:x,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-md bg-sky-600 px-2.5 text-xs font-semibold text-white transition hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-400/40 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-sky-500 dark:hover:bg-sky-400",children:[x?e.jsx(te,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,r("skills.update.action")]})]}):null,a.description?e.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a.description}):null,A?e.jsx("div",{className:"mt-4 rounded-xl bg-oai-gray-50 px-3 py-2.5 text-xs leading-5 text-oai-gray-600 ring-1 ring-oai-gray-200 dark:bg-oai-gray-900/60 dark:text-oai-gray-300 dark:ring-oai-gray-800",children:r($?"skills.inventory.read_only_remote":"skills.inventory.read_only_managed")}):null,a.sourceName?e.jsx("div",{className:"mt-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.inventory.source",{source:a.sourceName})}):null,F.length?e.jsxs("section",{className:"mt-5",children:[e.jsx("h3",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.inventory.devices_title")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:F.map(_=>e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 rounded-full bg-oai-gray-100 px-2.5 py-1 text-xs text-oai-gray-700 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800 dark:text-oai-gray-200 dark:ring-oai-gray-700",children:[e.jsx(La,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"max-w-52 truncate",children:_.name})]},_.id))})]}):null,de?e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.usage.section_title")}),e.jsxs("dl",{className:"divide-y divide-oai-gray-200/60 dark:divide-white/[0.06]",children:[e.jsx(oa,{label:r("skills.usage.invocations"),children:Ct(o?.invocations||0)}),e.jsx(oa,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:ae("h-1.5 w-1.5 rounded-full",Pr(o?.lastUsedAt)),"aria-hidden":!0}),he?Ce||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(oa,{label:e.jsxs(e.Fragment,{children:[r("skills.usage.cost"),e.jsx("span",{title:r("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(Ia,{className:"h-3 w-3","aria-label":r("skills.usage.disclaimer")})})]}),children:St(o?.cost||0,{currency:C,rate:R})})]}),he?null:e.jsx("p",{className:"mt-2 text-[11px] leading-4 text-oai-gray-400 dark:text-oai-gray-500",children:r("skills.usage.unused")})]}):null,A?null:e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.sync_section_title")}),e.jsx("div",{children:(s||[]).filter(_=>_.manageable!==!1).map(_=>{const E=L.has(_.id),M=d===Rr(a.id||a.directory,_.id),T=`skill-detail-sync-${a.id||a.directory}-${_.id}`;return e.jsxs("label",{htmlFor:T,className:"-mx-2 flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-sm text-oai-black transition-colors hover:bg-oai-gray-100/70 dark:text-white dark:hover:bg-white/[0.05]",children:[e.jsx(Sr,{id:T,checked:E,disabled:M,onCheckedChange:X=>y?.(a,_.id,!!X),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:e.jsx(_r,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(Be,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center","aria-hidden":!0,children:e.jsx(Ne,{provider:_.id,size:16})}),e.jsx("span",{className:"flex-1",children:_.label}),M?e.jsx(te,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},_.id)})})]})]}),A?null:e.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:[e.jsxs("button",{type:"button",onClick:()=>k?.(a),disabled:D,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:[D?e.jsx(te,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ha,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.detail.remove_button")]}),e.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.remove_confirm_hint")})]})]})]})}const Tr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),la=["claude","codex"],q="popular",Er={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"},xe="all",U="skillssh";function aa(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Ja(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function Or(a){return Ja(a).split("/").filter(Boolean).pop()||""}function Ar(a){if(a.repoOwner||a.repoName)return"";const s=Ja(a.directory);return!s||s.includes("/")?"":`dir:${s}`}function Sa(a){const s=Or(a.directory);return s?`dir:${s}`:""}function Xa(a){const s=new Set([aa(a).toLowerCase()]);a.repoOwner&&a.repoName&&s.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const d=Ar(a);return d&&s.add(d),s}function $r(a){return!a?.remote&&!a?.inventoryOnly&&!a?.readOnly}function Mr(a){const s=new Set;for(const d of Array.isArray(a)?a:[])if($r(d))for(const o of Xa(d))s.add(o);return s}function Xe(a){return`install:${aa(a)}`}function _a(a){return`remove:${a.id||a.directory}`}function Ya(a,s){return`target:${a}:${s}`}function je(a){return a.id||a.directory}function fa(a){return a.manageable!==!1}function Ur({target:a,state:s,busy:d,disabled:o,disabledLabel:h,onToggle:x}){const g=s==="synced",c=s==="orphan",y=c?r("skills.dot.orphan_aria",{agent:a.label}):g?r("skills.dot.synced_aria",{agent:a.label}):r("skills.dot.off_aria",{agent:a.label}),k=o&&h?`${y} — ${h}`:y;return e.jsxs("button",{type:"button",title:k,"aria-label":k,"aria-pressed":g,disabled:d||o,onClick:p=>{p.stopPropagation(),x?.(a.id,!g)},className:"relative flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/40 disabled:cursor-not-allowed dark:hover:bg-oai-gray-800/60",children:[d?e.jsx(te,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:ae("flex h-[18px] w-[18px] items-center justify-center transition",g&&Er[a.id],!g&&!c&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(Ne,{provider:a.id,size:18})}),c&&!d?e.jsx("span",{className:"absolute -bottom-px -right-px h-2 w-2 rounded-full bg-amber-500 ring-2 ring-oai-white dark:ring-oai-gray-900","aria-hidden":!0}):null]})}function Fr({skill:a,targets:s,onToggleTarget:d,busyKey:o}){const h=new Set(a.targets||[]),x=!!(a.readOnly||a.remote),g=[];for(const c of s)(x?h.has(c.id):fa(c))&&g.push(c);return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:g.map(c=>e.jsx(Ur,{target:c,state:a.targetStates?.[c.id]||"off",busy:o===Ya(je(a),c.id),disabled:x||c.manageable===!1,disabledLabel:r(a.remote?"skills.inventory.read_only_remote":"skills.inventory.read_only_managed"),onToggle:(y,k)=>d?.(a,y,k)},c.id))})}function zr({skill:a,targets:s,selected:d,onSelect:o,selectable:h,checked:x,onToggleSelect:g,onToggleTarget:c,hasUpdate:y,busyKey:k}){const p=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,C=[a.directory,p,a.sourceName].filter(Boolean).join(" · "),R=Array.isArray(a.deviceSources)?a.deviceSources:[],u=[a.remote?r("skills.inventory.remote"):null,a.scope==="plugin"?r("skills.inventory.plugin"):null].filter(Boolean),w=m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),o?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":d,"aria-label":r("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>o?.(a),onKeyDown:w,className:ae("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",d?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":x?"bg-oai-gray-50 dark:bg-oai-gray-900/40":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[h?e.jsx("label",{className:"flex shrink-0 items-center",onClick:m=>m.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:x,onChange:m=>g?.(a,m.target.checked),"aria-label":r("skills.select.row_aria",{name:a.name||a.directory}),className:"h-4 w-4 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"})}):null,e.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-oai-black dark:text-white",title:C,children:a.name||a.directory}),u.map(m=>e.jsx("span",{className:"inline-flex shrink-0 rounded-full bg-oai-gray-100 px-1.5 py-0.5 text-[10px] font-semibold text-oai-gray-600 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800 dark:text-oai-gray-300 dark:ring-oai-gray-700",children:m},m)),y?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-sky-50 px-1.5 py-0.5 text-[10px] font-semibold text-sky-700 ring-1 ring-sky-200 dark:bg-sky-950/40 dark:text-sky-300 dark:ring-sky-800/60",children:[e.jsx(Ka,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("skills.update.badge")]}):null,e.jsx(Fr,{skill:a,targets:s,onToggleTarget:c,busyKey:k}),e.jsx(cr,{className:ae("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",d&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]}),a.description?e.jsx("p",{className:ae("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",h&&"pl-7"),children:a.description}):null,a.sourceName||R.length?e.jsxs("div",{className:ae("mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",h&&"pl-7"),children:[a.sourceName?e.jsx("span",{className:"truncate",children:a.sourceName}):null,R.length?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",title:R.map(m=>m.name).join(", "),children:[e.jsx(La,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:r("skills.inventory.on_devices",{devices:R.map(m=>m.name).join(", ")})})]}):null]}):null]})}function Kr({agentFilter:a,agentOptions:s,onAgentFilter:d,filteredCount:o,totalCount:h,anyFilter:x,onClearFilters:g,searchQuery:c,onSearchQuery:y,searchPlaceholder:k}){return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsxs(Pa,{value:a,onValueChange:d,children:[e.jsxs(Da,{"aria-label":r("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:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[r("skills.filter.agent_label"),":"]}),e.jsx(Ba,{children:p=>p==="all"?r("skills.filter.agent_all"):s.find(C=>C.id===p)?.label||p}),e.jsx(qa,{className:"text-oai-gray-400",children:e.jsx(pa,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ta,{children:e.jsx(Ea,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Oa,{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:[e.jsxs(Ye,{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:[e.jsx(Ze,{children:r("skills.filter.agent_all")}),e.jsx(ea,{children:e.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),s.map(p=>e.jsxs(Ye,{value:p.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:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ne,{provider:p.id,size:14}),e.jsx(Ze,{children:p.label})]}),e.jsx(ea,{children:e.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},p.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(ma,{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}),e.jsx(xa,{type:"search",value:c,onChange:p=>y(p.target.value),onKeyDown:p=>{p.key==="Escape"&&c&&(p.preventDefault(),y(""))},"aria-label":r("skills.action.search_aria"),placeholder:k,className:"h-8 pl-9 pr-8 !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 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:p=>p.preventDefault(),onClick:()=>y(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!c,tabIndex:c?0:-1,className:ae("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out before:absolute before:-inset-1.5 before:content-[''] hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 motion-reduce:transition-none dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",c?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(De,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{role:"status","aria-live":"polite",className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.filter.result_count",{filtered:o,total:h})}),x?e.jsxs("button",{type:"button",onClick:g,className:"shrink-0 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:[e.jsx(De,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]})}function Vr({count:a,targets:s,busy:d,onBulkSync:o,onBulkRemove:h,onClear:x}){const g=s.filter(fa);return e.jsxs("div",{role:"toolbar","aria-label":r("skills.select.toolbar_aria"),className:"mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/50",children:[e.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200","aria-live":"polite",children:r("skills.select.count",{count:a})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs($a,{children:[e.jsxs(Ma,{disabled:d,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 disabled:opacity-60 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:[e.jsx(Aa,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_sync"),e.jsx(pa,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Ua,{children:e.jsx(Fa,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(za,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.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:r("skills.select.bulk_sync_hint")}),g.map(c=>e.jsxs("button",{type:"button",onClick:()=>o(c.id),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx(Ne,{provider:c.id,size:16}),e.jsx("span",{className:"flex-1",children:c.label})]},c.id))]})})})]}),e.jsxs(J,{type:"button",variant:"ghost",size:"sm",disabled:d,onClick:h,children:[e.jsx(ha,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:x,className:"inline-flex h-7 items-center gap-1 rounded-full px-2 text-[11px] font-medium text-oai-gray-500 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",children:[e.jsx(De,{className:"h-3 w-3","aria-hidden":!0}),r("skills.select.clear")]})]})]})}function qr({items:a,totalCount:s,targets:d,agentOptions:o,agentFilter:h,onAgentFilter:x,anyFilter:g,onClearFilters:c,searchQuery:y,onSearchQuery:k,searchPlaceholder:p,selectedId:C,onSelect:R,onToggleTarget:u,busyKey:w,updates:m,selectedIds:S,onToggleSelect:L,onClearSelection:A,onBulkSync:$,onBulkRemove:F}){const de=S.size;return e.jsxs("div",{children:[de>0?e.jsx(Vr,{count:de,targets:d,busy:w==="batch",onBulkSync:$,onBulkRemove:F,onClear:A}):e.jsx(Kr,{agentFilter:h,agentOptions:o,onAgentFilter:x,filteredCount:a.length,totalCount:s,anyFilter:g,onClearFilters:c,searchQuery:y,onSearchQuery:k,searchPlaceholder:p}),a.length===0?e.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:[e.jsx("p",{children:r("skills.empty.no_match")}),e.jsx(J,{type:"button",variant:"secondary",size:"sm",onClick:c,children:r("skills.filter.clear")})]}):e.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(D=>e.jsx(zr,{skill:D,targets:d,selected:C===(D.id||D.directory),onSelect:R,selectable:!D.readOnly&&!D.remote,checked:S.has(je(D)),onToggleSelect:L,onToggleTarget:u,hasUpdate:!!(D.id&&m?.[D.id]),busyKey:w},je(D)))})]})}const Wr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Hr=Dt.memo(function({skill:s,installed:d,installing:o,allTargets:h,defaultTargets:x,onInstall:g,onManage:c}){const[y,k]=i.useState(()=>(x||[]).filter(m=>h.some(S=>S.id===m))),p=m=>{k(S=>S.includes(m)?S.filter(L=>L!==m):[...S,m])},C=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,R=C?`https://github.com/${s.repoOwner}/${s.repoName}`:null,u=s.installs!=null?r("skills.card.installs",{count:Number(s.installs||0).toLocaleString()}):null,w=y.length?y.map(m=>h.find(S=>S.id===m)?.label||m).join(", "):r("skills.action.choose_targets");return e.jsxs(Tt,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[s.readmeUrl?e.jsxs("a",{href:s.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:s.readmeUrl,children:[e.jsx("span",{className:"truncate",children:s.name||s.directory}),e.jsx(ca,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:s.name||s.directory}),C||u?e.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:[R?e.jsxs("a",{href:R,target:"_blank",rel:"noopener noreferrer",onClick:m=>m.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:R,children:[e.jsx("span",{className:"truncate",children:C}),e.jsx(ca,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,C&&u?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,u?e.jsx("span",{className:"truncate",children:u}):null]}):null]})}),s.description?e.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s.description}):null,e.jsx("div",{className:"mt-auto pt-5",children:d?e.jsxs(J,{type:"button",variant:"secondary",size:"sm",onClick:()=>c?.(s),className:"w-full",children:[e.jsx(Be,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-500 dark:text-emerald-400","aria-hidden":!0}),r("skills.card.manage")]}):e.jsxs("div",{className:"space-y-2",children:[e.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:[e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.card.targets_prefix")}),e.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:y.length?w:r("skills.target.none")}),e.jsxs($a,{children:[e.jsx(Ma,{disabled:o,"aria-label":r("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:r("skills.card.targets_change")}),e.jsx(Ua,{children:e.jsx(Fa,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(za,{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:[e.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:r("skills.target.menu_label")}),h.map(m=>{const S=y.includes(m.id);return e.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:[e.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:S,onChange:()=>p(m.id)}),e.jsx(Ne,{provider:m.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:m.label})]},m.id)})]})})})]})]}),e.jsxs(J,{type:"button",size:"sm",onClick:()=>g(s,y),disabled:o||y.length===0,className:"w-full",children:[o?e.jsx(te,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Aa,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.action.install")]})]})})]})});function Gr({repos:a,repoInput:s,onRepoInput:d,busyKey:o,onAdd:h,onRemove:x}){return e.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:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx(xa,{value:s,onChange:g=>d(g.target.value),placeholder:r("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(J,{type:"button",variant:"secondary",size:"md",onClick:h,disabled:o==="repo:add",className:"shrink-0 whitespace-nowrap",children:[o==="repo:add"?e.jsx(te,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Va,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.repo.add")]})]}),a.length?e.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(g=>{const c=o===`repo:${g.owner}/${g.name}`;return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[g.owner,"/",g.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:g.branch})]}),e.jsxs(J,{type:"button",variant:"ghost",size:"sm",disabled:c,onClick:()=>x(g),className:"shrink-0",children:[c?e.jsx(te,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ha,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:r("skills.repo.remove")})]})]},`${g.owner}/${g.name}`)})}):null]})}function Qr(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function Cs(){const a=_t()||{},s=!!a.signedIn,d=a.getAccessToken,[o,h]=i.useState(Qr),[x,g]=i.useState({skills:[],targets:[]}),[c,y]=i.useState([]),[k,p]=i.useState([]),[C,R]=i.useState([]),[u,w]=i.useState(xe),[m,S]=i.useState(""),[L,A]=i.useState(""),[$,F]=i.useState(""),[de,D]=i.useState(""),[Ce,he]=i.useState(""),[pe,_]=i.useState(!1),[E,M]=i.useState("all"),[T,X]=i.useState(null),[W,Se]=i.useState(""),[Te,Ve]=i.useState(!0),[Ee,qe]=i.useState(!1),[re,O]=i.useState(""),[N,H]=i.useState(null),[se,B]=i.useState(null),[z,I]=i.useState(()=>new Set),[_e,Oe]=i.useState({}),[K,Re]=i.useState({}),[fe,ta]=i.useState([]),[Ae,We]=i.useState(!1),ye=i.useRef(!1),ne=i.useRef(0),ce=i.useMemo(()=>Mr(x.skills),[x.skills]),ue=i.useCallback(async()=>{const t=++ne.current,n=await Jt();if(ne.current!==t)return;const l={skills:n.skills||[],targets:n.targets||[]};g(l);const f=Rt();!s||!It()||!f||typeof d!="function"||(async()=>{try{const v=await d();if(!v||ne.current!==t)return;const[j]=await Promise.allSettled([Xt(v),Yt({accessToken:v,deviceId:f,skills:l.skills})]);if(j.status!=="fulfilled")return;const ze=j.value;if(ne.current!==t)return;g({targets:l.targets,skills:Zt(l.skills,ze,f)})}catch{}})()},[d,s]),Ie=i.useCallback(async()=>{const t=await er();R(t.repos||[])},[]),me=i.useCallback(async({force:t=!1}={})=>{qe(!0);try{const n=await ar({force:t});y(n.skills||[])}finally{qe(!1)}},[]),Y=i.useCallback(async({force:t=!1}={})=>{We(!0);try{const n=await tr({force:t});ta(n.skills||[])}finally{We(!1)}},[]),P=i.useCallback(async()=>{try{const t=await rr();Oe(t?.updates||{})}catch{Oe({})}},[]),Le=i.useCallback(async()=>{try{const t=await sr(),n={};for(const l of t?.skills||[])l.installed&&(l.directory&&(n[String(l.directory).toLowerCase()]=l),n[String(l.skill).toLowerCase()]=l);Re(n)}catch{Re({})}},[]),ge=i.useCallback(async()=>{Ve(!0),O("");try{await Promise.all([ue(),Ie()])}catch(t){O(t?.message||r("skills.error.generic"))}finally{Ve(!1)}},[ue,Ie]),be=i.useCallback(async()=>{await ge();const t=n=>O(n?.message||r("skills.error.generic"));o==="my"?(P(),Le()):u===q?Y({force:!0}).catch(t):u!==U&&me({force:!0}).catch(t)},[me,ge,Y,P,Le,u,o]);i.useEffect(()=>{ge()},[ge]),i.useEffect(()=>{if(ye.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("skill");if(!n){ye.current=!0;return}const l=x.skills||[];if(!l.length)return;const f=l.find(j=>j.directory===n||j.id===n);f&&(h("my"),X(f.id||f.directory)),ye.current=!0,t.delete("skill");const v=t.toString();window.history.replaceState({},"",`${window.location.pathname}${v?`?${v}`:""}${window.location.hash}`)},[x.skills]),i.useEffect(()=>{o==="browse"&&(u===U||u===q||c.length===0&&me().catch(t=>O(t?.message||r("skills.error.generic"))))},[c.length,me,u,o]),i.useEffect(()=>{o!=="browse"||u!==q||fe.length===0&&Y().catch(t=>O(t?.message||r("skills.error.generic")))},[Y,fe.length,u,o]);const Z=Object.keys(_e).length>0,$e=Object.keys(K).length>0;if(i.useEffect(()=>{o==="my"&&(Z||P(),$e||Le())},[o,Z,$e,P,Le]),i.useEffect(()=>{const t=setTimeout(()=>A(m),200);return()=>clearTimeout(t)},[m]),i.useEffect(()=>{const t=setTimeout(()=>D($),120);return()=>clearTimeout(t)},[$]),i.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("tab");if(o==="my"){if(!n)return;t.delete("tab")}else{if(n===o)return;t.set("tab",o)}const l=t.toString(),f=`${window.location.pathname}${l?`?${l}`:""}${window.location.hash}`;window.history.replaceState({},"",f)},[o]),!Tr&&!Lt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(Bt,{})});const G=async(t,n)=>{Se(t),O("");try{await n(),await ue()}catch(l){O(l?.message||r("skills.error.generic"))}finally{Se("")}},ra=(t,n)=>{const l=(n&&n.length?n:la).filter(f=>(x.targets||[]).some(v=>v.id===f));G(Xe(t),async()=>{await wa(t,l);const f=l.map(v=>(x.targets||[]).find(j=>j.id===v)?.label||v).join(", ");Pe({title:r("skills.toast.installed",{name:t.name||t.directory,targets:f||r("skills.target.none")}),timeout:4e3})})},sa=t=>{t?.readOnly||t?.remote||H(t)},na=()=>{const t=N;t&&(H(null),G(_a(t),async()=>{let n=null;t.managed?n=await va(t.id):await ja(t.directory,t.targets||[]);const l=!!(n?.trashed&&t.managed&&t.id);Pe({title:r("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:l?{onUndo:async()=>{try{await ir(t.id),await ue()}catch(f){O(f?.message||r("skills.error.generic"))}}}:void 0})}))},He=(t,n,l)=>t?.readOnly||t?.remote?Promise.resolve():G(Ya(je(t),n),async()=>{const f=new Set(t.targets||[]);l?f.add(n):f.delete(n),t.managed?await Na(t.id,Array.from(f)):await Ca(t.directory,Array.from(f));const v={name:t.name||t.directory,agent:Ge(n)};Pe({title:l?r("skills.toast.synced_one",v):r("skills.toast.unsynced_one",v),timeout:3e3})}),ke=i.useCallback(()=>I(new Set),[]),ia=i.useCallback((t,n)=>{if(t?.readOnly||t?.remote)return;const l=je(t);I(f=>{const v=new Set(f);return n?v.add(l):v.delete(l),v})},[]),Ge=t=>(x.targets||[]).find(n=>n.id===t)?.label||t,b=t=>{const n=(x.skills||[]).filter(l=>z.has(je(l))&&!l.readOnly&&!l.remote);n.length&&G("batch",async()=>{for(const l of n){const f=new Set(l.targets||[]);f.add(t),l.managed?await Na(l.id,Array.from(f)):await Ca(l.directory,Array.from(f))}ke(),Pe({title:r("skills.toast.bulk_synced",{count:n.length,agent:Ge(t)}),timeout:4e3})})},Q=()=>{const t=(x.skills||[]).filter(n=>z.has(je(n))&&!n.readOnly&&!n.remote);t.length&&B(t)},ie=()=>{const t=se;t&&(B(null),G("batch",async()=>{for(const n of t)n.managed?await va(n.id):await ja(n.directory,n.targets||[]);ke(),Pe({title:r("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},oe=t=>{!t?.repoOwner||!t?.repoName||G(Xe(t),async()=>{await wa({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:la),await P(),Pe({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},we=async()=>{const t=m.trim();if(!(t.length<2)){Se("search"),O("");try{const n=await nr(t);p(n.skills||[])}catch(n){O(n?.message||r("skills.error.generic"))}finally{Se("")}}},Me=async()=>{const t=Ce.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[n,l]=t.split("/");if(!n||!l){O(r("skills.repo.invalid"));return}await G("repo:add",async()=>{await lr({owner:n,name:l,branch:"main",enabled:!0}),he(""),await Ie(),await me()})},Ue=async t=>{await G(`repo:${t.owner}/${t.name}`,async()=>{await or(t.owner,t.name),await Ie(),await me()})},le=x.targets||[],Za=le.filter(fa),ve=x.skills||[],et=i.useMemo(()=>{const t=E==="all"?ve:ve.filter(l=>(l.targets||[]).includes(E)),n=de.trim().toLowerCase();return n?t.filter(l=>(l.name||"").toLowerCase().includes(n)||(l.directory||"").toLowerCase().includes(n)||(l.description||"").toLowerCase().includes(n)):t},[ve,E,de]),at=E!=="all",ee=i.useMemo(()=>T&&ve.find(t=>(t.id||t.directory)===T)||null,[ve,T]),tt=i.useCallback(()=>{M("all"),F("")},[]),rt=i.useCallback(t=>{X(n=>{const l=t?.id||t?.directory||null;return n===l?null:l})},[]),st=i.useCallback(()=>X(null),[]),nt=i.useCallback(t=>{const n=aa(t).toLowerCase(),l=Sa(t),f=(x.skills||[]).find(v=>{const j=Xa(v);return j.has(n)||l&&j.has(l)});f&&X(f.id||f.directory)},[x.skills]);i.useEffect(()=>{o!=="my"&&z.size&&I(new Set)},[o,z.size]),i.useEffect(()=>{T&&!ee&&X(null)},[ee,T]);const Fe=i.useMemo(()=>{const t=u===U?k:u===q?fe:c,l=u===U||u===q||u===xe?t:t.filter(j=>`${j.repoOwner}/${j.repoName}`===u),f=L.trim().toLowerCase();return(u===U||!f?l:l.filter(j=>(j.name||"").toLowerCase().includes(f)||(j.directory||"").toLowerCase().includes(f)||(j.description||"").toLowerCase().includes(f))).map(j=>{const ze=aa(j).toLowerCase(),V=Sa(j);return{...j,installed:ce.has(ze)||V&&ce.has(V)}})},[L,c,ce,fe,k,u]),it=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(te,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),ot=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(te,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.browse.loading_hint")})]}),Qe=(t,n=null)=>e.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:[e.jsx("p",{children:r(t)}),n]});let Je;if(Te)Je=it;else if(o==="my")Je=ve.length?e.jsx(qr,{items:et,totalCount:ve.length,targets:le,agentOptions:le,agentFilter:E,onAgentFilter:M,anyFilter:at,onClearFilters:tt,searchQuery:$,onSearchQuery:F,searchPlaceholder:r("skills.my.placeholder"),selectedId:T,onSelect:rt,onToggleTarget:He,busyKey:W,updates:_e,selectedIds:z,onToggleSelect:ia,onClearSelection:ke,onBulkSync:b,onBulkRemove:Q}):e.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:[le.length>0?e.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[e.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:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...le,...le].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(Ne,{provider:t.id,size:30})},`b-${n}`))})}),e.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:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...le,...le].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(Ne,{provider:t.id,size:30})},`c-${n}`))})}),e.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"}),e.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,e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.empty.my")}),e.jsx(J,{type:"button",size:"sm",onClick:()=>h("browse"),children:r("skills.empty.my_cta")})]});else{const t=u===U,n=u===q,l=C.length===0&&!t&&!n,f=Ee&&!t&&!n||n&&Ae,v=!t&&!n&&(L.trim()!==""||u!==xe),j=()=>{S(""),w(xe)},ze=!l&&!f&&(Fe.length>0||v)?e.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:[e.jsx("span",{children:r("skills.filter.result_count_browse",{count:Fe.length})}),v?e.jsxs("button",{type:"button",onClick:j,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:[e.jsx(De,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]}):null;let V;l?V=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:r("skills.browse.empty_sources")})}):f?V=ot:t&&m.trim().length<2?V=e.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:r("skills.browse.hint_skillssh")}):Fe.length?V=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Fe.map(Ke=>e.jsx("div",{style:Wr,children:e.jsx(Hr,{skill:Ke,installed:!!Ke.installed,installing:W===Xe(Ke),allTargets:Za,defaultTargets:la,onInstall:ra,onManage:nt})},Ke.id||Ke.key))}):v?V=Qe("skills.empty.no_match",e.jsx(J,{type:"button",variant:"secondary",size:"sm",onClick:j,children:r("skills.filter.clear")})):t?V=Qe("skills.empty.search"):n?V=Qe("skills.empty.popular"):V=Qe("skills.empty.browse");const lt=l||pe?e.jsx("div",{className:"mb-5",children:e.jsx(Gr,{repos:C,repoInput:Ce,onRepoInput:he,busyKey:W,onAdd:Me,onRemove:Ue})}):null,dt=!pe&&!t&&!n&&C.length<=1&&Fe.length>0?e.jsx(hr,{id:"skills-browse-intro",className:"mt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{children:r("skills.browse.add_repo_hint")}),e.jsx("button",{type:"button",onClick:()=>_(!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:r("skills.browse.manage_sources")})]})}):null;Je=e.jsxs(e.Fragment,{children:[lt,ze,V,dt]})}return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:r("skills.page.title")}),e.jsxs(J,{type:"button",variant:"secondary",size:"sm",onClick:be,disabled:Te||Ee||Ae,children:[e.jsx(Pt,{className:ae("mr-1.5 h-3.5 w-3.5",(Te||Ee||Ae)&&"animate-spin"),"aria-hidden":!0}),r("skills.action.refresh")]})]}),e.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",r("skills.tab.my")],["browse",r("skills.tab.browse")]].map(([t,n])=>e.jsx("button",{type:"button","aria-pressed":o===t,onClick:()=>h(t),className:ae("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",o===t?"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:n},t))}),re?e.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:re}):null,o==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx(Et,{className:"shrink-0",ariaLabel:r("skills.source.label"),options:[{id:"repo",label:r("skills.mode.repo")},{id:"popular",label:r("skills.mode.popular"),icon:e.jsx(dr,{className:"h-3.5 w-3.5","aria-hidden":!0})},{id:"skillssh",label:r("skills.mode.skillssh")}],value:u===U?"skillssh":u===q?"popular":"repo",onChange:t=>{t==="skillssh"?w(U):t==="popular"?w(q):(u===U||u===q)&&w(xe)}}),u!==U&&u!==q?e.jsxs(Pa,{value:u,onValueChange:w,children:[e.jsxs(Da,{"aria-label":r("skills.source.label"),className:"inline-flex h-8 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs 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:[e.jsx(Ba,{children:t=>t===xe?r("skills.source.all"):t}),e.jsx(qa,{className:"text-oai-gray-400",children:e.jsx(pa,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ta,{children:e.jsx(Ea,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Oa,{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:[e.jsxs(Ye,{value:xe,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:[e.jsx(Ze,{children:r("skills.source.all")}),e.jsx(ea,{children:e.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),C.map(t=>{const n=`${t.owner}/${t.name}`;return e.jsxs(Ye,{value:n,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:[e.jsx(Ze,{children:n}),e.jsx(ea,{children:e.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},n)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ma,{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}),e.jsx(xa,{type:"search",value:m,onChange:t=>S(t.target.value),onKeyDown:t=>{t.key==="Enter"&&u===U&&we()},"aria-label":r("skills.action.search_aria"),placeholder:u===U?r("skills.browse.placeholder_skillssh"):u===q?r("skills.browse.placeholder_popular"):u===xe?r("skills.browse.placeholder_all"):r("skills.browse.placeholder_repo",{repo:u}),className:"h-8 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"})]}),u===U?e.jsxs(J,{type:"button",size:"sm",onClick:we,disabled:m.trim().length<2||W==="search",className:"focus:!ring-oai-gray-400/30",children:[W==="search"?e.jsx(te,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):u===q?null:e.jsxs(J,{type:"button",variant:"secondary",size:"sm",onClick:()=>_(t=>!t),"aria-expanded":pe,className:"!h-8 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:[e.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.browse.manage_sources"),e.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:C.length})]})]}):null,Je,e.jsx(Dr,{skill:ee,targets:le,busyKey:W,usage:ee&&(K[String(ee.directory||"").toLowerCase()]||K[String(ee.name||"").toLowerCase()])||null,hasUpdate:!!(ee?.id&&_e?.[ee.id]),updating:ee?W===Xe(ee):!1,onUpdate:oe,onClose:st,onToggleTarget:He,onRemove:sa})]})}),e.jsx(ba,{open:!!N,title:r("skills.confirm.remove_title",{name:N?.name||N?.directory||""}),description:N?N.managed?r("skills.confirm.remove_managed"):r("skills.confirm.remove_local"):"",confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:W===_a(N||{}),onCancel:()=>H(null),onConfirm:na}),e.jsx(ba,{open:!!se,title:r("skills.confirm.bulk_remove_title",{count:se?.length||0}),description:r("skills.confirm.bulk_remove_desc"),confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:W==="batch",onCancel:()=>B(null),onConfirm:ie})]})}export{Cs as SkillsPage,Mr as buildLocallyInstalledKeys};
@@ -1 +0,0 @@
1
- import{m as on,bk as sn,r as y,bx as rn,bb as cn,aD as ln,by as an,Z as Tt,A as fn,bd as B,bz as te,bw as de,bA as Q,aN as q,bB as je,bC as Se,bD as Ne,bE as un,bF as Mt,bG as dn,bH as Ue,bI as Dt,bJ as De,bK as Xe,bL as xt,bM as Lt,a3 as gn,aF as oe,bc as qe,be as kt,bN as mn,z as hn,bO as pn}from"./__vite-browser-external-HdCplPKs.js";import{n as He,D as xn,o as wn,v as Ae,a as yn,f as bn}from"./useScrollLock-BUVUIPTX.js";const Rn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ko=on("chevron-down",Rn),ue=Math.min,K=Math.max,Ee=Math.round,Oe=Math.floor,G=e=>({x:e,y:e}),vn={left:"right",right:"left",bottom:"top",top:"bottom"};function Ft(e,t,n){return K(e,ue(t,n))}function ee(e,t){return typeof e=="function"?e(t):e}function X(e){return e.split("-")[0]}function ne(e){return e.split("-")[1]}function Ke(e){return e==="x"?"y":"x"}function Ge(e){return e==="y"?"height":"width"}function N(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Je(e){return Ke(N(e))}function An(e,t,n){n===void 0&&(n=!1);const o=ne(e),i=Je(e),s=Ge(i);let r=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=Pe(r)),[r,Pe(r)]}function On(e){const t=Pe(e);return[Ye(e),t,Ye(t)]}function Ye(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const wt=["left","right"],yt=["right","left"],Cn=["top","bottom"],Sn=["bottom","top"];function En(e,t,n){switch(e){case"top":case"bottom":return n?t?yt:wt:t?wt:yt;case"left":case"right":return t?Cn:Sn;default:return[]}}function Pn(e,t,n,o){const i=ne(e);let s=En(X(e),n==="start",o);return i&&(s=s.map(r=>r+"-"+i),t&&(s=s.concat(s.map(Ye)))),s}function Pe(e){const t=X(e);return vn[t]+e.slice(t.length)}function Tn(e){var t,n,o,i;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(o=e.bottom)!=null?o:0,left:(i=e.left)!=null?i:0}}function $t(e){return typeof e!="number"?Tn(e):{top:e,right:e,bottom:e,left:e}}function Te(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function Fo(e,t={}){const{enabled:n=!0,event:o="click",toggle:i=!0,ignoreMouse:s=!1,stickIfOpen:r=!0,touchOpenDelay:c=0,reason:l=sn}=t,a="rootStore"in e?e.rootStore:e,u=a.context.dataRef,d=y.useRef(void 0),h=rn(),f=cn(),m=y.useMemo(()=>{function x(g,p,v,b){const R=fn(l,p,v);g&&b==="touch"&&c>0?f.start(c,()=>{a.setOpen(!0,R)}):a.setOpen(g,R)}function w(g,p,v){const b=u.current.openEvent,R=a.select("domReferenceElement")!==p;return g&&R||!g||!i?!0:b&&r?!v(b.type):!1}return{onPointerDown(g){d.current=He(g.pointerType,!0)&&xn(g.nativeEvent)?"virtual":g.pointerType},onMouseDown(g){const p=d.current,v=g.nativeEvent,b=a.select("open");if(g.button!==0||o==="click"||He(p,!0)&&s)return;const R=w(b,g.currentTarget,O=>O==="click"||O==="mousedown"),A=ln(v);if(an(A)){x(R,v,A,p);return}const S=g.currentTarget;h.request(()=>{x(R,v,S,p)})},onClick(g){if(o==="mousedown-only")return;const p=d.current;if(o==="mousedown"&&p){d.current=void 0;return}if(He(p,!0)&&s)return;const v=a.select("open"),b=w(v,g.currentTarget,R=>R==="click"||R==="mousedown"||R==="keydown"||R==="keyup");x(b,g.nativeEvent,g.currentTarget,p)},onKeyDown(){d.current=void 0}}},[u,o,s,l,a,r,i,h,f,c]);return y.useMemo(()=>n?{reference:m}:Tt,[n,m])}function bt(e,t,n){let{reference:o,floating:i}=e;const s=N(t),r=Je(t),c=Ge(r),l=X(t),a=s==="y",u=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,h=o[c]/2-i[c]/2;let f;switch(l){case"top":f={x:u,y:o.y-i.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-i.width,y:d};break;default:f={x:o.x,y:o.y}}const m=ne(t);return m&&(f[r]+=h*(m==="end"?1:-1)*(n&&a?-1:1)),f}async function Mn(e,t){var n;t===void 0&&(t={});const{x:o,y:i,platform:s,rects:r,elements:c,strategy:l}=e,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=ee(t,e),m=$t(f),w=c[h?d==="floating"?"reference":"floating":d],g=Te(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:l})),p=d==="floating"?{x:o,y:i,width:r.floating.width,height:r.floating.height}:r.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(v))&&await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1},R=Te(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:p,offsetParent:v,strategy:l}):p);return{top:(g.top-R.top+m.top)/b.y,bottom:(R.bottom-g.bottom+m.bottom)/b.y,left:(g.left-R.left+m.left)/b.x,right:(R.right-g.right+m.right)/b.x}}const Dn=50,Ln=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:r}=n,c=r.detectOverflow?r:{...r,detectOverflow:Mn},l=await(r.isRTL==null?void 0:r.isRTL(t));let a=await r.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=bt(a,o,l),h=o,f=0;const m={};for(let x=0;x<s.length;x++){const w=s[x];if(!w)continue;const{name:g,fn:p}=w,{x:v,y:b,data:R,reset:A}=await p({x:u,y:d,initialPlacement:o,placement:h,strategy:i,middlewareData:m,rects:a,platform:c,elements:{reference:e,floating:t}});u=v??u,d=b??d,m[g]={...m[g],...R},A&&f<Dn&&(f++,typeof A=="object"&&(A.placement&&(h=A.placement),A.rects&&(a=A.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:u,y:d}=bt(a,h,l)),x=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:m}},kn=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:a}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:x=!0,...w}=ee(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const g=X(i),p=N(c),v=X(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(a.floating)),R=h||(v||!x?[Pe(c)]:On(c)),A=m!=="none";!h&&A&&R.push(...Pn(c,x,m,b));const S=[c,...R],O=await l.detectOverflow(t,w),M=[];let T=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&M.push(O[g]),d){const $=An(i,r,b);M.push(O[$[0]],O[$[1]])}if(T=[...T,{placement:i,overflows:M}],!M.every($=>$<=0)){var E,F;const $=(((E=s.flip)==null?void 0:E.index)||0)+1,I=S[$];if(I&&(!(d==="alignment"?p!==N(I):!1)||T.every(C=>N(C.placement)===p?C.overflows[0]>0:!0)))return{data:{index:$,overflows:T},reset:{placement:I}};let L=(F=T.filter(k=>k.overflows[0]<=0).sort((k,C)=>k.overflows[1]-C.overflows[1])[0])==null?void 0:F.placement;if(!L)switch(f){case"bestFit":{var W;const k=(W=T.filter(C=>{if(A){const _=N(C.placement);return _===p||_==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(_=>_>0).reduce((_,V)=>_+V,0)]).sort((C,_)=>C[1]-_[1])[0])==null?void 0:W[0];k&&(L=k);break}case"initialPlacement":L=c;break}if(i!==L)return{reset:{placement:L}}}return{}}}},Wt=new Set(["left","top"]);async function Fn(e,t){const{placement:n,platform:o,elements:i}=e,s=await(o.isRTL==null?void 0:o.isRTL(i.floating)),r=X(n),c=ne(n),l=N(n)==="y",a=Wt.has(r)?-1:1,u=s&&l?-1:1,d=ee(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:m}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof m=="number"&&(f=c==="end"?m*-1:m),l?{x:f*u,y:h*a}:{x:h*a,y:f*u}}const $n=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:s,placement:r,middlewareData:c}=t,l=await Fn(t,e);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}},Wn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i,platform:s}=t,{mainAxis:r=!0,crossAxis:c=!1,limiter:l={fn:p=>{let{x:v,y:b}=p;return{x:v,y:b}}},...a}=ee(e,t),u={x:n,y:o},d=await s.detectOverflow(t,a),h=N(i),f=Ke(h);let m=u[f],x=u[h];const w=(p,v)=>Ft(v+d[p==="y"?"top":"left"],v,v-d[p==="y"?"bottom":"right"]);r&&(m=w(f,m)),c&&(x=w(h,x));const g=l.fn({...t,[f]:m,[h]:x});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[f]:r,[h]:c}}}}}},In=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,o;const{x:i,y:s,placement:r,rects:c,middlewareData:l}=t,{offset:a=0,mainAxis:u=!0,crossAxis:d=!0}=ee(e,t),h={x:i,y:s},f=N(r),m=Ke(f);let x=h[m],w=h[f];const g=ee(a,t),p=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:(n=g.mainAxis)!=null?n:0,crossAxis:(o=g.crossAxis)!=null?o:0};if(u){const R=m==="y"?"height":"width",A=c.reference[m]-c.floating[R]+p.mainAxis,S=c.reference[m]+c.reference[R]-p.mainAxis;x<A?x=A:x>S&&(x=S)}if(d){var v,b;const R=m==="y"?"width":"height",A=Wt.has(X(r)),S=c.reference[f]-c.floating[R]+(A&&((v=l.offset)==null?void 0:v[f])||0)+(A?0:p.crossAxis),O=c.reference[f]+c.reference[R]+(A?0:((b=l.offset)==null?void 0:b[f])||0)-(A?p.crossAxis:0);w<S?w=S:w>O&&(w=O)}return{[m]:x,[f]:w}}}},Vn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:i,elements:s}=t,{apply:r=()=>{},...c}=ee(e,t),l=await i.detectOverflow(t,c),a=X(n),u=ne(n),d=N(n)==="y",{width:h,height:f}=o.floating;let m,x;a==="top"||a==="bottom"?(m=a,x=u===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(x=a,m=u==="end"?"top":"bottom");const w=f-l.top-l.bottom,g=h-l.left-l.right,p=ue(f-l[m],w),v=ue(h-l[x],g),b=t.middlewareData.shift,R=!b;let A=p,S=v;b!=null&&b.enabled.x&&(S=g),b!=null&&b.enabled.y&&(A=w),R&&!u&&(d?S=h-2*K(l.left,l.right):A=f-2*K(l.top,l.bottom)),await r({...t,availableWidth:S,availableHeight:A});const O=await i.getDimensions(s.floating);return h!==O.width||f!==O.height?{reset:{rects:!0}}:{}}}};function It(e){const t=Q(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=de(e),s=i?e.offsetWidth:n,r=i?e.offsetHeight:o,c=Ee(n)!==s||Ee(o)!==r;return c&&(n=s,o=r),{width:n,height:o,$:c}}function Ze(e){return B(e)?e:e.contextElement}function fe(e){const t=Ze(e);if(!de(t))return G(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:s}=It(t);let r=(s?Ee(n.width):n.width)/o,c=(s?Ee(n.height):n.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const _n=G(0);function Vt(e){const t=q(e);return!Lt()||!t.visualViewport?_n:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Hn(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===q(e)}function ie(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Ze(e);let r=G(1);t&&(o?B(o)&&(r=fe(o)):r=fe(e));const c=Hn(s,n,o)?Vt(s):G(0);let l=(i.left+c.x)/r.x,a=(i.top+c.y)/r.y,u=i.width/r.x,d=i.height/r.y;if(s&&o){const h=q(s),f=B(o)?q(o):o;let m=h,x=xt(m);for(;x&&f!==m;){const w=fe(x),g=x.getBoundingClientRect(),p=Q(x),v=g.left+(x.clientLeft+parseFloat(p.paddingLeft))*w.x,b=g.top+(x.clientTop+parseFloat(p.paddingTop))*w.y;l*=w.x,a*=w.y,u*=w.x,d*=w.y,l+=v,a+=b,m=q(x),x=xt(m)}}return Te({width:u,height:d,x:l,y:a})}function Le(e,t){const n=De(e).scrollLeft;return t?t.left+n:ie(te(e)).left+n}function _t(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Le(e,n),i=n.top+t.scrollTop;return{x:o,y:i}}function Bn(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const s=i==="fixed",r=te(o),c=t?je(t.floating):!1;if(o===r||c&&s)return n;let l={scrollLeft:0,scrollTop:0},a=G(1);const u=G(0),d=de(o);if((d||!s)&&((Ue(o)!=="body"||Dt(r))&&(l=De(o)),d)){const f=ie(o);a=fe(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const h=r&&!d&&!s?_t(r,l):G(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+u.x+h.x,y:n.y*a.y-l.scrollTop*a.y+u.y+h.y}}function zn(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Nn(e){const t=De(e),n=e.ownerDocument.body,o=K(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=K(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+Le(e);const r=-t.scrollTop;return Q(n).direction==="rtl"&&(s+=K(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:s,y:r}}const Xn=25;function Yn(e,t,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",i=q(e),s=te(e),r=i.visualViewport;let c=s.clientWidth,l=s.clientHeight,a=0,u=0;if(r){const h=!Lt()||t==="fixed";o?h||(a=-r.offsetLeft,u=-r.offsetTop):(c=r.width,l=r.height,h&&(a=r.offsetLeft,u=r.offsetTop))}if(Le(s)<=0){const h=s.ownerDocument,f=h.body,m=getComputedStyle(f),x=h.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,w=Math.abs(s.clientWidth-f.clientWidth-x),g=getComputedStyle(s).scrollbarGutter==="stable both-edges"?w/2:w;g<=Xn&&(c-=g)}return{width:c,height:l,x:a,y:u}}function jn(e,t){const n=ie(e,!0,t==="fixed"),o=n.top+e.clientTop,i=n.left+e.clientLeft,s=fe(e),r=e.clientWidth*s.x,c=e.clientHeight*s.y,l=i*s.x,a=o*s.y;return{width:r,height:c,x:l,y:a}}function Rt(e,t,n){let o;if(t==="viewport"||t==="layoutViewport")o=Yn(e,n,t);else if(t==="document")o=Nn(te(e));else if(B(t))o=jn(t,n);else{const i=Vt(e);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Te(o)}function Un(e,t){const n=t.get(e);if(n)return n;let o=Xe(e,[],!1).filter(c=>B(c)&&Ue(c)!=="body"),i=null;const s=Q(e).position==="fixed";let r=s?Se(e):e;for(;B(r)&&!Ne(r);){const c=Q(r),l=Mt(r),a=i?i.position:s?"fixed":"";!l&&(a==="fixed"||a==="absolute"&&c.position==="static")?o=o.filter(d=>d!==r):i=c,r=Se(r)}return t.set(e,o),o}function qn(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const r=[...n==="clippingAncestors"?je(t)?[]:Un(t,this._c):[].concat(n),o],c=Rt(t,r[0],i);let l=c.top,a=c.right,u=c.bottom,d=c.left;for(let h=1;h<r.length;h++){const f=Rt(t,r[h],i);l=K(f.top,l),a=ue(f.right,a),u=ue(f.bottom,u),d=K(f.left,d)}return{width:a-d,height:u-l,x:d,y:l}}function Kn(e){const{width:t,height:n}=It(e);return{width:t,height:n}}function Gn(e,t,n){const o=de(t),i=te(t),s=n==="fixed",r=ie(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=G(0);if((o||!s)&&((Ue(t)!=="body"||Dt(i))&&(c=De(t)),o)){const h=ie(t,!0,s,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}!o&&i&&(l.x=Le(i));const a=i&&!o&&!s?_t(i,c):G(0),u=r.left+c.scrollLeft-l.x-a.x,d=r.top+c.scrollTop-l.y-a.y;return{x:u,y:d,width:r.width,height:r.height}}function Be(e){return Q(e).position==="static"}function vt(e,t){if(!de(e)||Q(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return te(e)===n&&(n=n.ownerDocument.body),n}function Ht(e,t){const n=q(e);if(je(e))return n;if(!de(e)){let i=Se(e);for(;i&&!Ne(i);){if(B(i)&&!Be(i))return i;i=Se(i)}return n}let o=vt(e,t);for(;o&&un(o)&&Be(o);)o=vt(o,t);return o&&Ne(o)&&Be(o)&&!Mt(o)?n:o||dn(e)||n}const Jn=async function(e){const t=this.getOffsetParent||Ht,n=this.getDimensions,o=await n(e.floating);return{reference:Gn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Zn(e){return Q(e).direction==="rtl"}const Qn={convertOffsetParentRelativeRectToViewportRelativeRect:Bn,getDocumentElement:te,getClippingRect:qn,getOffsetParent:Ht,getElementRects:Jn,getClientRects:zn,getDimensions:Kn,getScale:fe,isElement:B,isRTL:Zn};function Bt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function eo(e,t,n){let o=null,i;const s=te(e);function r(){var u;clearTimeout(i),(u=o)==null||u.disconnect(),o=null}function c(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),r();const h=e.getBoundingClientRect(),{left:f,top:m,width:x,height:w}=h;if(u||t(),!x||!w)return;const g=Oe(m),p=Oe(s.clientWidth-(f+x)),v=Oe(s.clientHeight-(m+w)),b=Oe(f),A={rootMargin:-g+"px "+-p+"px "+-v+"px "+-b+"px",threshold:K(0,ue(1,d))||1};let S=!0;function O(M){const T=M[0].intersectionRatio;if(!Bt(h,e.getBoundingClientRect()))return c();if(T!==d){if(!S)return c();T?c(!1,T):i=setTimeout(()=>{c(!1,1e-7)},1e3)}S=!1}try{o=new IntersectionObserver(O,{...A,root:s.ownerDocument})}catch{o=new IntersectionObserver(O,A)}o.observe(e)}const l=q(e),a=()=>c(n);return l.addEventListener("resize",a),c(!0),()=>{l.removeEventListener("resize",a),r()}}function At(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=Ze(e),u=i||s?[...a?Xe(a):[],...t?Xe(t):[]]:[];u.forEach(g=>{i&&g.addEventListener("scroll",n),s&&g.addEventListener("resize",n)});const d=a&&c?eo(a,n,s):null;let h=-1,f=null;r&&(f=new ResizeObserver(g=>{let[p]=g;p&&p.target===a&&f&&t&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(t)})),n()}),a&&!l&&f.observe(a),t&&f.observe(t));let m,x=l?ie(e):null;l&&w();function w(){const g=ie(e);x&&!Bt(x,g)&&n(),x=g,m=requestAnimationFrame(w)}return n(),()=>{var g;u.forEach(p=>{i&&p.removeEventListener("scroll",n),s&&p.removeEventListener("resize",n)}),d?.(),(g=f)==null||g.disconnect(),f=null,l&&cancelAnimationFrame(m)}}const to=$n,no=Wn,oo=kn,io=Vn,so=In,ro=(e,t,n)=>{const o=new Map,i=n??{},s={...Qn,...i.platform,_c:o};return Ln(e,t,{...i,platform:s})};var co=typeof document<"u",lo=function(){},Ce=co?y.useLayoutEffect:lo;function Me(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Me(e[o],t[o]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,i[o]))return!1;for(o=n;o--!==0;){const s=i[o];if(!(s==="_owner"&&e.$$typeof)&&!Me(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function zt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ot(e,t){const n=zt(e);return Math.round(t*n)/n}function ze(e){const t=y.useRef(e);return Ce(()=>{t.current=e}),t}function ao(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:s,floating:r}={},transform:c=!0,whileElementsMounted:l,open:a}=e,[u,d]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=y.useState(o);Me(h,o)||f(o);const[m,x]=y.useState(null),[w,g]=y.useState(null),p=y.useCallback(C=>{C!==A.current&&(A.current=C,x(C))},[]),v=y.useCallback(C=>{C!==S.current&&(S.current=C,g(C))},[]),b=s||m,R=r||w,A=y.useRef(null),S=y.useRef(null),O=y.useRef(u),M=l!=null,T=ze(l),E=ze(i),F=ze(a),W=y.useCallback(()=>{if(!A.current||!S.current)return;const C={placement:t,strategy:n,middleware:h};E.current&&(C.platform=E.current),ro(A.current,S.current,C).then(_=>{const V={..._,isPositioned:F.current!==!1};$.current&&!Me(O.current,V)&&(O.current=V,gn.flushSync(()=>{d(V)}))})},[h,t,n,E,F]);Ce(()=>{a===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,d(C=>({...C,isPositioned:!1})))},[a]);const $=y.useRef(!1);Ce(()=>($.current=!0,()=>{$.current=!1}),[]),Ce(()=>{if(b&&(A.current=b),R&&(S.current=R),b&&R){if(T.current)return T.current(b,R,W);W()}},[b,R,W,T,M]);const I=y.useMemo(()=>({reference:A,floating:S,setReference:p,setFloating:v}),[p,v]),L=y.useMemo(()=>({reference:b,floating:R}),[b,R]),k=y.useMemo(()=>{const C={position:n,left:0,top:0};if(!L.floating)return C;const _=Ot(L.floating,u.x),V=Ot(L.floating,u.y);return c?{...C,transform:"translate("+_+"px, "+V+"px)",...zt(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:V}},[n,c,L.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:W,refs:I,elements:L,floatingStyles:k}),[u,W,I,L,k])}const fo=(e,t)=>{const n=to(e);return{name:n.name,fn:n.fn,options:[e,t]}},uo=(e,t)=>{const n=no(e);return{name:n.name,fn:n.fn,options:[e,t]}},go=(e,t)=>({fn:so(e).fn,options:[e,t]}),mo=(e,t)=>{const n=oo(e);return{name:n.name,fn:n.fn,options:[e,t]}},ho=(e,t)=>{const n=io(e);return{name:n.name,fn:n.fn,options:[e,t]}};function po(e){return xo(e,e.rootContext)}function xo(e,t){const{nodeId:n,externalTree:o}=e,i=t.useState("referenceElement"),s=t.useState("floatingElement"),r=t.useState("domReferenceElement"),c=t.useState("open"),l=t.useState("floatingId"),[a,u]=y.useState(null),[d,h]=y.useState(void 0),[f,m]=y.useState(void 0),x=y.useRef(null),w=wn(o),g=y.useMemo(()=>({reference:i,floating:s,domReference:r}),[i,s,r]),p=ao({...e,elements:{...g,...a&&{reference:a}}}),v=B(d)?d:null,b=f===void 0?t.state.floatingElement:f;t.useSyncedValue("referenceElement",d??null),t.useSyncedValue("domReferenceElement",d===void 0?r:v),t.useSyncedValue("floatingElement",b);const R=y.useCallback(E=>{const F=B(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;u(F),p.refs.setReference(F)},[p.refs]),A=y.useCallback(E=>{(B(E)||E===null)&&(x.current=E,h(E)),(B(p.refs.reference.current)||p.refs.reference.current===null||E!==null&&!B(E))&&p.refs.setReference(E)},[p.refs,h]),S=y.useCallback(E=>{m(E),p.refs.setFloating(E)},[p.refs]),O=y.useMemo(()=>({...p.refs,setReference:A,setFloating:S,setPositionReference:R,domReference:x}),[p.refs,A,S,R]),M=y.useMemo(()=>({...p.elements,domReference:r}),[p.elements,r]),T=y.useMemo(()=>({...p,dataRef:t.context.dataRef,open:c,onOpenChange:t.setOpen,events:t.context.events,floatingId:l,refs:O,elements:M,nodeId:n,rootStore:t}),[p,O,M,n,t,c,l]);return oe(()=>{r&&(x.current=r)},[r]),oe(()=>{t.context.dataRef.current.floatingContext=T;const E=w?.nodesRef.current.find(F=>F.id===n);E&&(E.context=T)}),y.useMemo(()=>({...p,context:T,refs:O,elements:M,rootStore:t}),[p,O,M,T,t])}const wo=y.createContext(void 0);function yo(){return y.useContext(wo)?.direction??"ltr"}const bo=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:s,platform:r,elements:c,middlewareData:l}=t,{element:a,padding:u=0,offsetParent:d="real"}=ee(e,t)||{};if(a==null)return{};const h=$t(u),f={x:n,y:o},m=Je(i),x=Ge(m),w=await r.getDimensions(a),g=m==="y",p=g?"top":"left",v=g?"bottom":"right",b=g?"clientHeight":"clientWidth",R=s.reference[x]+s.reference[m]-f[m]-s.floating[x],A=f[m]-s.reference[m],S=d==="real"?await r.getOffsetParent?.(a):c.floating;let O=c.floating[b]||s.floating[x];(!O||!await r.isElement?.(S))&&(O=c.floating[b]||s.floating[x]);const M=R/2-A/2,T=O/2-w[x]/2-1,E=Math.min(h[p],T),F=Math.min(h[v],T),W=E,$=O-w[x]-F,I=O/2-w[x]/2+M,L=Ft(W,I,$),k=!l.arrow&&ne(i)!=null&&I!==L&&s.reference[x]/2-(I<W?E:F)-w[x]/2<0,C=k?I<W?I-W:I-$:0;return{[m]:f[m]+C,data:{[m]:L,centerOffset:I-L-C,...k&&{alignmentOffset:C}},reset:k}}}),Ro=(e,t)=>({...bo(e),options:[e,t]}),vo={name:"hide",async fn(e){const{width:t,height:n,x:o,y:i}=e.rects.reference,s=t===0&&n===0&&o===0&&i===0,r=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:r.top-n>=0||r.right-t>=0||r.bottom-n>=0||r.left-t>=0||s}}}},Ao={sideX:"left",sideY:"top"},Ct="--available-width",St="--available-height";function Nt(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function Et(e,t,n){const{rects:o,placement:i}=e;return{side:Nt(t,X(i),n),align:ne(i)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function $o(e){return Oo(e,po)}function Oo(e,t){const{anchor:n,positionMethod:o="absolute",side:i="bottom",sideOffset:s=0,align:r="center",alignOffset:c=0,collisionBoundary:l,collisionPadding:a=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:h=!1,inline:f,keepMounted:m=!1,floatingRootContext:x,mounted:w,collisionAvoidance:g,shift:p,nodeId:v,adaptiveOrigin:b,lazyFlip:R=!1,externalTree:A}=e,[S,O]=y.useState(null);!w&&S!==null&&O(null);const M=g.side||"flip",T=g.align||"flip",E=g.fallbackAxisSide||"end",F=p?.crossAxis??!1,W=p?.rootBoundary,$=typeof n=="function"?n:void 0,I=qe($),L=$?I:n,k=Ae(n),C=Ae(w),V=yo()==="rtl",pe=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":V?"left":"right","inline-start":V?"right":"left"}[i],Xt=r==="center"?pe:`${pe}-${r}`;let D=a;typeof D=="number"?D={top:D,right:D,bottom:D,left:D}:D&&(D={top:D.top||0,right:D.right||0,bottom:D.bottom||0,left:D.left||0});const J=1,Yt=i==="bottom"?J:0,jt=i==="top"?J:0,Ut=i==="right"?J:0,qt=i==="left"?J:0,xe={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:D},se=y.useRef(null),ke=Ae(s),Fe=Ae(c),Kt=typeof s!="function"?s:0,Gt=typeof c!="function"?c:0,re=[];f&&re.push(f),re.push(fo(P=>{const z=Et(P,i,V),Y=typeof ke.current=="function"?ke.current(z):ke.current,H=typeof Fe.current=="function"?Fe.current(z):Fe.current;return{mainAxis:Y,crossAxis:H,alignmentAxis:H}},[Kt,Gt,V,i]));const Qe=T==="none"&&M!=="shift",et=!Qe&&(u||F||M==="shift"),tt=M==="none"?null:mo({...xe,padding:{top:D.top+J+Yt,right:D.right+J+qt,bottom:D.bottom+J+jt,left:D.left+J+Ut},mainAxis:!F&&M==="flip",crossAxis:T==="flip"?"alignment":!1,fallbackAxisSideDirection:E}),nt=Qe?null:uo({...xe,rootBoundary:W,mainAxis:T!=="none",crossAxis:et,limiter:u||F?void 0:go(P=>{if(!se.current)return{};const{width:z,height:Y}=se.current.getBoundingClientRect(),H=N(X(P.placement)),U=H==="y"?z:Y,j=H==="y"?D.left+D.right:D.top+D.bottom;return{offset:U/2+j/2}})},[xe,u,F,W,D,T]);M==="shift"||T==="shift"||r==="center"?re.push(nt,tt):re.push(tt,nt),re.push(ho({...xe,apply({elements:{floating:P},availableWidth:z,availableHeight:Y,rects:H}){if(!C.current)return;const U=P.style;U.setProperty(Ct,`${z}px`),U.setProperty(St,`${Y}px`);const j=q(P).devicePixelRatio||1,{x:me,y:Re,width:ve,height:We}=H.reference,Ie=(Math.round((me+ve)*j)-Math.round(me*j))/j,Ve=(Math.round((Re+We)*j)-Math.round(Re*j))/j;U.setProperty("--anchor-width",`${Ie}px`),U.setProperty("--anchor-height",`${Ve}px`)}}),Ro(P=>({element:se.current||kt(P.elements.floating).createElement("div"),padding:d,offsetParent:"floating"}),[d]),{name:"transformOrigin",fn(P){const{elements:z,middlewareData:Y,placement:H,rects:U,y:j}=P,me=X(H),Re=N(me),ve=se.current,We=Y.arrow?.x||0,Ie=Y.arrow?.y||0,Ve=ve?.clientWidth||0,Jt=ve?.clientHeight||0,_e=We+Ve/2,pt=Ie+Jt/2,Zt=Math.abs(Y.shift?.y||0),Qt=U.reference.height/2,he=typeof s=="function"?s(Et(P,i,V)):s,en=Zt>he,tn={top:`${_e}px calc(100% + ${he}px)`,bottom:`${_e}px ${-he}px`,left:`calc(100% + ${he}px) ${pt}px`,right:`${-he}px ${pt}px`}[me],nn=`${_e}px ${U.reference.y+Qt-j}px`;return z.floating.style.setProperty("--transform-origin",et&&Re==="y"&&en?nn:tn),{}}},vo,b),oe(()=>{!w&&x&&x.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[w,x]);const $e=y.useMemo(()=>({elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:ce,elements:ge,x:ot,y:it,middlewareData:le,update:we,placement:st,context:rt,isPositioned:Z,floatingStyles:ct}=t({rootContext:x,open:m?w:void 0,placement:Xt,middleware:re,strategy:o,whileElementsMounted:m?void 0:(...P)=>At(...P,$e),nodeId:v,externalTree:A}),{sideX:lt,sideY:at}=le.adaptiveOrigin||Ao,ye=Z?o:"fixed",ft=y.useMemo(()=>{let P;return Z?b?P={position:ye,[lt]:ot,[at]:it}:P={...ct,position:ye}:P={position:ye,top:0,left:0},P[Ct]="100vw",P[St]="100vh",Z||(P.opacity=0),P},[b,ye,lt,ot,at,it,ct,Z]),be=y.useRef(null);oe(()=>{if(!w)return;const P=k.current,z=typeof P=="function"?P():P,H=(Pt(z)?z.current:z)||null||null;H!==be.current&&(ce.setPositionReference(H),be.current=H)},[w,ce,L,k]),y.useEffect(()=>{if(!w)return;const P=k.current;typeof P!="function"&&Pt(P)&&P.current!==be.current&&(ce.setPositionReference(P.current),be.current=P.current)},[w,ce,L,k]),y.useEffect(()=>{if(m&&w&&ge.reference&&ge.floating)return At(ge.reference,ge.floating,we,$e)},[m,w,ge,we,$e]);const ae=X(st),ut=Nt(i,ae,V),dt=ne(st)||"center",gt=!!le.hide?.referenceHidden;oe(()=>{R&&w&&Z&&ae!==pe&&O(ae)},[R,w,Z,ae,pe]);const mt=y.useMemo(()=>({position:"absolute",top:le.arrow?.y,left:le.arrow?.x}),[le.arrow]),ht=le.arrow?.centerOffset!==0;return y.useMemo(()=>({positionerStyles:ft,arrowStyles:mt,arrowRef:se,arrowUncentered:ht,side:ut,align:dt,physicalSide:ae,anchorHidden:gt,refs:ce,context:rt,isPositioned:Z,update:we}),[ft,mt,se,ht,ut,dt,ae,gt,ce,rt,Z,we])}function Pt(e){return e!=null&&"current"in e}function Co(e){return e==="starting"?mn:Tt}function Wo(e,t,{styles:n,transitionStatus:o,props:i,refs:s,hidden:r,inert:c=!1}){const l={...n};return c&&(l.pointerEvents="none"),hn("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:r,style:l},Co(o),i],stateAttributesMapping:yn})}function So(e){const t=y.useRef(""),n=y.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:y.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:n}}function Eo(e,t){const n=y.useRef(e),o=qe(t);oe(()=>{n.current!==e&&o(n.current),n.current=e},[e,o])}function Po(e,t){const n=qe((s,r)=>{(typeof e=="function"?e():e)||t(r||(pn?"touch":""))}),{onClick:o,onPointerDown:i}=So(n);return y.useMemo(()=>({onClick:o,onPointerDown:i}),[o,i])}function Io(e){const[t,n]=y.useState(null),o=Po(e,n);return Eo(e,i=>{i&&!e&&n(null)}),y.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const To=20;function Vo(e,t,n,o){const[i,s]=y.useState(!1);oe(()=>{if(!e||!t||n==null){s(!1);return}const r=kt(n).documentElement.clientWidth,c=n.offsetWidth;s(r>0&&c>0&&c>=r-To)},[e,t,n]),bn(e&&(!t||i),o)}const Mo=y.createContext(void 0);function _o(e){return y.useContext(Mo)}export{ko as C,Fo as a,Po as b,$o as c,Vo as d,Wo as e,_o as f,Co as g,Io as h,yo as i,Qn as p,Te as r,Eo as u};
@@ -1 +0,0 @@
1
- import{j as e,c as a,S as R,U as E,r as b,q as $,d as O,e as W}from"./__vite-browser-external-HdCplPKs.js";import{S as F}from"./Select-Z2xTQ55f.js";import{u as K,T as D}from"./Controls-DxnaHBzv.js";import{F as N,S as G,a as z}from"./FadeIn-BFLojPGG.js";import{A as H}from"./arrow-up-right-CA5IJkqo.js";import{D as U}from"./download-DBm8dmvt.js";import"./ToolbarRootContext-DnC8LT_8.js";import"./useScrollLock-BUVUIPTX.js";import"./check-BBjF3bSm.js";import"./SelectItemText-Daq-XRZg.js";import"./Card-D7GmLoqP.js";import"./react-B4FPJgs_.js";import"./use-reduced-motion-aSaQtoJu.js";const V=["todayTokens","todayCost"],x="none",T=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"},{id:"codexCredits",label:"Codex Credit Limit",shortLabel:"Cx Cred",category:"limits"},{id:"codexSpark5h",label:"Codex Spark 5h Limit",shortLabel:"Cx Spark 5h",category:"limits"},{id:"codexSpark7d",label:"Codex Spark 7d Limit",shortLabel:"Cx Spark 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaudeWeekly",label:"Antigravity Claude 7d Limit",shortLabel:"Ag Cl 7d",category:"limits"},{id:"antigravityClaude5h",label:"Antigravity Claude 5h Limit",shortLabel:"Ag Cl 5h",category:"limits"},{id:"antigravityGeminiWeekly",label:"Antigravity Gemini 7d Limit",shortLabel:"Ag Gm 7d",category:"limits"},{id:"antigravityGemini5h",label:"Antigravity Gemini 5h Limit",shortLabel:"Ag Gm 5h",category:"limits"}];function S(t,i=T,r=2){const s=new Set(i.map(n=>n.id)),o=new Set,l=Array.isArray(t)?t.filter(n=>n===x?!0:!s.has(n)||o.has(n)?!1:(o.add(n),!0)):[];return(l.length>0?l:V).slice(0,Math.max(1,Number(r)||2))}const X=264,Y=124,g="ui-rounded, -apple-system, system-ui",C=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],q={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Z(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function y({size:t="sm",children:i}){const r=t==="lg",s=r?560:264,o=r?32:22;return e.jsx("div",{className:W("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",r?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:s,aspectRatio:`${X} / ${Y}`,borderRadius:o},children:i})})}function J({size:t="sm"}){const i="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",r=`${i} L264,124 L0,124 Z`,s=`sparkArea-${t}`;return e.jsx(y,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:a("widgets.preview.today")}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:a("widgets.preview.seven_days")}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$673.61"}),e.jsx("path",{d:r,fill:`url(#${s})`,stroke:"none"}),e.jsx("path",{d:i,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const _=(()=>{const r=[];for(let s=0;s<26;s++)for(let o=0;o<7;o++){const l=Math.sin((s+1)*12.9898+(o+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(l-Math.floor(l))*100);r.push({w:s,d:o,v:c})}return r})();function A(t,i){return t<18?i?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function Q(){return e.jsx(y,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:_.map(l=>e.jsx("rect",{x:l.w*(7.5+1.2),y:l.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(l.v,!0)},`d-${l.w}-${l.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:_.map(l=>e.jsx("rect",{x:l.w*(7.5+1.2),y:l.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(l.v,!1)},`l-${l.w}-${l.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:g,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:a("widgets.preview.heatmap_summary",{days:202})})]})})}function ee(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],i=22,r=28,s=14,o=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((l,c)=>{const n=r+c*i,u=C[c%C.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:u}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:l.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:g,children:l.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:g,children:[l.pct,"%"]}),e.jsx("rect",{x:s,y:n+4,width:o,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:s,y:n+4,width:Math.max(o*(l.pct/100),4),height:"2.8",rx:"1.4",fill:u})]},l.name)})})})}function te(){const t=[{label:`${a("limits.provider.claude")} · ${a("limits.label.claude_7d")}`,source:"claude",reset:a("widgets.preview.reset_days",{days:1}),pct:61},{label:`${a("limits.provider.claude")} · ${a("limits.label.claude_5h")}`,source:"claude",reset:a("widgets.preview.reset_hours_minutes",{hours:4,minutes:28}),pct:4},{label:a("limits.provider.cursor"),source:"cursor",reset:a("widgets.preview.reset_days",{days:25}),pct:51},{label:`${a("limits.provider.codex")} · ${a("limits.label.codex_7d")}`,source:"codex",reset:a("widgets.preview.reset_days",{days:1}),pct:32}],i=22,r=28,s=14,o=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((l,c)=>{const n=r+c*i,u=q[l.source],p=Z(l.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:u}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:l.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:l.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:g,children:[l.pct,"%"]}),e.jsx("rect",{x:s,y:n+4,width:o,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:s,y:n+4,width:Math.max(o*(l.pct/100),4),height:"2.8",rx:"1.4",fill:p})]},l.label)})})})}function ae(t){switch(t.category){case"none":return"";case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ie(t,i){switch(t){case x:return a("menubar.metric.none");case"todayTokens":return a("menubar.metric.today_tokens");case"todayCost":return a("menubar.metric.today_cost");case"last7dTokens":return a("menubar.metric.last_7d_tokens");case"totalTokens":return a("menubar.metric.total_tokens");case"totalCost":return a("menubar.metric.total_cost");case"claude5h":return a("menubar.metric.claude_5h");case"claude7d":return a("menubar.metric.claude_7d");case"codex5h":return a("menubar.metric.codex_5h");case"codex7d":return a("menubar.metric.codex_7d");case"codexCredits":return a("menubar.metric.codex_credits");case"codexSpark5h":return a("menubar.metric.codex_spark_5h");case"codexSpark7d":return a("menubar.metric.codex_spark_7d");default:return i}}function se(t,i){const r=new Set(i.map(o=>o.id)),s=t.filter(o=>o===x||r.has(o));for(const o of i){if(s.length>=2)break;o.id!==x&&(s.includes(o.id)||s.push(o.id))}return s.slice(0,2)}function re({slotConfigs:t,showStats:i}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),i?t.filter(({item:r})=>r?.category!=="none").map(({slot:r,item:s},o)=>e.jsxs(O.Fragment,{children:[o>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:W("flex min-w-[52px] flex-col items-center justify-center py-1.5",o===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:s?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:s?.shortLabel||a("widgets.preview.metric")})]})]},r)):null]})})}function le({slot:t,value:i,options:r,disabled:s,onChange:o}){const l=t===0?a("menubar.slot.primary"):a("menubar.slot.secondary");return e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:l}),e.jsx(F,{value:i,disabled:s,ariaLabel:l,onValueChange:c=>o(t,c),options:r.map(c=>({value:c.id,label:c.displayLabel})),matchTriggerWidth:!0,className:"w-full px-3 py-2 text-sm font-medium"})]})}function w({label:t,hint:i,checked:r,disabled:s,onChange:o}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(D,{checked:r,disabled:s,onChange:o,ariaLabel:t})]})}function oe({label:t,hint:i,value:r,options:s,disabled:o,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(F,{value:r,disabled:o,ariaLabel:t,onValueChange:l,options:s,className:"shrink-0 px-3 py-2 text-sm font-medium"})]})}function ne(){const{available:t,settings:i,setSetting:r}=K(),s=b.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:T).map(m=>({...m,displayLabel:ie(m.id,m.label),previewValue:ae(m)})),[i?.menuBarAvailableItems]),o=Number(i?.menuBarMaxItems)||2,l=b.useMemo(()=>S(i?.menuBarItems,s,o),[s,o,i?.menuBarItems]),c=b.useMemo(()=>se(l,s),[s,l]),n=i?.showStats!==!1,u=d=>{r("menuBarItems",S(d,s,o))},p=(d,m)=>{const h=[...c];m!==x&&h[d===0?1:0]===m||(h[d]=m,u(h))},k=[0,1].map(d=>{const m=c[d]||s[d]?.id||"",L=c[d===0?1:0],I=s.filter(f=>f.id===x||f.id===m||f.id!==L),P=s.find(f=>f.id===m);return{slot:d,currentValue:m,options:I,item:P}}),B=["clawd","bot","cat","pet","static"].includes(i?.menuBarIconStyle)?i.menuBarIconStyle:"clawd",j=i?.toastOnReset!==!1,v=i?.confettiOnReset!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(re,{slotConfigs:k,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:k.map(({slot:d,currentValue:m,options:h})=>e.jsx(le,{slot:d,value:m,options:h,disabled:!t||!n,onChange:p},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(w,{label:a("settings.menubar.showStats"),hint:t?a("settings.menubar.showStatsHint"):a("menubar.native_only"),checked:n,disabled:!t,onChange:()=>r("showStats",!n)}),e.jsx(oe,{label:a("settings.menubar.iconStyle"),hint:a("settings.menubar.iconStyleHint"),value:B,disabled:!t,options:[{value:"clawd",label:a("settings.menubar.iconStyle.clawd")},{value:"bot",label:a("settings.menubar.iconStyle.bot")},{value:"cat",label:a("settings.menubar.iconStyle.cat")},{value:"pet",label:a("settings.menubar.iconStyle.pet")},{value:"static",label:a("settings.menubar.iconStyle.static")}],onChange:d=>r("menuBarIconStyle",d)}),e.jsx(w,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),checked:j,disabled:!t,onChange:()=>r("toastOnReset",!j)}),e.jsx(w,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),checked:v,disabled:!t,onChange:()=>r("confettiOnReset",!v)})]})]})}function ce(){const[t,i]=b.useState("loading");return b.useEffect(()=>{if(typeof window>"u")return;if($()){i("native");return}const r=(navigator.userAgent||"").toLowerCase(),s=/mac/.test(r)&&!/iphone|ipad/.test(r);i(s?"mac-web":"other")},[]),t}function de(){const t=ce();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>R("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[a("widgets.cta.open_gallery"),e.jsx(H,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/xiufengsun/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(U,{className:"h-4 w-4","aria-hidden":"true"}),a("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(E,{className:"h-4 w-4","aria-hidden":"true"}),a("widgets.cta.macos_only")]})}const me=[{id:"summary",Preview:J,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:Q,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:ee,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:te,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function ge({Preview:t,nameKey:i,descKey:r}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:a(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:a(r)})]})]})}function M({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:a(t)})}function Ce(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(N,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(de,{})})]})}),e.jsx(N,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":a("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(M,{titleKey:"widgets.menubar.section.title"}),e.jsx(ne,{})]})}),e.jsxs("section",{"aria-label":a("widgets.gallery.section.title"),children:[e.jsx(M,{titleKey:"widgets.gallery.section.title"}),e.jsx(G,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:me.map(({id:t,Preview:i,nameKey:r,descKey:s})=>e.jsx(z,{children:e.jsx(ge,{Preview:i,nameKey:r,descKey:s})},t))})})]})]})})})}export{Ce as WidgetsPage};