tokentracker-cli 0.83.0 → 0.83.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-CFuXV5fe.js → AchievementBadge-BrSr5pjk.js} +1 -1
  2. package/dashboard/dist/assets/AchievementsPage-za-wqAO2.js +2 -0
  3. package/dashboard/dist/assets/AchievementsSection-CGRVm1uS.js +1 -0
  4. package/dashboard/dist/assets/BadgeDetailModal-D1XDT2dG.js +1 -0
  5. package/dashboard/dist/assets/{Card-BfIA_INW.js → Card-DX2Wwm9U.js} +1 -1
  6. package/dashboard/dist/assets/{ClawdAnimated-CwR_ecYb.js → ClawdAnimated-D6JzFu8y.js} +1 -1
  7. package/dashboard/dist/assets/CommandPalette-NWiETwtS.js +1 -0
  8. package/dashboard/dist/assets/CommunityStatsModal-D4FdxAWd.js +1 -0
  9. package/dashboard/dist/assets/{ConfirmModal-C8j0RpGd.js → ConfirmModal-SAheZUAv.js} +1 -1
  10. package/dashboard/dist/assets/DashboardPage-CjnBsm3Q.js +1 -0
  11. package/dashboard/dist/assets/{DevicePage-RjjWbW4F.js → DevicePage-Cf-PHRlL.js} +1 -1
  12. package/dashboard/dist/assets/DialogClose-pg5pVOeD.js +1 -0
  13. package/dashboard/dist/assets/DialogDescription-CVuGFYFU.js +1 -0
  14. package/dashboard/dist/assets/{DialogTitle-DS810PC0.js → DialogTitle-Im7ESzoS.js} +1 -1
  15. package/dashboard/dist/assets/FadeIn-CGGFraHR.js +1 -0
  16. package/dashboard/dist/assets/{HeaderGithubStar-C2QtX7sw.js → HeaderGithubStar-DRTZXRsx.js} +1 -1
  17. package/dashboard/dist/assets/{IpCheckPage-CgMt9L_t.js → IpCheckPage-Dn62HUZu.js} +1 -1
  18. package/dashboard/dist/assets/LandingPage-CLsljoir.js +2 -0
  19. package/dashboard/dist/assets/{LeaderboardAvatar-CVvOwhnW.js → LeaderboardAvatar-DktI_89h.js} +1 -1
  20. package/dashboard/dist/assets/LeaderboardPage-t87ElnDI.js +2 -0
  21. package/dashboard/dist/assets/{LeaderboardProfileModal-BUydt-W1.js → LeaderboardProfileModal-DN7HurS3.js} +4 -4
  22. package/dashboard/dist/assets/{LeaderboardProfilePage-DS0-21QT.js → LeaderboardProfilePage-CprOXLXX.js} +3 -3
  23. package/dashboard/dist/assets/{LimitsPage-BPs_yxZq.js → LimitsPage-DRX3XMYx.js} +3 -3
  24. package/dashboard/dist/assets/{LocalOnlyNotice-BaK2hDrE.js → LocalOnlyNotice-B8BtIdAA.js} +1 -1
  25. package/dashboard/dist/assets/LoginCard-OoduGJmK.js +1 -0
  26. package/dashboard/dist/assets/LoginModal-DoDoCpr6.js +1 -0
  27. package/dashboard/dist/assets/LoginPage-Dn2KMisI.js +1 -0
  28. package/dashboard/dist/assets/PetPage-CVaG5H3O.js +1 -0
  29. package/dashboard/dist/assets/PopoverPopup-B2HqJNaq.js +1 -0
  30. package/dashboard/dist/assets/ProviderIcon-BYl1Yyf3.js +1 -0
  31. package/dashboard/dist/assets/ResetPasswordPage-DWfgvuvR.js +1 -0
  32. package/dashboard/dist/assets/{Select-DZKuIQbj.js → Select-ClnnGJY1.js} +1 -1
  33. package/dashboard/dist/assets/SelectItemText-iaFWq7GD.js +1 -0
  34. package/dashboard/dist/assets/SettingsPage-zwAOWRur.js +1 -0
  35. package/dashboard/dist/assets/SkillsPage-BB96nB2i.js +1 -0
  36. package/dashboard/dist/assets/TokenGalaxy-9_VJKdPr.js +4314 -0
  37. package/dashboard/dist/assets/TrendMonitor-D9RHcQgH.js +19 -0
  38. package/dashboard/dist/assets/WidgetsPage-CjAT6p0C.js +1 -0
  39. package/dashboard/dist/assets/{WrappedPage-3NmejmVU.js → WrappedPage-ba6teG1N.js} +1 -1
  40. package/dashboard/dist/assets/__vite-browser-external-DWKjPxnU.js +1350 -0
  41. package/dashboard/dist/assets/__vite-browser-external-D_0JUhT7.css +1 -0
  42. package/dashboard/dist/assets/agent-logos-HCzl7U8i.js +1 -0
  43. package/dashboard/dist/assets/{arrow-up-right-DvzvdSQb.js → arrow-up-right-TvEj8NTT.js} +1 -1
  44. package/dashboard/dist/assets/{check-CoXa_Xbp.js → check-Cz3lYRiR.js} +1 -1
  45. package/dashboard/dist/assets/{copy-Dj_-rH-c.js → copy-CTtF84H9.js} +1 -1
  46. package/dashboard/dist/assets/{download-CR4S1Aif.js → download-B5WAY6Nh.js} +1 -1
  47. package/dashboard/dist/assets/{flame-nDDFx8aX.js → flame-Cja4F8Mj.js} +1 -1
  48. package/dashboard/dist/assets/{format-tokens-B1ivtp29.js → format-tokens-UavRPN4W.js} +1 -1
  49. package/dashboard/dist/assets/{icons-DcLZmQNe.js → icons-BW2vjmu_.js} +1 -1
  50. package/dashboard/dist/assets/index-0w19KMWl.js +9 -0
  51. package/dashboard/dist/assets/index-Bfxr6erc.js +1 -0
  52. package/dashboard/dist/assets/index-BnzrUY9J.js +1 -0
  53. package/dashboard/dist/assets/{info-DSsp1azO.js → info-F-75j15K.js} +1 -1
  54. package/dashboard/dist/assets/{limits-providers-B4Uj6owF.js → limits-providers-8NsMiLNP.js} +1 -1
  55. package/dashboard/dist/assets/{link-2-XUFa3f41.js → link-2-C_eJlLvb.js} +1 -1
  56. package/dashboard/dist/assets/{loader-circle-BirzI_cK.js → loader-circle-BjzQhjhO.js} +1 -1
  57. package/dashboard/dist/assets/module-kH5GsDis.js +2 -0
  58. package/dashboard/dist/assets/provider-display-D1zp03ID.js +42 -0
  59. package/dashboard/dist/assets/react-Nv3-bJyw.js +1 -0
  60. package/dashboard/dist/assets/skills-api-DazKXxME.js +1 -0
  61. package/dashboard/dist/assets/{terminal-BcVv_u2s.js → terminal-DBXjwlTm.js} +1 -1
  62. package/dashboard/dist/assets/{trash-2-ChpB4JZy.js → trash-2-DLG8hKJm.js} +1 -1
  63. package/dashboard/dist/assets/{use-community-stats-CdwfjUzX.js → use-community-stats-BQB72xAN.js} +1 -1
  64. package/dashboard/dist/assets/{use-limits-display-prefs-Dux0zZ9d.js → use-limits-display-prefs-CH8MmjYf.js} +1 -1
  65. package/dashboard/dist/assets/{use-native-settings-B3uhNxG6.js → use-native-settings-__RhxrW5.js} +1 -1
  66. package/dashboard/dist/assets/{use-ordered-list-CGzxXBMg.js → use-ordered-list-AhnqpdnT.js} +1 -1
  67. package/dashboard/dist/assets/use-reduced-motion-CA2IXeeO.js +1 -0
  68. package/dashboard/dist/assets/{use-session-efficiency-pref-D46S_ial.js → use-session-efficiency-pref-CCYtJ_cN.js} +1 -1
  69. package/dashboard/dist/assets/use-transform-BhcppNI4.js +1 -0
  70. package/dashboard/dist/assets/{use-usage-limits-Bg7JDy3y.js → use-usage-limits-CbA095lv.js} +1 -1
  71. package/dashboard/dist/assets/{useCurrency-gI4OcAFt.js → useCurrency-Dt2GqkDm.js} +1 -1
  72. package/dashboard/dist/assets/{useScrollLock-Bf0bCnKB.js → useScrollLock-C5d53j7C.js} +1 -1
  73. package/dashboard/dist/assets/{useTokenFormat-LEqBrCju.js → useTokenFormat-dnqZK7Z-.js} +1 -1
  74. package/dashboard/dist/assets/{zap-DFBBQ-y1.js → zap-Bw5OO91s.js} +1 -1
  75. package/dashboard/dist/index.html +2 -2
  76. package/dashboard/dist/share.html +2 -2
  77. package/package.json +1 -1
  78. package/src/commands/serve.js +21 -4
  79. package/src/commands/sync.js +142 -73
  80. package/src/lib/cursor-store.js +52 -2
  81. package/src/lib/local-api.js +143 -35
  82. package/src/lib/pricing/curated-overrides.json +3 -0
  83. package/src/lib/pricing/seed-snapshot.json +1 -1
  84. package/src/lib/runtime-config.js +19 -1
  85. package/dashboard/dist/assets/AchievementsPage-BZjeqSoK.js +0 -2
  86. package/dashboard/dist/assets/AchievementsSection-CbUEDJz0.js +0 -1
  87. package/dashboard/dist/assets/BadgeDetailModal-DEKnEruJ.js +0 -1
  88. package/dashboard/dist/assets/CommunityStatsModal-DbvrEHOl.js +0 -1
  89. package/dashboard/dist/assets/DashboardPage-iHzYecBI.js +0 -1
  90. package/dashboard/dist/assets/DialogClose-DTi8qCfV.js +0 -1
  91. package/dashboard/dist/assets/DialogDescription-B1bA7SgT.js +0 -1
  92. package/dashboard/dist/assets/FadeIn-BdzFMsS_.js +0 -1
  93. package/dashboard/dist/assets/LandingPage-CVUU3YZx.js +0 -4314
  94. package/dashboard/dist/assets/LeaderboardPage-Cu5LKqRp.js +0 -2
  95. package/dashboard/dist/assets/LoginPage-B1LXDbg1.js +0 -1
  96. package/dashboard/dist/assets/PetPage-CcQkf379.js +0 -1
  97. package/dashboard/dist/assets/PopoverPopup-Bi8OnMB7.js +0 -1
  98. package/dashboard/dist/assets/ResetPasswordPage-DWmnjhYZ.js +0 -1
  99. package/dashboard/dist/assets/SelectItemText-BR4lCZFV.js +0 -1
  100. package/dashboard/dist/assets/SettingsPage-BBSl_Z-L.js +0 -1
  101. package/dashboard/dist/assets/SkillsPage-CqCEBfol.js +0 -1
  102. package/dashboard/dist/assets/TrendMonitor-B3BX8OWh.js +0 -19
  103. package/dashboard/dist/assets/WidgetsPage-DGlgqfrI.js +0 -1
  104. package/dashboard/dist/assets/__vite-browser-external-BoyaLR3G.js +0 -1354
  105. package/dashboard/dist/assets/__vite-browser-external-C44tPAD-.css +0 -1
  106. package/dashboard/dist/assets/agent-logos-D17Yygwp.js +0 -1
  107. package/dashboard/dist/assets/provider-display-BhSu_Pfw.js +0 -42
  108. package/dashboard/dist/assets/use-transform-CTs3oD8M.js +0 -1
