tokentracker-cli 0.40.0 → 0.42.0

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 (118) hide show
  1. package/README.ja.md +2 -1
  2. package/README.ko.md +2 -1
  3. package/README.md +1 -0
  4. package/README.zh-CN.md +2 -1
  5. package/dashboard/dist/assets/{ActivityHeatmap-D0gkN1RW.js → ActivityHeatmap-CImSj13A.js} +1 -1
  6. package/dashboard/dist/assets/{Card-DgaNailB.js → Card-DpjFlMHF.js} +1 -1
  7. package/dashboard/dist/assets/DashboardPage-CZkSRYE8.js +19 -0
  8. package/dashboard/dist/assets/{DevicePage-WxD3UOS4.js → DevicePage-BIBlmBPl.js} +1 -1
  9. package/dashboard/dist/assets/DialogTitle-BMKzpys0.js +1 -0
  10. package/dashboard/dist/assets/{FadeIn-CIowr92k.js → FadeIn-B5-cy4YN.js} +1 -1
  11. package/dashboard/dist/assets/{HeaderGithubStar-BG7mHinn.js → HeaderGithubStar-BM-sbvJG.js} +1 -1
  12. package/dashboard/dist/assets/{IpCheckPage-BEf8N-sD.js → IpCheckPage-C7-NXbFK.js} +4 -4
  13. package/dashboard/dist/assets/LandingPage-ouOFlABY.js +4411 -0
  14. package/dashboard/dist/assets/{LeaderboardAvatar-tq8LphKG.js → LeaderboardAvatar-DMXPtCkx.js} +1 -1
  15. package/dashboard/dist/assets/{LeaderboardPage-DeeyHMbP.js → LeaderboardPage-CC4CFYAe.js} +3 -3
  16. package/dashboard/dist/assets/{LeaderboardProfileModal-Dj5nnKZq.js → LeaderboardProfileModal-D-ncIr24.js} +2 -2
  17. package/dashboard/dist/assets/LeaderboardProfilePage-DtDMfVuQ.js +421 -0
  18. package/dashboard/dist/assets/LimitsPage-qaD7Reti.js +2 -0
  19. package/dashboard/dist/assets/{LocalOnlyNotice-DDvq44QO.js → LocalOnlyNotice-BCy18fW4.js} +1 -1
  20. package/dashboard/dist/assets/{LoginPage-BaOQo7cY.js → LoginPage-BLPY2ZI-.js} +1 -1
  21. package/dashboard/dist/assets/PopoverPopup-CpIlpO0j.js +1 -0
  22. package/dashboard/dist/assets/Select-BOxMknxo.js +1 -0
  23. package/dashboard/dist/assets/SelectItemText-B0SL3Wb5.js +1 -0
  24. package/dashboard/dist/assets/SettingsPage-De7GbtPf.js +1 -0
  25. package/dashboard/dist/assets/SkillsPage-jpoYzUBQ.js +1 -0
  26. package/dashboard/dist/assets/WidgetsPage-BaEYiZZH.js +1 -0
  27. package/dashboard/dist/assets/{WrappedPage-DHiRPuq6.js → WrappedPage-BYhKuiTb.js} +1 -1
  28. package/dashboard/dist/assets/agent-logos-DSQgCNll.js +1 -0
  29. package/dashboard/dist/assets/{arrow-up-right-CEarB9tV.js → arrow-up-right-Brwh94cN.js} +1 -1
  30. package/dashboard/dist/assets/{download-Bh0gjfze.js → download-kFiot71R.js} +1 -1
  31. package/dashboard/dist/assets/geist-mono-cyrillic-400-normal-CeA7eGSt.woff +0 -0
  32. package/dashboard/dist/assets/geist-mono-cyrillic-400-normal-DoshcOXv.woff2 +0 -0
  33. package/dashboard/dist/assets/geist-mono-cyrillic-500-normal-BgLpzsdg.woff +0 -0
  34. package/dashboard/dist/assets/geist-mono-cyrillic-500-normal-BkE2O7RC.woff2 +0 -0
  35. package/dashboard/dist/assets/geist-mono-cyrillic-700-normal-4t7P5rT3.woff2 +0 -0
  36. package/dashboard/dist/assets/geist-mono-cyrillic-700-normal-DpJKySxv.woff +0 -0
  37. package/dashboard/dist/assets/geist-mono-cyrillic-900-normal-CVPizhN4.woff2 +0 -0
  38. package/dashboard/dist/assets/geist-mono-cyrillic-900-normal-DDpyx8f0.woff +0 -0
  39. package/dashboard/dist/assets/geist-mono-latin-400-normal-BXAprPdR.woff +0 -0
  40. package/dashboard/dist/assets/geist-mono-latin-400-normal-DKaoCDn5.woff2 +0 -0
  41. package/dashboard/dist/assets/geist-mono-latin-500-normal-C3sF8Y1B.woff2 +0 -0
  42. package/dashboard/dist/assets/geist-mono-latin-500-normal-YfPbDI_o.woff +0 -0
  43. package/dashboard/dist/assets/geist-mono-latin-700-normal-CzSaXH83.woff +0 -0
  44. package/dashboard/dist/assets/geist-mono-latin-700-normal-DMoeyBRY.woff2 +0 -0
  45. package/dashboard/dist/assets/geist-mono-latin-900-normal-DAGlevET.woff +0 -0
  46. package/dashboard/dist/assets/geist-mono-latin-900-normal-DVg4HgZN.woff2 +0 -0
  47. package/dashboard/dist/assets/geist-mono-latin-ext-400-normal-C1xxG8eb.woff2 +0 -0
  48. package/dashboard/dist/assets/geist-mono-latin-ext-400-normal-a1APXIwD.woff +0 -0
  49. package/dashboard/dist/assets/geist-mono-latin-ext-500-normal-CDyCFkgU.woff2 +0 -0
  50. package/dashboard/dist/assets/geist-mono-latin-ext-500-normal-CzSM7th5.woff +0 -0
  51. package/dashboard/dist/assets/geist-mono-latin-ext-700-normal-BG1muzu_.woff2 +0 -0
  52. package/dashboard/dist/assets/geist-mono-latin-ext-700-normal-BmQm3zK6.woff +0 -0
  53. package/dashboard/dist/assets/geist-mono-latin-ext-900-normal-DvYIGD1f.woff2 +0 -0
  54. package/dashboard/dist/assets/geist-mono-latin-ext-900-normal-LB8u5xx5.woff +0 -0
  55. package/dashboard/dist/assets/geist-mono-symbols2-400-normal-B5fXMCGq.woff +0 -0
  56. package/dashboard/dist/assets/geist-mono-symbols2-500-normal-BYvOiszX.woff +0 -0
  57. package/dashboard/dist/assets/geist-mono-symbols2-700-normal-nLp0AmIG.woff +0 -0
  58. package/dashboard/dist/assets/geist-mono-symbols2-900-normal-DPuoOkkO.woff +0 -0
  59. package/dashboard/dist/assets/geist-mono-vietnamese-400-normal-CyOwoevh.woff +0 -0
  60. package/dashboard/dist/assets/geist-mono-vietnamese-500-normal-Do_laDd2.woff +0 -0
  61. package/dashboard/dist/assets/geist-mono-vietnamese-700-normal-DKtT8o3X.woff +0 -0
  62. package/dashboard/dist/assets/geist-mono-vietnamese-900-normal-BAZIExb_.woff +0 -0
  63. package/dashboard/dist/assets/{info-BVM2oiQP.js → info-CGx4zWQF.js} +1 -1
  64. package/dashboard/dist/assets/main-9Ze1SUIZ.js +995 -0
  65. package/dashboard/dist/assets/main-DMJJVAOH.css +1 -0
  66. package/dashboard/dist/assets/use-limits-display-prefs-Ehri95OP.js +1 -0
  67. package/dashboard/dist/assets/{use-native-settings-BoIA6w2j.js → use-native-settings-BWqG5RDr.js} +1 -1
  68. package/dashboard/dist/assets/{use-usage-limits-Co8ywhqF.js → use-usage-limits-2ZxmPfoP.js} +1 -1
  69. package/dashboard/dist/assets/{useCurrency-CuLnDPms.js → useCurrency-DQmyhw3i.js} +1 -1
  70. package/dashboard/dist/assets/useScrollLock-BcLeWqWK.js +1 -0
  71. package/dashboard/dist/index.html +2 -2
  72. package/dashboard/dist/share.html +2 -2
  73. package/package.json +3 -3
  74. package/src/lib/grok-limits.js +184 -0
  75. package/src/lib/local-api.js +63 -0
  76. package/src/lib/pricing/seed-snapshot.json +1 -1
  77. package/src/lib/rollout.js +47 -29
  78. package/src/lib/usage-limits.js +6 -1
  79. package/dashboard/dist/assets/DashboardPage-CV_vq3RD.js +0 -19
  80. package/dashboard/dist/assets/DialogTitle-HpCbbWQz.js +0 -1
  81. package/dashboard/dist/assets/LandingPage-DWhpEISl.js +0 -4356
  82. package/dashboard/dist/assets/LeaderboardProfilePage-BMJyZxKC.js +0 -1
  83. package/dashboard/dist/assets/LimitsPage-DV6egWEj.js +0 -2
  84. package/dashboard/dist/assets/PopoverPopup-BhquCaxW.js +0 -1
  85. package/dashboard/dist/assets/Select-BBsxYIty.js +0 -1
  86. package/dashboard/dist/assets/SelectItemText-DV94Rvfw.js +0 -1
  87. package/dashboard/dist/assets/SettingsPage-D6kfA65g.js +0 -1
  88. package/dashboard/dist/assets/SkillsPage-BxzsmE10.js +0 -1
  89. package/dashboard/dist/assets/WidgetsPage-CtYs9AGI.js +0 -1
  90. package/dashboard/dist/assets/agent-logos-CKVvzLb1.js +0 -1
  91. package/dashboard/dist/assets/geist-mono-cyrillic-400-normal-BPBWmzPh.woff +0 -0
  92. package/dashboard/dist/assets/geist-mono-cyrillic-400-normal-Ce5q_31Z.woff2 +0 -0
  93. package/dashboard/dist/assets/geist-mono-cyrillic-500-normal-CJBLNVQT.woff2 +0 -0
  94. package/dashboard/dist/assets/geist-mono-cyrillic-500-normal-mNhfPmgl.woff +0 -0
  95. package/dashboard/dist/assets/geist-mono-cyrillic-700-normal-DH5Q319x.woff +0 -0
  96. package/dashboard/dist/assets/geist-mono-cyrillic-700-normal-VCNRadI3.woff2 +0 -0
  97. package/dashboard/dist/assets/geist-mono-cyrillic-900-normal-BKC3PZkM.woff +0 -0
  98. package/dashboard/dist/assets/geist-mono-cyrillic-900-normal-DdrQ8KBw.woff2 +0 -0
  99. package/dashboard/dist/assets/geist-mono-latin-400-normal-CoULgQGM.woff +0 -0
  100. package/dashboard/dist/assets/geist-mono-latin-400-normal-LC9RFr9I.woff2 +0 -0
  101. package/dashboard/dist/assets/geist-mono-latin-500-normal-D3o2eNa9.woff2 +0 -0
  102. package/dashboard/dist/assets/geist-mono-latin-500-normal-DOxI7kZ4.woff +0 -0
  103. package/dashboard/dist/assets/geist-mono-latin-700-normal-D6izGJRP.woff2 +0 -0
  104. package/dashboard/dist/assets/geist-mono-latin-700-normal-QGw08Lff.woff +0 -0
  105. package/dashboard/dist/assets/geist-mono-latin-900-normal-CmoKXrdK.woff +0 -0
  106. package/dashboard/dist/assets/geist-mono-latin-900-normal-Cu5MFKsu.woff2 +0 -0
  107. package/dashboard/dist/assets/geist-mono-latin-ext-400-normal-Cgks_Qgx.woff2 +0 -0
  108. package/dashboard/dist/assets/geist-mono-latin-ext-400-normal-CxNRRMGd.woff +0 -0
  109. package/dashboard/dist/assets/geist-mono-latin-ext-500-normal-CQcGuCNt.woff2 +0 -0
  110. package/dashboard/dist/assets/geist-mono-latin-ext-500-normal-diTenJ8L.woff +0 -0
  111. package/dashboard/dist/assets/geist-mono-latin-ext-700-normal-BX9f1BHp.woff +0 -0
  112. package/dashboard/dist/assets/geist-mono-latin-ext-700-normal-YOllDaLV.woff2 +0 -0
  113. package/dashboard/dist/assets/geist-mono-latin-ext-900-normal-Br6WNUGb.woff +0 -0
  114. package/dashboard/dist/assets/geist-mono-latin-ext-900-normal-CrmBTzU2.woff2 +0 -0
  115. package/dashboard/dist/assets/main-BMyBoVLI.css +0 -1
  116. package/dashboard/dist/assets/main-CPiNtuB_.js +0 -971
  117. package/dashboard/dist/assets/use-limits-display-prefs-kAa9p8ua.js +0 -1
  118. package/dashboard/dist/assets/useOpenInteractionType-CAJUA73r.js +0 -12