@@ -0,0 +1 @@
1
+ import{k as Vr,bc as kr,r as l,bx as Ht,b4 as vt,aC as qn,bF as Nr,av as zt,y as _e,b5 as Ae,cv as it,cw as rn,bo as nt,bO as rt,aK as Be,cx as un,bM as Ct,bL as _t,cy as Hr,cz as Kn,cA as _r,bt as fn,bT as dn,cB as jt,cC as En,cD as Xn,Z as Br,bu as Wr,aG as Tt,aF as J,by as Gn,bv as Ur,O as ue,cE as Cn,cF as Jt,cG as Tn,bC as Qt,b6 as ot,aD as at,cH as An,cI as It,bf as Jn,cJ as Yt,cK as qt,cL as Qn,cM as pn,cN as $r,bH as zr,cO as on,cP as jr,x as gt,bS as Yr,aw as Mt,aH as Le,j as Me,au as oe,N as z,ay as gn,aJ as sn,aI as qr,aL as Kr,aM as Xr,aN as mn,cQ as Gr,bD as Jr,br as Qr,w as Zn,cR as Zr,az as eo,cS as to,aA as no,bE as ro,b8 as oo,cT as so,ax as er,cU as Zt}from"./__vite-browser-external-DWKjPxnU.js";import{n as Mn,q as tr,F as io,P as co,o as nr,v as Ye,E as lo,G as et,H as rr,J as ao,p as or,u as uo,m as sr,h as fo,a as po,l as go,A as mo,i as ho,I as xo,d as yo,b as wo}from"./useScrollLock-C5d53j7C.js";const Ro=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ei=Vr("chevron-down",Ro),bo=["top","right","bottom","left"],wt=Math.min,He=Math.max,Bt=Math.round,Ot=Math.floor,Ge=e=>({x:e,y:e}),So={left:"right",right:"left",bottom:"top",top:"bottom"};function cn(e,t,n){return He(e,wt(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function ut(e){return e.split("-")[1]}function hn(e){return e==="x"?"y":"x"}function xn(e){return e==="y"?"height":"width"}function je(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yn(e){return hn(je(e))}function vo(e,t,n){n===void 0&&(n=!1);const r=ut(e),o=yn(e),s=xn(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Wt(i)),[i,Wt(i)]}function Eo(e){const t=Wt(e);return[ln(e),t,ln(t)]}function ln(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const In=["left","right"],On=["right","left"],Co=["top","bottom"],To=["bottom","top"];function Ao(e,t,n){switch(e){case"top":case"bottom":return n?t?On:In:t?In:On;case"left":case"right":return t?Co:To;default:return[]}}function Mo(e,t,n,r){const o=ut(e);let s=Ao(Ve(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ln)))),s}function Wt(e){const t=Ve(e);return So[t]+e.slice(t.length)}function Io(e){return{top:0,right:0,bottom:0,left:0,...e}}function ir(e){return typeof e!="number"?Io(e):{top:e,right:e,bottom:e,left:e}}function At(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Rt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function Oo(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:c=0,reason:a=kr}=t,f="rootStore"in e?e.rootStore:e,g=f.context.dataRef,u=l.useRef(void 0),d=Ht(),p=vt(),m=l.useMemo(()=>{function y(h,b,x,w){const S=_e(a,b,x);h&&w==="touch"&&c>0?p.start(c,()=>{f.setOpen(!0,S)}):f.setOpen(h,S)}function R(h,b,x){const w=g.current.openEvent,S=f.select("domReferenceElement")!==b;return h&&S||!h||!o?!0:w&&i?!x(w.type):!1}return{onPointerDown(h){u.current=h.pointerType},onMouseDown(h){const b=u.current,x=h.nativeEvent,w=f.select("open");if(h.button!==0||r==="click"||Mn(b,!0)&&s)return;const S=R(w,h.currentTarget,T=>T==="click"||T==="mousedown"),C=qn(x);if(Nr(C)){y(S,x,C,b);return}const P=h.currentTarget;d.request(()=>{y(S,x,P,b)})},onClick(h){if(r==="mousedown-only")return;const b=u.current;if(r==="mousedown"&&b){u.current=void 0;return}if(Mn(b,!0)&&s)return;const x=f.select("open"),w=R(x,h.currentTarget,S=>S==="click"||S==="mousedown"||S==="keydown"||S==="keyup");y(w,h.nativeEvent,h.currentTarget,b)},onKeyDown(){u.current=void 0}}},[g,r,s,a,f,i,o,d,p,c]);return l.useMemo(()=>n?{reference:m}:zt,[n,m])}function Pn(e,t,n){let{reference:r,floating:o}=e;const s=je(t),i=yn(t),c=xn(i),a=Ve(t),f=s==="y",g=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:g,y:r.y-o.height};break;case"bottom":p={x:g,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(ut(t)){case"start":p[i]-=d*(n&&f?-1:1);break;case"end":p[i]+=d*(n&&f?-1:1);break}return p}async function Po(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=st(t,e),m=ir(p),R=c[d?u==="floating"?"reference":"floating":u],h=At(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(R)))==null||n?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:g,strategy:a})),b=u==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),w=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},S=At(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:x,strategy:a}):b);return{top:(h.top-S.top+m.top)/w.y,bottom:(S.bottom-h.bottom+m.bottom)/w.y,left:(h.left-S.left+m.left)/w.x,right:(S.right-h.right+m.right)/w.x}}const Do=50,Lo=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Po},a=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:g,y:u}=Pn(f,r,a),d=r,p=0;const m={};for(let y=0;y<s.length;y++){const R=s[y];if(!R)continue;const{name:h,fn:b}=R,{x,y:w,data:S,reset:C}=await b({x:g,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:f,platform:c,elements:{reference:e,floating:t}});g=x??g,u=w??u,m[h]={...m[h],...S},C&&p<Do&&(p++,typeof C=="object"&&(C.placement&&(d=C.placement),C.rects&&(f=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:g,y:u}=Pn(f,d,a)),y=-1)}return{x:g,y:u,placement:d,strategy:o,middlewareData:m}},Fo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:f}=t,{mainAxis:g=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...R}=st(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const h=Ve(o),b=je(c),x=Ve(c)===c,w=await(a.isRTL==null?void 0:a.isRTL(f.floating)),S=d||(x||!y?[Wt(c)]:Eo(c)),C=m!=="none";!d&&C&&S.push(...Mo(c,y,m,w));const P=[c,...S],T=await a.detectOverflow(t,R),L=[];let _=((r=s.flip)==null?void 0:r.overflows)||[];if(g&&L.push(T[h]),u){const M=vo(o,i,w);L.push(T[M[0]],T[M[1]])}if(_=[..._,{placement:o,overflows:L}],!L.every(M=>M<=0)){var X,B;const M=(((X=s.flip)==null?void 0:X.index)||0)+1,N=P[M];if(N&&(!(u==="alignment"?b!==je(N):!1)||_.every(E=>je(E.placement)===b?E.overflows[0]>0:!0)))return{data:{index:M,overflows:_},reset:{placement:N}};let Y=(B=_.filter(F=>F.overflows[0]<=0).sort((F,E)=>F.overflows[1]-E.overflows[1])[0])==null?void 0:B.placement;if(!Y)switch(p){case"bestFit":{var k;const F=(k=_.filter(E=>{if(C){const W=je(E.placement);return W===b||W==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(W=>W>0).reduce((W,A)=>W+A,0)]).sort((E,W)=>E[1]-W[1])[0])==null?void 0:k[0];F&&(Y=F);break}case"initialPlacement":Y=c;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};function Dn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ln(e){return bo.some(t=>e[t]>=0)}const Vo=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=st(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=Dn(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Ln(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=Dn(i,n.floating);return{data:{escapedOffsets:c,escaped:Ln(c)}}}default:return{}}}}},cr=new Set(["left","top"]);async function ko(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ve(n),c=ut(n),a=je(n)==="y",f=cr.has(i)?-1:1,g=s&&a?-1:1,u=st(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof m=="number"&&(p=c==="end"?m*-1:m),a?{x:p*g,y:d*f}:{x:d*f,y:p*g}}const No=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await ko(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},Ho=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:h=>{let{x:b,y:x}=h;return{x:b,y:x}}},...f}=st(e,t),g={x:n,y:r},u=await s.detectOverflow(t,f),d=je(Ve(o)),p=hn(d);let m=g[p],y=g[d];if(i){const h=p==="y"?"top":"left",b=p==="y"?"bottom":"right",x=m+u[h],w=m-u[b];m=cn(x,m,w)}if(c){const h=d==="y"?"top":"left",b=d==="y"?"bottom":"right",x=y+u[h],w=y-u[b];y=cn(x,y,w)}const R=a.fn({...t,[p]:m,[d]:y});return{...R,data:{x:R.x-n,y:R.y-r,enabled:{[p]:i,[d]:c}}}}}},_o=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:a=!0,crossAxis:f=!0}=st(e,t),g={x:n,y:r},u=je(o),d=hn(u);let p=g[d],m=g[u];const y=st(c,t),R=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(a){const x=d==="y"?"height":"width",w=s.reference[d]-s.floating[x]+R.mainAxis,S=s.reference[d]+s.reference[x]-R.mainAxis;p<w?p=w:p>S&&(p=S)}if(f){var h,b;const x=d==="y"?"width":"height",w=cr.has(Ve(o)),S=s.reference[u]-s.floating[x]+(w&&((h=i.offset)==null?void 0:h[u])||0)+(w?0:R.crossAxis),C=s.reference[u]+s.reference[x]+(w?0:((b=i.offset)==null?void 0:b[u])||0)-(w?R.crossAxis:0);m<S?m=S:m>C&&(m=C)}return{[d]:p,[u]:m}}}},Bo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...f}=st(e,t),g=await i.detectOverflow(t,f),u=Ve(o),d=ut(o),p=je(o)==="y",{width:m,height:y}=s.floating;let R,h;u==="top"||u==="bottom"?(R=u,h=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(h=u,R=d==="end"?"top":"bottom");const b=y-g.top-g.bottom,x=m-g.left-g.right,w=wt(y-g[R],b),S=wt(m-g[h],x),C=!t.middlewareData.shift;let P=w,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=b),C&&!d){const _=He(g.left,0),X=He(g.right,0),B=He(g.top,0),k=He(g.bottom,0);p?T=m-2*(_!==0||X!==0?_+X:He(g.left,g.right)):P=y-2*(B!==0||k!==0?B+k:He(g.top,g.bottom))}await a({...t,availableWidth:T,availableHeight:P});const L=await i.getDimensions(c.floating);return m!==L.width||y!==L.height?{reset:{rects:!0}}:{}}}};function lr(e){const t=rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Bt(n)!==s||Bt(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function wn(e){return Ae(e)?e:e.contextElement}function yt(e){const t=wn(e);if(!nt(t))return Ge(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=lr(t);let i=(s?Bt(n.width):n.width)/r,c=(s?Bt(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Wo=Ge(0);function ar(e){const t=Be(e);return!Xn()||!t.visualViewport?Wo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Be(e)?!1:t}function dt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=wn(e);let i=Ge(1);t&&(r?Ae(r)&&(i=yt(r)):i=yt(e));const c=Uo(s,n,r)?ar(s):Ge(0);let a=(o.left+c.x)/i.x,f=(o.top+c.y)/i.y,g=o.width/i.x,u=o.height/i.y;if(s){const d=Be(s),p=r&&Ae(r)?Be(r):r;let m=d,y=En(m);for(;y&&r&&p!==m;){const R=yt(y),h=y.getBoundingClientRect(),b=rt(y),x=h.left+(y.clientLeft+parseFloat(b.paddingLeft))*R.x,w=h.top+(y.clientTop+parseFloat(b.paddingTop))*R.y;a*=R.x,f*=R.y,g*=R.x,u*=R.y,a+=x,f+=w,m=Be(y),y=En(m)}}return At({width:g,height:u,x:a,y:f})}function Kt(e,t){const n=jt(e).scrollLeft;return t?t.left+n:dt(it(e)).left+n}function ur(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Kt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function $o(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=it(r),c=t?un(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},f=Ge(1);const g=Ge(0),u=nt(r);if((u||!u&&!s)&&((fn(r)!=="body"||dn(i))&&(a=jt(r)),u)){const p=dt(r);f=yt(r),g.x=p.x+r.clientLeft,g.y=p.y+r.clientTop}const d=i&&!u&&!s?ur(i,a):Ge(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+g.x+d.x,y:n.y*f.y-a.scrollTop*f.y+g.y+d.y}}function zo(e){return Array.from(e.getClientRects())}function jo(e){const t=it(e),n=jt(e),r=e.ownerDocument.body,o=He(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=He(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Kt(e);const c=-n.scrollTop;return rt(r).direction==="rtl"&&(i+=He(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Fn=25;function Yo(e,t){const n=Be(e),r=it(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const g=Xn();(!g||g&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const f=Kt(r);if(f<=0){const g=r.ownerDocument,u=g.body,d=getComputedStyle(u),p=g.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,m=Math.abs(r.clientWidth-u.clientWidth-p);m<=Fn&&(s-=m)}else f<=Fn&&(s+=f);return{width:s,height:i,x:c,y:a}}function qo(e,t){const n=dt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=nt(e)?yt(e):Ge(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,f=r*s.y;return{width:i,height:c,x:a,y:f}}function Vn(e,t,n){let r;if(t==="viewport")r=Yo(e,n);else if(t==="document")r=jo(it(e));else if(Ae(t))r=qo(t,n);else{const o=ar(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return At(r)}function fr(e,t){const n=Ct(e);return n===t||!Ae(n)||_t(n)?!1:rt(n).position==="fixed"||fr(n,t)}function Ko(e,t){const n=t.get(e);if(n)return n;let r=rn(e,[],!1).filter(c=>Ae(c)&&fn(c)!=="body"),o=null;const s=rt(e).position==="fixed";let i=s?Ct(e):e;for(;Ae(i)&&!_t(i);){const c=rt(i),a=Kn(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||dn(i)&&!a&&fr(e,i))?r=r.filter(g=>g!==i):o=c,i=Ct(i)}return t.set(e,r),r}function Xo(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?un(t)?[]:Ko(t,this._c):[].concat(n),r],c=Vn(t,i[0],o);let a=c.top,f=c.right,g=c.bottom,u=c.left;for(let d=1;d<i.length;d++){const p=Vn(t,i[d],o);a=He(p.top,a),f=wt(p.right,f),g=wt(p.bottom,g),u=He(p.left,u)}return{width:f-u,height:g-a,x:u,y:a}}function Go(e){const{width:t,height:n}=lr(e);return{width:t,height:n}}function Jo(e,t,n){const r=nt(t),o=it(t),s=n==="fixed",i=dt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ge(0);function f(){a.x=Kt(o)}if(r||!r&&!s)if((fn(t)!=="body"||dn(o))&&(c=jt(t)),r){const p=dt(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&f();s&&!r&&o&&f();const g=o&&!r&&!s?ur(o,c):Ge(0),u=i.left+c.scrollLeft-a.x-g.x,d=i.top+c.scrollTop-a.y-g.y;return{x:u,y:d,width:i.width,height:i.height}}function en(e){return rt(e).position==="static"}function kn(e,t){if(!nt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return it(e)===n&&(n=n.ownerDocument.body),n}function dr(e,t){const n=Be(e);if(un(e))return n;if(!nt(e)){let o=Ct(e);for(;o&&!_t(o);){if(Ae(o)&&!en(o))return o;o=Ct(o)}return n}let r=kn(e,t);for(;r&&Hr(r)&&en(r);)r=kn(r,t);return r&&_t(r)&&en(r)&&!Kn(r)?n:r||_r(e)||n}const Qo=async function(e){const t=this.getOffsetParent||dr,n=this.getDimensions,r=await n(e.floating);return{reference:Jo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zo(e){return rt(e).direction==="rtl"}const pr={convertOffsetParentRelativeRectToViewportRelativeRect:$o,getDocumentElement:it,getClippingRect:Xo,getOffsetParent:dr,getElementRects:Qo,getClientRects:zo,getDimensions:Go,getScale:yt,isElement:Ae,isRTL:Zo};function gr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function es(e,t){let n=null,r;const o=it(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const f=e.getBoundingClientRect(),{left:g,top:u,width:d,height:p}=f;if(c||t(),!d||!p)return;const m=Ot(u),y=Ot(o.clientWidth-(g+d)),R=Ot(o.clientHeight-(u+p)),h=Ot(g),x={rootMargin:-m+"px "+-y+"px "+-R+"px "+-h+"px",threshold:He(0,wt(1,a))||1};let w=!0;function S(C){const P=C[0].intersectionRatio;if(P!==a){if(!w)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!gr(f,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(S,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return i(!0),s}function Nn(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,f=wn(e),g=o||s?[...f?rn(f):[],...t?rn(t):[]]:[];g.forEach(h=>{o&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const u=f&&c?es(f,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(h=>{let[b]=h;b&&b.target===f&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),f&&!a&&p.observe(f),t&&p.observe(t));let m,y=a?dt(e):null;a&&R();function R(){const h=dt(e);y&&!gr(y,h)&&n(),y=h,m=requestAnimationFrame(R)}return n(),()=>{var h;g.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),u?.(),(h=p)==null||h.disconnect(),p=null,a&&cancelAnimationFrame(m)}}const ts=No,ns=Ho,rs=Fo,os=Bo,ss=Vo,is=_o,cs=(e,t,n)=>{const r=new Map,o={platform:pr,...n},s={...o.platform,_c:r};return Lo(e,t,{...o,platform:s})};var ls=typeof document<"u",as=function(){},kt=ls?l.useLayoutEffect:as;function Ut(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,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ut(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ut(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function mr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Hn(e,t){const n=mr(e);return Math.round(t*n)/n}function tn(e){const t=l.useRef(e);return kt(()=>{t.current=e}),t}function us(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:f}=e,[g,u]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=l.useState(r);Ut(d,r)||p(r);const[m,y]=l.useState(null),[R,h]=l.useState(null),b=l.useCallback(E=>{E!==C.current&&(C.current=E,y(E))},[]),x=l.useCallback(E=>{E!==P.current&&(P.current=E,h(E))},[]),w=s||m,S=i||R,C=l.useRef(null),P=l.useRef(null),T=l.useRef(g),L=a!=null,_=tn(a),X=tn(o),B=tn(f),k=l.useCallback(()=>{if(!C.current||!P.current)return;const E={placement:t,strategy:n,middleware:d};X.current&&(E.platform=X.current),cs(C.current,P.current,E).then(W=>{const A={...W,isPositioned:B.current!==!1};M.current&&!Ut(T.current,A)&&(T.current=A,Br.flushSync(()=>{u(A)}))})},[d,t,n,X,B]);kt(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,u(E=>({...E,isPositioned:!1})))},[f]);const M=l.useRef(!1);kt(()=>(M.current=!0,()=>{M.current=!1}),[]),kt(()=>{if(w&&(C.current=w),S&&(P.current=S),w&&S){if(_.current)return _.current(w,S,k);k()}},[w,S,k,_,L]);const N=l.useMemo(()=>({reference:C,floating:P,setReference:b,setFloating:x}),[b,x]),Y=l.useMemo(()=>({reference:w,floating:S}),[w,S]),F=l.useMemo(()=>{const E={position:n,left:0,top:0};if(!Y.floating)return E;const W=Hn(Y.floating,g.x),A=Hn(Y.floating,g.y);return c?{...E,transform:"translate("+W+"px, "+A+"px)",...mr(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:A}},[n,c,Y.floating,g.x,g.y]);return l.useMemo(()=>({...g,update:k,refs:N,elements:Y,floatingStyles:F}),[g,k,N,Y,F])}const fs=(e,t)=>{const n=ts(e);return{name:n.name,fn:n.fn,options:[e,t]}},ds=(e,t)=>{const n=ns(e);return{name:n.name,fn:n.fn,options:[e,t]}},ps=(e,t)=>({fn:is(e).fn,options:[e,t]}),gs=(e,t)=>{const n=rs(e);return{name:n.name,fn:n.fn,options:[e,t]}},ms=(e,t)=>{const n=os(e);return{name:n.name,fn:n.fn,options:[e,t]}},hs=(e,t)=>{const n=ss(e);return{name:n.name,fn:n.fn,options:[e,t]}};function hr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Wr(),s=tr()!=null,i=Tt(()=>new io({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new co,floatingId:o,syncOnly:!1,nested:s})).current;return J(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ae(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),i.update(c)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function xs(e={}){const{nodeId:t,externalTree:n}=e,r=hr(e),o=e.rootContext||r,s=o.useState("referenceElement"),i=o.useState("floatingElement"),c=o.useState("domReferenceElement"),a=o.useState("open"),f=o.useState("floatingId"),[g,u]=l.useState(null),[d,p]=l.useState(void 0),[m,y]=l.useState(void 0),R=l.useRef(null),h=nr(n),b=l.useMemo(()=>({reference:s,floating:i,domReference:c}),[s,i,c]),x=us({...e,elements:{...b,...g&&{reference:g}}}),w=Ae(d)?d:null,S=m===void 0?o.state.floatingElement:m;o.useSyncedValue("referenceElement",d??null),o.useSyncedValue("domReferenceElement",d===void 0?c:w),o.useSyncedValue("floatingElement",S);const C=l.useCallback(B=>{const k=Ae(B)?{getBoundingClientRect:()=>B.getBoundingClientRect(),getClientRects:()=>B.getClientRects(),contextElement:B}:B;u(k),x.refs.setReference(k)},[x.refs]),P=l.useCallback(B=>{(Ae(B)||B===null)&&(R.current=B,p(B)),(Ae(x.refs.reference.current)||x.refs.reference.current===null||B!==null&&!Ae(B))&&x.refs.setReference(B)},[x.refs,p]),T=l.useCallback(B=>{y(B),x.refs.setFloating(B)},[x.refs]),L=l.useMemo(()=>({...x.refs,setReference:P,setFloating:T,setPositionReference:C,domReference:R}),[x.refs,P,T,C]),_=l.useMemo(()=>({...x.elements,domReference:c}),[x.elements,c]),X=l.useMemo(()=>({...x,dataRef:o.context.dataRef,open:a,onOpenChange:o.setOpen,events:o.context.events,floatingId:f,refs:L,elements:_,nodeId:t,rootStore:o}),[x,L,_,t,o,a,f]);return J(()=>{c&&(R.current=c)},[c]),J(()=>{o.context.dataRef.current.floatingContext=X;const B=h?.nodesRef.current.find(k=>k.id===t);B&&(B.context=X)}),l.useMemo(()=>({...x,context:X,refs:L,elements:_,rootStore:o}),[x,L,_,X,o])}const ys="Escape";function Xt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Pt(e,t){return Xt(t,e===Qn||e===pn,e===Yt||e===qt)}function nn(e,t,n){return Xt(t,e===pn,n?e===Yt:e===qt)||e==="Enter"||e===" "||e===""}function ws(e,t,n){return Xt(t,n?e===Yt:e===qt,e===pn)}function Rs(e,t,n,r){const o=n?e===qt:e===Yt,s=e===Qn;return t==="both"||t==="horizontal"&&r?e===ys:Xt(t,o,s)}function bs(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:c=!1,loopFocus:a=!1,nested:f=!1,rtl:g=!1,virtual:u=!1,focusItemOnOpen:d="auto",focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:y=void 0,orientation:R="vertical",parentOrientation:h,id:b,resetOnPointerLeave:x=!0,externalTree:w,grid:S}=t,C=S!=null,P="rootStore"in e?e.rootStore:e,T=P.useState("open"),L=P.useState("floatingElement"),_=P.useState("domReferenceElement"),X=P.context.dataRef,B=Gn(L),k=Ur(_),M=Ye(B),N=tr(),Y=nr(w),F=l.useRef(d),E=l.useRef(i??-1),W=l.useRef(null),A=l.useRef(!0),v=ue(I=>{o(E.current===-1?null:E.current,I)}),H=l.useRef(!!L),me=l.useRef(T),q=l.useRef(!1),ye=l.useRef(!1),he=l.useRef(null),O=Ye(y),j=Ye(T),le=Ye(i),Ce=Ye(x),Q=Ht(),ne=Ht(),se=ue(()=>{function I(G){u?Y?.events.emit("virtualfocus",G):he.current=lo(G,{sync:q.current,preventScroll:!0})}const D=n.current[E.current],Z=ye.current;D&&I(D),(q.current?G=>G():G=>Q.request(G))(()=>{const G=n.current[E.current]||D;if(!G)return;D||I(G),we&&(Z||!A.current)&&G.scrollIntoView?.({block:"nearest",inline:"nearest"})})});J(()=>{X.current.orientation=R},[X,R]),J(()=>{s&&(T&&L?(E.current=i??-1,F.current&&i!=null&&(ye.current=!0,v())):H.current&&(E.current=-1,v()))},[s,T,L,i,v]),J(()=>{if(s){if(!T){q.current=!1;return}if(L)if(r==null){if(q.current=!1,le.current!=null)return;if(H.current&&(E.current=-1,se()),(!me.current||!H.current)&&F.current&&(W.current!=null||F.current===!0&&W.current==null)){let I=0;const D=()=>{n.current[0]==null?(I<2&&(I?V=>ne.request(V):queueMicrotask)(D),I+=1):(E.current=W.current==null||nn(W.current,R,g)||f?Jt(n):Tn(n),W.current=null,v())};D()}}else Cn(n.current,r)||(E.current=r,se(),ye.current=!1)}},[s,T,L,r,le,f,n,R,g,v,se,ne]),J(()=>{if(!s||L||!Y||u||!H.current)return;const I=Y.nodesRef.current,D=I.find(G=>G.id===N)?.context?.elements.floating,Z=Qt(ot(_??D??null)),V=I.some(G=>G.context&&at(G.context.elements.floating,Z));D&&!V&&A.current&&D.focus({preventScroll:!0})},[s,L,_,Y,N,u]),J(()=>{me.current=T,H.current=!!L}),J(()=>{T||(W.current=null,F.current=d)},[T,d]);const Se=r!=null,fe=ue(I=>{if(!j.current)return;const D=n.current.indexOf(I.currentTarget);D!==-1&&(E.current!==D||r!==D)&&(E.current=D,v(I))}),de=ue(()=>h??Y?.nodesRef.current.find(I=>I.id===N)?.context?.dataRef?.current.orientation),xe=ue(()=>Jt(n,O.current)),te=ue(I=>{if(A.current=!1,q.current=!0,I.which===229||!j.current&&I.currentTarget===M.current)return;if(f&&Rs(I.key,R,g,C)){Pt(I.key,de())||et(I),P.setOpen(!1,_e(An,I.nativeEvent)),nt(_)&&(u?Y?.events.emit("virtualfocus",_):_.focus());return}const D=E.current,Z=Jt(n,y),V=Tn(n,y);if(k||(I.key==="Home"&&(et(I),E.current=Z,v(I)),I.key==="End"&&(et(I),E.current=V,v(I))),S!=null){const G=S(I,E.current,n,R,a,g,y,Z,V);if(G!=null&&(E.current=G,v(I)),R==="both")return}if(Pt(I.key,R)){if(et(I),T&&!u&&Qt(I.currentTarget.ownerDocument)===I.currentTarget){E.current=nn(I.key,R,g)?Z:V,v(I);return}nn(I.key,R,g)?a?D>=V?c&&D!==n.current.length?E.current=-1:(q.current=!1,E.current=Z):E.current=It(n.current,{startingIndex:D,disabledIndices:y}):E.current=Math.min(V,It(n.current,{startingIndex:D,disabledIndices:y})):a?D<=Z?c&&D!==-1?E.current=n.current.length:(q.current=!1,E.current=V):E.current=It(n.current,{startingIndex:D,decrement:!0,disabledIndices:y}):E.current=Math.max(Z,It(n.current,{startingIndex:D,decrement:!0,disabledIndices:y})),Cn(n.current,E.current)&&(E.current=-1),v(I)}}),we=l.useMemo(()=>({onFocus(D){q.current=!0,fe(D)},onClick:({currentTarget:D})=>D.focus({preventScroll:!0}),onMouseMove(D){q.current=!0,ye.current=!1,p&&fe(D)},onPointerLeave(D){if(!j.current||!A.current||D.pointerType==="touch")return;q.current=!0;const Z=D.relatedTarget;if(!(!p||n.current.includes(Z))&&Ce.current&&(he.current?.(),he.current=null,E.current=-1,v(D),!u)){const V=M.current,G=Qt(ot(V));V&&at(V,G)&&V.focus({preventScroll:!0})}}}),[fe,j,M,p,n,v,Ce,u]),ce=l.useMemo(()=>u&&T&&Se&&{"aria-activedescendant":`${b}-${r}`},[u,T,Se,b,r]),ie=l.useMemo(()=>({"aria-orientation":R==="both"?void 0:R,...k?{}:ce,onKeyDown(I){if(I.key==="Tab"&&I.shiftKey&&T&&!u){const D=qn(I.nativeEvent);if(D&&!at(M.current,D))return;et(I),P.setOpen(!1,_e(Jn,I.nativeEvent)),nt(_)&&_.focus();return}te(I)},onPointerMove(){A.current=!0}}),[ce,te,M,R,k,P,T,u,_]),re=l.useMemo(()=>{function I(V){P.setOpen(!0,_e(An,V.nativeEvent,V.currentTarget))}function D(V){d==="auto"&&rr(V.nativeEvent)&&(F.current=!u)}function Z(V){F.current=d,d==="auto"&&ao(V.nativeEvent)&&(F.current=!0)}return{onKeyDown(V){const G=P.select("open");A.current=!1;const ke=V.key.startsWith("Arrow"),We=ws(V.key,de(),g),Ie=Pt(V.key,R),Fe=(f?We:Ie)||V.key==="Enter"||V.key.trim()==="";if(u&&G)return te(V);if(!(!G&&!m&&ke)){if(Fe){const ae=Pt(V.key,de());W.current=f&&ae?null:V.key}if(f){We&&(et(V),G?(E.current=xe(),v(V)):I(V));return}Ie&&(le.current!=null&&(E.current=le.current),et(V),!G&&m?I(V):te(V),G&&v(V))}},onFocus(V){P.select("open")&&!u&&(E.current=-1,v(V))},onPointerDown:Z,onPointerEnter:Z,onMouseDown:D,onClick:D}},[te,d,xe,f,v,P,m,R,de,g,le,u]),$=l.useMemo(()=>({...ce,...re}),[ce,re]);return l.useMemo(()=>s?{reference:$,floating:ie,item:we,trigger:re}:{},[s,$,ie,re,we])}function Ss(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:c,enabled:a=!0,resetMs:f=750,selectedIndex:g=null}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),p=vt(),m=l.useRef(""),y=l.useRef(g??o??-1),R=l.useRef(null),h=ue(w=>{function S(M){const N=r?.current[M];return!N||zr(N)}function C(M){return S(M)?i==null||!$r(on,M,i):!1}function P(M,N,Y=0){if(M.length===0)return-1;const F=(Y%M.length+M.length)%M.length,E=N.toLowerCase();for(let W=0;W<M.length;W+=1){const A=(F+W)%M.length;if(!(!M[A]?.toLowerCase().startsWith(E)||!C(A)))return A}return-1}const T=n.current;if(m.current.length>0&&w.key===" "&&(et(w),c?.(!0)),m.current.length>0&&m.current[0]!==" "&&P(T,m.current)===-1&&w.key!==" "&&c?.(!1),T==null||w.key.length!==1||w.ctrlKey||w.metaKey||w.altKey)return;d&&w.key!==" "&&(et(w),c?.(!0));const L=m.current==="";L&&(y.current=g??o??-1),T.every((M,N)=>M&&C(N)?M[0]?.toLowerCase()!==M[1]?.toLowerCase():!0)&&m.current===w.key&&(m.current="",y.current=R.current),m.current+=w.key,p.start(f,()=>{m.current="",y.current=R.current,c?.(!1)});const B=((L?g??o??-1:y.current)??0)+1,k=P(T,m.current,B);k!==-1?(s?.(k),R.current=k):w.key!==" "&&(m.current="",c?.(!1))}),b=ue(w=>{const S=w.relatedTarget,C=u.select("domReferenceElement"),P=u.select("floatingElement");at(C,S)||at(P,S)||(p.clear(),m.current="",y.current=R.current,c?.(!1))});J(()=>{!d&&g!==null||(p.clear(),R.current=null,m.current!==""&&(m.current=""))},[d,g,p]),J(()=>{d&&m.current===""&&(y.current=g??o??-1)},[d,g,o]);const x=l.useMemo(()=>({onKeyDown:h,onBlur:b}),[h,b]);return l.useMemo(()=>a?{reference:x,floating:x}:{},[a,x])}const vs=l.createContext(void 0);function xr(){return l.useContext(vs)?.direction??"ltr"}const Es=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:f,padding:g=0,offsetParent:u="real"}=st(e,t)||{};if(f==null)return{};const d=ir(g),p={x:n,y:r},m=yn(o),y=xn(m),R=await i.getDimensions(f),h=m==="y",b=h?"top":"left",x=h?"bottom":"right",w=h?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[m]-p[m]-s.floating[y],C=p[m]-s.reference[m],P=u==="real"?await i.getOffsetParent?.(f):c.floating;let T=c.floating[w]||s.floating[y];(!T||!await i.isElement?.(P))&&(T=c.floating[w]||s.floating[y]);const L=S/2-C/2,_=T/2-R[y]/2-1,X=Math.min(d[b],_),B=Math.min(d[x],_),k=X,M=T-R[y]-B,N=T/2-R[y]/2+L,Y=cn(k,N,M),F=!a.arrow&&ut(o)!=null&&N!==Y&&s.reference[y]/2-(N<k?X:B)-R[y]/2<0,E=F?N<k?N-k:N-M:0;return{[m]:p[m]+E,data:{[m]:Y,centerOffset:N-Y-E,...F&&{alignmentOffset:E}},reset:F}}}),Cs=(e,t)=>({...Es(e),options:[e,t]}),Ts=hs().fn,As={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await Ts(e)).data?.referenceHidden||s}}}},Nt={sideX:"left",sideY:"top"},Ci={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:c}=e,a=Be(o),f=a.getComputedStyle(o);if(!(f.transitionDuration!=="0s"&&f.transitionDuration!==""))return{x:t,y:n,data:Nt};const u=await s.getOffsetParent?.(o);let d={width:0,height:0};if(i==="fixed"&&a?.visualViewport)d={width:a.visualViewport.width,height:a.visualViewport.height};else if(u===a){const b=ot(o);d={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(u)&&(d=await s.getDimensions(u));const p=Ve(c);let m=t,y=n;p==="left"&&(m=d.width-(t+r.width)),p==="top"&&(y=d.height-(n+r.height));const R=p==="left"?"right":Nt.sideX,h=p==="top"?"bottom":Nt.sideY;return{x:m,y,data:{sideX:R,sideY:h}}}};function yr(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function _n(e,t,n){const{rects:r,placement:o}=e;return{side:yr(t,Ve(o),n),align:ut(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Ms(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:a=5,sticky:f=!1,arrowPadding:g=5,disableAnchorTracking:u=!1,inline:d,keepMounted:p=!1,floatingRootContext:m,mounted:y,collisionAvoidance:R,shiftCrossAxis:h=!1,nodeId:b,adaptiveOrigin:x,lazyFlip:w=!1,externalTree:S}=e,[C,P]=l.useState(null);!y&&C!==null&&P(null);const T=R.side||"flip",L=R.align||"flip",_=R.fallbackAxisSide||"end",X=typeof t=="function"?t:void 0,B=ue(X),k=X?B:t,M=Ye(t),N=Ye(y),F=xr()==="rtl",E=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[r],W=s==="center"?E:`${E}-${s}`;let A=a;const v=1,H=r==="bottom"?v:0,me=r==="top"?v:0,q=r==="right"?v:0,ye=r==="left"?v:0;typeof A=="number"?A={top:A+H,right:A+ye,bottom:A+me,left:A+q}:A&&(A={top:(A.top||0)+H,right:(A.right||0)+ye,bottom:(A.bottom||0)+me,left:(A.left||0)+q});const he={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:A},O=l.useRef(null),j=Ye(o),le=Ye(i),Ce=typeof o!="function"?o:0,Q=typeof i!="function"?i:0,ne=[];d&&ne.push(d),ne.push(fs(ee=>{const pe=_n(ee,r,F),ve=typeof j.current=="function"?j.current(pe):j.current,be=typeof le.current=="function"?le.current(pe):le.current;return{mainAxis:ve,crossAxis:be,alignmentAxis:be}},[Ce,Q,F,r]));const se=L==="none"&&T!=="shift",Se=!se&&(f||h||T==="shift"),fe=T==="none"?null:gs({...he,padding:{top:A.top+v,right:A.right+v,bottom:A.bottom+v,left:A.left+v},mainAxis:!h&&T==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),de=se?null:ds(ee=>{const pe=ot(ee.elements.floating).documentElement;return{...he,rootBoundary:h?{x:0,y:0,width:pe.clientWidth,height:pe.clientHeight}:void 0,mainAxis:L!=="none",crossAxis:Se,limiter:f||h?void 0:ps(ve=>{if(!O.current)return{};const{width:be,height:Te}=O.current.getBoundingClientRect(),Re=je(Ve(ve.placement)),Oe=Re==="y"?be:Te,ze=Re==="y"?A.left+A.right:A.top+A.bottom;return{offset:Oe/2+ze/2}})}},[he,f,h,A,L]);T==="shift"||L==="shift"||s==="center"?ne.push(de,fe):ne.push(fe,de),ne.push(ms({...he,apply({elements:{floating:ee},availableWidth:pe,availableHeight:ve,rects:be}){if(!N.current)return;const Te=ee.style;Te.setProperty("--available-width",`${pe}px`),Te.setProperty("--available-height",`${ve}px`);const Re=Be(ee).devicePixelRatio||1,{x:Oe,y:ze,width:qe,height:ct}=be.reference,Pe=(Math.round((Oe+qe)*Re)-Math.round(Oe*Re))/Re,Ke=(Math.round((ze+ct)*Re)-Math.round(ze*Re))/Re;Te.setProperty("--anchor-width",`${Pe}px`),Te.setProperty("--anchor-height",`${Ke}px`)}}),Cs(ee=>({element:O.current||ot(ee.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(ee){const{elements:pe,middlewareData:ve,placement:be,rects:Te,y:Re}=ee,Oe=Ve(be),ze=je(Oe),qe=O.current,ct=ve.arrow?.x||0,Pe=ve.arrow?.y||0,Ke=qe?.clientWidth||0,ht=qe?.clientHeight||0,lt=ct+Ke/2,xt=Pe+ht/2,K=Math.abs(ve.shift?.y||0),ge=Te.reference.height/2,Ee=typeof o=="function"?o(_n(ee,r,F)):o,De=K>Ee,Xe={top:`${lt}px calc(100% + ${Ee}px)`,bottom:`${lt}px ${-Ee}px`,left:`calc(100% + ${Ee}px) ${xt}px`,right:`${-Ee}px ${xt}px`}[Oe],Ze=`${lt}px ${Te.reference.y+ge-Re}px`;return pe.floating.style.setProperty("--transform-origin",Se&&ze==="y"&&De?Ze:Xe),{}}},As,x),J(()=>{!y&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,m]);const xe=l.useMemo(()=>({elementResize:!u&&typeof ResizeObserver<"u",layoutShift:!u&&typeof IntersectionObserver<"u"}),[u]),{refs:te,elements:we,x:ce,y:ie,middlewareData:re,update:$,placement:I,context:D,isPositioned:Z,floatingStyles:V}=xs({rootContext:m,open:p?y:void 0,placement:W,middleware:ne,strategy:n,whileElementsMounted:p?void 0:(...ee)=>Nn(...ee,xe),nodeId:b,externalTree:S}),{sideX:G,sideY:ke}=re.adaptiveOrigin||Nt,We=Z?n:"fixed",Ie=l.useMemo(()=>{const ee=x?{position:We,[G]:ce,[ke]:ie}:{position:We,...V};return Z||(ee.opacity=0),ee},[x,We,G,ce,ke,ie,V,Z]),Fe=l.useRef(null);J(()=>{if(!y)return;const ee=M.current,pe=typeof ee=="function"?ee():ee,be=(Bn(pe)?pe.current:pe)||null||null;be!==Fe.current&&(te.setPositionReference(be),Fe.current=be)},[y,te,k,M]),l.useEffect(()=>{if(!y)return;const ee=M.current;typeof ee!="function"&&Bn(ee)&&ee.current!==Fe.current&&(te.setPositionReference(ee.current),Fe.current=ee.current)},[y,te,k,M]),l.useEffect(()=>{if(p&&y&&we.reference&&we.floating)return Nn(we.reference,we.floating,$,xe)},[p,y,we,$,xe]);const ae=Ve(I),Ue=yr(r,ae,F),$e=ut(I)||"center",Ne=!!re.hide?.referenceHidden;J(()=>{w&&y&&Z&&P(ae)},[w,y,Z,ae]);const Je=l.useMemo(()=>({position:"absolute",top:re.arrow?.y,left:re.arrow?.x}),[re.arrow]),Qe=re.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:Ie,arrowStyles:Je,arrowRef:O,arrowUncentered:Qe,side:Ue,align:$e,physicalSide:ae,anchorHidden:Ne,refs:te,context:D,isPositioned:Z,update:$}),[Ie,Je,O,Qe,Ue,$e,ae,Ne,te,D,Z,$])}function Bn(e){return e!=null&&"current"in e}function wr(e){return e==="starting"?jr:zt}function Is(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),gt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},wr(r),o],stateAttributesMapping:or})}function Os(e){const t=l.useRef(""),n=l.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:l.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function Rr(e,t){const n=l.useRef(e),r=ue(t);J(()=>{n.current!==e&&r(n.current)},[e,r]),J(()=>{n.current=e},[e])}function Ps(e,t){const n=ue((s,i)=>{(typeof e=="function"?e():e)||t(i||(Yr?"touch":""))}),{onClick:r,onPointerDown:o}=Os(n);return l.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Ds(e){const[t,n]=l.useState(null),r=Ps(e,n);return Rr(e,o=>{o&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Ls(e){const[t,n]=l.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Fs(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wn({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=l.useRef(e!==void 0),[s,i]=l.useState(t),c=o?e:s,a=l.useCallback(f=>{o||i(f)},[]);return[c,a]}const br=l.createContext(null),Sr=l.createContext(null);function mt(){const e=l.useContext(br);if(e===null)throw new Error(Mt(60));return e}function vr(){const e=l.useContext(Sr);if(e===null)throw new Error(Mt(61));return e}let Un=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Vs={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},bt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ks={disabled:!1,...bt},Ns={valid(e){return e===null?null:e?{[Un.valid]:""}:{[Un.invalid]:""}}},Hs={invalid:void 0,name:void 0,validityData:{state:Vs,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,touched:bt.touched,setTouched:Le,dirty:bt.dirty,setDirty:Le,filled:bt.filled,setFilled:Le,focused:bt.focused,setFocused:Le,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ks,markedDirtyRef:{current:!1},registerFieldControl:Le,validation:{getValidationProps:(e,t=zt)=>t,inputRef:{current:null},registerInput:Le,commit:async()=>{},change:Le}},_s=l.createContext(Hs);function Rn(e=!0){const t=l.useContext(_s);if(t.setValidityData===Le&&!e)throw new Error(Mt(28));return t}function Bs(e,t,n,r,o=!0,s){const{registerFieldControl:i}=Rn(),c=l.useRef(null);c.current||(c.current=Symbol()),J(()=>{const a=c.current;return!a||!o?void 0:(i(a,{controlRef:e,getValue:r,id:t,name:s,value:n}),()=>{i(a,void 0)})},[e,o,r,t,s,i,n])}const Ws=l.createContext({controlId:void 0,registerControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function Er(){return l.useContext(Ws)}function Cr(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:s}=Er(),i=uo(t),c=n?o:void 0,a=Tt(()=>Symbol("labelable-control")),f=l.useRef(!1),g=l.useRef(t!=null),u=ue(()=>{!f.current||s===Le||(f.current=!1,s(a.current,void 0))});return J(()=>{if(s===Le)return;let d;if(n){const p=r?.current;Ae(p)&&p.closest("label")!=null?d=t??null:d=c??i}else if(t!=null)g.current=!0,d=t;else if(g.current)d=i;else{u();return}if(d===void 0){u();return}f.current=!0,s(a.current,d)},[t,r,c,s,n,i,a,u]),l.useEffect(()=>u,[u]),o??i}const Us=(e,t)=>Object.is(e,t);function pt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function $s(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:pt(t,r,n))}function Et(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:pt(r,t,n))}function zs(e,t,n){return e.filter(r=>!pt(t,r,n))}function an(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function js(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Tr(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Ar(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return an(e)}function ft(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?an(e.value):an(e)}function Mr(e,t,n){function r(){return Ar(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,s=Tr(o)?o.flatMap(i=>i.items):o;if(e==null||typeof e!="object"){const i=s.find(c=>c.value===e);return i&&i.label!=null?i.label:r()}if("value"in e){const i=s.find(c=>c&&c.value===e.value);if(i&&i.label!=null)return i.label}}return r()}function Ys(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(Me.jsx(l.Fragment,{children:Mr(o,t,n)},s)),r),[])}const U={id:oe(e=>e.id),labelId:oe(e=>e.labelId),modal:oe(e=>e.modal),multiple:oe(e=>e.multiple),items:oe(e=>e.items),itemToStringLabel:oe(e=>e.itemToStringLabel),itemToStringValue:oe(e=>e.itemToStringValue),isItemEqualToValue:oe(e=>e.isItemEqualToValue),value:oe(e=>e.value),hasSelectedValue:oe(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ft(t,r)!==""}),hasNullItemLabel:oe((e,t)=>t?js(e.items):!1),open:oe(e=>e.open),mounted:oe(e=>e.mounted),forceMount:oe(e=>e.forceMount),transitionStatus:oe(e=>e.transitionStatus),openMethod:oe(e=>e.openMethod),activeIndex:oe(e=>e.activeIndex),selectedIndex:oe(e=>e.selectedIndex),isActive:oe((e,t)=>e.activeIndex===t),isSelected:oe((e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>pt(t,o,n)):pt(t,r,n)}),isSelectedByFocus:oe((e,t)=>e.selectedIndex===t),popupProps:oe(e=>e.popupProps),triggerProps:oe(e=>e.triggerProps),triggerElement:oe(e=>e.triggerElement),positionerElement:oe(e=>e.positionerElement),listElement:oe(e=>e.listElement),popupSide:oe(e=>e.popupSide),scrollUpArrowVisible:oe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:oe(e=>e.scrollDownArrowVisible),hasScrollArrows:oe(e=>e.hasScrollArrows)},qs=l.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Ks(){return l.useContext(qs)}function Xs(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}const tt=1;function Ir(e,t){return Math.max(0,e-t)}function Gs(e,t){if(t<=0)return 0;const n=Rt(e,0,t),r=n,o=t-n,s=r<=tt,i=o<=tt;return s&&i?r<=o?0:t:s?0:i?t:n}function Ti(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:c,name:a,form:f,autoComplete:g,disabled:u=!1,readOnly:d=!1,required:p=!1,modal:m=!0,actionsRef:y,inputRef:R,onOpenChangeComplete:h,items:b,multiple:x=!1,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C=Us,highlightItemOnHover:P=!0,children:T}=e,{clearErrors:L}=Ks(),{setDirty:_,setTouched:X,setFocused:B,validityData:k,setFilled:M,name:N,disabled:Y,validation:F,validationMode:E}=Rn(),W=Cr({id:t}),A=Y||u,v=N??a,[H,me]=Wn({controlled:n,default:x?r??on:r,name:"Select",state:"value"}),[q,ye]=Wn({controlled:s,default:i,name:"Select",state:"open"}),he=l.useRef([]),O=l.useRef([]),j=l.useRef(null),le=l.useRef(null),Ce=l.useRef(0),Q=l.useRef(null),ne=l.useRef([]),se=l.useRef(!1),Se=l.useRef(null),fe=l.useRef(null),de=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=l.useRef(!1),{mounted:te,setMounted:we,transitionStatus:ce}=sr(q),{openMethod:ie,triggerProps:re}=Ds(q),$=Tt(()=>new Gr({id:W,labelId:void 0,modal:m,multiple:x,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,value:H,open:q,mounted:te,transitionStatus:ce,items:b,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,I=z($,U.activeIndex),D=z($,U.selectedIndex),Z=z($,U.triggerElement),V=z($,U.positionerElement),G=Ls(ie),ke=ie??G??null,We=l.useMemo(()=>x?"":ft(H,S),[x,H,S]),Ie=l.useMemo(()=>x&&Array.isArray(H)?H.map(K=>ft(K,S)):ft(H,S),[x,H,S]),Fe=Ye($.state.triggerElement),ae=ue(()=>Ie);Bs(Fe,W,H,ae,!A,a);const Ue=l.useRef(H),$e=x?Array.isArray(H)&&H.length>0:H!=null&&ft(H,S)!=="";J(()=>{H!==Ue.current&&$.set("forceMount",!0)},[$,H]),J(()=>{M($e)},[$e,M]),J(function(){const ge=ne.current;let Ee;if(x){const De=Array.isArray(H)?H:[];if(De.length===0)Ee=null;else{const Xe=De[De.length-1],Ze=Et(ge,Xe,C);Ee=Ze===-1?null:Ze}}else{const De=Et(ge,H,C);Ee=De===-1?null:De}Ee===null&&(fe.current=null),!q&&$.set("selectedIndex",Ee)},[$e,x,q,H,ne,C,$,fe]);function Ne(K){const ge=k.initialValue;return Array.isArray(K)&&Array.isArray(ge)?!Xs(K,ge,(Ee,De)=>pt(Ee,De,C)):K!==ge}Rr(H,()=>{L(v),_(Ne(H)),F.change(H)});const Je=ue((K,ge)=>{c?.(K,ge),!ge.isCanceled&&(ye(K),!K&&(ge.reason===Jn||ge.reason===Jr)&&(X(!0),B(!1),E==="onBlur"&&F.commit(H)))}),Qe=ue(()=>{we(!1),$.update({activeIndex:null,openMethod:null}),h?.(!1)});gn({enabled:!y,open:q,ref:j,onComplete(){q||Qe()}}),l.useImperativeHandle(y,()=>({unmount:Qe}),[Qe]);const ee=ue((K,ge)=>{o?.(K,ge),!ge.isCanceled&&me(K)}),pe=ue(()=>{const K=$.state.listElement||j.current;if(!K)return;const ge=Ir(K.scrollHeight,K.clientHeight),Ee=Gs(K.scrollTop,ge),De=Ee>0,Xe=Ee<ge;$.state.scrollUpArrowVisible!==De&&$.set("scrollUpArrowVisible",De),$.state.scrollDownArrowVisible!==Xe&&$.set("scrollDownArrowVisible",Xe)}),ve=hr({open:q,onOpenChange:Je,elements:{reference:Z,floating:V}}),be=Oo(ve,{enabled:!d&&!A,event:"mousedown"}),Te=fo(ve),Re=bs(ve,{enabled:!d&&!A,listRef:he,activeIndex:I,selectedIndex:D,disabledIndices:on,onNavigate(K){K===null&&!q||$.set("activeIndex",K)},focusItemOnHover:P}),Oe=Ss(ve,{enabled:!d&&!A&&(q||!x),listRef:O,activeIndex:I,selectedIndex:D,disabledIndices:K=>Fs(he.current[K]),onMatch(K){q?$.set("activeIndex",K):ee(ne.current[K],_e("none"))},onTyping(K){se.current=K}}),ze=l.useMemo(()=>{const K=sn(Oe.reference,Re.reference,Te.reference,be.reference,re);return W&&(K.id=W),K},[be.reference,Oe.reference,Re.reference,Te.reference,re,W]),qe=l.useMemo(()=>sn(po,Oe.floating,Re.floating,Te.floating),[Oe.floating,Re.floating,Te.floating]),ct=Re.item??zt;go(()=>{$.update({popupProps:qe,triggerProps:ze})}),J(()=>{$.update({id:W,modal:m,multiple:x,value:H,open:q,mounted:te,transitionStatus:ce,popupProps:qe,triggerProps:ze,items:b,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,openMethod:ke})},[$,W,m,x,H,q,te,ce,qe,ze,b,w,S,C,ke]);const Pe=l.useMemo(()=>({store:$,name:v,required:p,disabled:A,readOnly:d,multiple:x,highlightItemOnHover:P,setValue:ee,setOpen:Je,listRef:he,popupRef:j,scrollHandlerRef:le,handleScrollArrowVisibility:pe,scrollArrowsMountedCountRef:Ce,itemProps:ct,valueRef:Q,valuesRef:ne,labelsRef:O,typingRef:se,selectionRef:de,firstItemTextRef:Se,selectedItemTextRef:fe,validation:F,onOpenChangeComplete:h,alignItemWithTriggerActiveRef:xe,initialValueRef:Ue}),[$,v,p,A,d,x,P,ee,Je,ct,F,h,pe]),Ke=qr(R,F.inputRef),ht=x&&Array.isArray(H)&&H.length>0,lt=x?void 0:v,xt=l.useMemo(()=>!x||!Array.isArray(H)||!v?null:H.map(K=>{const ge=ft(K,S);return Me.jsx("input",{type:"hidden",form:f,name:v,value:ge,disabled:A},ge)}),[x,H,f,v,S,A]);return Me.jsx(br.Provider,{value:Pe,children:Me.jsxs(Sr.Provider,{value:ve,children:[T,Me.jsx("input",{...F.getValidationProps(A,{onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(K){if(K.nativeEvent.defaultPrevented||A||d)return;const ge=K.currentTarget.value,Ee=_e(mn,K.nativeEvent);function De(){if(x)return;const Xe=ge.toLowerCase();let Ze=ne.current.findIndex(Gt=>ft(Gt,S).toLowerCase()===Xe||Ar(Gt,w).toLowerCase()===Xe);Ze===-1&&(Ze=ne.current.findIndex((Gt,Fr)=>{const vn=O.current[Fr];return vn!=null&&vn.toLowerCase()===Xe}));const Sn=Ze===-1?void 0:ne.current[Ze];Sn!=null&&ee(Sn,Ee)}$.set("forceMount",!0),queueMicrotask(De)}}),id:W&&lt==null?`${W}-hidden-input`:void 0,form:f,name:lt,autoComplete:g,value:We,disabled:A,required:p&&!ht,readOnly:d,ref:Ke,style:v?Kr:Xr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),xt]})})}function Js(e,t){return e??t}function Qs(e){const t=e.getBoundingClientRect(),n=Be(e);if(Qr)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,c=parseFloat(r.height)||0,a=parseFloat(o.width)||0,f=parseFloat(o.height)||0,g=Math.max(t.width,i,a),u=Math.max(t.height,c,f),d=g-t.width,p=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const Dt=2,Zs=400,ei={...mo,...Ns,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Ai=l.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:c=!0,style:a,...f}=t,{setTouched:g,setFocused:u,validationMode:d,state:p,disabled:m}=Rn(),{labelId:y}=Er(),{store:R,setOpen:h,selectionRef:b,validation:x,readOnly:w,required:S,alignItemWithTriggerActiveRef:C,disabled:P}=mt(),T=m||P||i,L=z(R,U.open),_=z(R,U.mounted),X=z(R,U.value),B=z(R,U.triggerProps),k=z(R,U.positionerElement),M=z(R,U.listElement),N=z(R,U.popupSide),Y=z(R,U.id),F=z(R,U.labelId),E=z(R,U.hasSelectedValue),W=_&&k?N:null,A=s??Y,v=Js(y,F);Cr({id:A});const H=Ye(k),me=l.useRef(null),{getButtonProps:q,buttonRef:ye}=Zn({disabled:T,native:c}),he=ue(se=>{R.set("triggerElement",se)}),O=vt(),j=vt(),le=vt();l.useEffect(()=>{if(L)return le.start(Zs,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{le.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},j.clear()},[L,b,j,le]);const Ce=sn(B,{id:A,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?M?.id??Gn(k)?.id:void 0,"aria-labelledby":v,"aria-readonly":w||void 0,"aria-required":S||void 0,tabIndex:T?-1:0,onFocus(se){u(!0),L&&C.current&&h(!1,_e(mn,se.nativeEvent)),O.start(0,()=>{R.set("forceMount",!0)})},onBlur(se){at(k,se.relatedTarget)||(g(!0),u(!1),d==="onBlur"&&x.commit(X))},onMouseDown(se){if(L)return;const Se=ot(se.currentTarget);function fe(de){if(!me.current)return;const xe=de.target;if(at(me.current,xe)||at(H.current,xe))return;const te=Qs(me.current);de.clientX>=te.left-Dt&&de.clientX<=te.right+Dt&&de.clientY>=te.top-Dt&&de.clientY<=te.bottom+Dt||h(!1,_e(Zr,de))}j.start(0,()=>{Se.addEventListener("mouseup",fe,{once:!0})})}},f,q),Q=x.getValidationProps(T,Ce);Q.role="combobox";const ne={...p,open:L,disabled:T,value:X,readOnly:w,popupSide:W,placeholder:!E};return gt("button",t,{ref:[n,me,ye,he],state:ne,stateAttributesMapping:ei,props:Q})}),ti={value:()=>null},Mi=l.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:c,...a}=t,{store:f,valueRef:g}=mt(),u=z(f,U.value),d=z(f,U.items),p=z(f,U.itemToStringLabel),m=z(f,U.hasSelectedValue),y=!m&&i!=null&&s==null,R=z(f,U.hasNullItemLabel,y),h={value:u,placeholder:!m};let b=null;return typeof s=="function"?b=s(u):s!=null?b=s:!m&&i!=null&&!R?b=i:Array.isArray(u)?b=Ys(u,d,p):b=Mr(u,d,p),gt("span",t,{state:h,ref:[n,g],props:[{children:b},a],stateAttributesMapping:ti})}),ni=l.createContext(void 0),Ii=l.forwardRef(function(t,n){const{store:r}=mt(),o=z(r,U.mounted),s=z(r,U.forceMount);return o||s?Me.jsx(ni.Provider,{value:!0,children:Me.jsx(eo,{ref:n,...t})}):null}),Or=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function ri(){return l.useContext(Or)}function oi(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ue(o),i=l.useRef(0),c=Tt(ii).current,a=Tt(si).current,[f,g]=l.useState(0),u=l.useRef(f),d=ue((h,b)=>{a.set(h,b??null),u.current+=1,g(u.current)}),p=ue(h=>{a.delete(h),u.current+=1,g(u.current)}),m=l.useMemo(()=>{const h=new Map;return Array.from(a.keys()).filter(x=>x.isConnected).sort(ci).forEach((x,w)=>{const S=a.get(x)??{};h.set(x,{...S,index:w})}),h},[a,f]);J(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const h=new MutationObserver(b=>{const x=new Set,w=S=>x.has(S)?x.delete(S):x.add(S);b.forEach(S=>{S.removedNodes.forEach(w),S.addedNodes.forEach(w)}),x.size===0&&(u.current+=1,g(u.current))});return m.forEach((b,x)=>{x.parentElement&&h.observe(x.parentElement,{childList:!0})}),()=>{h.disconnect()}},[m]),J(()=>{u.current===f&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),i.current=m.size),s(m)},[s,m,n,r,f]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{r&&(r.current=[])},[r]);const y=ue(h=>(c.add(h),()=>{c.delete(h)}));J(()=>{c.forEach(h=>h(m))},[c,m]);const R=l.useMemo(()=>({register:d,unregister:p,subscribeMapChange:y,elementsRef:n,labelsRef:r,nextIndexRef:i}),[d,p,y,n,r,i]);return Me.jsx(Or.Provider,{value:R,children:t})}function si(){return new Map}function ii(){return new Set}function ci(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Pr=l.createContext(void 0);function li(){const e=l.useContext(Pr);if(!e)throw new Error(Mt(59));return e}function $t(e,t){e&&Object.assign(e.style,t)}const ai={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ui=20;function fi(e,t,n,r){const[o,s]=l.useState(!1);J(()=>{if(!e||!t||n==null){s(!1);return}const i=ot(n).documentElement.clientWidth,c=n.offsetWidth;s(i>0&&c>0&&c>=i-ui)},[e,t,n]),ho(e&&(!t||o),r)}const di={position:"fixed"},Oi=l.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:c="bottom",align:a="center",sideOffset:f=0,alignOffset:g=0,collisionBoundary:u="clipping-ancestors",collisionPadding:d,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:y,alignItemWithTrigger:R=!0,collisionAvoidance:h=to,style:b,...x}=t,{store:w,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:P,selectedItemTextRef:T,valuesRef:L,initialValueRef:_,popupRef:X,setValue:B}=mt(),k=vr(),M=z(w,U.open),N=z(w,U.mounted),Y=z(w,U.modal),F=z(w,U.value),E=z(w,U.openMethod),W=z(w,U.positionerElement),A=z(w,U.triggerElement),v=z(w,U.isItemEqualToValue),H=z(w,U.transitionStatus),me=l.useRef(null),q=l.useRef(null),[ye,he]=l.useState(R),O=N&&ye&&E!=="touch";!N&&ye!==R&&he(R),J(()=>{N||(U.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),U.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,N]),l.useImperativeHandle(P,()=>O),fi((O||Y)&&M,E==="touch",W,A);const j=Ms({anchor:r,floatingRootContext:k,positionMethod:o,mounted:N,side:c,sideOffset:f,align:a,alignOffset:g,arrowPadding:p,collisionBoundary:u,collisionPadding:d,sticky:m,disableAnchorTracking:y??O,collisionAvoidance:h,keepMounted:!0}),le=O?"none":j.side,Ce=O?di:j.positionerStyles,Q={open:M,side:le,align:j.align,anchorHidden:j.anchorHidden};J(()=>{w.set("popupSide",j.side)},[w,j.side]);const ne=ue(xe=>{w.set("positionerElement",xe)}),se=Is(t,Q,{styles:Ce,transitionStatus:H,props:x,refs:[n,ne],hidden:!N,inert:!M}),Se=l.useRef(0),fe=ue(xe=>{if(xe.size===0&&Se.current===0||L.current.length===0)return;const te=Se.current;if(Se.current=xe.size,xe.size===te)return;const we=_e(mn);if(te!==0&&!w.state.multiple&&F!==null&&Et(L.current,F,v)===-1){const ie=_.current,$=ie!=null&&Et(L.current,ie,v)!==-1?ie:null;B($,we),$===null&&(w.set("selectedIndex",null),T.current=null)}if(te!==0&&w.state.multiple&&Array.isArray(F)){const ce=re=>Et(L.current,re,v)!==-1,ie=F.filter(re=>ce(re));(ie.length!==F.length||ie.some(re=>!$s(F,re,v)))&&(B(ie,we),ie.length===0&&(w.set("selectedIndex",null),T.current=null))}if(M&&O){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ce={height:""};$t(W,ce),$t(X.current,ce)}}),de=l.useMemo(()=>({...j,side:le,alignItemWithTriggerActive:O,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:me,scrollDownArrowRef:q}),[j,le,O,he]);return Me.jsx(oi,{elementsRef:S,labelsRef:C,onMapChange:fe,children:Me.jsxs(Pr.Provider,{value:de,children:[N&&Y&&Me.jsx(xo,{inert:no(!M),cutout:A}),se]})})}),Lt="base-ui-disable-scrollbar",$n={className:Lt,getElement(e){return Me.jsx("style",{nonce:e,href:Lt,precedence:"base-ui:low",children:`.${Lt}{scrollbar-width:none}.${Lt}::-webkit-scrollbar{display:none}`})}},pi=l.createContext(void 0);function gi(e){return l.useContext(pi)}const mi=l.createContext(void 0),hi={disableStyleElements:!1};function xi(){return l.useContext(mi)??hi}const yi={...or,...er},Pi=l.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...c}=t,{store:a,popupRef:f,onOpenChangeComplete:g,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:y,handleScrollArrowVisibility:R,scrollHandlerRef:h,listRef:b,highlightItemOnHover:x}=mt(),{side:w,align:S,alignItemWithTriggerActive:C,isPositioned:P,setControlledAlignItemWithTrigger:T}=li(),L=gi()!=null,_=vr(),X=xr(),{nonce:B,disableStyleElements:k}=xi(),M=z(a,U.id),N=z(a,U.open),Y=z(a,U.openMethod),F=z(a,U.mounted),E=z(a,U.popupProps),W=z(a,U.transitionStatus),A=z(a,U.triggerElement),v=z(a,U.positionerElement),H=z(a,U.listElement),me=l.useRef(!1),q=l.useRef(!1),ye=l.useRef({}),he=Ht(),O=ue(Q=>{if(!v||!f.current||!q.current)return;if(me.current||!C){R();return}const ne=v.style.top==="0px",se=v.style.bottom==="0px";if(!ne&&!se){R();return}const Se=jn(v),fe=St(v.getBoundingClientRect().height,"y",Se),de=ot(v),xe=Be(v),te=xe.getComputedStyle(v),we=parseFloat(te.marginTop),ce=parseFloat(te.marginBottom),ie=zn(xe.getComputedStyle(f.current)),re=Math.min(de.documentElement.clientHeight-we-ce,ie),$=Q.scrollTop,I=Ft(Q);let D=0,Z=null,V=!1,G=!1;const ke=ae=>{v.style.height=`${ae}px`},We=(ae,Ue)=>{const $e=Rt(ae,0,re-fe);$e>0&&ke(fe+$e),Q.scrollTop=Ue,re-(fe+$e)<=tt&&(me.current=!0),R()},Ie=ne?I-$:$,Fe=Math.min(fe+Ie,re);if(D=Fe,Ie<=tt){We(Ie,ne?I:0);return}if(re-Fe>tt)ne?G=!0:Z=0;else if(V=!0,se&&$<I){const ae=fe+Ie-re;Z=$-(Ie-ae)}if(D=Math.ceil(D),D!==0&&ke(D),G||Z!=null){const ae=Ft(Q),Ue=G?ae:Rt(Z,0,ae);Math.abs(Q.scrollTop-Ue)>tt&&(Q.scrollTop=Ue)}(V||D>=re-tt)&&(me.current=!0),R()});l.useImperativeHandle(h,()=>O,[O]),gn({open:N,ref:f,onComplete(){N&&g?.(!0)}});const j={open:N,transitionStatus:W,side:w,align:S};J(()=>{!v||!f.current||Object.keys(ye.current).length||(ye.current={top:v.style.top||"0",left:v.style.left||"0",right:v.style.right,height:v.style.height,bottom:v.style.bottom,minHeight:v.style.minHeight,maxHeight:v.style.maxHeight,marginTop:v.style.marginTop,marginBottom:v.style.marginBottom})},[f,v]),J(()=>{N||C||(q.current=!1,me.current=!1,$t(v,ye.current))},[N,C,v,f]),J(()=>{const Q=f.current;if(!N||!A||!v||!Q||C&&!P||a.state.transitionStatus==="ending")return;if(!C){q.current=!0,he.request(R),Q.style.removeProperty("--transform-origin");return}const ne=wi(Q);Q.style.removeProperty("--transform-origin");try{let se=m.current;se?.isConnected||(se=!U.hasSelectedValue(a.state)&&p.current?.isConnected?p.current:null);const Se=d.current,fe=Be(v),de=fe.getComputedStyle(v),xe=fe.getComputedStyle(Q),te=ot(A),we=jn(A),ce=Vt(A.getBoundingClientRect(),we),ie=Vt(v.getBoundingClientRect(),we),re=ce.height,$=H||Q,I=$.scrollHeight,D=parseFloat(xe.borderBottomWidth),Z=parseFloat(de.marginTop)||10,V=parseFloat(de.marginBottom)||10,G=parseFloat(de.minHeight)||100,ke=zn(xe),We=5,Ie=5,Fe=20,ae=te.documentElement.clientHeight-Z-V,Ue=te.documentElement.clientWidth,$e=ae-ce.bottom+re;let Ne,Je=X==="rtl"?ce.right-ie.width:ce.left,Qe=0;if(se&&Se){const Pe=Vt(Se.getBoundingClientRect(),we);Ne=Vt(se.getBoundingClientRect(),we),Je=ie.left+(X==="rtl"?Pe.right-Ne.right:Pe.left-Ne.left);const Ke=Pe.top-ce.top+Pe.height/2;Qe=Ne.top-ie.top+Ne.height/2-Ke}const ee=$e+Qe+V+D;let pe=Math.min(ae,ee);const ve=ae-Z-V,be=ee-pe,Te=Ue-Ie;v.style.left=`${Rt(Je,We,Te-ie.width)}px`,v.style.height=`${pe}px`,v.style.maxHeight="none",v.style.marginTop=`${Z}px`,v.style.marginBottom=`${V}px`,Q.style.height="100%";const Re=Ft($),Oe=be>=Re-tt;Oe&&(pe=Math.min(ae,ie.height)-(be-Re));const ze=ce.top<Fe||ce.bottom>ae-Fe||Math.ceil(pe)+tt<Math.min(I,G),qe=(fe.visualViewport?.scale??1)!==1&&ro;if(ze||qe){q.current=!0,$t(v,ye.current),T(!1);return}const ct=Math.max(G,pe);if(Oe){const Pe=Math.max(0,ae-ee);v.style.top=ie.height>=ve?"0":`${Pe}px`,v.style.height=`${pe}px`,$.scrollTop=Ft($)}else v.style.bottom="0",$.scrollTop=be;if(Ne){const Pe=ie.top,Ke=ie.height,ht=Ne.top+Ne.height/2,lt=Ke>0?(ht-Pe)/Ke*100:50,xt=Rt(lt,0,100);Q.style.setProperty("--transform-origin",`50% ${xt}%`)}(ct===ae||pe>=ke)&&(me.current=!0),R(),x&&a.state.selectedIndex===null&&a.state.activeIndex===null&&b.current[0]!=null&&a.set("activeIndex",0),q.current=!0}finally{ne()}},[a,N,v,A,d,p,m,f,R,C,T,he,H,b,x,X,P]),l.useEffect(()=>{if(!C||!v||!N)return;const Q=Be(v);function ne(se){u(!1,_e(so,se))}return oo(Q,"resize",ne)},[u,C,v,N]);const le={...H?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${M}-list`},onKeyDown(Q){L&&wo.has(Q.key)&&Q.stopPropagation()},onScroll(Q){H||O(Q.currentTarget)},...C&&{style:H?{height:"100%"}:ai}},Ce=gt("div",t,{ref:[n,f],state:j,stateAttributesMapping:yi,props:[E,le,wr(W),{className:!H&&C?$n.className:void 0},c]});return Me.jsxs(l.Fragment,{children:[!k&&$n.getElement(B),Me.jsx(yo,{context:_,modal:!1,disabled:!F,openInteractionType:Y,returnFocus:i,restoreFocus:!0,children:Ce})]})});function zn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ft(e){return Ir(e.scrollHeight,e.clientHeight)}function jn(e){return pr.getScale(e)}function St(e,t,n){return e/n[t]}function Vt(e,t){return At({x:St(e.x,"x",t),y:St(e.y,"y",t),width:St(e.width,"x",t),height:St(e.height,"y",t)})}const Yn=[["transform","none"],["scale","1"],["translate","0 0"]];function wi(e){const{style:t}=e,n={};for(const[r,o]of Yn)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Yn){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}let Dr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Ri(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:c,subscribeMapChange:a,elementsRef:f,labelsRef:g,nextIndexRef:u}=ri(),d=l.useRef(-1),[p,m]=l.useState(s??(o===Dr.GuessFromOrder?()=>{if(d.current===-1){const h=u.current;u.current+=1,d.current=h}return d.current}:-1)),y=l.useRef(null),R=l.useCallback(h=>{if(y.current=h,p!==-1&&h!==null&&(f.current[p]=h,g)){const b=t!==void 0;g.current[p]=b?t:r?.current?.textContent??h.textContent}},[p,f,g,t,r]);return J(()=>{if(s!=null)return;const h=y.current;if(h)return i(h,n),()=>{c(h)}},[s,i,c,n]),J(()=>{if(s==null)return a(h=>{const b=y.current?h.get(y.current)?.index:null;b!=null&&m(b)})},[s,a,m]),{ref:R,index:p}}const Lr=l.createContext(void 0);function bn(){const e=l.useContext(Lr);if(!e)throw new Error(Mt(57));return e}const Di=l.memo(l.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:c,disabled:a=!1,nativeButton:f=!1,...g}=t,u=l.useRef(null),d=Ri({label:c,textRef:u,indexGuessBehavior:Dr.GuessFromOrder}),{store:p,itemProps:m,setOpen:y,setValue:R,selectionRef:h,typingRef:b,valuesRef:x,multiple:w,selectedItemTextRef:S,disabled:C,readOnly:P}=mt(),T=z(p,U.isActive,d.index),L=z(p,U.open),_=z(p,U.isSelected,i),X=z(p,U.isSelectedByFocus,d.index),B=z(p,U.isItemEqualToValue),k=d.index,M=k!==-1,N=l.useRef(null);J(()=>{if(!M)return;const O=x.current;return O[k]=i,()=>{delete O[k]}},[M,k,i,x]),J(()=>{if(!M)return;const O=p.state.value;let j=O;w&&Array.isArray(O)&&(j=O.length>0?O[O.length-1]:void 0),j!==void 0&&pt(i,j,B)&&(p.set("selectedIndex",k),u.current&&(S.current=u.current))},[M,k,w,B,p,i,S]);const Y=l.useRef(null),F=l.useRef("mouse"),E=l.useRef(!1),{getButtonProps:W,buttonRef:A}=Zn({disabled:a,focusableWhenDisabled:!0,native:f,composite:!0}),v={disabled:a,selected:_,highlighted:T};function H(O){if(C||P)return;const j=p.state.value;if(w){const le=Array.isArray(j)?j:[],Ce=_?zs(le,i,B):[...le,i];R(Ce,_e(Zt,O))}else R(i,_e(Zt,O)),y(!1,_e(Zt,O))}function me(){h.current.dragY=0}const q={role:"option","aria-selected":_,tabIndex:L&&T?0:-1,onKeyDown(O){Y.current=O.key,p.set("activeIndex",k),O.key===" "&&b.current&&O.preventDefault()},onClick(O){const j=O.type==="click"&&F.current!=="touch",le=O.nativeEvent.pointerType,Ce=j&&rr(O.nativeEvent)&&(le!==void 0||T),Q=j&&!Ce&&!E.current;E.current=!1,!(O.type==="keydown"&&Y.current===null)&&(a||O.type==="keydown"&&Y.current===" "&&b.current||Q||(Y.current=null,H(O.nativeEvent)))},onPointerEnter(O){F.current=O.pointerType},onPointerMove(O){if(O.pointerType==="mouse"&&O.buttons===1){const j=h.current;j.dragY+=O.movementY,j.dragY**2>=64&&(j.allowUnselectedMouseUp=!0)}},onPointerDown(O){F.current=O.pointerType,E.current=!0,me()},onMouseUp(){if(me(),a||F.current==="touch"||E.current)return;const O=!h.current.allowSelectedMouseUp&&_,j=!h.current.allowUnselectedMouseUp&&!_;O||j||(E.current=!0,N.current?.click(),E.current=!1)}},ye=gt("div",t,{ref:[A,n,d.ref,N],state:v,props:[m,q,g,W]}),he=l.useMemo(()=>({selected:_,index:k,textRef:u,selectedByFocus:X,hasRegistered:M}),[_,k,u,X,M]);return Me.jsx(Lr.Provider,{value:he,children:ye})})),Li=l.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=bn();return r||o?Me.jsx(bi,{...t,ref:n}):null}),bi=l.memo(l.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:c}=bn(),a=l.useRef(null),{transitionStatus:f,setMounted:g}=sr(c),d=gt("span",e,{ref:[t,a],state:{selected:c,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:er});return gn({open:c,ref:a,onComplete(){c||g(!1)}}),d})),Fi=l.memo(l.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s,hasRegistered:i}=bn(),{firstItemTextRef:c,selectedItemTextRef:a}=mt(),{render:f,className:g,style:u,...d}=t,p=l.useCallback(y=>{y&&(i&&r===0&&(c.current=y),i&&s&&(a.current=y))},[c,a,r,s,i]);return gt("div",t,{ref:[p,n,o],props:d})}));export{wr as A,Ei as C,ai as L,Ti as S,li as a,$n as b,Ai as c,Mi as d,Ii as e,Oi as f,Pi as g,Di as h,Li as i,Fi as j,Ns as k,Ks as l,Rn as m,Er as n,Wn as o,Bs as p,Rr as q,Oo as r,U as s,Ps as t,mt as u,Ms as v,fi as w,Is as x,Ci as y,gi as z};
@@ -0,0 +1 @@
1
+ import{k as w,r as c,j as t,d as N,c as a,a as ae,am as ie,aQ as se,as as oe,at as re,a1 as U,aR as le,aS as ce,u as ue,R as C,U as de,Y as F,l as G,aT as ge,aU as he,M as pe,aV as me,v as be,aW as fe,aX as xe,aY as ye,aZ as ve,a_ as je,a$ as ke,b0 as Ne,L as Se,aP as we,b1 as Ce,ai as P}from"./__vite-browser-external-DWKjPxnU.js";import{b as Le,g as Ee,L as I,m as R}from"./react-Nv3-bJyw.js";import{u as Ae,L as _}from"./use-limits-display-prefs-CH8MmjYf.js";import{P as Ge}from"./ProviderIcon-BYl1Yyf3.js";import{a as O,l as T}from"./limits-providers-8NsMiLNP.js";import{a as k,T as j,b,S as L,u as H}from"./use-native-settings-__RhxrW5.js";import{P as Pe,u as Ie,a as _e}from"./use-session-efficiency-pref-CCYtJ_cN.js";import{C as Oe}from"./check-Cz3lYRiR.js";import{C as Te}from"./copy-CTtF84H9.js";import{A as De}from"./index-0w19KMWl.js";import{u as Me}from"./useCurrency-Dt2GqkDm.js";import{u as Ue}from"./useTokenFormat-dnqZK7Z-.js";import{S as $}from"./Select-ClnnGJY1.js";import{I as Fe}from"./info-F-75j15K.js";import{C as Re}from"./ConfirmModal-SAheZUAv.js";import{A as He}from"./arrow-up-right-TvEj8NTT.js";import{D as $e}from"./download-B5WAY6Nh.js";import"./Card-DX2Wwm9U.js";import"./SelectItemText-iaFWq7GD.js";import"./useScrollLock-C5d53j7C.js";import"./DialogTitle-Im7ESzoS.js";import"./DialogDescription-CVuGFYFU.js";const Ve=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Be=w("activity",Ve);const ze=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Ke=w("grip-vertical",ze);const Ze=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],We=w("languages",Ze);const qe=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Ye=w("log-out",qe),Qe=e=>!e.isLayoutDirty&&e.willUpdate(!1);function D(){const e=new Set,n=new WeakMap,i=()=>e.forEach(Qe);return{add:s=>{e.add(s),n.set(s,s.addEventListener("willUpdate",i))},remove:s=>{e.delete(s);const o=n.get(s);o&&(o(),n.delete(s)),i()},dirty:i}}const Je=c.createContext(null);function Xe(){const e=c.useRef(!1);return Le(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function et(){const e=Xe(),[n,i]=c.useState(0),s=c.useCallback(()=>{e.current&&i(n+1)},[n]);return[c.useCallback(()=>Ee.postRender(s),[s]),n]}const V=e=>e===!0,tt=e=>V(e===!0)||e==="id",nt=({children:e,id:n,inherit:i=!0})=>{const s=c.useContext(I),o=c.useContext(Je),[r,l]=et(),u=c.useRef(null),g=s.id||o;u.current===null&&(tt(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:V(i)&&s.group||D()});const h=c.useMemo(()=>({...u.current,forceRender:r}),[l]);return t.jsx(I.Provider,{value:h,children:e})},at="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function it({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:N("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:N("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function st({prefs:e}){const{order:n,visibility:i,toggle:s,moveToward:o}=e,[r,l]=c.useState(null),[u,g]=c.useState(null),h=d=>f=>{l(d),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("text/plain",d)},m=d=>f=>{f.preventDefault(),f.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},x=()=>{l(null),g(null)},y=d=>{d.preventDefault(),l(null),g(null)};return t.jsx(nt,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const f=i[d]!==!1,p=r===d;return t.jsxs(R.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:x,onDrop:y,className:N("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",p&&"opacity-40"),style:{cursor:p?"grabbing":"grab"},children:[t.jsx(Ke,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),O(d)?t.jsx(Ge,{provider:O(d),size:18,className:N("pointer-events-none",at)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:T(d)}),t.jsx("div",{onMouseDown:v=>v.stopPropagation(),draggable:!1,children:t.jsx(it,{checked:f,onChange:()=>s(d),ariaLabel:`${a("limits.settings.toggle_visible")}: ${T(d)}`})})]},d)})})})}function ot(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},s=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof s=="string"&&s.trim()?s.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function rt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function lt(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),s=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||s?.[1];return o?`https://github.com/${o}`:null}function E(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function ct(e,n,i){const[s,o]=c.useState(()=>ie()),r=n&&i&&se(),l=c.useCallback(async()=>{const u=!s;if(oe(u),o(u),!!u)try{await re(()=>e())}catch(g){E("cloud sync",g)}},[s,e]);return{cloudSyncOn:s,handleCloudSyncToggle:l,showLocalCloudSync:r}}function ut(e){const[n,i]=c.useState(!1),[s,o]=c.useState(!1),[r,l]=c.useState(!1),[u,g]=c.useState(!1),[h,m]=c.useState(null),[x,y]=c.useState(!1),[d,f]=c.useState(""),[p,v]=c.useState(!1),[S,A]=c.useState(""),[Z,W]=c.useState(""),[q,Y]=c.useState(!1),[Q,J]=c.useState(null),X=c.useMemo(()=>ot(e),[e]),ee=c.useMemo(()=>rt(e),[e]),te=c.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),ne=c.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:A,setProfileLoading:l,setPublicProfileOn:i,setShowGithubOn:v}),[]);return{anonymousOn:s,customDisplayName:h,displayName:X,editingGithub:q,editingName:x,email:ee,githubError:Q,githubInput:Z,githubUrl:S,loadSetters:ne,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:Y,setEditingName:y,setGithubError:J,setGithubInput:W,setGithubUrl:A,setNameInput:f,setProfileLoading:l,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:v,showGithubOn:p,userId:te}}function dt(e,n,i){c.useEffect(()=>{if(!n)return;let s=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await U({getAccessToken:e});if(!s||!o)return;const r=await le({accessToken:o});if(!s)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){E("load public profile",o)}finally{s&&i.setProfileLoading(!1)}})(),()=>{s=!1}},[e,n,i])}function gt(e,n){return c.useCallback(async(i,{label:s,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const l=await U({getAccessToken:e});if(!l)return!1;const u=await ce({accessToken:l,...i});return r?.(u),!0}catch(l){return o?o(l):E(s||"mutate profile",l),!1}finally{n.setProfileSaving(!1)}},[e,n])}function ht(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function pt(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function mt(e,n){const i=c.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:c.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function bt(e,n,i){const s=c.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),i?.()}})},[n,e,i]),o=c.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:s,startEditingName:o}}function ft(e,n){const i=c.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),s=c.useCallback(async()=>{const r=lt(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(a("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||a("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=c.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:s,handleShowGithubToggle:i,startEditingGithub:o}}function xt(){const e=ae(),n=ut(e.user),i=ct(e.getAccessToken,e.enabled,e.signedIn);dt(e.getAccessToken,e.signedIn,n.loadSetters);const s=gt(e.getAccessToken,n),o=mt(n,s),r=bt(n,s,e.refreshDisplayName),l=ft(n,s);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:ht(n,{...o,...r}),github:pt(n,l),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function B({disabled:e,onCancel:n,onSave:i,saveLabel:s=a("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:s}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function yt({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:s,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.displayName")}),t.jsx(B,{disabled:s||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:s?a("settings.account.saving"):void 0})]})}function vt({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:s,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{l(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),t.jsx(B,{disabled:s,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:s?a("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function z({disabled:e=!1,label:n,onClick:i,title:s}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:s,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Pe,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function K({actions:e,editing:n,editor:i,hint:s,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s})]}),n?null:e]})})}function jt({name:e}){const n=e.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(z,{disabled:e.anonymousOn,label:a("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function kt({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:s,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:x,startEditingName:y}=e,d=n?a("settings.account.displayNameAnonymousHint"):i||s;return t.jsx(K,{label:a("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(yt,{nameInput:u,setEditingName:m,setNameInput:x,profileSaving:h,handleSaveName:l}),actions:t.jsx(jt,{name:e})})}function Nt({github:e}){const{editingGithub:n,githubError:i,githubInput:s,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:x,showGithubOn:y,startEditingGithub:d}=e;return t.jsx(t.Fragment,{children:t.jsx(K,{label:a("settings.account.githubUrl"),editing:n,hint:o||a("settings.account.githubUrlHint"),editor:t.jsx(vt,{githubError:i,githubInput:s,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:x}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(z,{label:a("settings.account.edit"),onClick:d}),t.jsx(j,{checked:y,onChange:l,disabled:u||g,ariaLabel:a("settings.account.githubUrl")})]})})})}function St(){const{openLoginModal:e}=ue();return t.jsx(k,{title:a("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function wt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(kt,{name:e}),t.jsx(Nt,{github:n})]})}function Ct(){const e=xt();return e.enabled?e.signedIn?t.jsxs(k,{title:a("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Et,{onSignOut:e.signOut}),children:[t.jsx(Lt,{userId:e.userId}),t.jsx(At,{settings:e}),t.jsx(Gt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(Pt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(St,{}):null}function Lt({userId:e}){const[n,i]=C.useState(!1);if(!e)return null;const s=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[n?t.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?a("settings.account.copied"):a("settings.account.copy")]})]})}function Et({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function At({settings:e}){return e.showLocalCloudSync?t.jsx(b,{label:a("settings.account.cloudSync"),hint:a("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:a("settings.account.cloudSync")})}):null}function Gt({checked:e,disabled:n,onChange:i}){return t.jsx(b,{label:a("settings.account.publicProfile"),hint:a("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:a("settings.account.publicProfile")})})}function Pt({visible:e,name:n,github:i}){return t.jsx(De,{initial:!1,children:e?t.jsx(R.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(wt,{name:n,github:i})},"public-profile-fields"):null})}function It(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:ge},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:he},{value:"system",label:a("settings.appearance.theme.system"),Icon:pe}]}function _t(){return[{value:fe,label:a("settings.appearance.language.system")},{value:xe,label:a("settings.appearance.language.english")},{value:ye,label:a("settings.appearance.language.chinese")},{value:ve,label:a("settings.appearance.language.traditional_chinese")},{value:je,label:a("settings.appearance.language.japanese")},{value:ke,label:a("settings.appearance.language.korean")},{value:Ne,label:a("settings.appearance.language.german")}]}function Ot(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function Tt(e,n){const i=a(`settings.appearance.currency.rate_source.${e}`),s=Ot(n),o=s?a("settings.appearance.currency.rate_updated",{when:s}):a("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Dt({locale:e,setLocale:n}){const i=_t();return t.jsx($,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(We,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function Mt({currency:e,setCurrency:n}){const i=me().map(s=>({value:s.code,label:a(s.labelKey)}));return t.jsx($,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Ut({currency:e,rate:n,rateSource:i,rateFetchedAt:s}){if(e===be)return t.jsx(t.Fragment,{children:a("settings.appearance.currency.hint")});const o=Tt(i,s);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Ft(){const{theme:e,setTheme:n}=de(),{locale:i,setLocale:s}=F(),{currency:o,rate:r,rateSource:l,rateFetchedAt:u,setCurrency:g}=Me(),{mode:h,setMode:m}=Ue();return t.jsxs(k,{title:a("settings.section.appearance"),children:[t.jsx(b,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:t.jsx(L,{options:It(),value:e,onChange:n})}),t.jsx(b,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:t.jsx(Dt,{locale:i,setLocale:s})}),t.jsx(b,{label:a("settings.appearance.currency.label"),hint:t.jsx(Ut,{currency:o,rate:r,rateSource:l,rateFetchedAt:u}),control:t.jsx(Mt,{currency:o,setCurrency:g})}),t.jsx(b,{label:a("settings.appearance.token_format.label"),hint:a("settings.appearance.token_format.hint"),control:t.jsx(L,{options:[{value:G.COMPACT,label:a("settings.appearance.token_format.compact")},{value:G.FULL,label:a("settings.appearance.token_format.full")}],value:h,onChange:m})})]})}function M({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:a(e)}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:a("qpd.card.badge")})]})}function Rt(){const{enabled:e,toggle:n}=Ie(),{enabled:i,toggle:s}=_e();return t.jsxs(k,{title:a("settings.section.labs"),children:[t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.qpd.label"}),hint:a("settings.labs.qpd.hint"),control:t.jsx(j,{checked:e,onChange:n,ariaLabel:a("settings.labs.qpd.aria")})}),t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.sessions.label"}),hint:a("settings.labs.sessions.hint"),control:t.jsx(j,{checked:i,onChange:s,ariaLabel:a("settings.labs.sessions.aria")})})]})}function Ht(){const{available:e,settings:n,setSetting:i,runAction:s}=H();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,l=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(k,{title:a("settings.section.menubar"),children:[t.jsx(b,{label:a("settings.menubar.appearance"),hint:a("settings.menubar.appearanceHint"),control:t.jsxs(Se,{to:"/widgets",className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[a("settings.menubar.appearanceLink"),t.jsx(He,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),r?t.jsx(b,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,t.jsx(b,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>s("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(we,{className:N("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),t.jsx(b,{label:a("settings.menubar.updates"),hint:l||void 0,control:t.jsxs("button",{type:"button",onClick:()=>s("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function $t(e,n){function i(r){return r.replace(/^v/,"").split(".").map(Number)}const s=i(e),o=i(n);for(let r=0;r<Math.max(s.length,o.length);r++){const l=s[r]||0,u=o[r]||0;if(l<u)return!0;if(l>u)return!1}return!1}function Vt(){const{available:e,settings:n,runAction:i}=H(),s=e&&n?.version,[o,r]=C.useState(!1),[l,u]=C.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:g}=F(),h="0.83.2",m=async()=>{r(!0);try{const p=await fetch("https://api.github.com/repos/mm7894215/TokenTracker/releases/latest");if(!p.ok)throw new Error("Failed to fetch");const v=await p.json(),S=v.tag_name;$t(h,S)?u({open:!0,latestVersion:S,htmlUrl:v.html_url}):P({title:a("settings.menubar.updates.upToDate")})}catch(p){console.error("Check updates failed:",p),P({title:a("settings.menubar.updates.failed")})}finally{r(!1)}},x=a("settings.menubar.updates.modalTitle"),y=a("settings.menubar.updates.modalDescription",{version:l.latestVersion}),d=a("settings.menubar.updates.modalConfirm"),f=a("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCombined",{barVersion:n.version,coreVersion:h})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:h})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:m,disabled:o,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:o?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Ce,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),t.jsx(Re,{open:l.open,title:x,description:y,confirmLabel:d,cancelLabel:f,onConfirm:()=>{window.open(l.htmlUrl,"_blank"),u(p=>({...p,open:!1}))},onCancel:()=>u(p=>({...p,open:!1}))})]})}function Bt({prefs:e}){return t.jsx(L,{options:[{value:_.USED,label:a("limits.settings.display_mode_used")},{value:_.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function pn(){const e=Ae();return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Ft,{}),t.jsx(Ht,{}),t.jsx(Ct,{}),t.jsx(Rt,{}),t.jsx(k,{title:a("settings.section.limits"),action:t.jsx(Bt,{prefs:e}),children:t.jsx(st,{prefs:e})})]}),t.jsx(Vt,{})]})})})}export{pn as SettingsPage};
@@ -0,0 +1 @@
1
+ import{k as da,r as n,j as e,N as nt,x as ca,X as Ce,c as r,d as Z,aF as ia,aw as _a,aG as ot,w as lt,aH as ha,aI as dt,aJ as ct,av as ut,aK as xa,aL as mt,aM as gt,y as ht,aN as xt,ay as pt,ax as ft,aO as yt,a5 as bt,H as kt,B as G,aP as wt,R as vt,ai as Se}from"./__vite-browser-external-DWKjPxnU.js";import{L as jt}from"./LocalOnlyNotice-B8BtIdAA.js";import{C as Nt}from"./Card-DX2Wwm9U.js";import{C as pa}from"./ConfirmModal-SAheZUAv.js";import{I as La}from"./info-F-75j15K.js";import{P as be}from"./ProviderIcon-BYl1Yyf3.js";import{m as fa}from"./react-Nv3-bJyw.js";import{u as St}from"./useCurrency-Dt2GqkDm.js";import{L as ee}from"./loader-circle-BjzQhjhO.js";import{C as _e}from"./check-Cz3lYRiR.js";import{T as ua}from"./trash-2-DLG8hKJm.js";import{A as Ct}from"./index-0w19KMWl.js";import{u as _t}from"./use-reduced-motion-CA2IXeeO.js";import{u as Lt,s as Pt,k as Pa,l as Rt,m as It,n as Et,o as $t,p as Bt,q as Tt,S as Ra,c as Ia,d as Ea,C as ma,e as $a,f as Ba,g as Ta,h as Ge,j as We,i as Qe}from"./SelectItemText-iaFWq7GD.js";import{t as Dt,u as na,m as Mt}from"./useScrollLock-C5d53j7C.js";import{g as Ot,a as Ut,d as Ft,b as At,c as zt,e as Kt,S as oa,s as Vt,i as ya,u as ba,f as ka,r as qt,h as wa,j as va,k as Ht,l as Gt}from"./skills-api-DazKXxME.js";import{F as Wt}from"./flame-Cja4F8Mj.js";import{D as Da}from"./download-B5WAY6Nh.js";import{P as Ma,a as Oa,b as Ua,c as Fa,d as Aa,C as Qt}from"./PopoverPopup-B2HqJNaq.js";import"./arrow-up-right-TvEj8NTT.js";import"./DialogTitle-Im7ESzoS.js";import"./DialogDescription-CVuGFYFU.js";const Xt=[["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"}]],za=da("circle-arrow-up",Xt);const Jt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],la=da("external-link",Jt);const Yt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ka=da("plus",Yt);function ga({id:a,value:s,onChange:l,placeholder:m,disabled:c=!1,type:x="text",label:u,error:g,className:h="",...b}){const o=n.useId(),k=a||o,N=g?`${k}-error`:void 0,S=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${c?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${g?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${h}`;return e.jsxs("div",{className:"w-full",children:[u&&e.jsx("label",{htmlFor:k,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:u}),e.jsx("input",{id:k,type:x,value:s,onChange:l,placeholder:m,disabled:c,"aria-invalid":g?!0:void 0,"aria-describedby":N,className:S,...b}),g&&e.jsx("p",{id:N,className:"mt-1.5 text-sm text-oai-error",children:g})]})}const Va=n.forwardRef(function(s,l){const{render:m,className:c,style:x,...u}=s,{store:g}=Lt(),b={open:nt(g,Pt.open)};return ca("span",s,{state:b,ref:l,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:Dt})}),Zt="tt:hint:dismissed:";function qa(a){return Zt+a}function er(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(qa(a))==="1"}catch{return!1}}function ar({id:a,children:s,className:l,ariaLabel:m}){const[c,x]=n.useState(()=>er(a)),u=n.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(qa(a),"1")}catch{}x(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":m||r("hint.dismissible_aria"),className:Z("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",l),children:[e.jsx("button",{type:"button",onClick:u,"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(Ce,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(La,{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 tr(a){if(!a)return null;for(const s of a.elements){const l=s.tagName;if(l==="BUTTON"||l==="INPUT"){const m=s;if(m.type==="submit")return m}}return null}let ja=(function(a){return a.checked="data-checked",a.unchecked="data-unchecked",a.indeterminate="data-indeterminate",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a})({});function Ha(a){return n.useMemo(()=>({checked(s){return a.indeterminate?{}:s?{[ja.checked]:""}:{[ja.unchecked]:""}},...Pa}),[a.indeterminate])}const rr=n.createContext({disabled:!1});function sr(){return n.useContext(rr)}function ir(a,s,l,m=!0,c){const[x,u]=n.useState(),g=na(c?`${c}-label`:void 0),h=a??s??x;return ia(()=>{const b=a||s||!m?void 0:nr(l.current,g);x!==b&&u(b)}),h}function nr(a,s){const l=or(a);if(l)return!l.id&&s&&(l.id=s),l.id||void 0}function or(a){if(!a)return;const s=a.parentElement;if(s&&s.tagName==="LABEL")return s;const l=a.id;if(l){const c=a.nextElementSibling;if(c&&c.htmlFor===l)return c}const m=a.labels;return m&&m[0]}const lr=n.createContext(void 0);function dr(a=!0){const s=n.useContext(lr);if(s===void 0&&!a)throw new Error(_a(3));return s}const Ga=n.createContext(void 0);function cr(){const a=n.useContext(Ga);if(a===void 0)throw new Error(_a(14));return a}const ur="data-parent",mr=n.forwardRef(function(s,l){const{checked:m,className:c,defaultChecked:x=!1,"aria-labelledby":u,disabled:g=!1,form:h,id:b,indeterminate:o=!1,inputRef:k,name:N,onCheckedChange:w,parent:v=!1,readOnly:y=!1,render:S,required:E=!1,uncheckedValue:U,value:W,nativeButton:F=!1,style:ge,...j}=s,{clearErrors:ae}=Rt(),{disabled:$,name:K,setDirty:Q,setFilled:te,setFocused:A,setTouched:ke,state:we,validationMode:Ue,validityData:Le,validation:Fe}=It(),Ae=sr(),{labelId:D,controlId:re,registerControlId:X,getDescriptionProps:ve}=Et(),L=dr(),V=L?.parent,se=V&&L.allValues,I=$||Ae.disabled||L?.disabled||g,ie=K??N,P=W??ie,Pe=na(),je=na();let ne=re;se?ne=v?je:`${V.id}-${P}`:b&&(ne=b);let pe={};se&&(v?pe=L.parent.getParentProps():P&&(pe=L.parent.getChildProps(P)));const{checked:Re=m,indeterminate:Ie=o,onCheckedChange:Ee,...Ne}=pe,q=L?.value,oe=L?.setValue,fe=L?.defaultValue,le=n.useRef(null),de=ot(()=>Symbol("checkbox-control")),he=n.useRef(!1),{getButtonProps:Je,buttonRef:ze}=lt({disabled:I,native:F}),ce=L?.validation??Fe,[_,Ye]=$t({controlled:P&&q&&!v?q.includes(P):Re,default:P&&fe&&!v?fe.includes(P):x,name:"Checkbox",state:"checked"}),$e=se?!!Re:_,ye=se&&Ie||o;ia(()=>{X!==ha&&(he.current=!0,X(de.current,ne))},[ne,X,de]),n.useEffect(()=>{const f=de.current;return()=>{!he.current||X===ha||(he.current=!1,X(f,void 0))}},[X,de]),Bt(le,Pe,_,void 0,!L&&!I,N);const J=n.useRef(null),Be=dt(k,J,ce.inputRef,ce.registerInput),Ze=ir(u,D,J,!F,ne??void 0);ia(()=>{J.current&&(J.current.indeterminate=ye,_&&te(!0))},[_,ye,te]),Tt(_,()=>{L||(ae(ie),te(_),Q(_!==Le.initialValue),ce.change(_))});const Ke=ct({checked:_,disabled:I,form:h,name:v?void 0:ie,id:F?void 0:ne??void 0,required:E,ref:Be,style:ie?mt:gt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(f){if(f.nativeEvent.defaultPrevented)return;if(y){f.preventDefault();return}const M=f.currentTarget.checked,ue=ht(xt,f.nativeEvent);if(w?.(M,ue),!ue.isCanceled&&(Ee?.(M,ue),!ue.isCanceled&&(Ye(M),P&&q&&oe&&!v&&!se))){const me=M?[...q,P]:q.filter(B=>B!==P);oe(me,ue)}},onFocus(){le.current?.focus()}},W!==void 0?{value:(L?_&&W:W)||""}:ut,ve,f=>ce.getValidationProps(I,f));n.useEffect(()=>{if(!V||!P)return;const f=V.disabledStatesRef.current;return f.set(P,I),()=>{f.delete(P)}},[V,I,P]);const Te=n.useMemo(()=>({...we,checked:$e,disabled:I,readOnly:y,required:E,indeterminate:ye}),[we,$e,I,y,E,ye]),ea=Ha(Te),aa=ca("span",s,{state:Te,ref:[ze,le,l,L?.registerControlRef],props:[{id:F?ne??void 0:Pe,role:"checkbox","aria-checked":ye?"mixed":$e,"aria-readonly":y||void 0,"aria-required":E||void 0,"aria-labelledby":Ze,[ur]:v?"":void 0,onFocus(){I||A(!0)},onBlur(){const f=J.current;f&&(ke(!0),A(!1),Ue==="onBlur"&&ce.commit(L?q:f.checked))},onKeyDown(f){if(f.key!=="Enter"||(f.preventBaseUIHandler(),f.defaultPrevented))return;const M=J.current?.form??null,ue=f.currentTarget,me=f.nativeEvent,B=f.preventDefault,H=me.preventDefault;let De=!1;f.preventDefault=()=>{De=!0,B.call(f)},me.preventDefault=()=>{De=!0,H.call(me)},H.call(me),xa(ue).queueMicrotask(()=>{f.preventDefault=B,me.preventDefault=H,De||tr(M)?.click()})},onClick(f){if(y||I)return;f.preventDefault();const M=J.current;M&&M.dispatchEvent(new(xa(M)).PointerEvent("click",{bubbles:!0,shiftKey:f.shiftKey,ctrlKey:f.ctrlKey,altKey:f.altKey,metaKey:f.metaKey}))}},j,Ne,Je,ve,f=>ce.getValidationProps(I,f)],stateAttributesMapping:ea});return e.jsxs(Ga.Provider,{value:Te,children:[aa,!_&&!L&&ie&&!v&&U!==void 0&&e.jsx("input",{type:"hidden",form:h,name:ie,value:U,disabled:I}),e.jsx("input",{...Ke,suppressHydrationWarning:!0})]})}),gr=n.forwardRef(function(s,l){const{render:m,className:c,style:x,keepMounted:u=!1,...g}=s,h=cr(),b=h.checked||h.indeterminate,{mounted:o,transitionStatus:k,setMounted:N}=Mt(b),w=n.useRef(null),v={...h,transitionStatus:k};pt({open:b,ref:w,onComplete(){b||N(!1)}});const S={...Ha(h),...ft,...Pa},E=u||o,U=ca("span",s,{ref:[l,w],state:v,stateAttributesMapping:S,props:g});return E?U:null});function hr(a,s){return`target:${a}:${s}`}function xr(a){return`remove:${a.id||a.directory}`}function Wa(a){if(!a)return null;const s=new Date(a).getTime();return Number.isFinite(s)?Math.floor((Date.now()-s)/864e5):null}function pr(a){const s=Wa(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 l=Math.max(1,Math.floor(s/30));return r("skills.usage.months_ago",{months:l})}function fr(a){const s=Wa(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 ra({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 yr({skill:a,targets:s,busyKey:l,usage:m,hasUpdate:c,updating:x,onUpdate:u,onClose:g,onToggleTarget:h,onRemove:b}){return e.jsx(Ct,{children:a?e.jsx(br,{skill:a,targets:s,busyKey:l,usage:m,hasUpdate:c,updating:x,onUpdate:u,onClose:g,onToggleTarget:h,onRemove:b},a.id||a.directory):null})}function br({skill:a,targets:s,busyKey:l,usage:m,hasUpdate:c,updating:x,onUpdate:u,onClose:g,onToggleTarget:h,onRemove:b}){const o=_t(),{currency:k,rate:N}=St(),w=n.useRef(null);n.useEffect(()=>{const j=$=>{$.key==="Escape"&&($.stopPropagation(),g?.())},ae=$=>{const K=$.target;K instanceof Element&&(w.current?.contains(K)||K.closest('[data-skill-row="1"]')||g?.())};return document.addEventListener("keydown",j),document.addEventListener("mousedown",ae),()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousedown",ae)}},[g]);const v=a.name||a.directory,y=!!(a.repoOwner&&a.repoName),S=y?`https://github.com/${a.repoOwner}/${a.repoName}`:null,E=new Set(a.targets||[]),U=l===xr(a),W=pr(m?.lastUsedAt),F=!!(m&&m.invocations>0),ge=o?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(fa.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:o?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:o?0:.15},onClick:g,"aria-hidden":!0}),e.jsxs(fa.aside,{ref:w,role:"complementary","aria-label":v,initial:o?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:o?{opacity:0}:{opacity:0,x:24,scale:.98},transition:ge,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:v,children:v}),y?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(la,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==v?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:g,"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(Ce,{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:[c?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(za,{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:()=>u?.(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(ee,{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,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(ra,{label:r("skills.usage.invocations"),children:yt(m?.invocations||0)}),e.jsx(ra,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:Z("h-1.5 w-1.5 rounded-full",fr(m?.lastUsedAt)),"aria-hidden":!0}),F?W||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(ra,{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(La,{className:"h-3 w-3","aria-label":r("skills.usage.disclaimer")})})]}),children:bt(m?.cost||0,{currency:k,rate:N})})]}),F?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")})]}),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||[]).map(j=>{const ae=E.has(j.id),$=l===hr(a.id,j.id),K=`skill-detail-sync-${a.id||a.directory}-${j.id}`;return e.jsxs("label",{htmlFor:K,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(mr,{id:K,checked:ae,disabled:$,onCheckedChange:Q=>h?.(a,j.id,!!Q),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(gr,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(_e,{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(be,{provider:j.id,size:16})}),e.jsx("span",{className:"flex-1",children:j.label}),$?e.jsx(ee,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},j.id)})})]})]}),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:()=>b?.(a),disabled:U,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:[U?e.jsx(ee,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ua,{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 kr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),sa=["claude","codex"],O="popular",wr={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",T="skillssh";function Xe(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Qa(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function vr(a){return Qa(a).split("/").filter(Boolean).pop()||""}function jr(a){if(a.repoOwner||a.repoName)return"";const s=Qa(a.directory);return!s||s.includes("/")?"":`dir:${s}`}function Na(a){const s=vr(a.directory);return s?`dir:${s}`:""}function Sa(a){const s=new Set([Xe(a).toLowerCase()]);a.repoOwner&&a.repoName&&s.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const l=jr(a);return l&&s.add(l),s}function He(a){return`install:${Xe(a)}`}function Ca(a){return`remove:${a.id||a.directory}`}function Xa(a,s){return`target:${a}:${s}`}function Nr({target:a,state:s,busy:l,onToggle:m}){const c=s==="synced",x=s==="orphan",u=x?r("skills.dot.orphan_aria",{agent:a.label}):c?r("skills.dot.synced_aria",{agent:a.label}):r("skills.dot.off_aria",{agent:a.label});return e.jsxs("button",{type:"button",title:u,"aria-label":u,"aria-pressed":c,disabled:l,onClick:g=>{g.stopPropagation(),m?.(a.id,!c)},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:[l?e.jsx(ee,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:Z("flex h-[18px] w-[18px] items-center justify-center transition",c&&wr[a.id],!c&&!x&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(be,{provider:a.id,size:18})}),x&&!l?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 Sr({skill:a,targets:s,onToggleTarget:l,busyKey:m}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:s.map(c=>e.jsx(Nr,{target:c,state:a.targetStates?.[c.id]||"off",busy:m===Xa(a.id,c.id),onToggle:(x,u)=>l?.(a,x,u)},c.id))})}function Cr({skill:a,targets:s,selected:l,onSelect:m,selectable:c,checked:x,onToggleSelect:u,onToggleTarget:g,hasUpdate:h,busyKey:b}){const o=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,k=o?`${a.directory} · ${o}`:a.directory,N=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),m?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":l,"aria-label":r("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>m?.(a),onKeyDown:N,className:Z("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",l?"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:[c?e.jsx("label",{className:"flex shrink-0 items-center",onClick:w=>w.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:x,onChange:w=>u?.(a,w.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:k,children:a.name||a.directory}),h?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(za,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("skills.update.badge")]}):null,e.jsx(Sr,{skill:a,targets:s,onToggleTarget:g,busyKey:b}),e.jsx(Qt,{className:Z("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",l&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]}),a.description?e.jsx("p",{className:Z("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",c&&"pl-7"),children:a.description}):null]})}function _r({agentFilter:a,agentOptions:s,onAgentFilter:l,filteredCount:m,totalCount:c,anyFilter:x,onClearFilters:u,searchQuery:g,onSearchQuery:h,searchPlaceholder:b}){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(Ra,{value:a,onValueChange:l,children:[e.jsxs(Ia,{"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(Ea,{children:o=>o==="all"?r("skills.filter.agent_all"):s.find(k=>k.id===o)?.label||o}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx($a,{children:e.jsx(Ba,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Ta,{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(Ge,{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(We,{children:r("skills.filter.agent_all")}),e.jsx(Qe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),s.map(o=>e.jsxs(Ge,{value:o.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(be,{provider:o.id,size:14}),e.jsx(We,{children:o.label})]}),e.jsx(Qe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},o.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(oa,{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(ga,{type:"search",value:g,onChange:o=>h(o.target.value),onKeyDown:o=>{o.key==="Escape"&&g&&(o.preventDefault(),h(""))},"aria-label":r("skills.action.search_aria"),placeholder:b,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:o=>o.preventDefault(),onClick:()=>h(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!g,tabIndex:g?0:-1,className:Z("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",g?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Ce,{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:m,total:c})}),x?e.jsxs("button",{type:"button",onClick:u,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(Ce,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]})}function Lr({count:a,targets:s,busy:l,onBulkSync:m,onBulkRemove:c,onClear:x}){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(Ma,{children:[e.jsxs(Oa,{disabled:l,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(Da,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_sync"),e.jsx(ma,{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(Aa,{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")}),s.map(u=>e.jsxs("button",{type:"button",onClick:()=>m(u.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(be,{provider:u.id,size:16}),e.jsx("span",{className:"flex-1",children:u.label})]},u.id))]})})})]}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:c,children:[e.jsx(ua,{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(Ce,{className:"h-3 w-3","aria-hidden":!0}),r("skills.select.clear")]})]})]})}function Pr({items:a,totalCount:s,targets:l,agentOptions:m,agentFilter:c,onAgentFilter:x,anyFilter:u,onClearFilters:g,searchQuery:h,onSearchQuery:b,searchPlaceholder:o,selectedId:k,onSelect:N,onToggleTarget:w,busyKey:v,updates:y,selectedIds:S,onToggleSelect:E,onClearSelection:U,onBulkSync:W,onBulkRemove:F}){const ge=S.size;return e.jsxs("div",{children:[ge>0?e.jsx(Lr,{count:ge,targets:l,busy:v==="batch",onBulkSync:W,onBulkRemove:F,onClear:U}):e.jsx(_r,{agentFilter:c,agentOptions:m,onAgentFilter:x,filteredCount:a.length,totalCount:s,anyFilter:u,onClearFilters:g,searchQuery:h,onSearchQuery:b,searchPlaceholder:o}),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(G,{type:"button",variant:"secondary",size:"sm",onClick:g,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(j=>e.jsx(Cr,{skill:j,targets:l,selected:k===(j.id||j.directory),onSelect:N,selectable:!0,checked:S.has(j.id),onToggleSelect:E,onToggleTarget:w,hasUpdate:!!(j.id&&y?.[j.id]),busyKey:v},j.id||j.key))})]})}const Rr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Ir=vt.memo(function({skill:s,installed:l,installing:m,allTargets:c,defaultTargets:x,onInstall:u,onManage:g}){const[h,b]=n.useState(()=>(x||[]).filter(y=>c.some(S=>S.id===y))),o=y=>{b(S=>S.includes(y)?S.filter(E=>E!==y):[...S,y])},k=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,N=k?`https://github.com/${s.repoOwner}/${s.repoName}`:null,w=s.installs!=null?r("skills.card.installs",{count:Number(s.installs||0).toLocaleString()}):null,v=h.length?h.map(y=>c.find(S=>S.id===y)?.label||y).join(", "):r("skills.action.choose_targets");return e.jsxs(Nt,{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(la,{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}),k||w?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:[N?e.jsxs("a",{href:N,target:"_blank",rel:"noopener noreferrer",onClick:y=>y.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:N,children:[e.jsx("span",{className:"truncate",children:k}),e.jsx(la,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,k&&w?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,w?e.jsx("span",{className:"truncate",children:w}):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:l?e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:()=>g?.(s),className:"w-full",children:[e.jsx(_e,{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:h.length?v:r("skills.target.none")}),e.jsxs(Ma,{children:[e.jsx(Oa,{disabled:m,"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(Aa,{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")}),c.map(y=>{const S=h.includes(y.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:()=>o(y.id)}),e.jsx(be,{provider:y.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:y.label})]},y.id)})]})})})]})]}),e.jsxs(G,{type:"button",size:"sm",onClick:()=>u(s,h),disabled:m||h.length===0,className:"w-full",children:[m?e.jsx(ee,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Da,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.action.install")]})]})})]})});function Er({repos:a,repoInput:s,onRepoInput:l,busyKey:m,onAdd:c,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(ga,{value:s,onChange:u=>l(u.target.value),placeholder:r("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(G,{type:"button",variant:"secondary",size:"md",onClick:c,disabled:m==="repo:add",className:"shrink-0 whitespace-nowrap",children:[m==="repo:add"?e.jsx(ee,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Ka,{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(u=>{const g=m===`repo:${u.owner}/${u.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:[u.owner,"/",u.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:u.branch})]}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",disabled:g,onClick:()=>x(u),className:"shrink-0",children:[g?e.jsx(ee,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ua,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:r("skills.repo.remove")})]})]},`${u.owner}/${u.name}`)})}):null]})}function $r(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function ts(){const[a,s]=n.useState($r),[l,m]=n.useState({skills:[],targets:[]}),[c,x]=n.useState([]),[u,g]=n.useState([]),[h,b]=n.useState([]),[o,k]=n.useState(xe),[N,w]=n.useState(""),[v,y]=n.useState(""),[S,E]=n.useState(""),[U,W]=n.useState(""),[F,ge]=n.useState(""),[j,ae]=n.useState(!1),[$,K]=n.useState("all"),[Q,te]=n.useState(null),[A,ke]=n.useState(""),[we,Ue]=n.useState(!0),[Le,Fe]=n.useState(!1),[Ae,D]=n.useState(""),[re,X]=n.useState(null),[ve,L]=n.useState(null),[V,se]=n.useState(()=>new Set),[I,ie]=n.useState({}),[P,Pe]=n.useState({}),[je,ne]=n.useState([]),[pe,Re]=n.useState(!1),Ie=n.useRef(!1),Ee=n.useMemo(()=>{const t=new Set;for(const i of l.skills||[])for(const d of Sa(i))t.add(d);return t},[l.skills]),Ne=n.useCallback(async()=>{const t=await Ot();m({skills:t.skills||[],targets:t.targets||[]})},[]),q=n.useCallback(async()=>{const t=await Ut();b(t.repos||[])},[]),oe=n.useCallback(async({force:t=!1}={})=>{Fe(!0);try{const i=await Ft({force:t});x(i.skills||[])}finally{Fe(!1)}},[]),fe=n.useCallback(async({force:t=!1}={})=>{Re(!0);try{const i=await At({force:t});ne(i.skills||[])}finally{Re(!1)}},[]),le=n.useCallback(async()=>{try{const t=await zt();ie(t?.updates||{})}catch{ie({})}},[]),de=n.useCallback(async()=>{try{const t=await Kt(),i={};for(const d of t?.skills||[])d.installed&&(d.directory&&(i[String(d.directory).toLowerCase()]=d),i[String(d.skill).toLowerCase()]=d);Pe(i)}catch{Pe({})}},[]),he=n.useCallback(async()=>{Ue(!0),D("");try{await Promise.all([Ne(),q()])}catch(t){D(t?.message||r("skills.error.generic"))}finally{Ue(!1)}},[Ne,q]),Je=n.useCallback(async()=>{await he();const t=i=>D(i?.message||r("skills.error.generic"));a==="my"?(le(),de()):o===O?fe({force:!0}).catch(t):o!==T&&oe({force:!0}).catch(t)},[oe,he,fe,le,de,o,a]);n.useEffect(()=>{he()},[he]),n.useEffect(()=>{if(Ie.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("skill");if(!i){Ie.current=!0;return}const d=l.skills||[];if(!d.length)return;const p=d.find(C=>C.directory===i||C.id===i);p&&(s("my"),te(p.id||p.directory)),Ie.current=!0,t.delete("skill");const R=t.toString();window.history.replaceState({},"",`${window.location.pathname}${R?`?${R}`:""}${window.location.hash}`)},[l.skills]),n.useEffect(()=>{a==="browse"&&(o===T||o===O||c.length===0&&oe().catch(t=>D(t?.message||r("skills.error.generic"))))},[c.length,oe,o,a]),n.useEffect(()=>{a!=="browse"||o!==O||je.length===0&&fe().catch(t=>D(t?.message||r("skills.error.generic")))},[fe,je.length,o,a]);const ze=Object.keys(I).length>0,ce=Object.keys(P).length>0;if(n.useEffect(()=>{a==="my"&&(ze||le(),ce||de())},[a,ze,ce,le,de]),n.useEffect(()=>{const t=setTimeout(()=>y(N),200);return()=>clearTimeout(t)},[N]),n.useEffect(()=>{const t=setTimeout(()=>W(S),120);return()=>clearTimeout(t)},[S]),n.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("tab");if(a==="my"){if(!i)return;t.delete("tab")}else{if(i===a)return;t.set("tab",a)}const d=t.toString(),p=`${window.location.pathname}${d?`?${d}`:""}${window.location.hash}`;window.history.replaceState({},"",p)},[a]),!kr&&!kt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(jt,{})});const _=async(t,i)=>{ke(t),D("");try{await i(),await Ne()}catch(d){D(d?.message||r("skills.error.generic"))}finally{ke("")}},Ye=(t,i)=>{const d=(i&&i.length?i:sa).filter(p=>(l.targets||[]).some(R=>R.id===p));_(He(t),async()=>{await ya(t,d);const p=d.map(R=>(l.targets||[]).find(C=>C.id===R)?.label||R).join(", ");Se({title:r("skills.toast.installed",{name:t.name||t.directory,targets:p||r("skills.target.none")}),timeout:4e3})})},$e=t=>{X(t)},ye=()=>{const t=re;t&&(X(null),_(Ca(t),async()=>{let i=null;t.managed?i=await ba(t.id):await ka(t.directory,t.targets||[]);const d=!!(i?.trashed&&t.managed&&t.id);Se({title:r("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:d?{onUndo:async()=>{try{await qt(t.id),await Ne()}catch(p){D(p?.message||r("skills.error.generic"))}}}:void 0})}))},J=(t,i,d)=>_(Xa(t.id,i),async()=>{const p=new Set(t.targets||[]);d?p.add(i):p.delete(i),t.managed?await wa(t.id,Array.from(p)):await va(t.directory,Array.from(p));const R={name:t.name||t.directory,agent:Ke(i)};Se({title:d?r("skills.toast.synced_one",R):r("skills.toast.unsynced_one",R),timeout:3e3})}),Be=n.useCallback(()=>se(new Set),[]),Ze=n.useCallback((t,i)=>{se(d=>{const p=new Set(d);return i?p.add(t.id):p.delete(t.id),p})},[]),Ke=t=>(l.targets||[]).find(i=>i.id===t)?.label||t,Te=t=>{const i=(l.skills||[]).filter(d=>V.has(d.id));i.length&&_("batch",async()=>{for(const d of i){const p=new Set(d.targets||[]);p.add(t),d.managed?await wa(d.id,Array.from(p)):await va(d.directory,Array.from(p))}Be(),Se({title:r("skills.toast.bulk_synced",{count:i.length,agent:Ke(t)}),timeout:4e3})})},ea=()=>{const t=(l.skills||[]).filter(i=>V.has(i.id));t.length&&L(t)},aa=()=>{const t=ve;t&&(L(null),_("batch",async()=>{for(const i of t)i.managed?await ba(i.id):await ka(i.directory,i.targets||[]);Be(),Se({title:r("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},f=t=>{!t?.repoOwner||!t?.repoName||_(He(t),async()=>{await ya({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:sa),await le(),Se({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},M=async()=>{const t=N.trim();if(!(t.length<2)){ke("search"),D("");try{const i=await Vt(t);g(i.skills||[])}catch(i){D(i?.message||r("skills.error.generic"))}finally{ke("")}}},ue=async()=>{const t=F.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[i,d]=t.split("/");if(!i||!d){D(r("skills.repo.invalid"));return}await _("repo:add",async()=>{await Gt({owner:i,name:d,branch:"main",enabled:!0}),ge(""),await q(),await oe()})},me=async t=>{await _(`repo:${t.owner}/${t.name}`,async()=>{await Ht(t.owner,t.name),await q(),await oe()})},B=l.targets||[],H=l.skills||[],De=n.useMemo(()=>{const t=$==="all"?H:H.filter(d=>(d.targets||[]).includes($)),i=U.trim().toLowerCase();return i?t.filter(d=>(d.name||"").toLowerCase().includes(i)||(d.directory||"").toLowerCase().includes(i)||(d.description||"").toLowerCase().includes(i)):t},[H,$,U]),Ja=$!=="all",Y=n.useMemo(()=>Q&&H.find(t=>(t.id||t.directory)===Q)||null,[H,Q]),Ya=n.useCallback(()=>{K("all"),E("")},[]),Za=n.useCallback(t=>{te(i=>{const d=t?.id||t?.directory||null;return i===d?null:d})},[]),et=n.useCallback(()=>te(null),[]),at=n.useCallback(t=>{const i=Xe(t).toLowerCase(),d=Na(t),p=(l.skills||[]).find(R=>{const C=Sa(R);return C.has(i)||d&&C.has(d)});p&&te(p.id||p.directory)},[l.skills]);n.useEffect(()=>{a!=="my"&&V.size&&se(new Set)},[a,V.size]),n.useEffect(()=>{Q&&!Y&&te(null)},[Y,Q]);const Me=n.useMemo(()=>{const t=o===T?u:o===O?je:c,d=o===T||o===O||o===xe?t:t.filter(C=>`${C.repoOwner}/${C.repoName}`===o),p=v.trim().toLowerCase();return(o===T||!p?d:d.filter(C=>(C.name||"").toLowerCase().includes(p)||(C.directory||"").toLowerCase().includes(p)||(C.description||"").toLowerCase().includes(p))).map(C=>{const ta=Xe(C).toLowerCase(),z=Na(C);return{...C,installed:Ee.has(ta)||z&&Ee.has(z)}})},[v,c,Ee,je,u,o]),tt=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(ee,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),rt=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(ee,{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")})]}),Ve=(t,i=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)}),i]});let qe;if(we)qe=tt;else if(a==="my")qe=H.length?e.jsx(Pr,{items:De,totalCount:H.length,targets:B,agentOptions:B,agentFilter:$,onAgentFilter:K,anyFilter:Ja,onClearFilters:Ya,searchQuery:S,onSearchQuery:E,searchPlaceholder:r("skills.my.placeholder"),selectedId:Q,onSelect:Za,onToggleTarget:J,busyKey:A,updates:I,selectedIds:V,onToggleSelect:Ze,onClearSelection:Be,onBulkSync:Te,onBulkRemove:ea}):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:[B.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:[...B,...B].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(be,{provider:t.id,size:30})},`b-${i}`))})}),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:[...B,...B].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(be,{provider:t.id,size:30})},`c-${i}`))})}),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(G,{type:"button",size:"sm",onClick:()=>s("browse"),children:r("skills.empty.my_cta")})]});else{const t=o===T,i=o===O,d=h.length===0&&!t&&!i,p=Le&&!t&&!i||i&&pe,R=!t&&!i&&(v.trim()!==""||o!==xe),C=()=>{w(""),k(xe)},ta=!d&&!p&&(Me.length>0||R)?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:Me.length})}),R?e.jsxs("button",{type:"button",onClick:C,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Ce,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]}):null;let z;d?z=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")})}):p?z=rt:t&&N.trim().length<2?z=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")}):Me.length?z=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Me.map(Oe=>e.jsx("div",{style:Rr,children:e.jsx(Ir,{skill:Oe,installed:!!Oe.installed,installing:A===He(Oe),allTargets:B,defaultTargets:sa,onInstall:Ye,onManage:at})},Oe.id||Oe.key))}):R?z=Ve("skills.empty.no_match",e.jsx(G,{type:"button",variant:"secondary",size:"sm",onClick:C,children:r("skills.filter.clear")})):t?z=Ve("skills.empty.search"):i?z=Ve("skills.empty.popular"):z=Ve("skills.empty.browse");const st=d||j?e.jsx("div",{className:"mb-5",children:e.jsx(Er,{repos:h,repoInput:F,onRepoInput:ge,busyKey:A,onAdd:ue,onRemove:me})}):null,it=!j&&!t&&!i&&h.length<=1&&Me.length>0?e.jsx(ar,{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:()=>ae(!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;qe=e.jsxs(e.Fragment,{children:[st,ta,z,it]})}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(G,{type:"button",variant:"secondary",size:"sm",onClick:Je,disabled:we||Le||pe,children:[e.jsx(wt,{className:Z("mr-1.5 h-3.5 w-3.5",(we||Le||pe)&&"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,i])=>e.jsx("button",{type:"button","aria-pressed":a===t,onClick:()=>s(t),className:Z("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",a===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:i},t))}),Ae?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:Ae}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("div",{role:"tablist","aria-label":r("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",r("skills.mode.repo"),o!==T&&o!==O],["popular",r("skills.mode.popular"),o===O],["skillssh",r("skills.mode.skillssh"),o===T]].map(([t,i,d])=>e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>{t==="skillssh"?k(T):t==="popular"?k(O):(o===T||o===O)&&k(xe)},className:Z("inline-flex items-center gap-1.5 rounded px-3 py-1 text-sm font-medium transition-colors",d?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:[t==="popular"?e.jsx(Wt,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,i]},t))}),o!==T&&o!==O?e.jsxs(Ra,{value:o,onValueChange:k,children:[e.jsxs(Ia,{"aria-label":r("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Ea,{children:t=>t===xe?r("skills.source.all"):t}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ma,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsx($a,{children:e.jsx(Ba,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Ta,{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(Ge,{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(We,{children:r("skills.source.all")}),e.jsx(Qe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),h.map(t=>{const i=`${t.owner}/${t.name}`;return e.jsxs(Ge,{value:i,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(We,{children:i}),e.jsx(Qe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},i)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(oa,{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(ga,{type:"search",value:N,onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Enter"&&o===T&&M()},"aria-label":r("skills.action.search_aria"),placeholder:o===T?r("skills.browse.placeholder_skillssh"):o===O?r("skills.browse.placeholder_popular"):o===xe?r("skills.browse.placeholder_all"):r("skills.browse.placeholder_repo",{repo:o}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),o===T?e.jsxs(G,{type:"button",onClick:M,disabled:N.trim().length<2||A==="search",className:"focus:!ring-oai-gray-400/30",children:[A==="search"?e.jsx(ee,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(oa,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):o===O?null:e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:()=>ae(t=>!t),"aria-expanded":j,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(Ka,{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:h.length})]})]}):null,qe,e.jsx(yr,{skill:Y,targets:B,busyKey:A,usage:Y&&(P[String(Y.directory||"").toLowerCase()]||P[String(Y.name||"").toLowerCase()])||null,hasUpdate:!!(Y?.id&&I?.[Y.id]),updating:Y?A===He(Y):!1,onUpdate:f,onClose:et,onToggleTarget:J,onRemove:$e})]})}),e.jsx(pa,{open:!!re,title:r("skills.confirm.remove_title",{name:re?.name||re?.directory||""}),description:re?re.managed?r("skills.confirm.remove_managed"):r("skills.confirm.remove_local"):"",confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:A===Ca(re||{}),onCancel:()=>X(null),onConfirm:ye}),e.jsx(pa,{open:!!ve,title:r("skills.confirm.bulk_remove_title",{count:ve?.length||0}),description:r("skills.confirm.bulk_remove_desc"),confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:A==="batch",onCancel:()=>L(null),onConfirm:aa})]})}export{ts as SkillsPage};