@@ -0,0 +1 @@
1
+ import{c as we,bx as ge,b5 as Ue,by as Ke,bz as le,bA as We,bB as ne,b3 as me,r as m,bC as J,bD as he,bE as Ee,bF as oe,bG as be,bH as qe,bI as Le,bJ as $,b as z,bK as W,ar as ue,b4 as pe,bL as $e,bM as Te,bN as Qe,d as ze,bO as Je,bP as ve,bQ as q,j as Y,bR as Ze,b9 as Me,b8 as et,bS as tt,bT as nt,bU as ot,bV as st,u as rt,a as He,bW as it,bX as ye,bY as at,bZ as ct,b_ as lt,b$ as ut,be as ft,c0 as dt,bf as pt}from"./main-9Ze1SUIZ.js";import{b as Ae,c as Be,g as Ce,d as se,P as gt,e as mt,s as ht,F as Et,f as Tt,h as vt,i as Ct,j as Pt,k as bt,l as _e,m as Rt,u as St,n as Ot,p as It,t as Mt,o as yt,I as xt,q as Ft,r as kt,v as wt,w as Lt}from"./useScrollLock-BcLeWqWK.js";import{f as Ht,p as At,g as Bt}from"./DialogTitle-BMKzpys0.js";import{p as _t,q as Dt,r as Nt,t as jt,v as Yt,w as Vt,x as Gt,y as Xt}from"./SelectItemText-B0SL3Wb5.js";const Ut=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],En=we("chevron-right",Ut);const Kt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tn=we("loader-circle",Kt);function Wt(e,n){return n!=null&&!ge(n)?0:typeof e=="function"?e():e}function Pe(e,n,t){const c=Wt(e,t);return typeof c=="number"?c:c?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function qt(e){return e?.includes("mouse")&&e!=="mousedown"}class Re{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Re}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ne(e,n){const{scopeElement:t,referenceElement:c,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=c,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",c.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function $t(e,n={}){const{enabled:t=!0,closeDelay:c=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),S=o.useState("domReferenceElement"),{dataRef:f}=o.context,r=Ae(),O=Be(),h=je(o),j=We(),l=ne(()=>De(f.current.openEvent?.type,h.interactedInside)),N=ne(()=>qt(f.current.openEvent?.type)),g=ne(()=>{de(h)});me(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),me(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&N()&&J(S)&&E){const F=S,a=E,d=he(E),k=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;k&&(k.style.pointerEvents="");const A=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,T=k!==a?k:null,P=h.handleCloseOptions?.getScope?.()??A??T??F.closest("[data-rootownerid]")??d.body;return Ne(h,{scopeElement:P,referenceElement:F,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,N,r,O,g]),m.useEffect(()=>{if(!t)return;function F(){return!!(r&&O&&Ce(r.nodesRef.current,O).length>0)}function a(b){const M=Pe(c,"close",h.pointerType),_=()=>{o.setOpen(!1,z(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,_):(h.openChangeTimeout.clear(),_())}function d(b){const M=be(b);if(!qe(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function k(){h.openChangeTimeout.clear(),j.clear(),r?.events.off("floating.closed",T),g()}function A(b){if(F()&&r){r.events.on("floating.closed",T);return}if(Le(b.relatedTarget,o.context.triggerElements))return;const M=f.current.floatingContext?.nodeId??i,_=b.relatedTarget;if(!(r&&M&&J(_)&&Ce(r.nodesRef.current,M,!1).some(X=>$(X.context?.elements.floating,_)))){if(h.handler){h.handler(b);return}g(),l()||a(b)}}function T(b){!r||!O||F()||j.start(0,()=>{r.events.off("floating.closed",T),o.setOpen(!1,z(W,b)),r.events.emit("floating.closed",b)})}const P=E;return Ee(P&&oe(P,"mouseenter",k),P&&oe(P,"mouseleave",A),P&&oe(P,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",T)})},[t,E,o,f,c,i,l,g,h,r,O,j])}const Qt={current:null};function zt(e,n={}){const{enabled:t=!0,delay:c=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=Qt,externalTree:f,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:j}=n,l="rootStore"in e?e.rootStore:e,{dataRef:N,events:g}=l.context,F=Ae(f),a=je(l),d=m.useRef(!1),k=se(i),A=se(c),T=se(p),P=se(t),b=se(j),M=se(h),_=ne(()=>De(N.current.openEvent?.type,a.interactedInside)),G=ne(()=>b.current?.()!==!1),X=ne((s,v,H)=>{const R=l.context.triggerElements;if(R.hasElement(v))return!s||!$(s,v);if(!J(H))return!1;const u=H;return R.hasMatchingElement(B=>$(B,u))&&(!s||!$(s,u))}),D=ne(()=>{if(!a.handler)return;he(l.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),L=ne(()=>{de(a)});return r&&(a.handleCloseOptions=k.current?.__options),m.useEffect(()=>D,[D]),m.useEffect(()=>{if(!t)return;function s(v){v.open?d.current=!1:(d.current=v.reason===W,D(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,D]),m.useEffect(()=>{if(!t)return;function s(u,B=!0){const y=Pe(A.current,"close",a.pointerType);y?a.openChangeTimeout.start(y,()=>{l.setOpen(!1,z(W,u)),F?.events.emit("floating.closed",u)}):B&&(a.openChangeTimeout.clear(),l.setOpen(!1,z(W,u)),F?.events.emit("floating.closed",u))}const v=S.current??(r?l.select("domReferenceElement"):null);if(!J(v))return;function H(u){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!ge(a.pointerType))return;const B=xe(T.current),y=Pe(A.current,"open",a.pointerType),V=be(u),U=u.currentTarget??null,I=l.select("domReferenceElement");let w=U;if(J(V)&&!l.context.triggerElements.hasElement(V)){for(const Ie of l.context.triggerElements.elements())if($(Ie,V)){w=Ie;break}}J(U)&&J(I)&&!l.context.triggerElements.hasElement(U)&&$(U,I)&&(w=I);const C=w==null?!1:X(I,w,V),Q=l.select("open"),Z=M.current?.()??l.select("transitionStatus")==="ending",K=!Q&&Z&&d.current,ee=!C&&J(w)&&J(I)&&$(I,w)&&K,te=B>0&&!y,Xe=C&&(Q||K)||ee,Oe=!Q||C;if(Xe){G()&&l.setOpen(!0,z(W,u,w));return}te||(y?a.openChangeTimeout.start(y,()=>{Oe&&G()&&l.setOpen(!0,z(W,u,w))}):Oe&&G()&&l.setOpen(!0,z(W,u,w)))}function R(u){if(_()){L();return}D();const B=l.select("domReferenceElement"),y=he(B);a.restTimeout.clear(),a.restTimeoutPending=!1;const V=N.current.floatingContext??O?.();if(Le(u.relatedTarget,l.context.triggerElements))return;if(k.current&&V){l.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=k.current({...V,tree:F,x:u.clientX,y:u.clientY,onClose(){L(),D(),P.current&&!_()&&I===l.select("domReferenceElement")&&s(u,!0)}}),y.addEventListener("mousemove",a.handler),a.handler(u);return}(a.pointerType!=="touch"||!$(l.select("floatingElement"),u.relatedTarget))&&s(u)}return E?Ee(oe(v,"mousemove",H,{once:!0}),oe(v,"mouseenter",H),oe(v,"mouseleave",R)):Ee(oe(v,"mouseenter",H),oe(v,"mouseleave",R))},[D,L,N,A,l,t,k,a,r,X,_,o,E,T,S,F,P,O,M,G]),m.useMemo(()=>{if(!t)return;function s(v){a.pointerType=v.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(v){const{nativeEvent:H}=v,R=v.currentTarget,u=l.select("domReferenceElement"),B=l.select("open"),y=X(u,R,v.target);if(o&&!ge(a.pointerType))return;if(B&&y&&a.handleCloseOptions?.blockPointerEvents){const I=l.select("floatingElement");if(I){const w=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;Ne(a,{scopeElement:w,referenceElement:R,floatingElement:I})}}const V=xe(T.current);if(B&&!y||V===0||!y&&a.restTimeoutPending&&v.movementX**2+v.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,_())return;const I=l.select("open");!a.blockMouseMove&&(!I||y)&&G()&&l.setOpen(!0,z(W,H,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):y&&B?U():(a.restTimeoutPending=!0,a.restTimeout.start(V,U))}}},[t,a,_,X,o,l,T,G])}const Fe=.1,Jt=Fe*Fe,x=.5;function ie(e,n,t,c,i,o){return c>=n!=o>=n&&e<=(i-t)*(n-c)/(o-c)+t}function ae(e,n,t,c,i,o,p,E,S,f){let r=!1;return ie(e,n,t,c,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,S,f)&&(r=!r),ie(e,n,S,f,t,c)&&(r=!r),r}function Zt(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,c,i,o){const p=Math.min(t,i),E=Math.max(t,i),S=Math.min(c,o),f=Math.max(c,o);return e>=p&&e<=E&&n>=S&&n<=f}function en(e={}){const{blockPointerEvents:n=!1}=e,t=new le,c=({x:i,y:o,placement:p,elements:E,onClose:S,nodeId:f,tree:r})=>{const O=p?.split("-")[0];let h=!1,j=null,l=null,N=typeof performance<"u"?performance.now():0;function g(a,d){const k=performance.now(),A=k-N;if(j===null||l===null||A===0)return j=a,l=d,N=k,!1;const T=a-j,P=d-l,b=T*T+P*P,M=A*A*Jt;return j=a,l=d,N=k,b<M}function F(){t.clear(),S()}return function(d){t.clear();const k=E.domReference,A=E.floating;if(!k||!A||O==null||i==null||o==null)return;const{clientX:T,clientY:P}=d,b=be(d),M=d.type==="mouseleave",_=$(A,b),G=$(k,b);if(_&&(h=!0,!M))return;if(G&&(h=!1,!M)){h=!0;return}if(M&&J(d.relatedTarget)&&$(A,d.relatedTarget))return;function X(){return!!(r&&Ce(r.nodesRef.current,f).length>0)}function D(){X()||F()}if(X())return;const L=k.getBoundingClientRect(),s=A.getBoundingClientRect(),v=i>s.right-s.width/2,H=o>s.bottom-s.height/2,R=s.width>L.width,u=s.height>L.height,B=(R?L:s).left,y=(R?L:s).right,V=(u?L:s).top,U=(u?L:s).bottom;if(O==="top"&&o>=L.bottom-1||O==="bottom"&&o<=L.top+1||O==="left"&&i>=L.right-1||O==="right"&&i<=L.left+1){D();return}let I=!1;switch(O){case"top":I=ce(T,P,B,L.top+1,y,s.bottom-1);break;case"bottom":I=ce(T,P,B,s.top+1,y,L.bottom-1);break;case"left":I=ce(T,P,s.right-1,U,L.left+1,V);break;case"right":I=ce(T,P,L.right-1,U,s.left+1,V);break}if(I)return;if(h&&!Zt(T,P,L)){D();return}if(!M&&g(T,P)){D();return}let w=!1;switch(O){case"top":{const C=R?x/2:x*4,Q=R||v?i+C:i-C,Z=R?i-C:v?i+C:i-C,K=o+x+1,ee=v||R?s.bottom-x:s.top,te=v?R?s.bottom-x:s.top:s.bottom-x;w=ae(T,P,Q,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const C=R?x/2:x*4,Q=R||v?i+C:i-C,Z=R?i-C:v?i+C:i-C,K=o-x,ee=v||R?s.top+x:s.bottom,te=v?R?s.top+x:s.bottom:s.top+x;w=ae(T,P,Q,K,Z,K,s.left,ee,s.right,te);break}case"left":{const C=u?x/2:x*4,Q=u||H?o+C:o-C,Z=u?o-C:H?o+C:o-C,K=i+x+1,ee=H||u?s.right-x:s.left,te=H?u?s.right-x:s.left:s.right-x;w=ae(T,P,ee,s.top,te,s.bottom,K,Q,K,Z);break}case"right":{const C=u?x/2:x*4,Q=u||H?o+C:o-C,Z=u?o-C:H?o+C:o-C,K=i-x,ee=H||u?s.left+x:s.right,te=H?u?s.left+x:s.right:s.left+x;w=ae(T,P,K,Q,K,Z,ee,s.top,te,s.bottom);break}}w?h||t.start(40,D):D()}};return c.__options={...e,blockPointerEvents:n},c}const Ye=m.createContext(void 0);function re(e){const n=m.useContext(Ye);if(n===void 0&&!e)throw new Error(pe(47));return n}function tn(){return{...Bt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const nn={...At,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class Se extends $e{constructor(n,t,c=!1){const i={...tn(),...n},o=new gt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Ht(o,t,c),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},nn)}setOpen=(n,t)=>{const c=t.reason===W,i=t.reason===Te&&t.event.detail===0,o=!n&&(t.reason===Qe||t.reason==null);t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)};const p=this.select("activeTriggerId");if(!n&&t.reason===ze&&t.trigger==null&&p!=null&&(t.trigger=this.context.triggerElements.getById(p)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const E=()=>{const S={open:n,openChangeReason:t.reason};ht(S,n,t.trigger),this.update(S)};c?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Je,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(E)):E(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===ve?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:c,internalStore:i}=mt(n,(o,p)=>new Se(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),c}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:c=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:S,defaultTriggerId:f=null}=e,r=Se.useStore(E?.store,{modal:p,open:c,openProp:t,activeTriggerId:f,triggerIdProp:S});Tt(()=>{t===void 0&&r.state.open===!1&&c===!0&&r.update({open:!0,activeTriggerId:f})}),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",S);const O=r.useState("open"),h=r.useState("mounted"),j=r.useState("payload"),l=Be()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),vt(r,O),Ct(r);const{forceUnmount:N}=Pt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:l}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,z(Ze))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:N,close:g}),[N,g]);const F=O||h,a=m.useMemo(()=>({store:r}),[r]);return Y.jsxs(Ye.Provider,{value:a,children:[F&&Y.jsx(on,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function vn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Et,{children:Y.jsx(ke,{props:e})})}function on({store:e,modal:n}){const t=e.useState("floatingRootContext"),c=bt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=c.reference??Me,o=c.trigger??Me,p=m.useMemo(()=>et(_e,c.floating),[c.floating]);return Rt(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const sn=300;function rn(e,n){const t=m.useRef(null);function c(o){ue.flushSync(()=>{e.setOpen(!1,z(ve,o.nativeEvent,o.currentTarget))}),st(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&tt(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,z(ve,o.nativeEvent,o.currentTarget))});let E=nt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&$(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:c,handleFocusTargetFocus:i}}const Cn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:S,payload:f,openOnHover:r=!1,delay:O=sn,closeDelay:h=0,id:j,...l}=n,N=re(!0),g=S?.store??N?.store;if(!g)throw new Error(pe(74));const F=St(j),a=g.useState("isTriggerActive",F),d=g.useState("floatingRootContext"),k=g.useState("isOpenedByTrigger",F),A=g.useState("triggerPopupId",F),T=m.useRef(null),{registerTrigger:P,isMountedByThisTrigger:b}=Ot(F,T,g,{payload:f,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),_=g.useState("stickIfOpen"),G=g.useState("openMethod"),X=g.useState("focusManagerModal"),D=zt(d,{enabled:d!=null&&r&&(G!=="touch"||M!==Te),mouseOnly:!0,move:!1,handleClose:en(),restMs:O,delay:{close:h},triggerElementRef:T,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),L=_t(d,{enabled:d!=null,stickIfOpen:_}),s=Dt(()=>g.select("open"),w=>{g.set("openMethod",w)}),v=g.useState("triggerProps",b),{getButtonProps:H,buttonRef:R}=rt({disabled:p,native:E}),u={open(w){return w&&M===Te?It.open(w):Mt.open(w)}},{preFocusGuardRef:B,handlePreFocusGuardFocus:y,handleFocusTargetFocus:V}=rn(g,T),I=He("button",n,{state:{disabled:p,open:k},ref:[R,t,P,T],props:[L.reference,D,v,s,{[it]:"",id:F,"aria-haspopup":"dialog","aria-expanded":k,"aria-controls":A},l,H],stateAttributesMapping:u});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:B,onFocus:y}),Y.jsx(m.Fragment,{children:I},F),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:V})]}):Y.jsx(m.Fragment,{children:I},F)}),Ve=m.createContext(void 0);function an(){const e=m.useContext(Ve);if(e===void 0)throw new Error(pe(45));return e}const Pn=m.forwardRef(function(n,t){const{keepMounted:c=!1,...i}=n,{store:o}=re();return o.useState("mounted")||c?Y.jsx(Ve.Provider,{value:c,children:Y.jsx(at,{ref:t,...i})}):null}),Ge=m.createContext(void 0);function cn(){const e=m.useContext(Ge);if(!e)throw new Error(pe(46));return e}const bn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,anchor:p,positionMethod:E="absolute",side:S="bottom",align:f="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:j=5,arrowPadding:l=5,sticky:N=!1,disableAnchorTracking:g=!1,collisionAvoidance:F=ct,...a}=n,{store:d}=re(),k=an(),A=yt(),T=d.useState("floatingRootContext"),P=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),_=d.useState("activeTriggerElement"),G=d.useState("modal"),X=d.useState("openMethod"),D=d.useState("positionerElement"),L=d.useState("instantType"),s=d.useState("transitionStatus"),v=d.useState("hasViewport"),H=m.useRef(null),R=lt(D,!1,!1),u=Nt({anchor:p,floatingRootContext:T,positionMethod:E,mounted:P,side:S,sideOffset:r,align:f,alignOffset:O,arrowPadding:l,collisionBoundary:h,collisionPadding:j,sticky:N,disableAnchorTracking:g,keepMounted:k,nodeId:A,collisionAvoidance:F,adaptiveOrigin:v?Vt:void 0}),B=T.useState("domReferenceElement");me(()=>{const I=B,w=H.current;if(I&&(H.current=I),w&&I&&I!==w){d.set("instantType",void 0);const C=new AbortController;return R(()=>{d.set("instantType","trigger-change")},C.signal),()=>{C.abort()}}},[B,R,d]),jt(b&&G===!0&&M!==W,X==="touch",D,_);const y=m.useCallback(I=>{d.set("positionerElement",I)},[d]),V={open:b,side:u.side,align:u.align,anchorHidden:u.anchorHidden,instant:L},U=Yt(n,V,{styles:u.positionerStyles,transitionStatus:s,props:a,refs:[t,y],hidden:!P,inert:!b});return Y.jsxs(Ge.Provider,{value:u,children:[P&&G===!0&&M!==W&&Y.jsx(xt,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:_}),Y.jsx(Ft,{id:A,children:U})]})}),ln=m.createContext(void 0);function un(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function fn(e){const{value:n,children:t}=e;return Y.jsx(ln.Provider,{value:n,children:t})}const dn={...Lt,...pt},Rn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:f}=re(),r=cn(),O=Gt()!=null,{context:h,hasClosePart:j}=un(),l=f.useState("open"),N=f.useState("openMethod"),g=f.useState("instantType"),F=f.useState("transitionStatus"),a=f.useState("popupProps"),d=f.useState("titleElementId"),k=f.useState("descriptionElementId"),A=f.useState("modal"),T=f.useState("mounted"),P=f.useState("openChangeReason"),b=f.useState("activeTriggerElement"),M=f.useState("floatingRootContext"),_=M.useState("floatingId"),G=f.useState("disabled"),X=f.useState("openOnHover"),D=f.useState("closeDelay"),L=S.id??_;ft({open:l,ref:f.context.popupRef,onComplete(){l&&f.context.onOpenChangeComplete?.(!0)}}),$t(M,{enabled:X&&!G,closeDelay:D});function s(y){return y==="touch"?f.context.popupRef.current:!0}const v=p===void 0?s:p,H=A!==!1&&j;f.useSyncedValue("focusManagerModal",H);const R=m.useCallback(y=>{f.set("popupElement",y)},[f]),u={open:l,side:r.side,align:r.align,instant:g,transitionStatus:F},B=He("div",n,{state:u,ref:[t,f.context.popupRef,R],props:[a,{id:L,role:"dialog",..._e,"aria-labelledby":d,"aria-describedby":k,onKeyDown(y){O&&wt.has(y.key)&&y.stopPropagation()}},Xt(F),S],stateAttributesMapping:dn});return Y.jsx(kt,{context:M,openInteractionType:N,modal:H,disabled:!T||P===W,initialFocus:v,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:f.context.triggerFocusTargetRef,beforeContentFocusGuardRef:f.context.beforeContentFocusGuardRef,children:Y.jsx(fn,{value:h,children:B})})});export{En as C,Tn as L,vn as P,Cn as a,Pn as b,bn as c,Rn as d};
@@ -0,0 +1 @@
1
+ import{r as v,b2 as l,bB as w,a as k,j as e,V as x}from"./main-9Ze1SUIZ.js";import{u as j,z as N,s as i,L as C,A as E,S as I,h as R,i as T,C as A,j as L,k as P,l as V,m as _,o as z,n as B}from"./SelectItemText-B0SL3Wb5.js";import{C as D}from"./useScrollLock-BcLeWqWK.js";const G=v.forwardRef(function(t,s){const{render:n,className:p,style:o,...c}=t,{store:r,scrollHandlerRef:d}=j(),{alignItemWithTriggerActive:g}=N(),u=l(r,i.hasScrollArrows),h=l(r,i.openMethod),a=l(r,i.multiple),m={id:`${l(r,i.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(b){d.current?.(b.currentTarget)},...g&&{style:C},className:u&&h!=="touch"?E.className:void 0},S=w(b=>{r.set("listElement",b)});return k("div",t,{ref:[s,S],props:[m,c]})}),M="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function U({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:p,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(I,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(R,{id:p,"aria-label":n,className:x(M,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c,e.jsx(T,{className:"truncate"})]}),e.jsx(A,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(V,{className:x("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(G,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:f,disabled:m})=>x("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",f?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",m&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(z,{children:e.jsx(D,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(B,{children:a.label})})]},String(a.value)))})})})})]})}export{U as S};
@@ -0,0 +1 @@
1
+ import{c as Or,bM as Pr,r as l,c5 as Ut,bA as St,bx as xn,bG as _n,c6 as Lr,b9 as Et,b as We,c7 as tt,c8 as $e,c9 as Xe,ca as Dr,cb as Fr,cc as Vr,cd as kr,ce as xt,cf as It,cg as Ue,ch as Bn,ci as Wn,cj as Tt,ck as Nr,cl as Un,cm as on,cn as $n,bC as Ae,co as st,cp as sn,c0 as nt,cq as Je,cr as $t,cs as rt,ba as ze,ct as an,cu as At,cv as zt,cw as Hr,cx as zn,cy as _r,cz as un,cA as fn,cB as qt,cC as yn,cD as Dt,cE as Yn,ar as Br,cF as Wr,b5 as Mt,b3 as K,cG as jn,cH as Ur,bB as de,cI as Rn,cJ as Jt,cK as wn,cL as Qt,bD as ot,bJ as at,cM as Ze,cN as bn,cO as $r,cP as Zt,cQ as zr,cR as Yr,cS as Kt,cT as Ot,cU as Pt,cV as jr,cW as Ft,bP as qn,cX as Kn,cY as qr,cZ as Xn,c_ as Kr,c$ as Xr,a as dt,d0 as Gr,b4 as Lt,b6 as Be,j as Me,bQ as ne,b2 as U,be as dn,b8 as cn,b7 as Gn,bb as Jr,bc as Qr,bd as pn,d1 as vn,d2 as Zr,d3 as eo,u as Jn,d4 as to,bY as no,d5 as ro,b$ as oo,d6 as so,bF as io,d7 as co,bf as Qn,d8 as en}from"./main-9Ze1SUIZ.js";import{c as Zn,x as lo,P as ao,b as er,d as Ke,y as uo,w as tr,u as fo,a as nr,k as po,l as go,f as mo,p as ho,z as xo,I as yo,r as Ro,v as wo}from"./useScrollLock-BcLeWqWK.js";const bo=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],mi=Or("chevron-down",bo);function wt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function vo(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:i=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:d=Pr}=t,f="rootStore"in e?e.rootStore:e,h=f.context.dataRef,a=l.useRef(void 0),p=Ut(),u=St(),y=l.useMemo(()=>{function x(m,b,g,R){const v=We(d,b,g);m&&R==="touch"&&c>0?u.start(c,()=>{f.setOpen(!0,v)}):f.setOpen(m,v)}function w(m,b,g){const R=h.current.openEvent,v=f.select("domReferenceElement")!==b;return m&&v||!m||!o?!0:R&&s?!g(R.type):!1}return{onPointerDown(m){a.current=m.pointerType},onMouseDown(m){const b=a.current,g=m.nativeEvent,R=f.select("open");if(m.button!==0||r==="click"||xn(b,!0)&&i)return;const v=w(R,m.currentTarget,D=>D==="click"||D==="mousedown"),T=_n(g);if(Lr(T)){x(v,g,T,b);return}const E=m.currentTarget;p.request(()=>{x(v,g,E,b)})},onClick(m){if(r==="mousedown-only")return;const b=a.current;if(r==="mousedown"&&b){a.current=void 0;return}if(xn(b,!0)&&i)return;const g=f.select("open"),R=w(g,m.currentTarget,v=>v==="click"||v==="mousedown"||v==="keydown"||v==="keyup");x(R,m.nativeEvent,m.currentTarget,b)},onKeyDown(){a.current=void 0}}},[h,r,i,d,f,s,o,p,u,c]);return l.useMemo(()=>n?{reference:y}:Et,[n,y])}function Sn(e,t,n){let{reference:r,floating:o}=e;const i=Xe(t),s=Bn(t),c=Un(s),d=$e(t),f=i==="y",h=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let u;switch(d){case"top":u={x:h,y:r.y-o.height};break;case"bottom":u={x:h,y:r.y+r.height};break;case"right":u={x:r.x+r.width,y:a};break;case"left":u={x:r.x-o.width,y:a};break;default:u={x:r.x,y:r.y}}switch(xt(t)){case"start":u[s]-=p*(n&&f?-1:1);break;case"end":u[s]+=p*(n&&f?-1:1);break}return u}async function So(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:c,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:a="floating",altBoundary:p=!1,padding:u=0}=tt(t,e),y=Wn(u),w=c[p?a==="floating"?"reference":"floating":a],m=Tt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:f,rootBoundary:h,strategy:d})),b=a==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,g=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),R=await(i.isElement==null?void 0:i.isElement(g))?await(i.getScale==null?void 0:i.getScale(g))||{x:1,y:1}:{x:1,y:1},v=Tt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:g,strategy:d}):b);return{top:(m.top-v.top+y.top)/R.y,bottom:(v.bottom-m.bottom+y.bottom)/R.y,left:(m.left-v.left+y.left)/R.x,right:(v.right-m.right+y.right)/R.x}}const Co=50,Eo=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:So},d=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:a}=Sn(f,r,d),p=r,u=0;const y={};for(let x=0;x<i.length;x++){const w=i[x];if(!w)continue;const{name:m,fn:b}=w,{x:g,y:R,data:v,reset:T}=await b({x:h,y:a,initialPlacement:r,placement:p,strategy:o,middlewareData:y,rects:f,platform:c,elements:{reference:e,floating:t}});h=g??h,a=R??a,y[m]={...y[m],...v},T&&u<Co&&(u++,typeof T=="object"&&(T.placement&&(p=T.placement),T.rects&&(f=T.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:h,y:a}=Sn(f,p,d)),x=-1)}return{x:h,y:a,placement:p,strategy:o,middlewareData:y}},Io=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:c,platform:d,elements:f}=t,{mainAxis:h=!0,crossAxis:a=!0,fallbackPlacements:p,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=tt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const m=$e(o),b=Xe(c),g=$e(c)===c,R=await(d.isRTL==null?void 0:d.isRTL(f.floating)),v=p||(g||!x?[Dr(c)]:Fr(c)),T=y!=="none";!p&&T&&v.push(...Vr(c,x,y,R));const E=[c,...v],D=await d.detectOverflow(t,w),k=[];let V=((r=i.flip)==null?void 0:r.overflows)||[];if(h&&k.push(D[m]),a){const H=kr(o,s,R);k.push(D[H[0]],D[H[1]])}if(V=[...V,{placement:o,overflows:k}],!k.every(H=>H<=0)){var $,L;const H=((($=i.flip)==null?void 0:$.index)||0)+1,B=E[H];if(B&&(!(a==="alignment"?b!==Xe(B):!1)||V.every(A=>Xe(A.placement)===b?A.overflows[0]>0:!0)))return{data:{index:H,overflows:V},reset:{placement:B}};let z=(L=V.filter(I=>I.overflows[0]<=0).sort((I,A)=>I.overflows[1]-A.overflows[1])[0])==null?void 0:L.placement;if(!z)switch(u){case"bestFit":{var N;const I=(N=V.filter(A=>{if(T){const G=Xe(A.placement);return G===b||G==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(G=>G>0).reduce((G,M)=>G+M,0)]).sort((A,G)=>A[1]-G[1])[0])==null?void 0:N[0];I&&(z=I);break}case"initialPlacement":z=c;break}if(o!==z)return{reset:{placement:z}}}return{}}}};function Cn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function En(e){return Nr.some(t=>e[t]>=0)}const To=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=tt(e,t);switch(o){case"referenceHidden":{const s=await r.detectOverflow(t,{...i,elementContext:"reference"}),c=Cn(s,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:En(c)}}}case"escaped":{const s=await r.detectOverflow(t,{...i,altBoundary:!0}),c=Cn(s,n.floating);return{data:{escapedOffsets:c,escaped:En(c)}}}default:return{}}}}},rr=new Set(["left","top"]);async function Ao(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=$e(n),c=xt(n),d=Xe(n)==="y",f=rr.has(s)?-1:1,h=i&&d?-1:1,a=tt(t,e);let{mainAxis:p,crossAxis:u,alignmentAxis:y}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return c&&typeof y=="number"&&(u=c==="end"?y*-1:y),d?{x:u*h,y:p*f}:{x:p*f,y:u*h}}const Mo=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:c}=t,d=await Ao(t,e);return s===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+d.x,y:i+d.y,data:{...d,placement:s}}}}},Oo=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:d={fn:m=>{let{x:b,y:g}=m;return{x:b,y:g}}},...f}=tt(e,t),h={x:n,y:r},a=await i.detectOverflow(t,f),p=Xe($e(o)),u=$n(p);let y=h[u],x=h[p];if(s){const m=u==="y"?"top":"left",b=u==="y"?"bottom":"right",g=y+a[m],R=y-a[b];y=on(g,y,R)}if(c){const m=p==="y"?"top":"left",b=p==="y"?"bottom":"right",g=x+a[m],R=x-a[b];x=on(g,x,R)}const w=d.fn({...t,[u]:y,[p]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[u]:s,[p]:c}}}}}},Po=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:c=0,mainAxis:d=!0,crossAxis:f=!0}=tt(e,t),h={x:n,y:r},a=Xe(o),p=$n(a);let u=h[p],y=h[a];const x=tt(c,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(d){const g=p==="y"?"height":"width",R=i.reference[p]-i.floating[g]+w.mainAxis,v=i.reference[p]+i.reference[g]-w.mainAxis;u<R?u=R:u>v&&(u=v)}if(f){var m,b;const g=p==="y"?"width":"height",R=rr.has($e(o)),v=i.reference[a]-i.floating[g]+(R&&((m=s.offset)==null?void 0:m[a])||0)+(R?0:w.crossAxis),T=i.reference[a]+i.reference[g]+(R?0:((b=s.offset)==null?void 0:b[a])||0)-(R?w.crossAxis:0);y<v?y=v:y>T&&(y=T)}return{[p]:u,[a]:y}}}},Lo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:c}=t,{apply:d=()=>{},...f}=tt(e,t),h=await s.detectOverflow(t,f),a=$e(o),p=xt(o),u=Xe(o)==="y",{width:y,height:x}=i.floating;let w,m;a==="top"||a==="bottom"?(w=a,m=p===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(m=a,w=p==="end"?"top":"bottom");const b=x-h.top-h.bottom,g=y-h.left-h.right,R=It(x-h[w],b),v=It(y-h[m],g),T=!t.middlewareData.shift;let E=R,D=v;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(D=g),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=b),T&&!p){const V=Ue(h.left,0),$=Ue(h.right,0),L=Ue(h.top,0),N=Ue(h.bottom,0);u?D=y-2*(V!==0||$!==0?V+$:Ue(h.left,h.right)):E=x-2*(L!==0||N!==0?L+N:Ue(h.top,h.bottom))}await d({...t,availableWidth:D,availableHeight:E});const k=await s.getDimensions(c.floating);return y!==k.width||x!==k.height?{reset:{rects:!0}}:{}}}};function or(e){const t=rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,c=$t(n)!==i||$t(r)!==s;return c&&(n=i,r=s),{width:n,height:r,$:c}}function gn(e){return Ae(e)?e:e.contextElement}function mt(e){const t=gn(e);if(!nt(t))return Je(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=or(t);let s=(i?$t(n.width):n.width)/r,c=(i?$t(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Do=Je(0);function sr(e){const t=ze(e);return!Yn()||!t.visualViewport?Do:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ze(e)?!1:t}function ft(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=gn(e);let s=Je(1);t&&(r?Ae(r)&&(s=mt(r)):s=mt(e));const c=Fo(i,n,r)?sr(i):Je(0);let d=(o.left+c.x)/s.x,f=(o.top+c.y)/s.y,h=o.width/s.x,a=o.height/s.y;if(i){const p=ze(i),u=r&&Ae(r)?ze(r):r;let y=p,x=yn(y);for(;x&&r&&u!==y;){const w=mt(x),m=x.getBoundingClientRect(),b=rt(x),g=m.left+(x.clientLeft+parseFloat(b.paddingLeft))*w.x,R=m.top+(x.clientTop+parseFloat(b.paddingTop))*w.y;d*=w.x,f*=w.y,h*=w.x,a*=w.y,d+=g,f+=R,y=ze(x),x=yn(y)}}return Tt({width:h,height:a,x:d,y:f})}function Xt(e,t){const n=qt(e).scrollLeft;return t?t.left+n:ft(st(e)).left+n}function ir(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Xt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Vo(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=st(r),c=t?an(t.floating):!1;if(r===s||c&&i)return n;let d={scrollLeft:0,scrollTop:0},f=Je(1);const h=Je(0),a=nt(r);if((a||!a&&!i)&&((un(r)!=="body"||fn(s))&&(d=qt(r)),a)){const u=ft(r);f=mt(r),h.x=u.x+r.clientLeft,h.y=u.y+r.clientTop}const p=s&&!a&&!i?ir(s,d):Je(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+h.x+p.x,y:n.y*f.y-d.scrollTop*f.y+h.y+p.y}}function ko(e){return Array.from(e.getClientRects())}function No(e){const t=st(e),n=qt(e),r=e.ownerDocument.body,o=Ue(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ue(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Xt(e);const c=-n.scrollTop;return rt(r).direction==="rtl"&&(s+=Ue(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:c}}const In=25;function Ho(e,t){const n=ze(e),r=st(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,c=0,d=0;if(o){i=o.width,s=o.height;const h=Yn();(!h||h&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}const f=Xt(r);if(f<=0){const h=r.ownerDocument,a=h.body,p=getComputedStyle(a),u=h.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(r.clientWidth-a.clientWidth-u);y<=In&&(i-=y)}else f<=In&&(i+=f);return{width:i,height:s,x:c,y:d}}function _o(e,t){const n=ft(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=nt(e)?mt(e):Je(1),s=e.clientWidth*i.x,c=e.clientHeight*i.y,d=o*i.x,f=r*i.y;return{width:s,height:c,x:d,y:f}}function Tn(e,t,n){let r;if(t==="viewport")r=Ho(e,n);else if(t==="document")r=No(st(e));else if(Ae(t))r=_o(t,n);else{const o=sr(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Tt(r)}function cr(e,t){const n=At(e);return n===t||!Ae(n)||zt(n)?!1:rt(n).position==="fixed"||cr(n,t)}function Bo(e,t){const n=t.get(e);if(n)return n;let r=sn(e,[],!1).filter(c=>Ae(c)&&un(c)!=="body"),o=null;const i=rt(e).position==="fixed";let s=i?At(e):e;for(;Ae(s)&&!zt(s);){const c=rt(s),d=zn(s);!d&&c.position==="fixed"&&(o=null),(i?!d&&!o:!d&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||fn(s)&&!d&&cr(e,s))?r=r.filter(h=>h!==s):o=c,s=At(s)}return t.set(e,r),r}function Wo(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?an(t)?[]:Bo(t,this._c):[].concat(n),r],c=Tn(t,s[0],o);let d=c.top,f=c.right,h=c.bottom,a=c.left;for(let p=1;p<s.length;p++){const u=Tn(t,s[p],o);d=Ue(u.top,d),f=It(u.right,f),h=It(u.bottom,h),a=Ue(u.left,a)}return{width:f-a,height:h-d,x:a,y:d}}function Uo(e){const{width:t,height:n}=or(e);return{width:t,height:n}}function $o(e,t,n){const r=nt(t),o=st(t),i=n==="fixed",s=ft(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const d=Je(0);function f(){d.x=Xt(o)}if(r||!r&&!i)if((un(t)!=="body"||fn(o))&&(c=qt(t)),r){const u=ft(t,!0,i,t);d.x=u.x+t.clientLeft,d.y=u.y+t.clientTop}else o&&f();i&&!r&&o&&f();const h=o&&!r&&!i?ir(o,c):Je(0),a=s.left+c.scrollLeft-d.x-h.x,p=s.top+c.scrollTop-d.y-h.y;return{x:a,y:p,width:s.width,height:s.height}}function tn(e){return rt(e).position==="static"}function An(e,t){if(!nt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return st(e)===n&&(n=n.ownerDocument.body),n}function lr(e,t){const n=ze(e);if(an(e))return n;if(!nt(e)){let o=At(e);for(;o&&!zt(o);){if(Ae(o)&&!tn(o))return o;o=At(o)}return n}let r=An(e,t);for(;r&&Hr(r)&&tn(r);)r=An(r,t);return r&&zt(r)&&tn(r)&&!zn(r)?n:r||_r(e)||n}const zo=async function(e){const t=this.getOffsetParent||lr,n=this.getDimensions,r=await n(e.floating);return{reference:$o(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Yo(e){return rt(e).direction==="rtl"}const ar={convertOffsetParentRelativeRectToViewportRelativeRect:Vo,getDocumentElement:st,getClippingRect:Wo,getOffsetParent:lr,getElementRects:zo,getClientRects:ko,getDimensions:Uo,getScale:mt,isElement:Ae,isRTL:Yo};function ur(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jo(e,t){let n=null,r;const o=st(e);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function s(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),i();const f=e.getBoundingClientRect(),{left:h,top:a,width:p,height:u}=f;if(c||t(),!p||!u)return;const y=Dt(a),x=Dt(o.clientWidth-(h+p)),w=Dt(o.clientHeight-(a+u)),m=Dt(h),g={rootMargin:-y+"px "+-x+"px "+-w+"px "+-m+"px",threshold:Ue(0,It(1,d))||1};let R=!0;function v(T){const E=T[0].intersectionRatio;if(E!==d){if(!R)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}E===1&&!ur(f,e.getBoundingClientRect())&&s(),R=!1}try{n=new IntersectionObserver(v,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(v,g)}n.observe(e)}return s(!0),i}function Mn(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=gn(e),h=o||i?[...f?sn(f):[],...t?sn(t):[]]:[];h.forEach(m=>{o&&m.addEventListener("scroll",n,{passive:!0}),i&&m.addEventListener("resize",n)});const a=f&&c?jo(f,n):null;let p=-1,u=null;s&&(u=new ResizeObserver(m=>{let[b]=m;b&&b.target===f&&u&&t&&(u.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var g;(g=u)==null||g.observe(t)})),n()}),f&&!d&&u.observe(f),t&&u.observe(t));let y,x=d?ft(e):null;d&&w();function w(){const m=ft(e);x&&!ur(x,m)&&n(),x=m,y=requestAnimationFrame(w)}return n(),()=>{var m;h.forEach(b=>{o&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),a?.(),(m=u)==null||m.disconnect(),u=null,d&&cancelAnimationFrame(y)}}const qo=Mo,Ko=Oo,Xo=Io,Go=Lo,Jo=To,Qo=Po,Zo=(e,t,n)=>{const r=new Map,o={platform:ar,...n},i={...o.platform,_c:r};return Eo(e,t,{...o,platform:i})};var es=typeof document<"u",ts=function(){},Bt=es?l.useLayoutEffect:ts;function Yt(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(!Yt(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 i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Yt(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function fr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function On(e,t){const n=fr(e);return Math.round(t*n)/n}function nn(e){const t=l.useRef(e);return Bt(()=>{t.current=e}),t}function ns(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:d,open:f}=e,[h,a]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,u]=l.useState(r);Yt(p,r)||u(r);const[y,x]=l.useState(null),[w,m]=l.useState(null),b=l.useCallback(A=>{A!==T.current&&(T.current=A,x(A))},[]),g=l.useCallback(A=>{A!==E.current&&(E.current=A,m(A))},[]),R=i||y,v=s||w,T=l.useRef(null),E=l.useRef(null),D=l.useRef(h),k=d!=null,V=nn(d),$=nn(o),L=nn(f),N=l.useCallback(()=>{if(!T.current||!E.current)return;const A={placement:t,strategy:n,middleware:p};$.current&&(A.platform=$.current),Zo(T.current,E.current,A).then(G=>{const M={...G,isPositioned:L.current!==!1};H.current&&!Yt(D.current,M)&&(D.current=M,Br.flushSync(()=>{a(M)}))})},[p,t,n,$,L]);Bt(()=>{f===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,a(A=>({...A,isPositioned:!1})))},[f]);const H=l.useRef(!1);Bt(()=>(H.current=!0,()=>{H.current=!1}),[]),Bt(()=>{if(R&&(T.current=R),v&&(E.current=v),R&&v){if(V.current)return V.current(R,v,N);N()}},[R,v,N,V,k]);const B=l.useMemo(()=>({reference:T,floating:E,setReference:b,setFloating:g}),[b,g]),z=l.useMemo(()=>({reference:R,floating:v}),[R,v]),I=l.useMemo(()=>{const A={position:n,left:0,top:0};if(!z.floating)return A;const G=On(z.floating,h.x),M=On(z.floating,h.y);return c?{...A,transform:"translate("+G+"px, "+M+"px)",...fr(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:M}},[n,c,z.floating,h.x,h.y]);return l.useMemo(()=>({...h,update:N,refs:B,elements:z,floatingStyles:I}),[h,N,B,z,I])}const rs=(e,t)=>{const n=qo(e);return{name:n.name,fn:n.fn,options:[e,t]}},os=(e,t)=>{const n=Ko(e);return{name:n.name,fn:n.fn,options:[e,t]}},ss=(e,t)=>({fn:Qo(e).fn,options:[e,t]}),is=(e,t)=>{const n=Xo(e);return{name:n.name,fn:n.fn,options:[e,t]}},cs=(e,t)=>{const n=Go(e);return{name:n.name,fn:n.fn,options:[e,t]}},ls=(e,t)=>{const n=Jo(e);return{name:n.name,fn:n.fn,options:[e,t]}};function dr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Wr(),i=Zn()!=null,s=Mt(()=>new lo({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new ao,floatingId:o,syncOnly:!1,nested:i})).current;return K(()=>{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),s.update(c)},[t,o,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=i,s}function as(e={}){const{nodeId:t,externalTree:n}=e,r=dr(e),o=e.rootContext||r,i=o.useState("referenceElement"),s=o.useState("floatingElement"),c=o.useState("domReferenceElement"),d=o.useState("open"),f=o.useState("floatingId"),[h,a]=l.useState(null),[p,u]=l.useState(void 0),[y,x]=l.useState(void 0),w=l.useRef(null),m=er(n),b=l.useMemo(()=>({reference:i,floating:s,domReference:c}),[i,s,c]),g=ns({...e,elements:{...b,...h&&{reference:h}}}),R=Ae(p)?p:null,v=y===void 0?o.state.floatingElement:y;o.useSyncedValue("referenceElement",p??null),o.useSyncedValue("domReferenceElement",p===void 0?c:R),o.useSyncedValue("floatingElement",v);const T=l.useCallback(L=>{const N=Ae(L)?{getBoundingClientRect:()=>L.getBoundingClientRect(),getClientRects:()=>L.getClientRects(),contextElement:L}:L;a(N),g.refs.setReference(N)},[g.refs]),E=l.useCallback(L=>{(Ae(L)||L===null)&&(w.current=L,u(L)),(Ae(g.refs.reference.current)||g.refs.reference.current===null||L!==null&&!Ae(L))&&g.refs.setReference(L)},[g.refs,u]),D=l.useCallback(L=>{x(L),g.refs.setFloating(L)},[g.refs]),k=l.useMemo(()=>({...g.refs,setReference:E,setFloating:D,setPositionReference:T,domReference:w}),[g.refs,E,D,T]),V=l.useMemo(()=>({...g.elements,domReference:c}),[g.elements,c]),$=l.useMemo(()=>({...g,dataRef:o.context.dataRef,open:d,onOpenChange:o.setOpen,events:o.context.events,floatingId:f,refs:k,elements:V,nodeId:t,rootStore:o}),[g,k,V,t,o,d,f]);return K(()=>{c&&(w.current=c)},[c]),K(()=>{o.context.dataRef.current.floatingContext=$;const L=m?.nodesRef.current.find(N=>N.id===t);L&&(L.context=$)}),l.useMemo(()=>({...g,context:$,refs:k,elements:V,rootStore:o}),[g,k,V,$,o])}const us="Escape";function Gt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Vt(e,t){return Gt(t,e===Xn||e===Kt,e===Ot||e===Pt)}function rn(e,t,n){return Gt(t,e===Kt,n?e===Ot:e===Pt)||e==="Enter"||e===" "||e===""}function fs(e,t,n){return Gt(t,n?e===Ot:e===Pt,e===Kt)}function ds(e,t,n,r){const o=n?e===Pt:e===Ot,i=e===Xn;return t==="both"||t==="horizontal"&&r&&r>1?e===us:Gt(t,o,i)}function ps(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:i=!0,selectedIndex:s=null,allowEscape:c=!1,loopFocus:d=!1,nested:f=!1,rtl:h=!1,virtual:a=!1,focusItemOnOpen:p="auto",focusItemOnHover:u=!0,openOnArrowKeyDown:y=!0,disabledIndices:x=void 0,orientation:w="vertical",parentOrientation:m,cols:b=1,id:g,resetOnPointerLeave:R=!0,externalTree:v}=t,T="rootStore"in e?e.rootStore:e,E=T.useState("open"),D=T.useState("floatingElement"),k=T.useState("domReferenceElement"),V=T.context.dataRef,$=jn(D),L=Ur(k),N=Ke($),H=Zn(),B=er(v),z=l.useRef(p),I=l.useRef(s??-1),A=l.useRef(null),G=l.useRef(!0),M=de(P=>{o(I.current===-1?null:I.current,P)}),Z=l.useRef(M),re=l.useRef(!!D),S=l.useRef(E),O=l.useRef(!1),_=l.useRef(!1),ce=l.useRef(null),ee=Ke(x),le=Ke(E),pe=Ke(s),Le=Ke(R),Ne=Ut(),Ce=Ut(),Y=de(()=>{function P(j){a?B?.events.emit("virtualfocus",j):ce.current=uo(j,{sync:O.current,preventScroll:!0})}const C=n.current[I.current],X=_.current;C&&P(C),(O.current?j=>j():j=>Ne.request(j))(()=>{const j=n.current[I.current]||C;if(!j)return;C||P(j),ue&&(X||!G.current)&&j.scrollIntoView?.({block:"nearest",inline:"nearest"})})});K(()=>{V.current.orientation=w},[V,w]),K(()=>{i&&(E&&D?(I.current=s??-1,z.current&&s!=null&&(_.current=!0,M())):re.current&&(I.current=-1,Z.current()))},[i,E,D,s,M]),K(()=>{if(i){if(!E){O.current=!1;return}if(D)if(r==null){if(O.current=!1,pe.current!=null)return;if(re.current&&(I.current=-1,Y()),(!S.current||!re.current)&&z.current&&(A.current!=null||z.current===!0&&A.current==null)){let P=0;const C=()=>{n.current[0]==null?(P<2&&(P?F=>Ce.request(F):queueMicrotask)(C),P+=1):(I.current=A.current==null||rn(A.current,w,h)||f?Jt(n):wn(n),A.current=null,M())};C()}}else Rn(n.current,r)||(I.current=r,Y(),_.current=!1)}},[i,E,D,r,pe,f,n,w,h,M,Y,Ce]),K(()=>{if(!i||D||!B||a||!re.current)return;const P=B.nodesRef.current,C=P.find(j=>j.id===H)?.context?.elements.floating,X=Qt(ot(D)),F=P.some(j=>j.context&&at(j.context.elements.floating,X));C&&!F&&G.current&&C.focus({preventScroll:!0})},[i,D,B,H,a]),K(()=>{Z.current=M,S.current=E,re.current=!!D}),K(()=>{E||(A.current=null,z.current=p)},[E,p]);const oe=r!=null,xe=de(P=>{if(!le.current)return;const C=n.current.indexOf(P.currentTarget);C!==-1&&(I.current!==C||r!==C)&&(I.current=C,M(P))}),Ee=de(()=>m??B?.nodesRef.current.find(P=>P.id===H)?.context?.dataRef?.current.orientation),J=de(()=>Jt(n,ee.current)),ae=de(P=>{if(G.current=!1,O.current=!0,P.which===229||!le.current&&P.currentTarget===N.current)return;if(f&&ds(P.key,w,h,b)){Vt(P.key,Ee())||Ze(P),T.setOpen(!1,We(bn,P.nativeEvent)),nt(k)&&(a?B?.events.emit("virtualfocus",k):k.focus());return}const C=I.current,X=Jt(n,x),F=wn(n,x);if(L||(P.key==="Home"&&(Ze(P),I.current=X,M(P)),P.key==="End"&&(Ze(P),I.current=F,M(P))),b>1){const j=Array.from({length:n.current.length},()=>({width:1,height:1})),me=$r(j,b),Te=me.findIndex(he=>he!=null&&!Zt(n.current,he,x)),De=me.reduce((he,ye,Se)=>ye!=null&&!Zt(n.current,ye,x)?Se:he,-1),ve=me[zr(me.map(he=>he!=null?n.current[he]:null),{event:P,orientation:w,loopFocus:d,rtl:h,cols:b,disabledIndices:jr([...(typeof x!="function"?x:null)||n.current.map((he,ye)=>Zt(n.current,ye,x)?ye:void 0),void 0],me),minIndex:Te,maxIndex:De,prevIndex:Yr(I.current>F?X:I.current,j,me,b,P.key===Kt?"bl":P.key===(h?Ot:Pt)?"tr":"tl"),stopEvent:!0})];if(ve!=null&&(I.current=ve,M(P)),w==="both")return}if(Vt(P.key,w)){if(Ze(P),E&&!a&&Qt(P.currentTarget.ownerDocument)===P.currentTarget){I.current=rn(P.key,w,h)?X:F,M(P);return}rn(P.key,w,h)?d?C>=F?c&&C!==n.current.length?I.current=-1:(O.current=!1,I.current=X):I.current=Ft(n.current,{startingIndex:C,disabledIndices:x}):I.current=Math.min(F,Ft(n.current,{startingIndex:C,disabledIndices:x})):d?C<=X?c&&C!==-1?I.current=n.current.length:(O.current=!1,I.current=F):I.current=Ft(n.current,{startingIndex:C,decrement:!0,disabledIndices:x}):I.current=Math.max(X,Ft(n.current,{startingIndex:C,decrement:!0,disabledIndices:x})),Rn(n.current,I.current)&&(I.current=-1),M(P)}}),ue=l.useMemo(()=>({onFocus(C){O.current=!0,xe(C)},onClick:({currentTarget:C})=>C.focus({preventScroll:!0}),onMouseMove(C){O.current=!0,_.current=!1,u&&xe(C)},onPointerLeave(C){if(!le.current||!G.current||C.pointerType==="touch")return;O.current=!0;const X=C.relatedTarget;if(!(!u||n.current.includes(X))&&Le.current&&(ce.current?.(),ce.current=null,I.current=-1,M(C),!a)){const F=N.current,j=Qt(ot(F));F&&at(F,j)&&F.focus({preventScroll:!0})}}}),[xe,le,N,u,n,M,Le,a]),Re=l.useMemo(()=>a&&E&&oe&&{"aria-activedescendant":`${g}-${r}`},[a,E,oe,g,r]),ge=l.useMemo(()=>({"aria-orientation":w==="both"?void 0:w,...L?{}:Re,onKeyDown(P){if(P.key==="Tab"&&P.shiftKey&&E&&!a){const C=_n(P.nativeEvent);if(C&&!at(N.current,C))return;Ze(P),T.setOpen(!1,We(qn,P.nativeEvent)),nt(k)&&k.focus();return}ae(P)},onPointerMove(){G.current=!0}}),[Re,ae,N,w,L,T,E,a,k]),te=l.useMemo(()=>{function P(F){T.setOpen(!0,We(bn,F.nativeEvent,F.currentTarget))}function C(F){p==="auto"&&Kn(F.nativeEvent)&&(z.current=!a)}function X(F){z.current=p,p==="auto"&&qr(F.nativeEvent)&&(z.current=!0)}return{onKeyDown(F){const j=T.select("open");G.current=!1;const me=F.key.startsWith("Arrow"),Te=fs(F.key,Ee(),h),De=Vt(F.key,w),ve=(f?Te:De)||F.key==="Enter"||F.key.trim()==="";if(a&&j)return ae(F);if(!(!j&&!y&&me)){if(ve){const he=Vt(F.key,Ee());A.current=f&&he?null:F.key}if(f){Te&&(Ze(F),j?(I.current=J(),M(F)):P(F));return}De&&(pe.current!=null&&(I.current=pe.current),Ze(F),!j&&y?P(F):ae(F),j&&M(F))}},onFocus(F){T.select("open")&&!a&&(I.current=-1,M(F))},onPointerDown:X,onPointerEnter:X,onMouseDown:C,onClick:C}},[ae,p,J,f,M,T,y,w,Ee,h,pe,a]),se=l.useMemo(()=>({...Re,...te}),[Re,te]);return l.useMemo(()=>i?{reference:se,floating:ge,item:ue,trigger:te}:{},[i,se,ge,te,ue])}function gs(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:i,onTyping:s,enabled:c=!0,resetMs:d=750,selectedIndex:f=null}=t,h="rootStore"in e?e.rootStore:e,a=h.useState("open"),p=St(),u=l.useRef(""),y=l.useRef(f??o??-1),x=l.useRef(null),w=de(g=>{function R(L){const N=r?.current[L];return!N||Kr(N)}function v(L,N,H=0){if(L.length===0)return-1;const B=(H%L.length+L.length)%L.length,z=N.toLocaleLowerCase();for(let I=0;I<L.length;I+=1){const A=(B+I)%L.length;if(!(!L[A]?.toLocaleLowerCase().startsWith(z)||!R(A)))return A}return-1}const T=n.current;if(u.current.length>0&&g.key===" "&&(Ze(g),s?.(!0)),u.current.length>0&&u.current[0]!==" "&&v(T,u.current)===-1&&g.key!==" "&&s?.(!1),T==null||g.key.length!==1||g.ctrlKey||g.metaKey||g.altKey)return;a&&g.key!==" "&&(Ze(g),s?.(!0));const E=u.current==="";E&&(y.current=f??o??-1),T.every(L=>L?L[0]?.toLocaleLowerCase()!==L[1]?.toLocaleLowerCase():!0)&&u.current===g.key&&(u.current="",y.current=x.current),u.current+=g.key,p.start(d,()=>{u.current="",y.current=x.current,s?.(!1)});const V=((E?f??o??-1:y.current)??0)+1,$=v(T,u.current,V);$!==-1?(i?.($),x.current=$):g.key!==" "&&(u.current="",s?.(!1))}),m=de(g=>{const R=g.relatedTarget,v=h.select("domReferenceElement"),T=h.select("floatingElement");at(v,R)||at(T,R)||(p.clear(),u.current="",y.current=x.current,s?.(!1))});K(()=>{!a&&f!==null||(p.clear(),x.current=null,u.current!==""&&(u.current=""))},[a,f,p]),K(()=>{a&&u.current===""&&(y.current=f??o??-1)},[a,f,o]);const b=l.useMemo(()=>({onKeyDown:w,onBlur:m}),[w,m]);return l.useMemo(()=>c?{reference:b,floating:b}:{},[c,b])}const ms=l.createContext(void 0);function pr(){return l.useContext(ms)?.direction??"ltr"}const hs=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:c,middlewareData:d}=t,{element:f,padding:h=0,offsetParent:a="real"}=tt(e,t)||{};if(f==null)return{};const p=Wn(h),u={x:n,y:r},y=Bn(o),x=Un(y),w=await s.getDimensions(f),m=y==="y",b=m?"top":"left",g=m?"bottom":"right",R=m?"clientHeight":"clientWidth",v=i.reference[x]+i.reference[y]-u[y]-i.floating[x],T=u[y]-i.reference[y],E=a==="real"?await s.getOffsetParent?.(f):c.floating;let D=c.floating[R]||i.floating[x];(!D||!await s.isElement?.(E))&&(D=c.floating[R]||i.floating[x]);const k=v/2-T/2,V=D/2-w[x]/2-1,$=Math.min(p[b],V),L=Math.min(p[g],V),N=$,H=D-w[x]-L,B=D/2-w[x]/2+k,z=on(N,B,H),I=!d.arrow&&xt(o)!=null&&B!==z&&i.reference[x]/2-(B<N?$:L)-w[x]/2<0,A=I?B<N?B-N:B-H:0;return{[y]:u[y]+A,data:{[y]:z,centerOffset:B-z-A,...I&&{alignmentOffset:A}},reset:I}}}),xs=(e,t)=>({...hs(e),options:[e,t]}),ys={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,i=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await ls().fn(e)).data?.referenceHidden||i}}}},Wt={sideX:"left",sideY:"top"},hi={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:i,strategy:s,placement:c}=e,d=ze(o),f=d.getComputedStyle(o);if(!(f.transitionDuration!=="0s"&&f.transitionDuration!==""))return{x:t,y:n,data:Wt};const a=await i.getOffsetParent?.(o);let p={width:0,height:0};if(s==="fixed"&&d?.visualViewport)p={width:d.visualViewport.width,height:d.visualViewport.height};else if(a===d){const b=ot(o);p={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await i.isElement?.(a)&&(p=await i.getDimensions(a));const u=$e(c);let y=t,x=n;u==="left"&&(y=p.width-(t+r.width)),u==="top"&&(x=p.height-(n+r.height));const w=u==="left"?"right":Wt.sideX,m=u==="top"?"bottom":Wt.sideY;return{x:y,y:x,data:{sideX:w,sideY:m}}}};function gr(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 Pn(e,t,n){const{rects:r,placement:o}=e;return{side:gr(t,$e(o),n),align:xt(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Rs(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,collisionBoundary:c,collisionPadding:d=5,sticky:f=!1,arrowPadding:h=5,disableAnchorTracking:a=!1,inline:p,keepMounted:u=!1,floatingRootContext:y,mounted:x,collisionAvoidance:w,shiftCrossAxis:m=!1,nodeId:b,adaptiveOrigin:g,lazyFlip:R=!1,externalTree:v}=e,[T,E]=l.useState(null);!x&&T!==null&&E(null);const D=w.side||"flip",k=w.align||"flip",V=w.fallbackAxisSide||"end",$=typeof t=="function"?t:void 0,L=de($),N=$?L:t,H=Ke(t),B=Ke(x),I=pr()==="rtl",A=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[r],G=i==="center"?A:`${A}-${i}`;let M=d;const Z=1,re=r==="bottom"?Z:0,S=r==="top"?Z:0,O=r==="right"?Z:0,_=r==="left"?Z:0;typeof M=="number"?M={top:M+re,right:M+_,bottom:M+S,left:M+O}:M&&(M={top:(M.top||0)+re,right:(M.right||0)+_,bottom:(M.bottom||0)+S,left:(M.left||0)+O});const ce={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:M},ee=l.useRef(null),le=Ke(o),pe=Ke(s),Le=typeof o!="function"?o:0,Ne=typeof s!="function"?s:0,Ce=[];p&&Ce.push(p),Ce.push(rs(Q=>{const we=Pn(Q,r,I),Ie=typeof le.current=="function"?le.current(we):le.current,ie=typeof pe.current=="function"?pe.current(we):pe.current;return{mainAxis:Ie,crossAxis:ie,alignmentAxis:ie}},[Le,Ne,I,r]));const Y=k==="none"&&D!=="shift",oe=!Y&&(f||m||D==="shift"),xe=D==="none"?null:is({...ce,padding:{top:M.top+Z,right:M.right+Z,bottom:M.bottom+Z,left:M.left+Z},mainAxis:!m&&D==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:V}),Ee=Y?null:os(Q=>{const we=ot(Q.elements.floating).documentElement;return{...ce,rootBoundary:m?{x:0,y:0,width:we.clientWidth,height:we.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:oe,limiter:f||m?void 0:ss(Ie=>{if(!ee.current)return{};const{width:ie,height:Fe}=ee.current.getBoundingClientRect(),be=Xe($e(Ie.placement)),Pe=be==="y"?ie:Fe,Ve=be==="y"?M.left+M.right:M.top+M.bottom;return{offset:Pe/2+Ve/2}})}},[ce,f,m,M,k]);D==="shift"||k==="shift"||i==="center"?Ce.push(Ee,xe):Ce.push(xe,Ee),Ce.push(cs({...ce,apply({elements:{floating:Q},availableWidth:we,availableHeight:Ie,rects:ie}){if(!B.current)return;const Fe=Q.style;Fe.setProperty("--available-width",`${we}px`),Fe.setProperty("--available-height",`${Ie}px`);const be=ze(Q).devicePixelRatio||1,{x:Pe,y:Ve,width:je,height:Qe}=ie.reference,ct=(Math.round((Pe+je)*be)-Math.round(Pe*be))/be,ut=(Math.round((Ve+Qe)*be)-Math.round(Ve*be))/be;Fe.setProperty("--anchor-width",`${ct}px`),Fe.setProperty("--anchor-height",`${ut}px`)}}),xs(Q=>({element:ee.current||ot(Q.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(Q){const{elements:we,middlewareData:Ie,placement:ie,rects:Fe,y:be}=Q,Pe=$e(ie),Ve=Xe(Pe),je=ee.current,Qe=Ie.arrow?.x||0,ct=Ie.arrow?.y||0,ut=je?.clientWidth||0,He=je?.clientHeight||0,Ge=Qe+ut/2,lt=ct+He/2,yt=Math.abs(Ie.shift?.y||0),q=Fe.reference.height/2,fe=typeof o=="function"?o(Pn(Q,r,I)):o,ke=yt>fe,_e={top:`${Ge}px calc(100% + ${fe}px)`,bottom:`${Ge}px ${-fe}px`,left:`calc(100% + ${fe}px) ${lt}px`,right:`${-fe}px ${lt}px`}[Pe],qe=`${Ge}px ${Fe.reference.y+q-be}px`;return we.floating.style.setProperty("--transform-origin",oe&&Ve==="y"&&ke?qe:_e),{}}},ys,g),K(()=>{!x&&y&&y.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[x,y]);const J=l.useMemo(()=>({elementResize:!a&&typeof ResizeObserver<"u",layoutShift:!a&&typeof IntersectionObserver<"u"}),[a]),{refs:ae,elements:ue,x:Re,y:ge,middlewareData:te,update:se,placement:P,context:C,isPositioned:X,floatingStyles:F}=as({rootContext:y,open:u?x:void 0,placement:G,middleware:Ce,strategy:n,whileElementsMounted:u?void 0:(...Q)=>Mn(...Q,J),nodeId:b,externalTree:v}),{sideX:j,sideY:me}=te.adaptiveOrigin||Wt,Te=X?n:"fixed",De=l.useMemo(()=>{const Q=g?{position:Te,[j]:Re,[me]:ge}:{position:Te,...F};return X||(Q.opacity=0),Q},[g,Te,j,Re,me,ge,F,X]),ve=l.useRef(null);K(()=>{if(!x)return;const Q=H.current,we=typeof Q=="function"?Q():Q,ie=(Ln(we)?we.current:we)||null||null;ie!==ve.current&&(ae.setPositionReference(ie),ve.current=ie)},[x,ae,N,H]),l.useEffect(()=>{if(!x)return;const Q=H.current;typeof Q!="function"&&Ln(Q)&&Q.current!==ve.current&&(ae.setPositionReference(Q.current),ve.current=Q.current)},[x,ae,N,H]),l.useEffect(()=>{if(u&&x&&ue.domReference&&ue.floating)return Mn(ue.domReference,ue.floating,se,J)},[u,x,ue,se,J]);const he=$e(P),ye=gr(r,he,I),Se=xt(P)||"center",Ye=!!te.hide?.referenceHidden;K(()=>{R&&x&&X&&E(he)},[R,x,X,he]);const it=l.useMemo(()=>({position:"absolute",top:te.arrow?.y,left:te.arrow?.x}),[te.arrow]),Oe=te.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:De,arrowStyles:it,arrowRef:ee,arrowUncentered:Oe,side:ye,align:Se,physicalSide:he,anchorHidden:Ye,refs:ae,context:C,isPositioned:X,update:se}),[De,it,ee,Oe,ye,Se,he,Ye,ae,C,X,se])}function Ln(e){return e!=null&&"current"in e}function mr(e){return e==="starting"?Xr:Et}function ws(e,t,{styles:n,transitionStatus:r,props:o,refs:i,hidden:s,inert:c=!1}){const d={...n};return c&&(d.pointerEvents="none"),dt("div",e,{state:t,ref:i,props:[{role:"presentation",hidden:s,style:d},mr(r),o],stateAttributesMapping:tr})}function bs(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 hr(e,t){const n=l.useRef(e),r=de(t);K(()=>{n.current!==e&&r(n.current)},[e,r]),K(()=>{n.current=e},[e])}function vs(e,t){const n=de((i,s)=>{(typeof e=="function"?e():e)||t(s||(Gr?"touch":""))}),{onClick:r,onPointerDown:o}=bs(n);return l.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Ss(e){const[t,n]=l.useState(null),r=vs(e,n);return hr(e,o=>{o&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Cs(e){const[t,n]=l.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Dn({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=l.useRef(e!==void 0),[i,s]=l.useState(t),c=o?e:i,d=l.useCallback(f=>{o||s(f)},[]);return[c,d]}const xr=l.createContext(null),yr=l.createContext(null);function pt(){const e=l.useContext(xr);if(e===null)throw new Error(Lt(60));return e}function Rr(){const e=l.useContext(yr);if(e===null)throw new Error(Lt(61));return e}let Fn=(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 Es={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},Is={disabled:!1,...bt},Ts={valid(e){return e===null?null:e?{[Fn.valid]:""}:{[Fn.invalid]:""}}},As={invalid:void 0,name:void 0,validityData:{state:Es,errors:[],error:"",value:"",initialValue:null},setValidityData:Be,disabled:void 0,touched:bt.touched,setTouched:Be,dirty:bt.dirty,setDirty:Be,filled:bt.filled,setFilled:Be,focused:bt.focused,setFocused:Be,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Is,markedDirtyRef:{current:!1},registerFieldControl:Be,validation:{getValidationProps:(e=Et)=>e,getInputValidationProps:(e=Et)=>e,inputRef:{current:null},commit:async()=>{}}},Ms=l.createContext(As);function mn(e=!0){const t=l.useContext(Ms);if(t.setValidityData===Be&&!e)throw new Error(Lt(28));return t}function Os(e,t,n,r,o=!0){const{registerFieldControl:i}=mn(),s=l.useRef(null);s.current||(s.current=Symbol()),K(()=>{const c=s.current;return!c||!o?void 0:(i(c,{controlRef:e,getValue:r,id:t,value:n}),()=>{i(c,void 0)})},[e,o,r,t,i,n])}const Ps=l.createContext({controlId:void 0,registerControlId:Be,labelId:void 0,setLabelId:Be,messageIds:[],setMessageIds:Be,getDescriptionProps:e=>e});function wr(){return l.useContext(Ps)}function br(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:i}=wr(),s=fo(t),c=n?o:void 0,d=Mt(()=>Symbol("labelable-control")),f=l.useRef(!1),h=l.useRef(t!=null),a=de(()=>{!f.current||i===Be||(f.current=!1,i(d.current,void 0))});return K(()=>{if(i===Be)return;let p;if(n){const u=r?.current;Ae(u)&&u.closest("label")!=null?p=t??null:p=c??s}else if(t!=null)h.current=!0,p=t;else if(h.current)p=s;else{a();return}if(p===void 0){a();return}f.current=!0,i(d.current,p)},[t,r,c,i,n,s,d,a]),l.useEffect(()=>a,[a]),o??s}const Ls=(e,t)=>Object.is(e,t);function ht(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ds(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:ht(t,r,n))}function Ct(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:ht(r,t,n))}function Fs(e,t,n){return e.filter(r=>!ht(t,r,n))}function ln(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function vr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Vs(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(vr(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 Sr(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 ln(e)}function gt(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?ln(e.value):ln(e)}function Cr(e,t,n){function r(){return Sr(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,i=vr(o)?o.flatMap(s=>s.items):o;if(e==null||typeof e!="object"){const s=i.find(c=>c.value===e);return s&&s.label!=null?s.label:r()}if("value"in e){const s=i.find(c=>c&&c.value===e.value);if(s&&s.label!=null)return s.label}}return r()}function ks(e,t,n){return e.reduce((r,o,i)=>(i>0&&r.push(", "),r.push(Me.jsx(l.Fragment,{children:Cr(o,t,n)},i)),r),[])}const W={id:ne(e=>e.id),labelId:ne(e=>e.labelId),modal:ne(e=>e.modal),multiple:ne(e=>e.multiple),items:ne(e=>e.items),itemToStringLabel:ne(e=>e.itemToStringLabel),itemToStringValue:ne(e=>e.itemToStringValue),isItemEqualToValue:ne(e=>e.isItemEqualToValue),value:ne(e=>e.value),hasSelectedValue:ne(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:gt(t,r)!==""}),hasNullItemLabel:ne((e,t)=>t?Vs(e.items):!1),open:ne(e=>e.open),mounted:ne(e=>e.mounted),forceMount:ne(e=>e.forceMount),transitionStatus:ne(e=>e.transitionStatus),openMethod:ne(e=>e.openMethod),activeIndex:ne(e=>e.activeIndex),selectedIndex:ne(e=>e.selectedIndex),isActive:ne((e,t)=>e.activeIndex===t),isSelected:ne((e,t,n)=>{const r=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(i=>ht(n,i,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:ht(n,o,r)}),isSelectedByFocus:ne((e,t)=>e.selectedIndex===t),popupProps:ne(e=>e.popupProps),triggerProps:ne(e=>e.triggerProps),triggerElement:ne(e=>e.triggerElement),positionerElement:ne(e=>e.positionerElement),listElement:ne(e=>e.listElement),popupSide:ne(e=>e.popupSide),scrollUpArrowVisible:ne(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:ne(e=>e.scrollDownArrowVisible),hasScrollArrows:ne(e=>e.hasScrollArrows)},Ns=l.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Be,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Hs(){return l.useContext(Ns)}const et=1;function Er(e,t){return Math.max(0,e-t)}function _s(e,t){if(t<=0)return 0;const n=wt(e,0,t),r=n,o=t-n,i=r<=et,s=o<=et;return i&&s?r<=o?0:t:i?0:s?t:n}function xi(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:i,defaultOpen:s=!1,onOpenChange:c,name:d,form:f,autoComplete:h,disabled:a=!1,readOnly:p=!1,required:u=!1,modal:y=!0,actionsRef:x,inputRef:w,onOpenChangeComplete:m,items:b,multiple:g=!1,itemToStringLabel:R,itemToStringValue:v,isItemEqualToValue:T=Ls,highlightItemOnHover:E=!0,children:D}=e,{clearErrors:k}=Hs(),{setDirty:V,setTouched:$,setFocused:L,shouldValidateOnChange:N,validityData:H,setFilled:B,name:z,disabled:I,validation:A,validationMode:G}=mn(),M=br({id:t}),Z=I||a,re=z??d,[S,O]=Dn({controlled:n,default:g?r??vn:r,name:"Select",state:"value"}),[_,ce]=Dn({controlled:i,default:s,name:"Select",state:"open"}),ee=l.useRef([]),le=l.useRef([]),pe=l.useRef(null),Le=l.useRef(null),Ne=l.useRef(0),Ce=l.useRef(null),Y=l.useRef([]),oe=l.useRef(!1),xe=l.useRef(!1),Ee=l.useRef(null),J=l.useRef(null),ae=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ue=l.useRef(!1),{mounted:Re,setMounted:ge,transitionStatus:te}=nr(_),{openMethod:se,triggerProps:P}=Ss(_),C=Mt(()=>new Zr({id:M,labelId:void 0,modal:y,multiple:g,itemToStringLabel:R,itemToStringValue:v,isItemEqualToValue:T,value:S,open:_,mounted:Re,transitionStatus:te,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,X=U(C,W.activeIndex),F=U(C,W.selectedIndex),j=U(C,W.triggerElement),me=U(C,W.positionerElement),Te=Cs(se),De=se??Te,ve=l.useMemo(()=>g&&Array.isArray(S)&&S.length===0?"":gt(S,v),[g,S,v]),he=l.useMemo(()=>g&&Array.isArray(S)?S.map(q=>gt(q,v)):gt(S,v),[g,S,v]),ye=Ke(C.state.triggerElement),Se=de(()=>he);Os(ye,M,S,Se);const Ye=l.useRef(S),it=g?Array.isArray(S)&&S.length>0:S!=null;K(()=>{S!==Ye.current&&C.set("forceMount",!0)},[C,S]),K(()=>{B(it)},[it,B]),K(function(){const fe=Y.current;let ke;if(g){const _e=Array.isArray(S)?S:[];if(_e.length===0)ke=null;else{const qe=_e[_e.length-1],Rt=Ct(fe,qe,T);ke=Rt===-1?null:Rt}}else{const _e=Ct(fe,S,T);ke=_e===-1?null:_e}ke===null&&(J.current=null),!_&&C.set("selectedIndex",ke)},[it,g,_,S,Y,T,C,J]),hr(S,()=>{k(re),V(S!==H.initialValue),N()?A.commit(S):A.commit(S,!0)});const Oe=de((q,fe)=>{if(c?.(q,fe),!fe.isCanceled&&(ce(q),!q&&(fe.reason===qn||fe.reason===eo)&&($(!0),L(!1),G==="onBlur"&&A.commit(S)),!q&&C.state.activeIndex!==null)){const ke=ee.current[C.state.activeIndex];queueMicrotask(()=>{ke?.setAttribute("tabindex","-1")})}}),Q=de(()=>{ge(!1),C.update({activeIndex:null,openMethod:null}),m?.(!1)});dn({enabled:!x,open:_,ref:pe,onComplete(){_||Q()}}),l.useImperativeHandle(x,()=>({unmount:Q}),[Q]);const we=de((q,fe)=>{o?.(q,fe),!fe.isCanceled&&O(q)}),Ie=de(()=>{const q=C.state.listElement||pe.current;if(!q)return;const fe=Er(q.scrollHeight,q.clientHeight),ke=_s(q.scrollTop,fe),_e=ke>0,qe=ke<fe;C.state.scrollUpArrowVisible!==_e&&C.set("scrollUpArrowVisible",_e),C.state.scrollDownArrowVisible!==qe&&C.set("scrollDownArrowVisible",qe)}),ie=dr({open:_,onOpenChange:Oe,elements:{reference:j,floating:me}}),Fe=vo(ie,{enabled:!p&&!Z,event:"mousedown"}),be=po(ie),Pe=ps(ie,{enabled:!p&&!Z,listRef:ee,activeIndex:X,selectedIndex:F,disabledIndices:vn,onNavigate(q){q===null&&!_||C.set("activeIndex",q)},focusItemOnHover:E}),Ve=gs(ie,{enabled:!p&&!Z&&(_||!g),listRef:le,activeIndex:X,selectedIndex:F,onMatch(q){_?C.set("activeIndex",q):we(Y.current[q],We("none"))},onTyping(q){oe.current=q}}),je=l.useMemo(()=>{const q=cn(Ve.reference,Pe.reference,be.reference,Fe.reference,P);return M&&(q.id=M),q},[Fe.reference,Ve.reference,Pe.reference,be.reference,P,M]),Qe=l.useMemo(()=>cn(go,Ve.floating,Pe.floating,be.floating),[Ve.floating,Pe.floating,be.floating]),ct=Pe.item??Et;mo(()=>{C.update({popupProps:Qe,triggerProps:je})}),K(()=>{C.update({id:M,modal:y,multiple:g,value:S,open:_,mounted:Re,transitionStatus:te,popupProps:Qe,triggerProps:je,items:b,itemToStringLabel:R,itemToStringValue:v,isItemEqualToValue:T,openMethod:De})},[C,M,y,g,S,_,Re,te,Qe,je,b,R,v,T,De]);const ut=l.useMemo(()=>({store:C,name:re,required:u,disabled:Z,readOnly:p,multiple:g,highlightItemOnHover:E,setValue:we,setOpen:Oe,listRef:ee,popupRef:pe,scrollHandlerRef:Le,handleScrollArrowVisibility:Ie,scrollArrowsMountedCountRef:Ne,itemProps:ct,events:ie.context.events,valueRef:Ce,valuesRef:Y,labelsRef:le,typingRef:oe,selectionRef:ae,firstItemTextRef:Ee,selectedItemTextRef:J,validation:A,onOpenChangeComplete:m,keyboardActiveRef:xe,alignItemWithTriggerActiveRef:ue,initialValueRef:Ye}),[C,re,u,Z,p,g,E,we,Oe,ct,ie.context.events,A,m,Ie]),He=Gn(w,A.inputRef),Ge=g&&Array.isArray(S)&&S.length>0,lt=g?void 0:re,yt=l.useMemo(()=>!g||!Array.isArray(S)||!re?null:S.map(q=>{const fe=gt(q,v);return Me.jsx("input",{type:"hidden",form:f,name:re,value:fe},fe)}),[g,S,f,re,v]);return Me.jsx(xr.Provider,{value:ut,children:Me.jsxs(yr.Provider,{value:ie,children:[D,Me.jsx("input",{...A.getInputValidationProps({onFocus(){C.state.triggerElement?.focus({focusVisible:!0})},onChange(q){if(q.nativeEvent.defaultPrevented||Z||p){q.preventBaseUIHandler?.();return}const fe=q.currentTarget.value,ke=We(pn,q.nativeEvent);function _e(){if(g)return;const qe=Y.current.find(Rt=>gt(Rt,v).toLowerCase()===fe.toLowerCase()||Sr(Rt,R).toLowerCase()===fe.toLowerCase());qe!=null&&(V(qe!==H.initialValue),we(qe,ke),N()&&A.commit(qe))}C.set("forceMount",!0),queueMicrotask(_e)}}),id:M&&lt==null?`${M}-hidden-input`:void 0,form:f,name:lt,autoComplete:h,value:ve,disabled:Z,required:u&&!Ge,readOnly:p,ref:He,style:re?Jr:Qr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),yt]})})}function Bs(e,t){return e??t}function Ws(e){const t=e.getBoundingClientRect(),n=ze(e),r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const s=parseFloat(r.width)||0,c=parseFloat(r.height)||0,d=parseFloat(o.width)||0,f=parseFloat(o.height)||0,h=Math.max(t.width,s,d),a=Math.max(t.height,c,f),p=h-t.width,u=a-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-u/2,bottom:t.bottom+u/2}}const kt=2,Us=400,$s={...ho,...Ts,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},yi=l.forwardRef(function(t,n){const{render:r,className:o,id:i,disabled:s=!1,nativeButton:c=!0,style:d,...f}=t,{setTouched:h,setFocused:a,validationMode:p,state:u,disabled:y}=mn(),{labelId:x}=wr(),{store:w,setOpen:m,selectionRef:b,validation:g,readOnly:R,required:v,alignItemWithTriggerActiveRef:T,disabled:E,keyboardActiveRef:D}=pt(),k=y||E||s,V=U(w,W.open),$=U(w,W.mounted),L=U(w,W.value),N=U(w,W.triggerProps),H=U(w,W.positionerElement),B=U(w,W.listElement),z=U(w,W.popupSide),I=U(w,W.id),A=U(w,W.labelId),G=U(w,W.hasSelectedValue),M=$&&H?z:null,Z=i??I,re=Bs(x,A);br({id:Z});const S=Ke(H),O=l.useRef(null),{getButtonProps:_,buttonRef:ce}=Jn({disabled:k,native:c}),ee=de(oe=>{w.set("triggerElement",oe)}),le=Gn(n,O,ce,ee),pe=St(),Le=St(),Ne=St();l.useEffect(()=>{if(V)return Ne.start(Us,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{Ne.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Le.clear()},[V,b,Le,Ne]);const Ce=cn(N,{id:Z,role:"combobox","aria-expanded":V?"true":"false","aria-haspopup":"listbox","aria-controls":V?B?.id??jn(H)?.id:void 0,"aria-labelledby":re,"aria-readonly":R||void 0,"aria-required":v||void 0,tabIndex:k?-1:0,ref:le,onFocus(oe){a(!0),V&&T.current&&m(!1,We(pn,oe.nativeEvent)),pe.start(0,()=>{w.set("forceMount",!0)})},onBlur(oe){at(H,oe.relatedTarget)||(h(!0),a(!1),p==="onBlur"&&g.commit(L))},onPointerMove(){D.current=!1},onKeyDown(){D.current=!0},onMouseDown(oe){if(V)return;const xe=ot(oe.currentTarget);function Ee(J){if(!O.current)return;const ae=J.target;if(at(O.current,ae)||at(S.current,ae)||ae===O.current)return;const ue=Ws(O.current);J.clientX>=ue.left-kt&&J.clientX<=ue.right+kt&&J.clientY>=ue.top-kt&&J.clientY<=ue.bottom+kt||m(!1,We(to,J))}Le.start(0,()=>{xe.addEventListener("mouseup",Ee,{once:!0})})}},g.getValidationProps,f,_);Ce.role="combobox";const Y={...u,open:V,disabled:k,value:L,readOnly:R,popupSide:M,placeholder:!G};return dt("button",t,{ref:[n,O],state:Y,stateAttributesMapping:$s,props:Ce})}),zs={value:()=>null},Ri=l.forwardRef(function(t,n){const{className:r,render:o,children:i,placeholder:s,style:c,...d}=t,{store:f,valueRef:h}=pt(),a=U(f,W.value),p=U(f,W.items),u=U(f,W.itemToStringLabel),y=U(f,W.hasSelectedValue),x=!y&&s!=null&&i==null,w=U(f,W.hasNullItemLabel,x),m={value:a,placeholder:!y};let b=null;return typeof i=="function"?b=i(a):i!=null?b=i:!y&&s!=null&&!w?b=s:Array.isArray(a)?b=ks(a,p,u):b=Cr(a,p,u),dt("span",t,{state:m,ref:[n,h],props:[{children:b},d],stateAttributesMapping:zs})}),Ys=l.createContext(void 0),wi=l.forwardRef(function(t,n){const{store:r}=pt(),o=U(r,W.mounted),i=U(r,W.forceMount);return o||i?Me.jsx(Ys.Provider,{value:!0,children:Me.jsx(no,{ref:n,...t})}):null}),Ir=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function js(){return l.useContext(Ir)}function qs(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,i=de(o),s=l.useRef(0),c=Mt(Xs).current,d=Mt(Ks).current,[f,h]=l.useState(0),a=l.useRef(f),p=de((m,b)=>{d.set(m,b??null),a.current+=1,h(a.current)}),u=de(m=>{d.delete(m),a.current+=1,h(a.current)}),y=l.useMemo(()=>{const m=new Map;return Array.from(d.keys()).filter(g=>g.isConnected).sort(Gs).forEach((g,R)=>{const v=d.get(g)??{};m.set(g,{...v,index:R})}),m},[d,f]);K(()=>{if(typeof MutationObserver!="function"||y.size===0)return;const m=new MutationObserver(b=>{const g=new Set,R=v=>g.has(v)?g.delete(v):g.add(v);b.forEach(v=>{v.removedNodes.forEach(R),v.addedNodes.forEach(R)}),g.size===0&&(a.current+=1,h(a.current))});return y.forEach((b,g)=>{g.parentElement&&m.observe(g.parentElement,{childList:!0})}),()=>{m.disconnect()}},[y]),K(()=>{a.current===f&&(n.current.length!==y.size&&(n.current.length=y.size),r&&r.current.length!==y.size&&(r.current.length=y.size),s.current=y.size),i(y)},[i,y,n,r,f]),K(()=>()=>{n.current=[]},[n]),K(()=>()=>{r&&(r.current=[])},[r]);const x=de(m=>(c.add(m),()=>{c.delete(m)}));K(()=>{c.forEach(m=>m(y))},[c,y]);const w=l.useMemo(()=>({register:p,unregister:u,subscribeMapChange:x,elementsRef:n,labelsRef:r,nextIndexRef:s}),[p,u,x,n,r,s]);return Me.jsx(Ir.Provider,{value:w,children:t})}function Ks(){return new Map}function Xs(){return new Set}function Gs(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 Tr=l.createContext(void 0);function Js(){const e=l.useContext(Tr);if(!e)throw new Error(Lt(59));return e}function jt(e,t){e&&Object.assign(e.style,t)}const Qs={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Zs=20;function ei(e,t,n,r){const[o,i]=l.useState(!1);K(()=>{if(!e||!t||n==null){i(!1);return}const s=ot(n).documentElement.clientWidth,c=n.offsetWidth;i(s>0&&c>0&&c>=s-Zs)},[e,t,n]),xo(e&&(!t||o),r)}const ti={position:"fixed"},bi=l.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:i,render:s,side:c="bottom",align:d="center",sideOffset:f=0,alignOffset:h=0,collisionBoundary:a="clipping-ancestors",collisionPadding:p,arrowPadding:u=5,sticky:y=!1,disableAnchorTracking:x,alignItemWithTrigger:w=!0,collisionAvoidance:m=ro,style:b,...g}=t,{store:R,listRef:v,labelsRef:T,alignItemWithTriggerActiveRef:E,selectedItemTextRef:D,valuesRef:k,initialValueRef:V,popupRef:$,setValue:L}=pt(),N=Rr(),H=U(R,W.open),B=U(R,W.mounted),z=U(R,W.modal),I=U(R,W.value),A=U(R,W.openMethod),G=U(R,W.positionerElement),M=U(R,W.triggerElement),Z=U(R,W.isItemEqualToValue),re=U(R,W.transitionStatus),S=l.useRef(null),O=l.useRef(null),[_,ce]=l.useState(w),ee=B&&_&&A!=="touch";!B&&_!==w&&ce(w),K(()=>{B||(W.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),W.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,B]),l.useImperativeHandle(E,()=>ee),ei((ee||z)&&H,A==="touch",G,M);const le=Rs({anchor:r,floatingRootContext:N,positionMethod:o,mounted:B,side:c,sideOffset:f,align:d,alignOffset:h,arrowPadding:u,collisionBoundary:a,collisionPadding:p,sticky:y,disableAnchorTracking:x??ee,collisionAvoidance:m,keepMounted:!0}),pe=ee?"none":le.side,Le=ee?ti:le.positionerStyles,Ne={open:H,side:pe,align:le.align,anchorHidden:le.anchorHidden};K(()=>{R.set("popupSide",le.side)},[R,le.side]);const Ce=de(J=>{R.set("positionerElement",J)}),Y=ws(t,Ne,{styles:Le,transitionStatus:re,props:g,refs:[n,Ce],hidden:!B,inert:!H}),oe=l.useRef(0),xe=de(J=>{if(J.size===0&&oe.current===0||k.current.length===0)return;const ae=oe.current;if(oe.current=J.size,J.size===ae)return;const ue=We(pn);if(ae!==0&&!R.state.multiple&&I!==null&&Ct(k.current,I,Z)===-1){const ge=V.current,se=ge!=null&&Ct(k.current,ge,Z)!==-1?ge:null;L(se,ue),se===null&&(R.set("selectedIndex",null),D.current=null)}if(ae!==0&&R.state.multiple&&Array.isArray(I)){const Re=te=>Ct(k.current,te,Z)!==-1,ge=I.filter(te=>Re(te));(ge.length!==I.length||ge.some(te=>!Ds(I,te,Z)))&&(L(ge,ue),ge.length===0&&(R.set("selectedIndex",null),D.current=null))}if(H&&ee){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Re={height:""};jt(G,Re),jt($.current,Re)}}),Ee=l.useMemo(()=>({...le,side:pe,alignItemWithTriggerActive:ee,setControlledAlignItemWithTrigger:ce,scrollUpArrowRef:S,scrollDownArrowRef:O}),[le,pe,ee,ce]);return Me.jsx(qs,{elementsRef:v,labelsRef:T,onMapChange:xe,children:Me.jsxs(Tr.Provider,{value:Ee,children:[B&&z&&Me.jsx(yo,{inert:oo(!H),cutout:M}),Y]})})}),Nt="base-ui-disable-scrollbar",Vn={className:Nt,getElement(e){return Me.jsx("style",{nonce:e,href:Nt,precedence:"base-ui:low",children:`.${Nt}{scrollbar-width:none}.${Nt}::-webkit-scrollbar{display:none}`})}},ni=l.createContext(void 0);function ri(e){return l.useContext(ni)}const oi=l.createContext(void 0),si={disableStyleElements:!1};function ii(){return l.useContext(oi)??si}const ci={...tr,...Qn},vi=l.forwardRef(function(t,n){const{render:r,className:o,style:i,finalFocus:s,...c}=t,{store:d,popupRef:f,onOpenChangeComplete:h,setOpen:a,valueRef:p,firstItemTextRef:u,selectedItemTextRef:y,keyboardActiveRef:x,multiple:w,handleScrollArrowVisibility:m,scrollHandlerRef:b,listRef:g,highlightItemOnHover:R}=pt(),{side:v,align:T,alignItemWithTriggerActive:E,isPositioned:D,setControlledAlignItemWithTrigger:k,scrollDownArrowRef:V,scrollUpArrowRef:$}=Js(),L=ri()!=null,N=Rr(),H=pr(),{nonce:B,disableStyleElements:z}=ii(),I=U(d,W.id),A=U(d,W.open),G=U(d,W.mounted),M=U(d,W.popupProps),Z=U(d,W.transitionStatus),re=U(d,W.triggerElement),S=U(d,W.positionerElement),O=U(d,W.listElement),_=l.useRef(!1),ce=l.useRef(!1),ee=l.useRef({}),le=Ut(),pe=de(Y=>{if(!S||!f.current||!ce.current)return;if(_.current||!E){m();return}const oe=S.style.top==="0px",xe=S.style.bottom==="0px";if(!oe&&!xe){m();return}const Ee=Nn(S),J=vt(S.getBoundingClientRect().height,"y",Ee),ae=ot(S),ue=getComputedStyle(S),Re=parseFloat(ue.marginTop),ge=parseFloat(ue.marginBottom),te=kn(getComputedStyle(f.current)),se=Math.min(ae.documentElement.clientHeight-Re-ge,te),P=Y.scrollTop,C=Ht(Y);let X=0,F=null,j=!1,me=!1;const Te=ye=>{S.style.height=`${ye}px`},De=(ye,Se)=>{const Ye=wt(ye,0,se-J);Ye>0&&Te(J+Ye),Y.scrollTop=Se,se-(J+Ye)<=et&&(_.current=!0),m()},ve=oe?C-P:P,he=Math.min(J+ve,se);if(X=he,ve<=et){De(ve,oe?C:0);return}if(se-he>et)oe?me=!0:F=0;else if(j=!0,xe&&P<C){const ye=J+ve-se;F=P-(ve-ye)}if(X=Math.ceil(X),X!==0&&Te(X),me||F!=null){const ye=Ht(Y),Se=me?ye:wt(F,0,ye);Math.abs(Y.scrollTop-Se)>et&&(Y.scrollTop=Se)}(j||X>=se-et)&&(_.current=!0),m()});l.useImperativeHandle(b,()=>pe,[pe]),dn({open:A,ref:f,onComplete(){A&&h?.(!0)}});const Le={open:A,transitionStatus:Z,side:v,align:T};K(()=>{!S||!f.current||Object.keys(ee.current).length||(ee.current={top:S.style.top||"0",left:S.style.left||"0",right:S.style.right,height:S.style.height,bottom:S.style.bottom,minHeight:S.style.minHeight,maxHeight:S.style.maxHeight,marginTop:S.style.marginTop,marginBottom:S.style.marginBottom})},[f,S]),K(()=>{A||E||(ce.current=!1,_.current=!1,jt(S,ee.current))},[A,E,S,f]),K(()=>{const Y=f.current;if(!A||!re||!S||!Y||E&&!D||d.state.transitionStatus==="ending")return;if(!E){ce.current=!0,le.request(m),Y.style.removeProperty("--transform-origin");return}const oe=li(Y);Y.style.removeProperty("--transform-origin");try{let xe=y.current;xe?.isConnected||(xe=!W.hasSelectedValue(d.state)&&u.current?.isConnected?u.current:null);const Ee=p.current,J=getComputedStyle(S),ae=getComputedStyle(Y),ue=ot(re),Re=ze(S),ge=Nn(re),te=_t(re.getBoundingClientRect(),ge),se=_t(S.getBoundingClientRect(),ge),P=te.height,C=O||Y,X=C.scrollHeight,F=parseFloat(ae.borderBottomWidth),j=parseFloat(J.marginTop)||10,me=parseFloat(J.marginBottom)||10,Te=parseFloat(J.minHeight)||100,De=kn(ae),ve=5,he=5,ye=20,Se=ue.documentElement.clientHeight-j-me,Ye=ue.documentElement.clientWidth,it=Se-te.bottom+P;let Oe,Q=H==="rtl"?te.right-se.width:te.left,we=0;if(xe&&Ee){const He=_t(Ee.getBoundingClientRect(),ge);Oe=_t(xe.getBoundingClientRect(),ge),Q=se.left+(H==="rtl"?He.right-Oe.right:He.left-Oe.left);const Ge=He.top-te.top+He.height/2;we=Oe.top-se.top+Oe.height/2-Ge}const Ie=it+we+me+F;let ie=Math.min(Se,Ie);const Fe=Se-j-me,be=Ie-ie,Pe=Ye-he;S.style.left=`${wt(Q,ve,Pe-se.width)}px`,S.style.height=`${ie}px`,S.style.maxHeight="auto",S.style.marginTop=`${j}px`,S.style.marginBottom=`${me}px`,Y.style.height="100%";const Ve=Ht(C),je=be>=Ve-et;je&&(ie=Math.min(Se,se.height)-(be-Ve));const Qe=te.top<ye||te.bottom>Se-ye||Math.ceil(ie)+et<Math.min(X,Te),ct=(Re.visualViewport?.scale??1)!==1&&so;if(Qe||ct){ce.current=!0,jt(S,ee.current),k(!1);return}const ut=Math.max(Te,ie);if(je){const He=Math.max(0,Se-Ie);S.style.top=se.height>=Fe?"0":`${He}px`,S.style.height=`${ie}px`,C.scrollTop=Ht(C)}else S.style.bottom="0",C.scrollTop=be;if(Oe){const He=se.top,Ge=se.height,lt=Oe.top+Oe.height/2,yt=Ge>0?(lt-He)/Ge*100:50,q=wt(yt,0,100);Y.style.setProperty("--transform-origin",`50% ${q}%`)}(ut===Se||ie>=De)&&(_.current=!0),m(),R&&d.state.selectedIndex===null&&d.state.activeIndex===null&&g.current[0]!=null&&d.set("activeIndex",0),ce.current=!0}finally{oe()}},[d,A,S,re,p,u,y,f,m,E,k,le,V,$,O,g,R,H,D]),l.useEffect(()=>{if(!E||!S||!A)return;const Y=ze(S);function oe(xe){a(!1,We(co,xe))}return io(Y,"resize",oe)},[a,E,S,A]);const Ne={...O?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":w||void 0,id:`${I}-list`},onKeyDown(Y){x.current=!0,L&&wo.has(Y.key)&&Y.stopPropagation()},onMouseMove(){x.current=!1},onScroll(Y){O||pe(Y.currentTarget)},...E&&{style:O?{height:"100%"}:Qs}},Ce=dt("div",t,{ref:[n,f],state:Le,stateAttributesMapping:ci,props:[M,Ne,mr(Z),{className:!O&&E?Vn.className:void 0},c]});return Me.jsxs(l.Fragment,{children:[!z&&Vn.getElement(B),Me.jsx(Ro,{context:N,modal:!1,disabled:!G,returnFocus:s,restoreFocus:!0,children:Ce})]})});function kn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ht(e){return Er(e.scrollHeight,e.clientHeight)}function Nn(e){return ar.getScale(e)}function vt(e,t,n){return e/n[t]}function _t(e,t){return Tt({x:vt(e.x,"x",t),y:vt(e.y,"y",t),width:vt(e.width,"x",t),height:vt(e.height,"y",t)})}const Hn=[["transform","none"],["scale","1"],["translate","0 0"]];function li(e){const{style:t}=e,n={};for(const[r,o]of Hn)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Hn){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}let Ar=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function ai(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:i}=e,{register:s,unregister:c,subscribeMapChange:d,elementsRef:f,labelsRef:h,nextIndexRef:a}=js(),p=l.useRef(-1),[u,y]=l.useState(i??(o===Ar.GuessFromOrder?()=>{if(p.current===-1){const m=a.current;a.current+=1,p.current=m}return p.current}:-1)),x=l.useRef(null),w=l.useCallback(m=>{if(x.current=m,u!==-1&&m!==null&&(f.current[u]=m,h)){const b=t!==void 0;h.current[u]=b?t:r?.current?.textContent??m.textContent}},[u,f,h,t,r]);return K(()=>{if(i!=null)return;const m=x.current;if(m)return s(m,n),()=>{c(m)}},[i,s,c,n]),K(()=>{if(i==null)return d(m=>{const b=x.current?m.get(x.current)?.index:null;b!=null&&y(b)})},[i,d,y]),l.useMemo(()=>({ref:w,index:u}),[u,w])}const Mr=l.createContext(void 0);function hn(){const e=l.useContext(Mr);if(!e)throw new Error(Lt(57));return e}const Si=l.memo(l.forwardRef(function(t,n){const{render:r,className:o,style:i,value:s=null,label:c,disabled:d=!1,nativeButton:f=!1,...h}=t,a=l.useRef(null),p=ai({label:c,textRef:a,indexGuessBehavior:Ar.GuessFromOrder}),{store:u,itemProps:y,setOpen:x,setValue:w,selectionRef:m,typingRef:b,valuesRef:g,multiple:R,selectedItemTextRef:v}=pt(),T=U(u,W.isActive,p.index),E=U(u,W.isSelected,p.index,s),D=U(u,W.isSelectedByFocus,p.index),k=U(u,W.isItemEqualToValue),V=p.index,$=V!==-1,L=l.useRef(null);K(()=>{if(!$)return;const O=g.current;return O[V]=s,()=>{delete O[V]}},[$,V,s,g]),K(()=>{if(!$)return;const O=u.state.value;let _=O;R&&Array.isArray(O)&&O.length>0&&(_=O[O.length-1]),_!==void 0&&ht(s,_,k)&&(u.set("selectedIndex",V),a.current&&(v.current=a.current))},[$,V,R,k,u,s,v]);const N=l.useRef(null),H=l.useRef("mouse"),B=l.useRef(!1),{getButtonProps:z,buttonRef:I}=Jn({disabled:d,focusableWhenDisabled:!0,native:f,composite:!0}),A={disabled:d,selected:E,highlighted:T};function G(O){const _=u.state.value;if(R){const ce=Array.isArray(_)?_:[],ee=E?Fs(ce,s,k):[...ce,s];w(ee,We(en,O))}else w(s,We(en,O)),x(!1,We(en,O))}function M(){m.current.dragY=0}const Z={role:"option","aria-selected":E,tabIndex:T?0:-1,onKeyDown(O){N.current=O.key,u.set("activeIndex",V),O.key===" "&&b.current&&O.preventDefault()},onClick(O){const _=O.type==="click"&&H.current!=="touch",ce=O.nativeEvent.pointerType,ee=_&&Kn(O.nativeEvent)&&(ce!==void 0||T),le=_&&!ee&&!B.current;B.current=!1,!(O.type==="keydown"&&N.current===null)&&(d||O.type==="keydown"&&N.current===" "&&b.current||le||(N.current=null,G(O.nativeEvent)))},onPointerEnter(O){H.current=O.pointerType},onPointerMove(O){if(O.pointerType==="mouse"&&O.buttons===1){const _=m.current;_.dragY+=O.movementY,_.dragY**2>=64&&(_.allowUnselectedMouseUp=!0)}},onPointerDown(O){H.current=O.pointerType,B.current=!0,M()},onMouseUp(){if(M(),d||H.current==="touch"||B.current)return;const O=!m.current.allowSelectedMouseUp&&E,_=!m.current.allowUnselectedMouseUp&&!E;O||_||(B.current=!0,L.current?.click(),B.current=!1)}},re=dt("div",t,{ref:[I,n,p.ref,L],state:A,props:[y,Z,h,z]}),S=l.useMemo(()=>({selected:E,index:V,textRef:a,selectedByFocus:D,hasRegistered:$}),[E,V,a,D,$]);return Me.jsx(Mr.Provider,{value:S,children:re})})),Ci=l.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=hn();return r||o?Me.jsx(ui,{...t,ref:n}):null}),ui=l.memo(l.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:i,...s}=e,{selected:c}=hn(),d=l.useRef(null),{transitionStatus:f,setMounted:h}=nr(c),p=dt("span",e,{ref:[t,d],state:{selected:c,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:Qn});return dn({open:c,ref:d,onComplete(){c||h(!1)}}),p})),Ei=l.memo(l.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:i,hasRegistered:s}=hn(),{firstItemTextRef:c,selectedItemTextRef:d}=pt(),{render:f,className:h,style:a,...p}=t,u=l.useCallback(x=>{x&&(s&&r===0&&(c.current=x),s&&i&&(d.current=x))},[c,d,r,i,s]);return dt("div",t,{ref:[u,n,o],props:p})}));export{Vn as A,mi as C,Qs as L,xi as S,Hs as a,mn as b,wr as c,Dn as d,Os as e,Ts as f,hr as g,yi as h,Ri as i,wi as j,bi as k,vi as l,Si as m,Ei as n,Ci as o,vo as p,vs as q,Rs as r,W as s,ei as t,pt as u,ws as v,hi as w,ri as x,mr as y,Js as z};
@@ -0,0 +1 @@
1
+ import{c as y,r as l,ao as X,ai as q,aL as L,j as n,m as O,U as ee,V as v,G as s,Y as te,av as ne,aM as ae,az as ie,aA as se,aB as P,aN as oe,aO as re,W as le,R as ce,S as ue,T as de,a2 as ge,aP as he,aQ as pe,aR as me,aS as be,K as fe,aT as xe,aU as ye,aV as ve,aW as je,aX as ke,aY as Ne,aZ as Se,ag as we}from"./main-9Ze1SUIZ.js";import{b as G,l as A,u as Ce,L as E}from"./use-limits-display-prefs-Ehri95OP.js";import{S as j,T as k,a as b,b as _,u as T}from"./use-native-settings-BWqG5RDr.js";import{C as Le}from"./useScrollLock-BcLeWqWK.js";import{u as Ge}from"./useCurrency-DQmyhw3i.js";import{S as D}from"./Select-BOxMknxo.js";import{I as Ae}from"./info-CGx4zWQF.js";import{D as Ee}from"./download-kFiot71R.js";import"./Card-DpjFlMHF.js";import"./SelectItemText-B0SL3Wb5.js";const Ie=[["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"}]],Oe=y("activity",Ie);const Pe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],_e=y("copy",Pe);const Te=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],De=y("grip-vertical",Te);const Me=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Ue=y("languages",Me);const Re=[["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"}]],Fe=y("log-out",Re);const He=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],$e=y("pencil",He),Be=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach(Be);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const ze=l.createContext(null);function Ve(){const e=l.useRef(!1);return X(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function We(){const e=Ve(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>q.postRender(i),[i]),t]}const M=e=>e===!0,Ze=e=>M(e===!0)||e==="id",Ke=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(ze),[r,c]=We(),u=l.useRef(null),g=i.id||o;u.current===null&&(Ze(a)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:M(a)&&i.group||I()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:h,children:e})},Ye="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Je({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:v("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:v("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Qe({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},m=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},x=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Ke,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const p=a[d]!==!1,N=r===d;return n.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:f,onDrop:x,className:v("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[n.jsx(De,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),G(d)?n.jsx(ee,{provider:G(d),size:18,className:v("pointer-events-none",Ye)}):null,n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:A(d)}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx(Je,{checked:p,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${A(d)}`})})]},d)})})})}function Xe(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function qe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function et(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function tt(e,t,a){const[i,o]=l.useState(()=>ne()),r=t&&a&&ae(),c=l.useCallback(async()=>{const u=!i;if(ie(u),o(u),!!u)try{await se(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function nt(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[f,x]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[H,C]=l.useState(""),[$,B]=l.useState(""),[z,V]=l.useState(!1),[W,Z]=l.useState(null),K=l.useMemo(()=>Xe(e),[e]),Y=l.useMemo(()=>qe(e),[e]),J=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:h,displayName:K,editingGithub:z,editingName:f,email:Y,githubError:W,githubInput:$,githubUrl:H,loadSetters:Q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:V,setEditingName:x,setGithubError:Z,setGithubInput:B,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:N,userId:J}}function at(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await P({getAccessToken:e});if(!i||!o)return;const r=await oe({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function it(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await P({getAccessToken:e});if(!c)return!1;const u=await re({accessToken:c,...a});return r?.(u),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function st(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function ot(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function rt(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function lt(e,t,a){const i=l.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await t({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),a?.()}})},[t,e,a]),o=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function ct(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=et(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function ut(){const e=te(),t=nt(e.user),a=tt(e.getAccessToken,e.enabled,e.signedIn);at(e.getAccessToken,e.signedIn,t.loadSetters);const i=it(e.getAccessToken,t),o=rt(t,i),r=lt(t,i,e.refreshDisplayName),c=ct(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:t.userId,name:st(t,{...o,...r}),github:ot(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function U({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),n.jsx("button",{type:"button",onClick:t,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function dt({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),n.jsx(U,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function gt({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&a(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),n.jsx(U,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function R({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function F({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function ht({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function pt({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:f,startEditingName:x}=e,d=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(F,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(dt,{nameInput:u,setEditingName:m,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:n.jsx(ht,{name:e})})}function mt({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f,showGithubOn:x,startEditingGithub:d}=e;return n.jsx(F,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(gt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{label:s("settings.account.edit"),onClick:d}),n.jsx(k,{checked:x,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function bt(){const{openLoginModal:e}=le();return n.jsx(j,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function ft({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(pt,{name:e}),n.jsx(mt,{github:t})]})}function xt(){const e=ut();return e.enabled?e.signedIn?n.jsxs(j,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(vt,{onSignOut:e.signOut}),children:[n.jsx(yt,{userId:e.userId}),n.jsx(jt,{settings:e}),n.jsx(kt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(Nt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(bt,{}):null}function yt({userId:e}){const[t,a]=ce.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),a(!0),globalThis.setTimeout(()=>a(!1),1200)}catch{a(!1)}};return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),n.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":s("settings.account.copyUserId"),children:[t?n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}):n.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t?s("settings.account.copied"):s("settings.account.copy")]})]})}function vt({onSignOut:e}){return n.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[n.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function jt({settings:e}){return e.showLocalCloudSync?n.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function kt({checked:e,disabled:t,onChange:a}){return n.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function Nt({visible:e,name:t,github:a}){return n.jsx(ue,{initial:!1,children:e?n.jsx(O.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:n.jsx(ft,{name:t,github:a})},"public-profile-fields"):null})}function St(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:he},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:pe},{value:"system",label:s("settings.appearance.theme.system"),Icon:me}]}function wt(){return[{value:xe,label:s("settings.appearance.language.system")},{value:ye,label:s("settings.appearance.language.english")},{value:ve,label:s("settings.appearance.language.chinese")},{value:je,label:s("settings.appearance.language.traditional_chinese")},{value:ke,label:s("settings.appearance.language.japanese")},{value:Ne,label:s("settings.appearance.language.korean")}]}function Ct(e){if(!e)return null;try{const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString()}catch{return null}}function Lt(e,t){const a=s(`settings.appearance.currency.rate_source.${e}`),i=Ct(t),o=i?s("settings.appearance.currency.rate_updated",{when:i}):s("settings.appearance.currency.rate_never");return`${a} · ${o}`}function Gt({locale:e,setLocale:t}){const a=wt();return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:n.jsx(Ue,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function At({currency:e,setCurrency:t}){const a=be().map(i=>({value:i.code,label:s(i.labelKey)}));return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Et({currency:e,rate:t,rateSource:a,rateFetchedAt:i}){if(e===fe)return n.jsx(n.Fragment,{children:s("settings.appearance.currency.hint")});const o=Lt(a,i);return n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{children:`1 USD = ${t.toFixed(4)} ${e}`}),n.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:n.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function It(){const{theme:e,setTheme:t}=de(),{locale:a,setLocale:i}=ge(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ge();return n.jsxs(j,{title:s("settings.section.appearance"),children:[n.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(_,{options:St(),value:e,onChange:t})}),n.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(Gt,{locale:a,setLocale:i})}),n.jsx(b,{label:s("settings.appearance.currency.label"),hint:n.jsx(Et,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:n.jsx(At,{currency:o,setCurrency:g})})]})}function Ot(){const{available:e,settings:t,setSetting:a,runAction:i}=T();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,u=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(j,{title:s("settings.section.menubar"),children:[r?n.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Se,{className:v("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Pt(){const{available:e,settings:t,runAction:a}=T(),i=e&&t?.version;return n.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[i?n.jsxs(n.Fragment,{children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),n.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,n.jsxs("a",{href:we,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[n.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function _t({prefs:e}){return n.jsx(_,{options:[{value:E.USED,label:s("limits.settings.display_mode_used")},{value:E.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Vt(){const e=Ce();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(It,{}),n.jsx(Ot,{}),n.jsx(xt,{}),n.jsx(j,{title:s("settings.section.limits"),action:n.jsx(_t,{prefs:e}),children:n.jsx(Qe,{prefs:e})})]}),n.jsx(Pt,{})]})})})}export{Vt as SettingsPage};
@@ -0,0 +1 @@
1
+ import{c as Oe,r as n,a as ea,j as e,M as U,V as W,b2 as rt,X as Se,G as r,b3 as da,b4 as _a,b5 as st,u as it,b6 as pa,b7 as nt,b8 as ot,b9 as lt,ba as ya,bb as dt,bc as ct,b as ut,bd as gt,be as mt,bf as xt,S as ht,e as pt,m as fa,ad as yt,I as ft,U as ye,bg as bt,bh as kt,bi as wt,bj as vt,bk as jt,bl as Nt,i as Ct,aZ as St,bm as ca,R as _t,bn as Pt,bo as ba,bp as Ce,bq as ka,br as wa,bs as Rt,bt as va,bu as ja,bv as Lt,bw as It}from"./main-9Ze1SUIZ.js";import{L as $t}from"./LocalOnlyNotice-BCy18fW4.js";import{C as Dt}from"./Card-DpjFlMHF.js";import{u as Et,D as Mt,a as Bt,b as Tt,c as Ot,d as Ut,e as zt}from"./DialogTitle-BMKzpys0.js";import{u as Xe,t as Ft,a as At,C as _e}from"./useScrollLock-BcLeWqWK.js";import{I as Pa}from"./info-CGx4zWQF.js";import{u as Vt}from"./useCurrency-DQmyhw3i.js";import{L as ae,P as Ra,a as La,b as Ia,c as $a,d as Da,C as Kt}from"./PopoverPopup-CpIlpO0j.js";import{u as qt,s as Ht,f as Ea,a as Gt,b as Wt,c as Qt,d as Xt,e as Yt,g as Jt,S as Ma,h as Ba,i as Ta,C as ma,j as Oa,k as Ua,l as za,m as Ye,n as Je,o as Ze}from"./SelectItemText-B0SL3Wb5.js";import{D as Fa}from"./download-kFiot71R.js";import"./arrow-up-right-Brwh94cN.js";const Zt=[["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"}]],Aa=Oe("circle-arrow-up",Zt);const er=[["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"}]],ua=Oe("external-link",er);const ar=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],tr=Oe("flame",ar);const rr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Va=Oe("plus",rr);const sr=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],xa=Oe("trash-2",sr),ir=n.forwardRef(function(s,l){const{render:g,className:c,style:h,id:u,...m}=s,{store:x}=Et(),y=Xe(u);return x.useSyncedValueWithCleanup("descriptionElementId",y),ea("p",s,{ref:l,props:[{id:y},m]})});function Na({open:a,title:s,description:l,confirmLabel:g,cancelLabel:c,destructive:h=!1,busy:u=!1,onConfirm:m,onCancel:x}){return e.jsx(Mt,{open:a,onOpenChange:y=>{!y&&!u&&x?.()},children:e.jsxs(Bt,{children:[e.jsx(Tt,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsx(Ot,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(Ut,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[e.jsx(zt,{className:"text-base font-semibold text-oai-black dark:text-white",children:s}),l?e.jsx(ir,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:l}):null,e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"secondary",size:"sm",disabled:u,onClick:()=>x?.(),children:c}),e.jsx(U,{type:"button",size:"sm",disabled:u,onClick:()=>m?.(),className:W(h&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:g})]})]})})]})})}function ha({id:a,value:s,onChange:l,placeholder:g,disabled:c=!1,type:h="text",label:u,error:m,className:x="",...y}){const o=n.useId(),k=a||o,C=m?`${k}-error`:void 0,N=`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":""} ${m?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${x}`;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:h,value:s,onChange:l,placeholder:g,disabled:c,"aria-invalid":m?!0:void 0,"aria-describedby":C,className:N,...y}),m&&e.jsx("p",{id:C,className:"mt-1.5 text-sm text-oai-error",children:m})]})}const Ka=n.forwardRef(function(s,l){const{render:g,className:c,style:h,...u}=s,{store:m}=qt(),y={open:rt(m,Ht.open)};return ea("span",s,{state:y,ref:l,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:Ft})}),nr="tt:hint:dismissed:";function qa(a){return nr+a}function or(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(qa(a))==="1"}catch{return!1}}function lr({id:a,children:s,className:l,ariaLabel:g}){const[c,h]=n.useState(()=>or(a)),u=n.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(qa(a),"1")}catch{}h(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":g||r("hint.dismissible_aria"),className:W("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(Se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(Pa,{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 dr(a){if(!a)return null;for(const s of a.elements){const l=s.tagName;if(l==="BUTTON"||l==="INPUT"){const g=s;if(g.type==="submit")return g}}return null}let Ca=(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?{[Ca.checked]:""}:{[Ca.unchecked]:""}},...Ea}),[a.indeterminate])}const cr=n.createContext({disabled:!1});function ur(){return n.useContext(cr)}function gr(a,s,l,g=!0,c){const[h,u]=n.useState(),m=Xe(c?`${c}-label`:void 0),x=a??s??h;return da(()=>{const y=a||s||!g?void 0:mr(l.current,m);h!==y&&u(y)}),x}function mr(a,s){const l=xr(a);if(l)return!l.id&&s&&(l.id=s),l.id||void 0}function xr(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 g=a.labels;return g&&g[0]}const hr=n.createContext(void 0);function pr(a=!0){const s=n.useContext(hr);if(s===void 0&&!a)throw new Error(_a(3));return s}const Ga=n.createContext(void 0);function yr(){const a=n.useContext(Ga);if(a===void 0)throw new Error(_a(14));return a}const fr="data-parent",br=n.forwardRef(function(s,l){const{checked:g,className:c,defaultChecked:h=!1,"aria-labelledby":u,disabled:m=!1,form:x,id:y,indeterminate:o=!1,inputRef:k,name:C,onCheckedChange:w,parent:v=!1,readOnly:f=!1,render:N,required:I=!1,uncheckedValue:z,value:Q,nativeButton:F=!1,style:de,...j}=s,{clearErrors:te}=Gt(),{disabled:$,name:H,setDirty:X,setFilled:re,setFocused:A,setTouched:fe,state:be,validationMode:Ue,validityData:Pe,shouldValidateOnChange:ze,validation:Fe}=Wt(),B=ur(),{labelId:se,controlId:Re,registerControlId:Y,getDescriptionProps:ke}=Qt(),S=pr(),ie=S?.parent,ne=ie&&S.allValues,J=$||B.disabled||S?.disabled||m,Z=H??C,P=Q??Z,he=Xe(),aa=Xe();let G=Re;ne?G=v?aa:`${ie.id}-${P}`:y&&(G=y);let we={};ne&&(v?we=S.parent.getParentProps():P&&(we=S.parent.getChildProps(P)));const{checked:ve=g,indeterminate:ce=o,onCheckedChange:je,...Ne}=we,T=S?.value,pe=S?.setValue,ue=S?.defaultValue,ge=n.useRef(null),oe=st(()=>Symbol("checkbox-control")),Le=n.useRef(!1),{getButtonProps:Ae,buttonRef:Ve}=it({disabled:J,native:F}),L=S?.validation??Fe,[D,ta]=Xt({controlled:P&&T&&!v?T.includes(P):ve,default:P&&ue&&!v?ue.includes(P):h,name:"Checkbox",state:"checked"});da(()=>{Y!==pa&&(Le.current=!0,Y(oe.current,G))},[G,Y,oe]),n.useEffect(()=>{const b=oe.current;return()=>{!Le.current||Y===pa||(Le.current=!1,Y(b,void 0))}},[Y,oe]),Yt(ge,he,D,void 0,!S);const le=n.useRef(null),Ke=nt(k,le,L.inputRef),Ie=gr(u,se,le,!F,G??void 0);da(()=>{le.current&&(le.current.indeterminate=ce,D&&re(!0))},[D,ce,re]),Jt(D,()=>{S&&!v||(te(Z),re(D),X(D!==Pe.initialValue),ze()?L.commit(D):L.commit(D,!0))});const ra=ot({checked:D,disabled:J,form:x,name:v?void 0:Z,id:F?void 0:G??void 0,required:I,ref:Ke,style:Z?dt:ct,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(f){b.preventDefault();return}const V=b.currentTarget.checked,me=ut(gt,b.nativeEvent);if(je?.(V,me),w?.(V,me),!me.isCanceled&&(ta(V),P&&T&&pe&&!v&&!ne)){const R=V?[...T,P]:T.filter(K=>K!==P);pe(R,me)}},onFocus(){ge.current?.focus()}},Q!==void 0?{value:(S?D&&Q:Q)||""}:lt,ke,S?L.getValidationProps:L.getInputValidationProps),$e=ne?!!ve:D,qe=ne&&ce||o;n.useEffect(()=>{if(!ie||!P)return;const b=ie.disabledStatesRef.current;return b.set(P,J),()=>{b.delete(P)}},[ie,J,P]);const De=n.useMemo(()=>({...be,checked:$e,disabled:J,readOnly:f,required:I,indeterminate:qe}),[be,$e,J,f,I,qe]),sa=Ha(De),ia=ea("span",s,{state:De,ref:[Ve,ge,l,S?.registerControlRef],props:[{id:F?G??void 0:he,role:"checkbox","aria-checked":ce?"mixed":D,"aria-readonly":f||void 0,"aria-required":I||void 0,"aria-labelledby":Ie,[fr]:v?"":void 0,onFocus(){A(!0)},onBlur(){const b=le.current;b&&(fe(!0),A(!1),Ue==="onBlur"&&L.commit(S?T:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const V=le.current?.form??null,me=b.currentTarget,R=b.nativeEvent,K=b.preventDefault,Ee=R.preventDefault;let Me=!1;b.preventDefault=()=>{Me=!0,K.call(b)},R.preventDefault=()=>{Me=!0,Ee.call(R)},Ee.call(R),ya(me).queueMicrotask(()=>{b.preventDefault=K,R.preventDefault=Ee,Me||dr(V)?.click()})},onClick(b){if(f||J)return;b.preventDefault();const V=le.current;V&&V.dispatchEvent(new(ya(V)).PointerEvent("click",{bubbles:!0,shiftKey:b.shiftKey,ctrlKey:b.ctrlKey,altKey:b.altKey,metaKey:b.metaKey}))}},ke,L.getValidationProps,j,Ne,Ae],stateAttributesMapping:sa});return e.jsxs(Ga.Provider,{value:De,children:[ia,!D&&!S&&Z&&!v&&z!==void 0&&e.jsx("input",{type:"hidden",form:x,name:Z,value:z}),e.jsx("input",{...ra,suppressHydrationWarning:!0})]})}),kr=n.forwardRef(function(s,l){const{render:g,className:c,style:h,keepMounted:u=!1,...m}=s,x=yr(),y=x.checked||x.indeterminate,{mounted:o,transitionStatus:k,setMounted:C}=At(y),w=n.useRef(null),v={...x,transitionStatus:k};mt({open:y,ref:w,onComplete(){y||C(!1)}});const N={...Ha(x),...xt,...Ea},I=u||o,z=ea("span",s,{ref:[l,w],state:v,stateAttributesMapping:N,props:m});return I?z:null});function wr(a,s){return`target:${a}:${s}`}function vr(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 jr(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 Nr(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 oa({label:a,children:s}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[e.jsx("dt",{className:"flex items-center gap-1 text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"text-right font-medium tabular-nums text-oai-black dark:text-white",children:s})]})}function Cr({skill:a,targets:s,busyKey:l,usage:g,hasUpdate:c,updating:h,onUpdate:u,onClose:m,onToggleTarget:x,onRemove:y}){return e.jsx(ht,{children:a?e.jsx(Sr,{skill:a,targets:s,busyKey:l,usage:g,hasUpdate:c,updating:h,onUpdate:u,onClose:m,onToggleTarget:x,onRemove:y},a.id||a.directory):null})}function Sr({skill:a,targets:s,busyKey:l,usage:g,hasUpdate:c,updating:h,onUpdate:u,onClose:m,onToggleTarget:x,onRemove:y}){const o=pt(),{currency:k,rate:C}=Vt(),w=n.useRef(null);n.useEffect(()=>{const j=$=>{$.key==="Escape"&&($.stopPropagation(),m?.())},te=$=>{const H=$.target;H instanceof Element&&(w.current?.contains(H)||H.closest('[data-skill-row="1"]')||m?.())};return document.addEventListener("keydown",j),document.addEventListener("mousedown",te),()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousedown",te)}},[m]);const v=a.name||a.directory,f=!!(a.repoOwner&&a.repoName),N=f?`https://github.com/${a.repoOwner}/${a.repoName}`:null,I=new Set(a.targets||[]),z=l===vr(a),Q=jr(g?.lastUsedAt),F=!!(g&&g.invocations>0),de=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:m,"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:de,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}),f?e.jsxs("a",{href:N,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:N,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(ua,{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:m,"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(Se,{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(Aa,{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:h,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:[h?e.jsx(ae,{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(oa,{label:r("skills.usage.invocations"),children:yt(g?.invocations||0)}),e.jsx(oa,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:W("h-1.5 w-1.5 rounded-full",Nr(g?.lastUsedAt)),"aria-hidden":!0}),F?Q||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(oa,{label:e.jsxs(e.Fragment,{children:[r("skills.usage.cost"),e.jsx("span",{title:r("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(Pa,{className:"h-3 w-3","aria-label":r("skills.usage.disclaimer")})})]}),children:ft(g?.cost||0,{currency:k,rate:C})})]}),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 te=I.has(j.id),$=l===wr(a.id,j.id),H=`skill-detail-sync-${a.id||a.directory}-${j.id}`;return e.jsxs("label",{htmlFor:H,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(br,{id:H,checked:te,disabled:$,onCheckedChange:X=>x?.(a,j.id,!!X),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:e.jsx(kr,{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(ye,{provider:j.id,size:16})}),e.jsx("span",{className:"flex-1",children:j.label}),$?e.jsx(ae,{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:()=>y?.(a),disabled:z,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:[z?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(xa,{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 _r=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),la=["claude","codex"],O="popular",Pr={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",M="skillssh";function ga(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Qe(a){return`install:${ga(a)}`}function Sa(a){return`remove:${a.id||a.directory}`}function Qa(a,s){return`target:${a}:${s}`}function Rr({target:a,state:s,busy:l,onToggle:g}){const c=s==="synced",h=s==="orphan",u=h?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:m=>{m.stopPropagation(),g?.(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(ae,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:W("flex h-[18px] w-[18px] items-center justify-center transition",c&&Pr[a.id],!c&&!h&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(ye,{provider:a.id,size:18})}),h&&!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 Lr({skill:a,targets:s,onToggleTarget:l,busyKey:g}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:s.map(c=>e.jsx(Rr,{target:c,state:a.targetStates?.[c.id]||"off",busy:g===Qa(a.id,c.id),onToggle:(h,u)=>l?.(a,h,u)},c.id))})}function Ir({skill:a,targets:s,selected:l,onSelect:g,selectable:c,checked:h,onToggleSelect:u,onToggleTarget:m,hasUpdate:x,busyKey:y}){const o=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,k=o?`${a.directory} · ${o}`:a.directory,C=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),g?.(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:()=>g?.(a),onKeyDown:C,className:W("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":h?"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:h,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}),x?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(Aa,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("skills.update.badge")]}):null,e.jsx(Lr,{skill:a,targets:s,onToggleTarget:m,busyKey:y}),e.jsx(Kt,{className:W("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:W("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:g,totalCount:c,anyFilter:h,onClearFilters:u,searchQuery:m,onSearchQuery:x,searchPlaceholder:y}){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(Ma,{value:a,onValueChange:l,children:[e.jsxs(Ba,{"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(Ta,{children:o=>o==="all"?r("skills.filter.agent_all"):s.find(k=>k.id===o)?.label||o}),e.jsx(Ka,{className:"text-oai-gray-400",children:e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Oa,{children:e.jsx(Ua,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(za,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Ye,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Je,{children:r("skills.filter.agent_all")}),e.jsx(Ze,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),s.map(o=>e.jsxs(Ye,{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(ye,{provider:o.id,size:14}),e.jsx(Je,{children:o.label})]}),e.jsx(Ze,{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(ca,{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(ha,{type:"search",value:m,onChange:o=>x(o.target.value),onKeyDown:o=>{o.key==="Escape"&&m&&(o.preventDefault(),x(""))},"aria-label":r("skills.action.search_aria"),placeholder:y,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:()=>x(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!m,tabIndex:m?0:-1,className:W("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",m?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Se,{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:g,total:c})}),h?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(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]})}function Dr({count:a,targets:s,busy:l,onBulkSync:g,onBulkRemove:c,onClear:h}){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(Ra,{children:[e.jsxs(La,{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(Fa,{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(Ia,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Da,{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:()=>g(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(ye,{provider:u.id,size:16}),e.jsx("span",{className:"flex-1",children:u.label})]},u.id))]})})})]}),e.jsxs(U,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:c,children:[e.jsx(xa,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:h,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(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.select.clear")]})]})]})}function Er({items:a,totalCount:s,targets:l,agentOptions:g,agentFilter:c,onAgentFilter:h,anyFilter:u,onClearFilters:m,searchQuery:x,onSearchQuery:y,searchPlaceholder:o,selectedId:k,onSelect:C,onToggleTarget:w,busyKey:v,updates:f,selectedIds:N,onToggleSelect:I,onClearSelection:z,onBulkSync:Q,onBulkRemove:F}){const de=N.size;return e.jsxs("div",{children:[de>0?e.jsx(Dr,{count:de,targets:l,busy:v==="batch",onBulkSync:Q,onBulkRemove:F,onClear:z}):e.jsx($r,{agentFilter:c,agentOptions:g,onAgentFilter:h,filteredCount:a.length,totalCount:s,anyFilter:u,onClearFilters:m,searchQuery:x,onSearchQuery:y,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(U,{type:"button",variant:"secondary",size:"sm",onClick:m,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(Ir,{skill:j,targets:l,selected:k===(j.id||j.directory),onSelect:C,selectable:!0,checked:N.has(j.id),onToggleSelect:I,onToggleTarget:w,hasUpdate:!!(j.id&&f?.[j.id]),busyKey:v},j.id||j.key))})]})}const Mr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Br=_t.memo(function({skill:s,installed:l,installing:g,allTargets:c,defaultTargets:h,onInstall:u,onManage:m}){const[x,y]=n.useState(()=>(h||[]).filter(f=>c.some(N=>N.id===f))),o=f=>{y(N=>N.includes(f)?N.filter(I=>I!==f):[...N,f])},k=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,C=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=x.length?x.map(f=>c.find(N=>N.id===f)?.label||f).join(", "):r("skills.action.choose_targets");return e.jsxs(Dt,{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(ua,{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:[C?e.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",onClick:f=>f.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:C,children:[e.jsx("span",{className:"truncate",children:k}),e.jsx(ua,{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(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>m?.(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:x.length?v:r("skills.target.none")}),e.jsxs(Ra,{children:[e.jsx(La,{disabled:g,"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(Ia,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Da,{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(f=>{const N=x.includes(f.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:N,onChange:()=>o(f.id)}),e.jsx(ye,{provider:f.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:f.label})]},f.id)})]})})})]})]}),e.jsxs(U,{type:"button",size:"sm",onClick:()=>u(s,x),disabled:g||x.length===0,className:"w-full",children:[g?e.jsx(ae,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Fa,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.action.install")]})]})})]})});function Tr({repos:a,repoInput:s,onRepoInput:l,busyKey:g,onAdd:c,onRemove:h}){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(ha,{value:s,onChange:u=>l(u.target.value),placeholder:r("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(U,{type:"button",variant:"secondary",size:"md",onClick:c,disabled:g==="repo:add",className:"shrink-0 whitespace-nowrap",children:[g==="repo:add"?e.jsx(ae,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Va,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.repo.add")]})]}),a.length?e.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(u=>{const m=g===`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(U,{type:"button",variant:"ghost",size:"sm",disabled:m,onClick:()=>h(u),className:"shrink-0",children:[m?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(xa,{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 Or(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function Xr(){const[a,s]=n.useState(Or),[l,g]=n.useState({skills:[],targets:[]}),[c,h]=n.useState([]),[u,m]=n.useState([]),[x,y]=n.useState([]),[o,k]=n.useState(xe),[C,w]=n.useState(""),[v,f]=n.useState(""),[N,I]=n.useState(""),[z,Q]=n.useState(""),[F,de]=n.useState(""),[j,te]=n.useState(!1),[$,H]=n.useState("all"),[X,re]=n.useState(null),[A,fe]=n.useState(""),[be,Ue]=n.useState(!0),[Pe,ze]=n.useState(!1),[Fe,B]=n.useState(""),[se,Re]=n.useState(null),[Y,ke]=n.useState(null),[S,ie]=n.useState(()=>new Set),[ne,J]=n.useState({}),[Z,P]=n.useState({}),[he,aa]=n.useState([]),[G,we]=n.useState(!1),ve=n.useRef(!1),ce=n.useMemo(()=>{const t=new Set;for(const i of l.skills||[]){t.add(ga(i).toLowerCase()),i.repoOwner&&i.repoName&&t.add(`${i.repoOwner}/${i.repoName}:${i.sourceDirectory||i.directory}`.toLowerCase());const d=String(i.directory||"").split(/[\\/]/).pop().toLowerCase();d&&t.add(`dir:${d}`)}return t},[l.skills]),je=n.useCallback(async()=>{const t=await bt();g({skills:t.skills||[],targets:t.targets||[]})},[]),Ne=n.useCallback(async()=>{const t=await kt();y(t.repos||[])},[]),T=n.useCallback(async({force:t=!1}={})=>{ze(!0);try{const i=await wt({force:t});h(i.skills||[])}finally{ze(!1)}},[]),pe=n.useCallback(async({force:t=!1}={})=>{we(!0);try{const i=await vt({force:t});aa(i.skills||[])}finally{we(!1)}},[]),ue=n.useCallback(async()=>{try{const t=await jt();J(t?.updates||{})}catch{J({})}},[]),ge=n.useCallback(async()=>{try{const t=await Nt(),i={};for(const d of t?.skills||[])d.installed&&(d.directory&&(i[String(d.directory).toLowerCase()]=d),i[String(d.skill).toLowerCase()]=d);P(i)}catch{P({})}},[]),oe=n.useCallback(async()=>{Ue(!0),B("");try{await Promise.all([je(),Ne()])}catch(t){B(t?.message||r("skills.error.generic"))}finally{Ue(!1)}},[je,Ne]),Le=n.useCallback(async()=>{await oe();const t=i=>B(i?.message||r("skills.error.generic"));a==="my"?(ue(),ge()):o===O?pe({force:!0}).catch(t):o!==M&&T({force:!0}).catch(t)},[T,oe,pe,ue,ge,o,a]);n.useEffect(()=>{oe()},[oe]),n.useEffect(()=>{if(ve.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("skill");if(!i){ve.current=!0;return}const d=l.skills||[];if(!d.length)return;const p=d.find(_=>_.directory===i||_.id===i);p&&(s("my"),re(p.id||p.directory)),ve.current=!0,t.delete("skill");const E=t.toString();window.history.replaceState({},"",`${window.location.pathname}${E?`?${E}`:""}${window.location.hash}`)},[l.skills]),n.useEffect(()=>{a==="browse"&&(o===M||o===O||c.length===0&&T().catch(t=>B(t?.message||r("skills.error.generic"))))},[c.length,T,o,a]),n.useEffect(()=>{a!=="browse"||o!==O||he.length===0&&pe().catch(t=>B(t?.message||r("skills.error.generic")))},[pe,he.length,o,a]);const Ae=Object.keys(ne).length>0,Ve=Object.keys(Z).length>0;if(n.useEffect(()=>{a==="my"&&(Ae||ue(),Ve||ge())},[a,Ae,Ve,ue,ge]),n.useEffect(()=>{const t=setTimeout(()=>f(C),200);return()=>clearTimeout(t)},[C]),n.useEffect(()=>{const t=setTimeout(()=>Q(N),120);return()=>clearTimeout(t)},[N]),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]),!_r&&!Ct())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx($t,{})});const L=async(t,i)=>{fe(t),B("");try{await i(),await je()}catch(d){B(d?.message||r("skills.error.generic"))}finally{fe("")}},D=(t,i)=>{const d=(i&&i.length?i:la).filter(p=>(l.targets||[]).some(E=>E.id===p));L(Qe(t),async()=>{await ba(t,d);const p=d.map(E=>(l.targets||[]).find(_=>_.id===E)?.label||E).join(", ");Ce({title:r("skills.toast.installed",{name:t.name||t.directory,targets:p||r("skills.target.none")}),timeout:4e3})})},ta=t=>{Re(t)},le=()=>{const t=se;t&&(Re(null),L(Sa(t),async()=>{let i=null;t.managed?i=await ka(t.id):await wa(t.directory,t.targets||[]);const d=!!(i?.trashed&&t.managed&&t.id);Ce({title:r("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:d?{onUndo:async()=>{try{await Rt(t.id),await je()}catch(p){B(p?.message||r("skills.error.generic"))}}}:void 0})}))},Ke=(t,i,d)=>L(Qa(t.id,i),async()=>{const p=new Set(t.targets||[]);d?p.add(i):p.delete(i),t.managed?await va(t.id,Array.from(p)):await ja(t.directory,Array.from(p));const E={name:t.name||t.directory,agent:$e(i)};Ce({title:d?r("skills.toast.synced_one",E):r("skills.toast.unsynced_one",E),timeout:3e3})}),Ie=n.useCallback(()=>ie(new Set),[]),ra=n.useCallback((t,i)=>{ie(d=>{const p=new Set(d);return i?p.add(t.id):p.delete(t.id),p})},[]),$e=t=>(l.targets||[]).find(i=>i.id===t)?.label||t,qe=t=>{const i=(l.skills||[]).filter(d=>S.has(d.id));i.length&&L("batch",async()=>{for(const d of i){const p=new Set(d.targets||[]);p.add(t),d.managed?await va(d.id,Array.from(p)):await ja(d.directory,Array.from(p))}Ie(),Ce({title:r("skills.toast.bulk_synced",{count:i.length,agent:$e(t)}),timeout:4e3})})},De=()=>{const t=(l.skills||[]).filter(i=>S.has(i.id));t.length&&ke(t)},sa=()=>{const t=Y;t&&(ke(null),L("batch",async()=>{for(const i of t)i.managed?await ka(i.id):await wa(i.directory,i.targets||[]);Ie(),Ce({title:r("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},ia=t=>{!t?.repoOwner||!t?.repoName||L(Qe(t),async()=>{await ba({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:la),await ue(),Ce({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},b=async()=>{const t=C.trim();if(!(t.length<2)){fe("search"),B("");try{const i=await Pt(t);m(i.skills||[])}catch(i){B(i?.message||r("skills.error.generic"))}finally{fe("")}}},V=async()=>{const t=F.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[i,d]=t.split("/");if(!i||!d){B(r("skills.repo.invalid"));return}await L("repo:add",async()=>{await It({owner:i,name:d,branch:"main",enabled:!0}),de(""),await Ne(),await T()})},me=async t=>{await L(`repo:${t.owner}/${t.name}`,async()=>{await Lt(t.owner,t.name),await Ne(),await T()})},R=l.targets||[],K=l.skills||[],Ee=n.useMemo(()=>{const t=$==="all"?K:K.filter(d=>(d.targets||[]).includes($)),i=z.trim().toLowerCase();return i?t.filter(d=>(d.name||"").toLowerCase().includes(i)||(d.directory||"").toLowerCase().includes(i)||(d.description||"").toLowerCase().includes(i)):t},[K,$,z]),Me=$!=="all",ee=n.useMemo(()=>X&&K.find(t=>(t.id||t.directory)===X)||null,[K,X]),Xa=n.useCallback(()=>{H("all"),I("")},[]),Ya=n.useCallback(t=>{re(i=>{const d=t?.id||t?.directory||null;return i===d?null:d})},[]),Ja=n.useCallback(()=>re(null),[]),Za=n.useCallback(t=>{const i=String(t.directory||"").split(/[\\/]/).pop().toLowerCase(),d=(l.skills||[]).find(p=>String(p.directory||"").toLowerCase()===i);d&&re(d.id||d.directory)},[l.skills]);n.useEffect(()=>{a!=="my"&&S.size&&ie(new Set)},[a,S.size]),n.useEffect(()=>{X&&!ee&&re(null)},[ee,X]);const Be=n.useMemo(()=>{const t=o===M?u:o===O?he:c,d=o===M||o===O||o===xe?t:t.filter(_=>`${_.repoOwner}/${_.repoName}`===o),p=v.trim().toLowerCase();return(o===M||!p?d:d.filter(_=>(_.name||"").toLowerCase().includes(p)||(_.directory||"").toLowerCase().includes(p)||(_.description||"").toLowerCase().includes(p))).map(_=>{const na=ga(_).toLowerCase(),q=String(_.directory||"").split(/[\\/]/).pop().toLowerCase(),We=q?`dir:${q}`:"";return{..._,installed:ce.has(na)||We&&ce.has(We)}})},[v,c,ce,he,u,o]),et=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(ae,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),at=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(ae,{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")})]}),He=(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 Ge;if(be)Ge=et;else if(a==="my")Ge=K.length?e.jsx(Er,{items:Ee,totalCount:K.length,targets:R,agentOptions:R,agentFilter:$,onAgentFilter:H,anyFilter:Me,onClearFilters:Xa,searchQuery:N,onSearchQuery:I,searchPlaceholder:r("skills.my.placeholder"),selectedId:X,onSelect:Ya,onToggleTarget:Ke,busyKey:A,updates:ne,selectedIds:S,onToggleSelect:ra,onClearSelection:Ie,onBulkSync:qe,onBulkRemove:De}):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:[R.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:[...R,...R].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ye,{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:[...R,...R].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ye,{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(U,{type:"button",size:"sm",onClick:()=>s("browse"),children:r("skills.empty.my_cta")})]});else{const t=o===M,i=o===O,d=x.length===0&&!t&&!i,p=Pe&&!t&&!i||i&&G,E=!t&&!i&&(v.trim()!==""||o!==xe),_=()=>{w(""),k(xe)},na=!d&&!p&&(Be.length>0||E)?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:Be.length})}),E?e.jsxs("button",{type:"button",onClick:_,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(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]}):null;let q;d?q=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?q=at:t&&C.trim().length<2?q=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")}):Be.length?q=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Be.map(Te=>e.jsx("div",{style:Mr,children:e.jsx(Br,{skill:Te,installed:!!Te.installed,installing:A===Qe(Te),allTargets:R,defaultTargets:la,onInstall:D,onManage:Za})},Te.id||Te.key))}):E?q=He("skills.empty.no_match",e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:_,children:r("skills.filter.clear")})):t?q=He("skills.empty.search"):i?q=He("skills.empty.popular"):q=He("skills.empty.browse");const We=d||j?e.jsx("div",{className:"mb-5",children:e.jsx(Tr,{repos:x,repoInput:F,onRepoInput:de,busyKey:A,onAdd:V,onRemove:me})}):null,tt=!j&&!t&&!i&&x.length<=1&&Be.length>0?e.jsx(lr,{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:()=>te(!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;Ge=e.jsxs(e.Fragment,{children:[We,na,q,tt]})}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(U,{type:"button",variant:"secondary",size:"sm",onClick:Le,disabled:be||Pe||G,children:[e.jsx(St,{className:W("mr-1.5 h-3.5 w-3.5",(be||Pe||G)&&"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:W("-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))}),Fe?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:Fe}):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!==M&&o!==O],["popular",r("skills.mode.popular"),o===O],["skillssh",r("skills.mode.skillssh"),o===M]].map(([t,i,d])=>e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>{t==="skillssh"?k(M):t==="popular"?k(O):(o===M||o===O)&&k(xe)},className:W("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(tr,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,i]},t))}),o!==M&&o!==O?e.jsxs(Ma,{value:o,onValueChange:k,children:[e.jsxs(Ba,{"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(Ta,{children:t=>t===xe?r("skills.source.all"):t}),e.jsx(Ka,{className:"text-oai-gray-400",children:e.jsx(ma,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsx(Oa,{children:e.jsx(Ua,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(za,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Ye,{value:xe,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Je,{children:r("skills.source.all")}),e.jsx(Ze,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),x.map(t=>{const i=`${t.owner}/${t.name}`;return e.jsxs(Ye,{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(Je,{children:i}),e.jsx(Ze,{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(ca,{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(ha,{type:"search",value:C,onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Enter"&&o===M&&b()},"aria-label":r("skills.action.search_aria"),placeholder:o===M?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===M?e.jsxs(U,{type:"button",onClick:b,disabled:C.trim().length<2||A==="search",className:"focus:!ring-oai-gray-400/30",children:[A==="search"?e.jsx(ae,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(ca,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):o===O?null:e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>te(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(Va,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.browse.manage_sources"),e.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:x.length})]})]}):null,Ge,e.jsx(Cr,{skill:ee,targets:R,busyKey:A,usage:ee&&(Z[String(ee.directory||"").toLowerCase()]||Z[String(ee.name||"").toLowerCase()])||null,hasUpdate:!!(ee?.id&&ne?.[ee.id]),updating:ee?A===Qe(ee):!1,onUpdate:ia,onClose:Ja,onToggleTarget:Ke,onRemove:ta})]})}),e.jsx(Na,{open:!!se,title:r("skills.confirm.remove_title",{name:se?.name||se?.directory||""}),description:se?se.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===Sa(se||{}),onCancel:()=>Re(null),onConfirm:le}),e.jsx(Na,{open:!!Y,title:r("skills.confirm.bulk_remove_title",{count:Y?.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:()=>ke(null),onConfirm:sa})]})}export{Xr as SkillsPage};
@@ -0,0 +1 @@
1
+ import{j as e,G as o,c3 as _,aR as P,r as u,a_ as I,R as B,V as M}from"./main-9Ze1SUIZ.js";import{S as D}from"./Select-BOxMknxo.js";import{u as E,T as K}from"./use-native-settings-BWqG5RDr.js";import{F as j,S as G,a as $}from"./FadeIn-B5-cy4YN.js";import{A as z}from"./arrow-up-right-Brwh94cN.js";import{D as R}from"./download-kFiot71R.js";import"./SelectItemText-B0SL3Wb5.js";import"./useScrollLock-BcLeWqWK.js";import"./Card-DpjFlMHF.js";const H=["todayTokens","todayCost"],F=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaude",label:"Antigravity Claude Limit",shortLabel:"Ag Cl",category:"limits"},{id:"antigravityGPro",label:"Antigravity Gemini Pro Limit",shortLabel:"Ag GPro",category:"limits"},{id:"antigravityFlash",label:"Antigravity Flash Limit",shortLabel:"Ag Fl",category:"limits"}];function v(t,i=F,r=2){const a=new Set(i.map(n=>n.id)),l=new Set,s=Array.isArray(t)?t.filter(n=>!a.has(n)||l.has(n)?!1:(l.add(n),!0)):[];return(s.length>0?s:H).slice(0,Math.max(1,Number(r)||2))}const O=264,U=124,g="ui-rounded, -apple-system, system-ui",L=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],V={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function X(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function b({size:t="sm",children:i}){const r=t==="lg",a=r?560:264,l=r?32:22;return e.jsx("div",{className:M("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",r?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:a,aspectRatio:`${O} / ${U}`,borderRadius:l},children:i})})}function Y({size:t="sm"}){const i="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",r=`${i} L264,124 L0,124 Z`,a=`sparkArea-${t}`;return e.jsx(b,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$673.61"}),e.jsx("path",{d:r,fill:`url(#${a})`,stroke:"none"}),e.jsx("path",{d:i,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const N=(()=>{const r=[];for(let a=0;a<26;a++)for(let l=0;l<7;l++){const s=Math.sin((a+1)*12.9898+(l+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(s-Math.floor(s))*100);r.push({w:a,d:l,v:c})}return r})();function C(t,i){return t<18?i?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function Z(){return e.jsx(b,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:N.map(s=>e.jsx("rect",{x:s.w*(7.5+1.2),y:s.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:C(s.v,!0)},`d-${s.w}-${s.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:N.map(s=>e.jsx("rect",{x:s.w*(7.5+1.2),y:s.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:C(s.v,!1)},`l-${s.w}-${s.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:g,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function q(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],i=22,r=28,a=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((s,c)=>{const n=r+c*i,h=L[c%L.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:s.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:g,children:s.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:g,children:[s.pct,"%"]}),e.jsx("rect",{x:a,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:h})]},s.name)})})})}function J(){const t=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],i=22,r=28,a=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((s,c)=>{const n=r+c*i,h=V[s.source],y=X(s.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:s.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:s.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:g,children:[s.pct,"%"]}),e.jsx("rect",{x:a,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},s.label)})})})}function Q(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ee(t,i){switch(t){case"todayTokens":return o("menubar.metric.today_tokens");case"todayCost":return o("menubar.metric.today_cost");case"last7dTokens":return o("menubar.metric.last_7d_tokens");case"totalTokens":return o("menubar.metric.total_tokens");case"totalCost":return o("menubar.metric.total_cost");case"claude5h":return o("menubar.metric.claude_5h");case"claude7d":return o("menubar.metric.claude_7d");case"codex5h":return o("menubar.metric.codex_5h");case"codex7d":return o("menubar.metric.codex_7d");default:return i}}function te(t,i){const r=new Set(i.map(l=>l.id)),a=t.filter(l=>r.has(l));for(const l of i){if(a.length>=2)break;a.includes(l.id)||a.push(l.id)}return a.slice(0,2)}function ae({slotConfigs:t,showStats:i}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),i?t.map(({slot:r,item:a},l)=>e.jsxs(B.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:M("flex min-w-[52px] flex-col items-center justify-center py-1.5",l===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:a?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:a?.shortLabel||"Metric"})]})]},r)):null]})})}function ie({slot:t,value:i,options:r,disabled:a,onChange:l}){const s=t===0?o("menubar.slot.primary"):o("menubar.slot.secondary");return e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:s}),e.jsx(D,{value:i,disabled:a,ariaLabel:s,onValueChange:c=>l(t,c),options:r.map(c=>({value:c.id,label:c.displayLabel})),matchTriggerWidth:!0,className:"w-full px-3 py-2 text-sm font-medium"})]})}function S({label:t,hint:i,checked:r,disabled:a,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(K,{checked:r,disabled:a,onChange:l,ariaLabel:t})]})}function se(){const{available:t,settings:i,setSetting:r}=E(),a=u.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:F).map(m=>({...m,displayLabel:ee(m.id,m.label),previewValue:Q(m)})),[i?.menuBarAvailableItems]),l=Number(i?.menuBarMaxItems)||2,s=u.useMemo(()=>v(i?.menuBarItems,a,l),[a,l,i?.menuBarItems]),c=u.useMemo(()=>te(s,a),[a,s]),n=i?.showStats!==!1,h=d=>{r("menuBarItems",v(d,a,l))},y=(d,m)=>{const x=[...c];x[d===0?1:0]!==m&&(x[d]=m,h(x))},p=[0,1].map(d=>{const m=c[d]||a[d]?.id||"",k=c[d===0?1:0],W=a.filter(f=>f.id===m||f.id!==k),T=a.find(f=>f.id===m);return{slot:d,currentValue:m,options:W,item:T}}),w=i?.animatedIcon!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(ae,{slotConfigs:p,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:p.map(({slot:d,currentValue:m,options:x})=>e.jsx(ie,{slot:d,value:m,options:x,disabled:!t||!n,onChange:y},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(S,{label:o("settings.menubar.showStats"),hint:t?o("settings.menubar.showStatsHint"):o("menubar.native_only"),checked:n,disabled:!t,onChange:()=>r("showStats",!n)}),e.jsx(S,{label:o("settings.menubar.animatedIcon"),hint:o("settings.menubar.animatedIconHint"),checked:w,disabled:!t,onChange:()=>r("animatedIcon",!w)})]})]})}function re(){const[t,i]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(I()){i("native");return}const r=(navigator.userAgent||"").toLowerCase(),a=/mac/.test(r)&&!/iphone|ipad/.test(r);i(a?"mac-web":"other")},[]),t}function le(){const t=re();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>_("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[o("widgets.cta.open_gallery"),e.jsx(z,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(R,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(P,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.macos_only")]})}const oe=[{id:"summary",Preview:Y,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:Z,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:q,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:J,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function ne({Preview:t,nameKey:i,descKey:r}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:o(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:o(r)})]})]})}function A({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:o(t)})}function ye(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(j,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:o("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(le,{})})]})}),e.jsx(j,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":o("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(A,{titleKey:"widgets.menubar.section.title"}),e.jsx(se,{})]})}),e.jsxs("section",{"aria-label":o("widgets.gallery.section.title"),children:[e.jsx(A,{titleKey:"widgets.gallery.section.title"}),e.jsx(G,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:oe.map(({id:t,Preview:i,nameKey:r,descKey:a})=>e.jsx($,{children:e.jsx(ne,{Preview:i,nameKey:r,descKey:a})},t))})})]})]})})})}export{ye as WidgetsPage};
@@ -1 +1 @@
1
- import{r as l,j as e,D as y}from"./main-CPiNtuB_.js";function o(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":y(a,{decimals:2}):"0"}function r({children:a,accent:n=!1,className:i=""}){const c="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",d=n?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${c} ${d} ${i}`,children:a})}function u(){const[a,n]=l.useState(null),[i,c]=l.useState("loading"),[d,g]=l.useState("");if(l.useEffect(()=>{let t=!1;const h=new URLSearchParams(window.location.search).get("year"),p=h?`/functions/tokentracker-wrapped?year=${encodeURIComponent(h)}`:"/functions/tokentracker-wrapped";return fetch(p).then(async s=>{if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}).then(s=>{t||(n(s),c(s.totals&&s.totals.tokens>0?"ready":"empty"))}).catch(s=>{t||(g(String(s?.message||s)),c("error"))}),()=>{t=!0}},[]),i==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:"Loading…"})});if(i==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-red-600 dark:text-red-300",children:["Couldn't load Wrapped: ",d]})})});if(i==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-oai-gray-500",children:["No data for that year yet. Run ",e.jsx("code",{children:"tracker sync"})," first."]})})});const x=t=>`${(t*100).toFixed(0)}%`;return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"TokenTracker Wrapped"}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(r,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:"Total tokens"}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:o(a.totals.tokens)}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:["across ",e.jsx("strong",{children:a.totals.conversations.toLocaleString("en-US")})," conversations,"," ",e.jsx("strong",{children:a.totals.active_days})," active days, and"," ",e.jsx("strong",{children:a.totals.sources})," tools"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top tools"}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[o(t.tokens)," · ",x(t.share)]})]},t.source))})]}),e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top models"}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[o(t.tokens)," · ",x(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Peak hour"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[o(a.peak_hour.tokens)," tokens"]})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Longest streak"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[a.longest_streak.days," days"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top days"}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:o(t.tokens)})]},t.day))})]}),a.highlights.length>0&&e.jsxs(r,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:"Highlights"}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:a.highlights.map((t,m)=>e.jsxs("li",{className:"text-base",children:["· ",t]},m))})]}),e.jsxs("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:["Generated from local queue.jsonl · share with"," ",e.jsx("code",{className:"font-mono",children:"tracker wrapped --json"})]})]})})}export{u as default};
1
+ import{r as l,j as e,J as y}from"./main-9Ze1SUIZ.js";function o(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":y(a,{decimals:2}):"0"}function r({children:a,accent:n=!1,className:i=""}){const c="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",d=n?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${c} ${d} ${i}`,children:a})}function u(){const[a,n]=l.useState(null),[i,c]=l.useState("loading"),[d,g]=l.useState("");if(l.useEffect(()=>{let t=!1;const h=new URLSearchParams(window.location.search).get("year"),p=h?`/functions/tokentracker-wrapped?year=${encodeURIComponent(h)}`:"/functions/tokentracker-wrapped";return fetch(p).then(async s=>{if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}).then(s=>{t||(n(s),c(s.totals&&s.totals.tokens>0?"ready":"empty"))}).catch(s=>{t||(g(String(s?.message||s)),c("error"))}),()=>{t=!0}},[]),i==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:"Loading…"})});if(i==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-red-600 dark:text-red-300",children:["Couldn't load Wrapped: ",d]})})});if(i==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-oai-gray-500",children:["No data for that year yet. Run ",e.jsx("code",{children:"tracker sync"})," first."]})})});const x=t=>`${(t*100).toFixed(0)}%`;return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"TokenTracker Wrapped"}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(r,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:"Total tokens"}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:o(a.totals.tokens)}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:["across ",e.jsx("strong",{children:a.totals.conversations.toLocaleString("en-US")})," conversations,"," ",e.jsx("strong",{children:a.totals.active_days})," active days, and"," ",e.jsx("strong",{children:a.totals.sources})," tools"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top tools"}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[o(t.tokens)," · ",x(t.share)]})]},t.source))})]}),e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top models"}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[o(t.tokens)," · ",x(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Peak hour"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[o(a.peak_hour.tokens)," tokens"]})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Longest streak"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[a.longest_streak.days," days"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top days"}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:o(t.tokens)})]},t.day))})]}),a.highlights.length>0&&e.jsxs(r,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:"Highlights"}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:a.highlights.map((t,m)=>e.jsxs("li",{className:"text-base",children:["· ",t]},m))})]}),e.jsxs("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:["Generated from local queue.jsonl · share with"," ",e.jsx("code",{className:"font-mono",children:"tracker wrapped --json"})]})]})})}export{u as default};
@@ -0,0 +1 @@
1
+ import{ah as I,ai as j,aj as w,ak as M,al as h,am as N,r as u,an as V,ao as G,ap as H,aq as g,j as p,R as F,m as v,S as C,U as D}from"./main-9Ze1SUIZ.js";function P(...e){const t=!Array.isArray(e[0]),n=t?0:-1,o=e[0+n],r=e[1+n],i=e[2+n],a=e[3+n],s=I(r,i,a);return t?s(o):s}function K(e,t,n={}){const o=e.get();let r=null,i=o,a;const s=typeof o=="string"?o.replace(/[\d.-]/g,""):void 0,c=()=>{r&&(r.stop(),r=null),e.animation=void 0},d=()=>{const l=b(e.get()),m=b(i);if(l===m){c();return}const y=r?r.getGeneratorVelocity():e.getVelocity();c(),r=new M({keyframes:[l,m],velocity:y,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:a})},f=()=>{d(),e.animation=r??void 0,e.events.animationStart?.notify(),r?.then(()=>{e.animation=void 0,e.events.animationComplete?.notify()})};if(e.attach((l,m)=>{i=l,a=y=>m(x(y,s)),j.postRender(f)},c),w(t)){let l=n.skipInitialAnimation===!0;const m=t.on("change",A=>{l?(l=!1,e.jump(x(A,s),!1)):e.set(x(A,s))}),y=e.on("destroy",m);return()=>{m(),y()}}return c}function x(e,t){return t?e+t:e}function b(e){return typeof e=="number"?e:parseFloat(e)}function k(e){const t=h(()=>N(e)),{isStatic:n}=u.useContext(V);if(n){const[,o]=u.useState(e);u.useEffect(()=>t.on("change",o),[])}return t}function E(e,t){const n=k(t()),o=()=>n.set(t());return o(),G(()=>{const r=()=>j.preRender(o,!1,!0),i=e.map(a=>a.on("change",r));return()=>{i.forEach(a=>a()),H(o)}}),n}function T(e){g.current=[],e();const t=E(g.current,e);return g.current=void 0,t}function L(e,t,n,o){if(typeof e=="function")return T(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!="function")return U(e,t,n,o);const a=typeof t=="function"?t:P(t,n,o),s=Array.isArray(e)?S(e,a):S([e],([d])=>a(d)),c=Array.isArray(e)?void 0:e.accelerate;return c&&!c.isTransformed&&typeof t!="function"&&Array.isArray(n)&&o?.clamp!==!1&&(s.accelerate={...c,times:t,keyframes:n,isTransformed:!0}),s}function S(e,t){const n=h(()=>[]);return E(e,()=>{n.length=0;const o=e.length;for(let r=0;r<o;r++)n[r]=e[r].get();return t(n)})}function U(e,t,n,o){const r=h(()=>Object.keys(n)),i=h(()=>({}));for(const a of r)i[a]=L(e,t,n[a],o);return i}function z(e,t={}){const{isStatic:n}=u.useContext(V),o=()=>w(e)?e.get():e;if(n)return L(o);const r=k(o());return u.useInsertionEffect(()=>K(r,e,t),[r,JSON.stringify(t)]),r}function O(e,t={}){return z(e,{type:"spring",...t})}function J(e){const t=[...e];for(let n=t.length-1;n>0;n--){const o=Math.floor(Math.random()*(n+1));[t[n],t[o]]=[t[o],t[n]]}return t}function $(e,t){const n=J(e),o=Array.from({length:t},()=>[]);n.forEach((i,a)=>{o[a%t].push(i)});const r=Math.max(...o.map(i=>i.length));return o.forEach(i=>{for(;i.length<r;)i.push(n[Math.floor(Math.random()*n.length)])}),o}const q=F.memo(function({logos:t,index:n,currentTime:o,onHoverChange:r}){const[i,a]=u.useState(!1),s=4e3,c=n*400,d=(o+c)%(s*t.length),f=Math.floor(d/s),l=t[f],m=y=>{a(y),r(y)};return p.jsxs("div",{className:"relative flex flex-col items-center",onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[p.jsx(v.div,{className:"relative h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 overflow-hidden",initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{delay:n*.1,duration:.5,ease:"easeOut"},children:p.jsx(C,{mode:"wait",children:p.jsx(v.div,{className:"absolute inset-0 flex items-center justify-center",initial:{y:"18%",opacity:0,filter:"blur(4px)"},animate:{y:"0%",opacity:1,filter:"blur(0px)",transition:{type:"tween",ease:[.22,1,.36,1],duration:.9}},exit:{y:"-18%",opacity:0,filter:"blur(4px)",transition:{type:"tween",ease:[.4,0,1,1],duration:.55}},children:p.jsx(D,{provider:l.provider,size:24,className:"object-contain"})},`${l.id}-${f}`)})}),p.jsx(C,{children:i&&p.jsx(v.span,{className:"pointer-events-none absolute -bottom-7 z-10 whitespace-nowrap rounded bg-oai-gray-800 px-2 py-0.5 text-xs font-medium text-oai-gray-100 shadow-lg ring-1 ring-oai-gray-700",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:l.name})})]})});function _({logos:e,columnCount:t=2}){const[n,o]=u.useState([]),[r,i]=u.useState(0),[a,s]=u.useState(!1);u.useEffect(()=>{o($(e,t))},[e,t]),u.useEffect(()=>{if(a)return;const d=setInterval(()=>i(f=>f+100),100);return()=>clearInterval(d)},[a]);const c=u.useCallback(d=>{s(d)},[]);return p.jsx("div",{className:"flex gap-2.5 sm:gap-4 text-oai-gray-200",children:n.map((d,f)=>p.jsx(q,{logos:d,index:f,currentTime:r,onHoverChange:c},f))})}const Q=[{id:1,name:"Claude Code",provider:"claude"},{id:2,name:"Codex",provider:"codex"},{id:3,name:"Cursor",provider:"cursor"},{id:4,name:"Gemini",provider:"gemini"},{id:5,name:"OpenCode",provider:"opencode"},{id:6,name:"OpenClaw",provider:"openclaw"},{id:7,name:"Antigravity",provider:"antigravity"},{id:8,name:"Kiro",provider:"kiro"},{id:9,name:"Hermes",provider:"hermes"},{id:10,name:"GitHub Copilot",provider:"copilot"},{id:11,name:"Kimi",provider:"kimi"},{id:12,name:"oh-my-pi",provider:"omp"},{id:13,name:"Pi",provider:"pi"},{id:14,name:"CodeBuddy",provider:"codebuddy"},{id:15,name:"Grok",provider:"grok"},{id:16,name:"Kilo",provider:"kilo-cli"},{id:17,name:"Craft",provider:"craft"},{id:18,name:"Droid",provider:"droid"},{id:19,name:"GitHub",provider:"github"}];export{Q as A,_ as L,O as a,L as b,k as u};