tokentracker-cli 0.64.2 → 0.65.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.
- package/dashboard/dist/assets/ActivityHeatmap-Ccf0I3uP.js +42 -0
- package/dashboard/dist/assets/{Card-Cg-6DDbN.js → Card-BSF8dYEt.js} +1 -1
- package/dashboard/dist/assets/ConfirmModal-Bjp6eg2f.js +1 -0
- package/dashboard/dist/assets/DashboardPage-BInQkoDe.js +19 -0
- package/dashboard/dist/assets/{DevicePage-C78nzmZm.js → DevicePage-B0yxbDDR.js} +1 -1
- package/dashboard/dist/assets/DialogTitle-uw-Oa5Qv.js +1 -0
- package/dashboard/dist/assets/{FadeIn-RZKrtHup.js → FadeIn-DPIBqXRl.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-B1gFlLrg.js → HeaderGithubStar-DDXfJ1uC.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-RrZDmOFh.js → IpCheckPage-KC93tPlt.js} +1 -1
- package/dashboard/dist/assets/LandingPage-Itx2uPWI.js +4415 -0
- package/dashboard/dist/assets/{LeaderboardAvatar-_tiTs_tT.js → LeaderboardAvatar-Bv44b_Kl.js} +1 -1
- package/dashboard/dist/assets/LeaderboardPage-DDq5gzyz.js +2 -0
- package/dashboard/dist/assets/{LeaderboardProfileModal-BiQREZ6Z.js → LeaderboardProfileModal-LQyYrCf1.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfilePage-DU43hEuh.js → LeaderboardProfilePage-3you3mbA.js} +2 -2
- package/dashboard/dist/assets/LimitsPage-CrLvR8vE.js +3 -0
- package/dashboard/dist/assets/{LocalOnlyNotice-Dvcf7F9s.js → LocalOnlyNotice-Di1gnfIi.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-UlbsYFKJ.js → LoginPage-f9QHz_uZ.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-BsBKLiJu.js → PopoverPopup-7rjAxAqk.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-BuKemqhr.js → ResetPasswordPage-DKA7HGpJ.js} +1 -1
- package/dashboard/dist/assets/{Select-9oplHX46.js → Select-2gikPo1a.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-CnL08w_W.js → SelectItemText-DZx33XF1.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-CwHPmuZV.js +1 -0
- package/dashboard/dist/assets/SkillsPage-B6BJ9UZp.js +1 -0
- package/dashboard/dist/assets/WidgetsPage-D8p3Tx7E.js +1 -0
- package/dashboard/dist/assets/{WrappedPage-DPAz_bit.js → WrappedPage-cXEfhti9.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-uSGgZshc.js → agent-logos-D3iFlaWg.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-9sot4sNP.js → arrow-up-right-D87Aw_ZN.js} +1 -1
- package/dashboard/dist/assets/{download-3O0nnnqv.js → download-BtcEs1OB.js} +1 -1
- package/dashboard/dist/assets/index-BFIcLxb4.js +2 -0
- package/dashboard/dist/assets/main-CGx8BJ4O.css +1 -0
- package/dashboard/dist/assets/{main-C5qSiLnL.js → main-DqnXui98.js} +30 -19
- package/dashboard/dist/assets/{use-limits-display-prefs-Bh7PFn6x.js → use-limits-display-prefs-DAxlRSu2.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-MKCjJWeQ.js → use-native-settings-CgvB_B6W.js} +1 -1
- package/dashboard/dist/assets/use-ordered-list-DOfX6aSy.js +5 -0
- package/dashboard/dist/assets/{use-quality-per-dollar-pref-D-m9WqCz.js → use-quality-per-dollar-pref-kEbwQwk2.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-CCu4bGI4.js → use-usage-limits-la-KPfJj.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-BZmZ49MO.js → useCurrency-LDRg7ST0.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-BdBmNNmw.js → useScrollLock-lP1Is9IY.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/cli.js +7 -0
- package/src/commands/status.js +38 -0
- package/src/commands/sync.js +1 -0
- package/src/lib/pricing/curated-overrides.json +1 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/project-usage-purge.js +13 -2
- package/src/lib/rollout.js +364 -44
- package/src/lib/usage-limits.js +210 -2
- package/dashboard/dist/assets/ActivityHeatmap-CrW1u40M.js +0 -42
- package/dashboard/dist/assets/DashboardPage-Bl8jvnt-.js +0 -19
- package/dashboard/dist/assets/DialogTitle-COVyZQVB.js +0 -1
- package/dashboard/dist/assets/LandingPage-CV9EvgTg.js +0 -4411
- package/dashboard/dist/assets/LeaderboardPage-2tltO9IR.js +0 -6
- package/dashboard/dist/assets/LimitsPage-C7xuyH5P.js +0 -3
- package/dashboard/dist/assets/SettingsPage-CeqgABWP.js +0 -1
- package/dashboard/dist/assets/SkillsPage-CW6aD8GD.js +0 -1
- package/dashboard/dist/assets/WidgetsPage-DtOkMdxK.js +0 -1
- package/dashboard/dist/assets/index-BeoRn2gJ.js +0 -2
- package/dashboard/dist/assets/info-CfCBZRtQ.js +0 -1
- package/dashboard/dist/assets/main-DWsITcdg.css +0 -1
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-BiQREZ6Z.js","assets/main-C5qSiLnL.js","assets/main-DWsITcdg.css","assets/useCurrency-BZmZ49MO.js","assets/LeaderboardAvatar-_tiTs_tT.js","assets/ActivityHeatmap-CrW1u40M.js","assets/info-CfCBZRtQ.js","assets/arrow-up-right-9sot4sNP.js","assets/useScrollLock-BdBmNNmw.js","assets/DialogTitle-COVyZQVB.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as Qr,r as s,R as re,av as qe,j as c,V as L,G as y,aw as en,ax as tn,W as rn,Y as nn,ay as on,i as an,f as sn,az as ln,aA as cn,aB as Et,a4 as dn,aC as un,m as fn,U as gn,L as hn,J as bn,ag as kr,H as pn,aD as mn,aE as xn,aF as Qt,aG as vn,a2 as yn,K as wn}from"./main-C5qSiLnL.js";import{S as kn}from"./Select-9oplHX46.js";import{u as Sn}from"./useCurrency-BZmZ49MO.js";import{L as Lt}from"./LeaderboardAvatar-_tiTs_tT.js";import"./SelectItemText-CnL08w_W.js";import"./useScrollLock-BdBmNNmw.js";const Cn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Nn=Qr("arrow-right",Cn);function Rn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return s.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const Ct=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $e(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Wt(e){return"nodeType"in e}function ne(e){var t,r;return e?$e(e)?e:Wt(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Xt(e){const{Document:t}=ne(e);return e instanceof t}function at(e){return $e(e)?!1:e instanceof ne(e).HTMLElement}function Sr(e){return e instanceof ne(e).SVGElement}function Fe(e){return e?$e(e)?e.document:Wt(e)?Xt(e)?e:at(e)||Sr(e)?e.ownerDocument:document:document:document}const we=Ct?s.useLayoutEffect:s.useEffect;function Ht(e){const t=s.useRef(e);return we(()=>{t.current=e}),s.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function Dn(){const e=s.useRef(null),t=s.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=s.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function et(e,t){t===void 0&&(t=[e]);const r=s.useRef(e);return we(()=>{r.current!==e&&(r.current=e)},t),r}function st(e,t){const r=s.useRef();return s.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function vt(e){const t=Ht(e),r=s.useRef(null),n=s.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function Ot(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let Mt={};function it(e,t){return s.useMemo(()=>{if(t)return t;const r=Mt[e]==null?0:Mt[e]+1;return Mt[e]=r,e+"-"+r},[e,t])}function Cr(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,i)=>{const l=Object.entries(i);for(const[d,u]of l){const g=a[d];g!=null&&(a[d]=g+e*u)}return a},{...t})}}const Ke=Cr(1),tt=Cr(-1);function jn(e){return"clientX"in e&&"clientY"in e}function Gt(e){if(!e)return!1;const{KeyboardEvent:t}=ne(e.target);return t&&e instanceof t}function En(e){if(!e)return!1;const{TouchEvent:t}=ne(e.target);return t&&e instanceof t}function Pt(e){if(En(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return jn(e)?{x:e.clientX,y:e.clientY}:null}const rt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[rt.Translate.toString(e),rt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),er="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Mn(e){return e.matches(er)?e:e.querySelector(er)}const _n={display:"none"};function An(e){let{id:t,value:r}=e;return re.createElement("div",{id:t,style:_n},r)}function In(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return re.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Tn(){const[e,t]=s.useState("");return{announce:s.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Nr=s.createContext(null);function Ln(e){const t=s.useContext(Nr);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function On(){const[e]=s.useState(()=>new Set),t=s.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[s.useCallback(n=>{let{type:o,event:a}=n;e.forEach(i=>{var l;return(l=i[o])==null?void 0:l.call(i,a)})},[e]),t]}const Pn={draggable:`
|
|
3
|
-
To pick up a draggable item, press the space bar.
|
|
4
|
-
While dragging, use the arrow keys to move the item.
|
|
5
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
6
|
-
`},zn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Bn(e){let{announcements:t=zn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Pn}=e;const{announce:a,announcement:i}=Tn(),l=it("DndLiveRegion"),[d,u]=s.useState(!1);if(s.useEffect(()=>{u(!0)},[]),Ln(s.useMemo(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:b}=f;t.onDragMove&&a(t.onDragMove({active:p,over:b}))},onDragOver(f){let{active:p,over:b}=f;a(t.onDragOver({active:p,over:b}))},onDragEnd(f){let{active:p,over:b}=f;a(t.onDragEnd({active:p,over:b}))},onDragCancel(f){let{active:p,over:b}=f;a(t.onDragCancel({active:p,over:b}))}}),[a,t])),!d)return null;const g=re.createElement(re.Fragment,null,re.createElement(An,{id:n,value:o.draggable}),re.createElement(In,{id:l,announcement:i}));return r?qe.createPortal(g,r):g}var $;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})($||($={}));function yt(){}function tr(e,t){return s.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Kn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return s.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const me=Object.freeze({x:0,y:0});function Rr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Dr(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function $n(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function rr(e){let{left:t,top:r,height:n,width:o}=e;return[{x:t,y:r},{x:t+o,y:r},{x:t,y:r+n},{x:t+o,y:r+n}]}function jr(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function nr(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Fn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=nr(t,t.left,t.top),a=[];for(const i of n){const{id:l}=i,d=r.get(l);if(d){const u=Rr(nr(d),o);a.push({id:l,data:{droppableContainer:i,value:u}})}}return a.sort(Dr)},Un=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=rr(t),a=[];for(const i of n){const{id:l}=i,d=r.get(l);if(d){const u=rr(d),g=o.reduce((p,b,w)=>p+Rr(u[w],b),0),f=Number((g/4).toFixed(4));a.push({id:l,data:{droppableContainer:i,value:f}})}}return a.sort(Dr)};function Yn(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=o-n,l=a-r;if(n<o&&r<a){const d=t.width*t.height,u=e.width*e.height,g=i*l,f=g/(d+u-g);return Number(f.toFixed(4))}return 0}const Wn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:i}=a,l=r.get(i);if(l){const d=Yn(l,t);d>0&&o.push({id:i,data:{droppableContainer:a,value:d}})}}return o.sort($n)};function Xn(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Er(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:me}function Hn(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...r})}}const Gn=Hn(1);function Vn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function qn(e,t,r){const n=Vn(t);if(!n)return e;const{scaleX:o,scaleY:a,x:i,y:l}=n,d=e.left-i-(1-o)*parseFloat(r),u=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),g=o?e.width/o:e.width,f=a?e.height/a:e.height;return{width:g,height:f,top:u,right:d+g,bottom:u+f,left:d}}const Jn={ignoreTransform:!1};function Ue(e,t){t===void 0&&(t=Jn);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=ne(e).getComputedStyle(e);u&&(r=qn(r,u,g))}const{top:n,left:o,width:a,height:i,bottom:l,right:d}=r;return{top:n,left:o,width:a,height:i,bottom:l,right:d}}function or(e){return Ue(e,{ignoreTransform:!0})}function Zn(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Qn(e,t){return t===void 0&&(t=ne(e).getComputedStyle(e)),t.position==="fixed"}function eo(e,t){t===void 0&&(t=ne(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?r.test(a):!1})}function Nt(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(Xt(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!at(o)||Sr(o)||r.includes(o))return r;const a=ne(e).getComputedStyle(o);return o!==e&&eo(o,a)&&r.push(o),Qn(o,a)?r:n(o.parentNode)}return e?n(e):r}function Mr(e){const[t]=Nt(e,1);return t??null}function _t(e){return!Ct||!e?null:$e(e)?e:Wt(e)?Xt(e)||e===Fe(e).scrollingElement?window:at(e)?e:null:null}function _r(e){return $e(e)?e.scrollX:e.scrollLeft}function Ar(e){return $e(e)?e.scrollY:e.scrollTop}function zt(e){return{x:_r(e),y:Ar(e)}}var F;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(F||(F={}));function Ir(e){return!Ct||!e?!1:e===document.scrollingElement}function Tr(e){const t={x:0,y:0},r=Ir(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=n.y,l=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:i,isRight:l,maxScroll:n,minScroll:t}}const to={x:.2,y:.2};function ro(e,t,r,n,o){let{top:a,left:i,right:l,bottom:d}=r;n===void 0&&(n=10),o===void 0&&(o=to);const{isTop:u,isBottom:g,isLeft:f,isRight:p}=Tr(e),b={x:0,y:0},w={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&a<=t.top+m.height?(b.y=F.Backward,w.y=n*Math.abs((t.top+m.height-a)/m.height)):!g&&d>=t.bottom-m.height&&(b.y=F.Forward,w.y=n*Math.abs((t.bottom-m.height-d)/m.height)),!p&&l>=t.right-m.width?(b.x=F.Forward,w.x=n*Math.abs((t.right-m.width-l)/m.width)):!f&&i<=t.left+m.width&&(b.x=F.Backward,w.x=n*Math.abs((t.left+m.width-i)/m.width)),{direction:b,speed:w}}function no(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Lr(e){return e.reduce((t,r)=>Ke(t,zt(r)),me)}function oo(e){return e.reduce((t,r)=>t+_r(r),0)}function ao(e){return e.reduce((t,r)=>t+Ar(r),0)}function so(e,t){if(t===void 0&&(t=Ue),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);Mr(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const io=[["x",["left","right"],oo],["y",["top","bottom"],ao]];class Vt{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Nt(r),o=Lr(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of io)for(const d of i)Object.defineProperty(this,d,{get:()=>{const u=l(n),g=o[a]-u;return this.rect[d]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Je{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var o;(o=this.target)==null||o.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function lo(e){const{EventTarget:t}=ne(e);return e instanceof t?e:Fe(e)}function At(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var fe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(fe||(fe={}));function ar(e){e.preventDefault()}function co(e){e.stopPropagation()}var E;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(E||(E={}));const Or={start:[E.Space,E.Enter],cancel:[E.Esc],end:[E.Space,E.Enter,E.Tab]},uo=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case E.Right:return{...r,x:r.x+25};case E.Left:return{...r,x:r.x-25};case E.Down:return{...r,y:r.y+25};case E.Up:return{...r,y:r.y-25}}};class qt{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new Je(Fe(r)),this.windowListeners=new Je(ne(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(fe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&so(n),r(me)}handleKeyDown(t){if(Gt(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=Or,coordinateGetter:i=uo,scrollBehavior:l="smooth"}=o,{code:d}=t;if(a.end.includes(d)){this.handleEnd(t);return}if(a.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:u}=n.current,g=u?{x:u.left,y:u.top}:me;this.referenceCoordinates||(this.referenceCoordinates=g);const f=i(t,{active:r,context:n.current,currentCoordinates:g});if(f){const p=tt(f,g),b={x:0,y:0},{scrollableAncestors:w}=n.current;for(const m of w){const x=t.code,{isTop:k,isRight:S,isLeft:v,isBottom:N,maxScroll:_,minScroll:R}=Tr(m),C=no(m),D={x:Math.min(x===E.Right?C.right-C.width/2:C.right,Math.max(x===E.Right?C.left:C.left+C.width/2,f.x)),y:Math.min(x===E.Down?C.bottom-C.height/2:C.bottom,Math.max(x===E.Down?C.top:C.top+C.height/2,f.y))},P=x===E.Right&&!S||x===E.Left&&!v,I=x===E.Down&&!N||x===E.Up&&!k;if(P&&D.x!==f.x){const j=m.scrollLeft+p.x,oe=x===E.Right&&j<=_.x||x===E.Left&&j>=R.x;if(oe&&!p.y){m.scrollTo({left:j,behavior:l});return}oe?b.x=m.scrollLeft-j:b.x=x===E.Right?m.scrollLeft-_.x:m.scrollLeft-R.x,b.x&&m.scrollBy({left:-b.x,behavior:l});break}else if(I&&D.y!==f.y){const j=m.scrollTop+p.y,oe=x===E.Down&&j<=_.y||x===E.Up&&j>=R.y;if(oe&&!p.x){m.scrollTo({top:j,behavior:l});return}oe?b.y=m.scrollTop-j:b.y=x===E.Down?m.scrollTop-_.y:m.scrollTop-R.y,b.y&&m.scrollBy({top:-b.y,behavior:l});break}}this.handleMove(t,Ke(tt(f,this.referenceCoordinates),b))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}qt.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Or,onActivation:o}=t,{active:a}=r;const{code:i}=e.nativeEvent;if(n.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function sr(e){return!!(e&&"distance"in e)}function ir(e){return!!(e&&"delay"in e)}class Jt{constructor(t,r,n){var o;n===void 0&&(n=lo(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:i}=a;this.props=t,this.events=r,this.document=Fe(i),this.documentListeners=new Je(this.document),this.listeners=new Je(n),this.windowListeners=new Je(ne(i)),this.initialCoordinates=(o=Pt(a))!=null?o:me,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(fe.Resize,this.handleCancel),this.windowListeners.add(fe.DragStart,ar),this.windowListeners.add(fe.VisibilityChange,this.handleCancel),this.windowListeners.add(fe.ContextMenu,ar),this.documentListeners.add(fe.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ir(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(sr(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:o}=this.props;o(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(fe.Click,co,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(fe.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!o)return;const d=(r=Pt(t))!=null?r:me,u=tt(o,d);if(!n&&l){if(sr(l)){if(l.tolerance!=null&&At(u,l.tolerance))return this.handleCancel();if(At(u,l.distance))return this.handleStart()}if(ir(l)&&At(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),i(d)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===E.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const fo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Zt extends Jt{constructor(t){const{event:r}=t,n=Fe(r.target);super(t,fo,n)}}Zt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];const go={move:{name:"mousemove"},end:{name:"mouseup"}};var Bt;(function(e){e[e.RightClick=2]="RightClick"})(Bt||(Bt={}));class ho extends Jt{constructor(t){super(t,go,Fe(t.event.target))}}ho.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Bt.RightClick?!1:(n?.({event:r}),!0)}}];const It={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class bo extends Jt{constructor(t){super(t,It)}static setup(){return window.addEventListener(It.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(It.move.name,t)};function t(){}}}bo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:o}=r;return o.length>1?!1:(n?.({event:r}),!0)}}];var Ze;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ze||(Ze={}));var wt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(wt||(wt={}));function po(e){let{acceleration:t,activator:r=Ze.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:i=5,order:l=wt.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:p}=e;const b=xo({delta:f,disabled:!a}),[w,m]=Dn(),x=s.useRef({x:0,y:0}),k=s.useRef({x:0,y:0}),S=s.useMemo(()=>{switch(r){case Ze.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Ze.DraggableRect:return o}},[r,o,d]),v=s.useRef(null),N=s.useCallback(()=>{const R=v.current;if(!R)return;const C=x.current.x*k.current.x,D=x.current.y*k.current.y;R.scrollBy(C,D)},[]),_=s.useMemo(()=>l===wt.TreeOrder?[...u].reverse():u,[l,u]);s.useEffect(()=>{if(!a||!u.length||!S){m();return}for(const R of _){if(n?.(R)===!1)continue;const C=u.indexOf(R),D=g[C];if(!D)continue;const{direction:P,speed:I}=ro(R,D,S,t,p);for(const j of["x","y"])b[j][P[j]]||(I[j]=0,P[j]=0);if(I.x>0||I.y>0){m(),v.current=R,w(N,i),x.current=I,k.current=P;return}}x.current={x:0,y:0},k.current={x:0,y:0},m()},[t,N,n,m,a,i,JSON.stringify(S),JSON.stringify(b),w,u,_,g,JSON.stringify(p)])}const mo={x:{[F.Backward]:!1,[F.Forward]:!1},y:{[F.Backward]:!1,[F.Forward]:!1}};function xo(e){let{delta:t,disabled:r}=e;const n=Ot(t);return st(o=>{if(r||!n||!o)return mo;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[F.Backward]:o.x[F.Backward]||a.x===-1,[F.Forward]:o.x[F.Forward]||a.x===1},y:{[F.Backward]:o.y[F.Backward]||a.y===-1,[F.Forward]:o.y[F.Forward]||a.y===1}}},[r,t,n])}function vo(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return st(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function yo(e,t){return s.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,n)}));return[...r,...a]},[]),[e,t])}var nt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(nt||(nt={}));var Kt;(function(e){e.Optimized="optimized"})(Kt||(Kt={}));const lr=new Map;function wo(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,i]=s.useState(null),{frequency:l,measure:d,strategy:u}=o,g=s.useRef(e),f=x(),p=et(f),b=s.useCallback(function(k){k===void 0&&(k=[]),!p.current&&i(S=>S===null?k:S.concat(k.filter(v=>!S.includes(v))))},[p]),w=s.useRef(null),m=st(k=>{if(f&&!r)return lr;if(!k||k===lr||g.current!==e||a!=null){const S=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){S.set(v.id,v.rect.current);continue}const N=v.node.current,_=N?new Vt(d(N),N):null;v.rect.current=_,_&&S.set(v.id,_)}return S}return k},[e,a,r,f,d]);return s.useEffect(()=>{g.current=e},[e]),s.useEffect(()=>{f||b()},[r,f]),s.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),s.useEffect(()=>{f||typeof l!="number"||w.current!==null||(w.current=setTimeout(()=>{b(),w.current=null},l))},[l,f,b,...n]),{droppableRects:m,measureDroppableContainers:b,measuringScheduled:a!=null};function x(){switch(u){case nt.Always:return!1;case nt.BeforeDragging:return r;default:return!r}}}function Pr(e,t){return st(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function ko(e,t){return Pr(e,t)}function So(e){let{callback:t,disabled:r}=e;const n=Ht(t),o=s.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function Rt(e){let{callback:t,disabled:r}=e;const n=Ht(t),o=s.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function Co(e){return new Vt(Ue(e),e)}function cr(e,t,r){t===void 0&&(t=Co);const[n,o]=s.useState(null);function a(){o(d=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=d??r)!=null?u:null}const g=t(e);return JSON.stringify(d)===JSON.stringify(g)?d:g})}const i=So({callback(d){if(e)for(const u of d){const{type:g,target:f}=u;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=Rt({callback:a});return we(()=>{a(),e?(l?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),i?.disconnect())},[e]),n}function No(e){const t=Pr(e);return Er(e,t)}const dr=[];function Ro(e){const t=s.useRef(e),r=st(n=>e?n&&n!==dr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Nt(e):dr,[e]);return s.useEffect(()=>{t.current=e},[e]),r}function Do(e){const[t,r]=s.useState(null),n=s.useRef(e),o=s.useCallback(a=>{const i=_t(a.target);i&&r(l=>l?(l.set(i,zt(i)),new Map(l)):null)},[]);return s.useEffect(()=>{const a=n.current;if(e!==a){i(a);const l=e.map(d=>{const u=_t(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,zt(u)]):null}).filter(d=>d!=null);r(l.length?new Map(l):null),n.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(d=>{const u=_t(d);u?.removeEventListener("scroll",o)})}},[o,e]),s.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Ke(a,i),me):Lr(e):me,[e,t])}function ur(e,t){t===void 0&&(t=[]);const r=s.useRef(null);return s.useEffect(()=>{r.current=null},t),s.useEffect(()=>{const n=e!==me;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?tt(e,r.current):me}function jo(e){s.useEffect(()=>{if(!Ct)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function Eo(e,t){return s.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=i=>{a(i,t)},r},{}),[e,t])}function zr(e){return s.useMemo(()=>e?Zn(e):null,[e])}const fr=[];function Mo(e,t){t===void 0&&(t=Ue);const[r]=e,n=zr(r?ne(r):null),[o,a]=s.useState(fr);function i(){a(()=>e.length?e.map(d=>Ir(d)?n:new Vt(t(d),d)):fr)}const l=Rt({callback:i});return we(()=>{l?.disconnect(),i(),e.forEach(d=>l?.observe(d))},[e]),o}function _o(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return at(t)?t:e}function Ao(e){let{measure:t}=e;const[r,n]=s.useState(null),o=s.useCallback(u=>{for(const{target:g}of u)if(at(g)){n(f=>{const p=t(g);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=Rt({callback:o}),i=s.useCallback(u=>{const g=_o(u);a?.disconnect(),g&&a?.observe(g),n(g?t(g):null)},[t,a]),[l,d]=vt(i);return s.useMemo(()=>({nodeRef:l,rect:r,setRef:d}),[r,l,d])}const Io=[{sensor:Zt,options:{}},{sensor:qt,options:{}}],To={current:{}},xt={draggable:{measure:or},droppable:{measure:or,strategy:nt.WhileDragging,frequency:Kt.Optimized},dragOverlay:{measure:Ue}};class Qe extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const Lo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Qe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:yt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:xt,measureDroppableContainers:yt,windowRect:null,measuringScheduled:!1},Oo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:yt,draggableNodes:new Map,over:null,measureDroppableContainers:yt},Dt=s.createContext(Oo),Br=s.createContext(Lo);function Po(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Qe}}}function zo(e,t){switch(t.type){case $.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case $.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case $.DragEnd:case $.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case $.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new Qe(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case $.SetDroppableDisabled:{const{id:r,key:n,disabled:o}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const i=new Qe(e.droppable.containers);return i.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case $.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new Qe(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Bo(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=s.useContext(Dt),a=Ot(n),i=Ot(r?.id);return s.useEffect(()=>{if(!t&&!n&&a&&i!=null){if(!Gt(a)||document.activeElement===a.target)return;const l=o.get(i);if(!l)return;const{activatorNode:d,node:u}=l;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[d.current,u.current]){if(!g)continue;const f=Mn(g);if(f){f.focus();break}}})}},[n,t,o,i,a]),null}function Ko(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function $o(e){return s.useMemo(()=>({draggable:{...xt.draggable,...e?.draggable},droppable:{...xt.droppable,...e?.droppable},dragOverlay:{...xt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fo(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=s.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;we(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!n)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const g=r(u),f=Er(g,n);if(i||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=Mr(u);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,l,n,r])}const Kr=s.createContext({...me,scaleX:1,scaleY:1});var Ie;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ie||(Ie={}));const Uo=s.memo(function(t){var r,n,o,a;let{id:i,accessibility:l,autoScroll:d=!0,children:u,sensors:g=Io,collisionDetection:f=Wn,measuring:p,modifiers:b,...w}=t;const m=s.useReducer(zo,void 0,Po),[x,k]=m,[S,v]=On(),[N,_]=s.useState(Ie.Uninitialized),R=N===Ie.Initialized,{draggable:{active:C,nodes:D,translate:P},droppable:{containers:I}}=x,j=C!=null?D.get(C):null,oe=s.useRef({initial:null,translated:null}),Z=s.useMemo(()=>{var B;return C!=null?{id:C,data:(B=j?.data)!=null?B:To,rect:oe}:null},[C,j]),ae=s.useRef(null),[ke,Pe]=s.useState(null),[V,Te]=s.useState(null),ge=et(w,Object.values(w)),Le=it("DndDescribedBy",i),ze=s.useMemo(()=>I.getEnabled(),[I]),U=$o(p),{droppableRects:ce,measureDroppableContainers:K,measuringScheduled:Oe}=wo(ze,{dragging:R,dependencies:[P.x,P.y],config:U.droppable}),Y=vo(D,C),he=s.useMemo(()=>V?Pt(V):null,[V]),T=Me(),q=ko(Y,U.draggable.measure);Fo({activeNode:C!=null?D.get(C):null,config:T.layoutShiftCompensation,initialRect:q,measure:U.draggable.measure});const M=cr(Y,U.draggable.measure,q),Se=cr(Y?Y.parentElement:null),O=s.useRef({activatorEvent:null,active:null,activeNode:Y,collisionRect:null,collisions:null,droppableRects:ce,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),W=I.getNodeFor((r=O.current.over)==null?void 0:r.id),Q=Ao({measure:U.dragOverlay.measure}),De=(n=Q.nodeRef.current)!=null?n:Y,se=R?(o=Q.rect)!=null?o:M:null,lt=!!(Q.nodeRef.current&&Q.rect),Ye=No(lt?null:M),Be=zr(De?ne(De):null),be=Ro(R?W??Y:null),de=Mo(be),Ce=Ko(b,{transform:{x:P.x-Ye.x,y:P.y-Ye.y,scaleX:1,scaleY:1},activatorEvent:V,active:Z,activeNodeRect:M,containerNodeRect:Se,draggingNodeRect:se,over:O.current.over,overlayNodeRect:Q.rect,scrollableAncestors:be,scrollableAncestorRects:de,windowRect:Be}),ct=he?Ke(he,P):null,We=Do(be),dt=ur(We),ut=ur(We,[M]),Ne=Ke(Ce,dt),xe=se?Gn(se,Ce):null,ue=Z&&xe?f({active:Z,collisionRect:xe,droppableRects:ce,droppableContainers:ze,pointerCoordinates:ct}):null,ft=jr(ue,"id"),[ve,gt]=s.useState(null),ht=lt?Ce:Ke(Ce,ut),bt=Xn(ht,(a=ve?.rect)!=null?a:null,M),je=s.useRef(null),Ee=s.useCallback((B,J)=>{let{sensor:z,options:ee}=J;if(ae.current==null)return;const ie=D.get(ae.current);if(!ie)return;const te=B.nativeEvent,le=new z({active:ae.current,activeNode:ie,event:te,options:ee,context:O,onAbort(X){if(!D.get(X))return;const{onDragAbort:ye}=ge.current,Re={id:X};ye?.(Re),S({type:"onDragAbort",event:Re})},onPending(X,_e,ye,Re){if(!D.get(X))return;const{onDragPending:Ge}=ge.current,Ae={id:X,constraint:_e,initialCoordinates:ye,offset:Re};Ge?.(Ae),S({type:"onDragPending",event:Ae})},onStart(X){const _e=ae.current;if(_e==null)return;const ye=D.get(_e);if(!ye)return;const{onDragStart:Re}=ge.current,He={activatorEvent:te,active:{id:_e,data:ye.data,rect:oe}};qe.unstable_batchedUpdates(()=>{Re?.(He),_(Ie.Initializing),k({type:$.DragStart,initialCoordinates:X,active:_e}),S({type:"onDragStart",event:He}),Pe(je.current),Te(te)})},onMove(X){k({type:$.DragMove,coordinates:X})},onEnd:G($.DragEnd),onCancel:G($.DragCancel)});je.current=le;function G(X){return async function(){const{active:ye,collisions:Re,over:He,scrollAdjustedTranslate:Ge}=O.current;let Ae=null;if(ye&&Ge){const{cancelDrop:Ve}=ge.current;Ae={activatorEvent:te,active:ye,collisions:Re,delta:Ge,over:He},X===$.DragEnd&&typeof Ve=="function"&&await Promise.resolve(Ve(Ae))&&(X=$.DragCancel)}ae.current=null,qe.unstable_batchedUpdates(()=>{k({type:X}),_(Ie.Uninitialized),gt(null),Pe(null),Te(null),je.current=null;const Ve=X===$.DragEnd?"onDragEnd":"onDragCancel";if(Ae){const jt=ge.current[Ve];jt?.(Ae),S({type:Ve,event:Ae})}})}}},[D]),Xe=s.useCallback((B,J)=>(z,ee)=>{const ie=z.nativeEvent,te=D.get(ee);if(ae.current!==null||!te||ie.dndKit||ie.defaultPrevented)return;const le={active:te};B(z,J.options,le)===!0&&(ie.dndKit={capturedBy:J.sensor},ae.current=ee,Ee(z,J))},[D,Ee]),h=yo(g,Xe);jo(g),we(()=>{M&&N===Ie.Initializing&&_(Ie.Initialized)},[M,N]),s.useEffect(()=>{const{onDragMove:B}=ge.current,{active:J,activatorEvent:z,collisions:ee,over:ie}=O.current;if(!J||!z)return;const te={active:J,activatorEvent:z,collisions:ee,delta:{x:Ne.x,y:Ne.y},over:ie};qe.unstable_batchedUpdates(()=>{B?.(te),S({type:"onDragMove",event:te})})},[Ne.x,Ne.y]),s.useEffect(()=>{const{active:B,activatorEvent:J,collisions:z,droppableContainers:ee,scrollAdjustedTranslate:ie}=O.current;if(!B||ae.current==null||!J||!ie)return;const{onDragOver:te}=ge.current,le=ee.get(ft),G=le&&le.rect.current?{id:le.id,rect:le.rect.current,data:le.data,disabled:le.disabled}:null,X={active:B,activatorEvent:J,collisions:z,delta:{x:ie.x,y:ie.y},over:G};qe.unstable_batchedUpdates(()=>{gt(G),te?.(X),S({type:"onDragOver",event:X})})},[ft]),we(()=>{O.current={activatorEvent:V,active:Z,activeNode:Y,collisionRect:xe,collisions:ue,droppableRects:ce,draggableNodes:D,draggingNode:De,draggingNodeRect:se,droppableContainers:I,over:ve,scrollableAncestors:be,scrollAdjustedTranslate:Ne},oe.current={initial:se,translated:xe}},[Z,Y,ue,xe,D,De,se,ce,I,ve,be,Ne]),po({...T,delta:P,draggingRect:xe,pointerCoordinates:ct,scrollableAncestors:be,scrollableAncestorRects:de});const A=s.useMemo(()=>({active:Z,activeNode:Y,activeNodeRect:M,activatorEvent:V,collisions:ue,containerNodeRect:Se,dragOverlay:Q,draggableNodes:D,droppableContainers:I,droppableRects:ce,over:ve,measureDroppableContainers:K,scrollableAncestors:be,scrollableAncestorRects:de,measuringConfiguration:U,measuringScheduled:Oe,windowRect:Be}),[Z,Y,M,V,ue,Se,Q,D,I,ce,ve,K,be,de,U,Oe,Be]),H=s.useMemo(()=>({activatorEvent:V,activators:h,active:Z,activeNodeRect:M,ariaDescribedById:{draggable:Le},dispatch:k,draggableNodes:D,over:ve,measureDroppableContainers:K}),[V,h,Z,M,k,Le,D,ve,K]);return re.createElement(Nr.Provider,{value:v},re.createElement(Dt.Provider,{value:H},re.createElement(Br.Provider,{value:A},re.createElement(Kr.Provider,{value:bt},u)),re.createElement(Bo,{disabled:l?.restoreFocus===!1})),re.createElement(Bn,{...l,hiddenTextDescribedById:Le}));function Me(){const B=ke?.autoScrollEnabled===!1,J=typeof d=="object"?d.enabled===!1:d===!1,z=R&&!B&&!J;return typeof d=="object"?{...d,enabled:z}:{enabled:z}}}),Yo=s.createContext(null),gr="button",Wo="Draggable";function Xo(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=it(Wo),{activators:i,activatorEvent:l,active:d,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:p}=s.useContext(Dt),{role:b=gr,roleDescription:w="draggable",tabIndex:m=0}=o??{},x=d?.id===t,k=s.useContext(x?Kr:Yo),[S,v]=vt(),[N,_]=vt(),R=Eo(i,t),C=et(r);we(()=>(f.set(t,{id:t,key:a,node:S,activatorNode:N,data:C}),()=>{const P=f.get(t);P&&P.key===a&&f.delete(t)}),[f,t]);const D=s.useMemo(()=>({role:b,tabIndex:m,"aria-disabled":n,"aria-pressed":x&&b===gr?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[n,b,m,x,w,g.draggable]);return{active:d,activatorEvent:l,activeNodeRect:u,attributes:D,isDragging:x,listeners:n?void 0:R,node:S,over:p,setNodeRef:v,setActivatorNodeRef:_,transform:k}}function Ho(){return s.useContext(Br)}const Go="Droppable",Vo={timeout:25};function qo(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=it(Go),{active:i,dispatch:l,over:d,measureDroppableContainers:u}=s.useContext(Dt),g=s.useRef({disabled:r}),f=s.useRef(!1),p=s.useRef(null),b=s.useRef(null),{disabled:w,updateMeasurementsFor:m,timeout:x}={...Vo,...o},k=et(m??n),S=s.useCallback(()=>{if(!f.current){f.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{u(Array.isArray(k.current)?k.current:[k.current]),b.current=null},x)},[x]),v=Rt({callback:S,disabled:w||!i}),N=s.useCallback((D,P)=>{v&&(P&&(v.unobserve(P),f.current=!1),D&&v.observe(D))},[v]),[_,R]=vt(N),C=et(t);return s.useEffect(()=>{!v||!_.current||(v.disconnect(),f.current=!1,v.observe(_.current))},[_,v]),s.useEffect(()=>(l({type:$.RegisterDroppable,element:{id:n,key:a,disabled:r,node:_,rect:p,data:C}}),()=>l({type:$.UnregisterDroppable,key:a,id:n})),[n]),s.useEffect(()=>{r!==g.current.disabled&&(l({type:$.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,l]),{active:i,rect:p,isOver:d?.id===n,node:_,over:d,setNodeRef:R}}const Jo=e=>{let{transform:t}=e;return{...t,y:0}};function $r(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Zo(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function pt(e){return e!==null&&e>=0}function Qo(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function ea(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const mt={scaleX:1,scaleY:1},ta=e=>{var t;let{rects:r,activeNodeRect:n,activeIndex:o,overIndex:a,index:i}=e;const l=(t=r[o])!=null?t:n;if(!l)return null;const d=ra(r,i,o);if(i===o){const u=r[a];return u?{x:o<a?u.left+u.width-(l.left+l.width):u.left-l.left,y:0,...mt}:null}return i>o&&i<=a?{x:-l.width-d,y:0,...mt}:i<o&&i>=a?{x:l.width+d,y:0,...mt}:{x:0,y:0,...mt}};function ra(e,t,r){const n=e[t],o=e[t-1],a=e[t+1];return!n||!o&&!a?0:r<t?o?n.left-(o.left+o.width):a.left-(n.left+n.width):a?a.left-(n.left+n.width):n.left-(o.left+o.width)}const Fr=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=$r(t,n,r),i=t[o],l=a[o];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},Ur="Sortable",Yr=re.createContext({activeIndex:-1,containerId:Ur,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Fr,disabled:{draggable:!1,droppable:!1}});function na(e){let{children:t,id:r,items:n,strategy:o=Fr,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:d,over:u,measureDroppableContainers:g}=Ho(),f=it(Ur,r),p=l.rect!==null,b=s.useMemo(()=>n.map(R=>typeof R=="object"&&"id"in R?R.id:R),[n]),w=i!=null,m=i?b.indexOf(i.id):-1,x=u?b.indexOf(u.id):-1,k=s.useRef(b),S=!Qo(b,k.current),v=x!==-1&&m===-1||S,N=ea(a);we(()=>{S&&w&&g(b)},[S,b,w,g]),s.useEffect(()=>{k.current=b},[b]);const _=s.useMemo(()=>({activeIndex:m,containerId:f,disabled:N,disableTransforms:v,items:b,overIndex:x,useDragOverlay:p,sortedRects:Zo(b,d),strategy:o}),[m,f,N.draggable,N.droppable,v,b,x,d,p,o]);return re.createElement(Yr.Provider,{value:_},t)}const oa=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return $r(r,n,o).indexOf(t)},aa=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:i,previousItems:l,previousContainerId:d,transition:u}=e;return!u||!n||l!==a&&o===i?!1:r?!0:i!==o&&t===d},sa={duration:200,easing:"ease"},Wr="transform",ia=rt.Transition.toString({property:Wr,duration:0,easing:"linear"}),la={roleDescription:"sortable"};function ca(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,i]=s.useState(null),l=s.useRef(r);return we(()=>{if(!t&&r!==l.current&&n.current){const d=o.current;if(d){const u=Ue(n.current,{ignoreTransform:!0}),g={x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height};(g.x||g.y)&&i(g)}}r!==l.current&&(l.current=r)},[t,r,n,o]),s.useEffect(()=>{a&&i(null)},[a]),a}function da(e){let{animateLayoutChanges:t=aa,attributes:r,disabled:n,data:o,getNewIndex:a=oa,id:i,strategy:l,resizeObserverConfig:d,transition:u=sa}=e;const{items:g,containerId:f,activeIndex:p,disabled:b,disableTransforms:w,sortedRects:m,overIndex:x,useDragOverlay:k,strategy:S}=s.useContext(Yr),v=ua(n,b),N=g.indexOf(i),_=s.useMemo(()=>({sortable:{containerId:f,index:N,items:g},...o}),[f,o,N,g]),R=s.useMemo(()=>g.slice(g.indexOf(i)),[g,i]),{rect:C,node:D,isOver:P,setNodeRef:I}=qo({id:i,data:_,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...d}}),{active:j,activatorEvent:oe,activeNodeRect:Z,attributes:ae,setNodeRef:ke,listeners:Pe,isDragging:V,over:Te,setActivatorNodeRef:ge,transform:Le}=Xo({id:i,data:_,attributes:{...la,...r},disabled:v.draggable}),ze=Rn(I,ke),U=!!j,ce=U&&!w&&pt(p)&&pt(x),K=!k&&V,Oe=K&&ce?Le:null,he=ce?Oe??(l??S)({rects:m,activeNodeRect:Z,activeIndex:p,overIndex:x,index:N}):null,T=pt(p)&&pt(x)?a({id:i,items:g,activeIndex:p,overIndex:x}):N,q=j?.id,M=s.useRef({activeId:q,items:g,newIndex:T,containerId:f}),Se=g!==M.current.items,O=t({active:j,containerId:f,isDragging:V,isSorting:U,id:i,index:N,items:g,newIndex:M.current.newIndex,previousItems:M.current.items,previousContainerId:M.current.containerId,transition:u,wasDragging:M.current.activeId!=null}),W=ca({disabled:!O,index:N,node:D,rect:C});return s.useEffect(()=>{U&&M.current.newIndex!==T&&(M.current.newIndex=T),f!==M.current.containerId&&(M.current.containerId=f),g!==M.current.items&&(M.current.items=g)},[U,T,f,g]),s.useEffect(()=>{if(q===M.current.activeId)return;if(q&&!M.current.activeId){M.current.activeId=q;return}const De=setTimeout(()=>{M.current.activeId=q},50);return()=>clearTimeout(De)},[q]),{active:j,activeIndex:p,attributes:ae,data:_,rect:C,index:N,newIndex:T,items:g,isOver:P,isSorting:U,isDragging:V,listeners:Pe,node:D,overIndex:x,over:Te,setNodeRef:ze,setActivatorNodeRef:ge,setDroppableNodeRef:I,setDraggableNodeRef:ke,transform:W??he,transition:Q()};function Q(){if(W||Se&&M.current.newIndex===N)return ia;if(!(K&&!Gt(oe)||!u)&&(U||O))return rt.Transition.toString({...u,property:Wr})}}function ua(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function kt(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const fa=[E.Down,E.Right,E.Up,E.Left],ga=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:i,scrollableAncestors:l}}=t;if(fa.includes(e.code)){if(e.preventDefault(),!r||!n)return;const d=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const p=o.get(f.id);if(p)switch(e.code){case E.Down:n.top<p.top&&d.push(f);break;case E.Up:n.top>p.top&&d.push(f);break;case E.Left:n.left>p.left&&d.push(f);break;case E.Right:n.left<p.left&&d.push(f);break}});const u=Un({collisionRect:n,droppableRects:o,droppableContainers:d});let g=jr(u,"id");if(g===i?.id&&u.length>1&&(g=u[1].id),g!=null){const f=a.get(r.id),p=a.get(g),b=p?o.get(p.id):null,w=p?.node.current;if(w&&b&&f&&p){const x=Nt(w).some((R,C)=>l[C]!==R),k=Xr(f,p),S=ha(f,p),v=x||!k?{x:0,y:0}:{x:S?n.width-b.width:0,y:S?n.height-b.height:0},N={x:b.left,y:b.top};return v.x&&v.y?N:tt(N,v)}}}};function Xr(e,t){return!kt(e)||!kt(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ha(e,t){return!kt(e)||!kt(t)||!Xr(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function ot(e,{min:t,max:r,fallback:n}){const o=Number(e);if(!Number.isFinite(o))return n;const a=Math.floor(o);return a<t?t:a>r?r:a}function ba(e,t){const r=ot(t,{min:0,max:1e6,fallback:0}),n=ot(e,{min:1,max:Math.max(1,r||1),fallback:1});if(r<=1)return[1];const o=new Set([1,r,n-2,n-1,n,n+1,n+2]),a=Array.from(o).filter(d=>Number.isInteger(d)&&d>=1&&d<=r).sort((d,u)=>d-u),i=[];let l=null;for(const d of a)l!=null&&d-l>1&&i.push(null),i.push(d),l=d;return i}function pa({page:e,totalPages:t}){const r=typeof t=="number"&&Number.isFinite(t)&&t>=0,n=r?ot(t,{min:0,max:1e6,fallback:0}):null,o=ot(e,{min:1,max:r?Math.max(1,n||1):1e6,fallback:1}),a=o>1,i=r?o<n:!0;return{canPrev:a,canNext:i,safePage:o,safeTotal:n}}function ma({entries:e,me:t,meLabel:r}){const n=Array.isArray(e)?e:[],o=t&&typeof t.rank=="number"?t.rank:null;return!o||n.some(i=>!!i?.is_me)?n:[{rank:o,is_me:!0,is_pinned:!0,user_id:t?.user_id??null,display_name:r,avatar_url:t?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:t?.gpt_tokens??"0",claude_tokens:t?.claude_tokens??"0",gemini_tokens:t?.gemini_tokens??"0",cursor_tokens:t?.cursor_tokens??"0",opencode_tokens:t?.opencode_tokens??"0",openclaw_tokens:t?.openclaw_tokens??"0",hermes_tokens:t?.hermes_tokens??"0",kiro_tokens:t?.kiro_tokens??"0",copilot_tokens:t?.copilot_tokens??"0",kimi_tokens:t?.kimi_tokens??"0",other_tokens:t?.other_tokens??"0",total_tokens:t?.total_tokens??"0",estimated_cost_usd:t?.estimated_cost_usd??null},...n]}function xa(e,t){const r=Number(e),n=Number(t);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:Math.ceil(r/n)}const va=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function ya({iconSrc:e,label:t}){return c.jsxs("span",{className:"inline-flex items-center gap-3",children:[e?c.jsx("img",{src:e,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${va.has(e)?"dark:invert":""}`}):null,c.jsx("span",{className:"whitespace-nowrap",children:t})]})}const St=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],Hr="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",Gr="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function $t(e){return L("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",e?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function Ft(e){return L("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",e?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function pe({className:e}){return c.jsx("div",{className:L("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function wa({index:e}){const t=e<3?"w-24":e<8?"w-20":"w-16",r=e<3?"w-16":"w-12",n=e<5?"w-14":"w-10";return c.jsxs("tr",{className:"group",children:[c.jsx("td",{className:L($t(!1),"!group-hover:bg-transparent"),children:c.jsx(pe,{className:"h-4 w-6"})}),c.jsx("td",{className:L(Ft(!1),"!group-hover:bg-transparent"),children:c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(pe,{className:"h-8 w-8 min-w-8 rounded-full"}),c.jsx(pe,{className:L("h-4",t)})]})}),c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(pe,{className:L("h-4",r)})}),c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(pe,{className:"h-4 w-12"})}),St.map(o=>c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(pe,{className:L("h-4",n)})},o.key))]})}function ka({rows:e=10}){return c.jsx("div",{className:"w-full overflow-x-auto",children:c.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[c.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:c.jsxs("tr",{children:[c.jsx("th",{className:L(Hr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(pe,{className:"h-3.5 w-6"})}),c.jsx("th",{className:L(Gr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(pe,{className:"h-3.5 w-12"})}),c.jsx("th",{className:"px-4 py-4",children:c.jsx(pe,{className:"h-3.5 w-10"})}),c.jsx("th",{className:"px-4 py-4",children:c.jsx(pe,{className:"h-3.5 w-14"})}),St.map(t=>c.jsx("th",{className:"px-4 py-4",children:c.jsx(pe,{className:"h-3.5 w-12"})},t.key))]})}),c.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:e},(t,r)=>c.jsx(wa,{index:r},r))})]})})}function Sa({id:e,thClassName:t,children:r}){const{attributes:n,listeners:o,setNodeRef:a,transform:i,transition:l,isDragging:d}=da({id:e}),u=rt.Transform.toString(i)||"";s.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${e}"]`),p="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(b=>{b.style.transform=u,b.style.transition=l||"",b.style.zIndex=d?"20":"",b.style.position=u?"relative":"",b.style.boxShadow=d?p:""}),()=>{f.forEach(b=>{b.style.transform="",b.style.transition="",b.style.zIndex="",b.style.position="",b.style.boxShadow=""})}},[e,u,l,d]);const g={transform:u,transition:l,position:u?"relative":void 0,zIndex:d?20:void 0,boxShadow:d?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return c.jsx("th",{ref:a,style:g,className:L(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...o,children:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[c.jsx("span",{"aria-hidden":"true",className:L("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",d&&"opacity-100"),children:c.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[c.jsx("circle",{cx:"2",cy:"2",r:"1"}),c.jsx("circle",{cx:"6",cy:"2",r:"1"}),c.jsx("circle",{cx:"2",cy:"7",r:"1"}),c.jsx("circle",{cx:"6",cy:"7",r:"1"}),c.jsx("circle",{cx:"2",cy:"12",r:"1"}),c.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),r]})})}const Vr="tokentracker.leaderboard.columnOrder.v1";function Ca(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Vr);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>typeof r=="string"):null}catch{return null}}function Tt(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Vr,JSON.stringify(e))}catch{}}function hr(e,t){if(!e)return t;const r=new Set(t),n=e.filter(a=>r.has(a)),o=t.filter(a=>!n.includes(a));return[...n,...o]}function Na(e){const t=s.useMemo(()=>e.join("|"),[e]),[r,n]=s.useState(()=>hr(Ca(),e));s.useEffect(()=>{n(i=>{const l=hr(i,e);return l.length===i.length&&l.every((u,g)=>u===i[g])?i:(Tt(l),l)})},[t,e]);const o=s.useCallback((i,l)=>{!i||!l||i===l||n(d=>{const u=d.indexOf(i),g=d.indexOf(l);if(u===-1||g===-1)return d;const f=d.slice(),[p]=f.splice(u,1);return f.splice(g,0,p),Tt(f),f})},[]),a=s.useCallback(()=>{Tt(e),n(e)},[e]);return{order:r,reorder:o,reset:a}}function Ra(e,t){const r=Number(e),n=Number(t);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(r/n*100)))}function qr(e){return typeof e=="string"?e.trim():""}function Da(e){const t=qr(e);return t?t.toLowerCase()==="anonymous":!0}function ja({me:e,totalEntries:t,meLabel:r,onOpenProfile:n,onJumpToMe:o,canJump:a,className:i}){const l=e&&typeof e.rank=="number"?e.rank:null;if(!l)return null;const d=Number(t)||0,u=Ra(l,d),g=qr(e?.display_name),f=!g||Da(g)?r||"You":g,p=e?.user_id||f,b=n||(a?o:null),w=typeof b=="function",m=w?"button":"div",x=w?{type:"button",onClick:b,"aria-label":y(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return c.jsxs(m,{...x,className:L("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none shadow-[0_1px_2px_rgba(0,0,0,0.03)]",w?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] hover:shadow-[0_4px_12px_rgba(0,0,0,0.05)] dark:hover:shadow-[0_4px_20px_rgba(0,0,0,0.25)] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",i),children:[c.jsx(Lt,{size:"sm",avatarUrl:e?.avatar_url,displayName:f,seed:p}),c.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:f}),c.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",l.toLocaleString()]}),u!=null&&c.jsx("span",{className:L("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",u<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:y("leaderboard.summary.percentile",{p:String(u)})}),w?c.jsx(Nn,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):c.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[c.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),c.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const Ea=s.lazy(()=>yn(()=>import("./LeaderboardProfileModal-BiQREZ6Z.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(e=>({default:e.LeaderboardProfileModal}))),Ut=[10,20,50,100],Yt=20,Jr="tokentracker:leaderboard:pageSize";function Ma(){if(typeof window>"u")return Yt;try{const e=window.localStorage.getItem(Jr),t=Number(e);if(Ut.includes(t))return t}catch{}return Yt}function br(e,t,r){const n=Number(e);if(!Number.isFinite(n)||n<=0)return"-";const o=pn(t),a=t===wn?n:n*r;return a>=1e3?`${o}${Math.round(a).toLocaleString()}`:a>=10?`${o}${Math.round(a)}`:`${o}${a.toFixed(2)}`}function pr({value:e}){return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"sm:hidden",children:bn(e)}),c.jsx("span",{className:"hidden sm:inline",children:kr(e)})]})}function mr(e,t,r){const n=t?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",o=t?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60";return r.map(a=>c.jsx("td",{"data-column-key":a.key,className:L("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",n,o),children:kr(e?.[a.key])},a.key))}const _a={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function xr({rank:e,placeholder:t}){const r=_a[e];return r?c.jsx("span",{className:L("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",r.text,r.badge),children:e}):c.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:e??t})}function vr(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t==="week"||t==="month"||t==="total"?t:null}function Aa(e){if(!e)return y("shared.error.prefix",{error:y("leaderboard.error.unknown")});const t=e?.message||String(e),r=String(t||"").trim()||y("leaderboard.error.unknown");return y("shared.error.prefix",{error:r})}function Zr(e){return typeof e!="string"?"":e.trim()}function Ia(e){const t=Zr(e);return t?t.toLowerCase()==="anonymous":!0}function yr(e,t){const r=typeof e?.user_id=="string"?e.user_id.trim():"";return r||`${e?.rank??""}:${t}`}function wr({githubUrl:e}){return c.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[c.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:t=>t.stopPropagation(),"aria-label":y("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:c.jsx(gn,{provider:"GITHUB",size:16})}),c.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute right-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[c.jsx("span",{className:"block",children:y("leaderboard.github.tooltipAction")}),c.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[y("leaderboard.github.tooltipPrefix")," ",c.jsx(hn,{to:"/settings",onClick:t=>t.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:y("leaderboard.github.tooltipSettingsLink")}),y("leaderboard.github.tooltipSuffix")]})]})]})}function Ka({auth:e,signedIn:t,sessionSoftExpired:r}){const n=en(),o=tn(),{openLoginModal:a}=rn(),{signedIn:i,loading:l,user:d}=nn(),{currency:u,rate:g}=Sn(),f=s.useMemo(()=>on(),[]),p=an(),b=t&&!r,w=s.useMemo(()=>b&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,b]),m=b?w:null,x=b&&sn(m),k=y("shared.placeholder.short"),S=s.useMemo(()=>St.map(h=>h.key),[]),{order:v,reorder:N}=Na(S),_=s.useMemo(()=>{const h=new Map;for(const A of St)h.set(A.key,A);return h},[]),R=s.useMemo(()=>v.map(h=>_.get(h)).filter(Boolean),[v,_]),C=Kn(tr(Zt,{activationConstraint:{distance:6}}),tr(qt,{coordinateGetter:ga})),D=s.useCallback(h=>{const{active:A,over:H}=h;!H||A.id===H.id||N(String(A.id),String(H.id))},[N]),[P,I]=s.useState(1),[j,oe]=s.useState(Ma),[Z,ae]=s.useState(null),ke=s.useCallback(h=>{typeof h=="string"&&h.trim()&&ae(h.trim())},[]),Pe=s.useCallback(()=>ae(null),[]),V=s.useCallback(h=>{const A=Ut.includes(h)?h:Yt;oe(A),I(1);try{window.localStorage.setItem(Jr,String(A))}catch{}},[]),[Te,ge]=s.useState(0),[Le,ze]=s.useState(()=>ln()),[U,ce]=s.useState(!1),K=s.useMemo(()=>{const h=new URLSearchParams(n?.search||"");return vr(h.get("period"))||"total"},[n?.search]),Oe=h=>{const A=vr(h);if(!A||A===K)return;const H=new URLSearchParams(n?.search||"");H.set("period",A),I(1),o(`${n?.pathname||"/leaderboard"}?${H.toString()}`,{replace:!0})};s.useEffect(()=>{l||p||i||a()},[i,l,p,a]),s.useEffect(()=>{I(1)},[K]);const Y=s.useMemo(()=>(ot(P,{min:1,max:1e6,fallback:1})-1)*j,[P,j]),he=s.useMemo(()=>p?"mock":l?"unavailable":i?"cloud":t?"local":f?"public":"unavailable",[l,i,f,p,t]),T=s.useMemo(()=>cn({accessMode:he,baseUrl:f,mockEnabled:p,userId:d?.id||null,period:K,pageSize:j,offset:Y}),[d?.id,he,f,Y,p,j,K]),[q,M]=s.useState(()=>{const h=Et(T);return h?{loading:!1,error:null,data:h.data,contextKey:T}:{loading:!1,error:null,data:null,contextKey:null}});s.useEffect(()=>{if(!f&&!p||!p&&he==="unavailable"){M({loading:!1,error:null,data:null,contextKey:null});return}const h=Et(T);let A=!0;return M(h?{loading:!1,error:null,data:h.data,contextKey:T}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const H=await dn({userId:d?.id||null,period:K,limit:j,offset:Y});A&&(un(H,{activeContextKey:T,contextKey:T,source:Te>0?"manual-refresh":"page-load"}),M({loading:!1,error:null,data:H,contextKey:T}))})().catch(H=>{if(!A)return;const Me=Aa(H);M(B=>B.contextKey===T?{...B,loading:!1,error:Me}:{loading:!1,error:Me,data:null,contextKey:T})}),()=>{A=!1}},[f,he,d?.id,T,Y,Te,p,K,j]);const Se=s.useMemo(()=>q.contextKey===T?null:Et(T),[T,q.contextKey]),O=s.useMemo(()=>q.contextKey===T?q:Se?{loading:!1,error:null,data:Se.data,contextKey:T}:{loading:!!(f||p)&&he!=="unavailable",error:null,data:null,contextKey:T},[he,f,T,q,p,Se]),W=O.data,Q=W?.total_pages??null,De=W?.total_entries??0,se=W?.page??P,lt=s.useMemo(()=>ba(se,Q),[se,Q]),Ye=W?.from||null,Be=W?.to||null,be=W?.generated_at||null,de=W?.me||null,Ce=y("leaderboard.me_label"),ct=y("leaderboard.anon_label"),We=y("leaderboard.period.week"),dt=y("leaderboard.period.month"),ut=y("leaderboard.period.total"),Ne=K==="month"?dt:K==="total"?ut:We,xe=s.useMemo(()=>{const h=Array.isArray(W?.entries)?W.entries:[];return ma({entries:h,me:de,meLabel:Ce})},[W?.entries,de,Ce]),ue=s.useMemo(()=>xa(de?.rank,j),[de?.rank,j]),ft=ue!=null&&ue===se,ve=s.useCallback(()=>{ue!=null&&I(ue)},[ue]),gt=async()=>{ce(!0);try{mn(!0),ze(!0),await xn(()=>Qt(m));const h=await Qt(m);h&&await vn({accessToken:h,period:K,source:"leaderboard-enable-sync"}),ge(A=>A+1)}catch(h){console.warn("[tokentracker] sync:",h)}finally{ce(!1)}},{canPrev:ht,canNext:bt}=pa({page:se,totalPages:Q}),je=Array.isArray(xe)&&xe.length!==0;let Ee=null;O.loading&&!je?Ee=c.jsx(ka,{rows:j}):O.error&&!je?Ee=c.jsx("div",{className:"px-6 py-12 text-center",children:c.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:O.error})}):je?Ee=c.jsx(Uo,{sensors:C,collisionDetection:Fn,modifiers:[Jo],onDragEnd:D,children:c.jsx("div",{className:"w-full overflow-x-auto",children:c.jsxs("table",{className:"min-w-full sm:min-w-max w-full text-left text-sm",children:[c.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:c.jsxs("tr",{children:[c.jsx("th",{className:L(Hr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:y("leaderboard.column.rank")}),c.jsx("th",{className:L(Gr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:y("leaderboard.column.user")}),c.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:y("leaderboard.column.total")}),c.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:y("leaderboard.column.est_cost")}),c.jsx(na,{items:v,strategy:ta,children:R.map(h=>c.jsx(Sa,{id:h.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:c.jsx(ya,{iconSrc:h.icon,label:y(h.copyKey)})},h.key))})]})}),c.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:xe.map((h,A)=>{if(h?.is_ellipsis){const G=4+R.length;return c.jsx("tr",{"aria-hidden":"true",children:c.jsx("td",{colSpan:G,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${A}`)}const H=!!h?.is_me,Me=typeof h?.user_id=="string"?h.user_id:null,B=Zr(h?.display_name),J=Ia(B)?ct:B,z=H?Ce:J,ee=!!Me,le=ee?{role:"button",tabIndex:0,onClick:ee?()=>ke(Me):void 0,onKeyDown:ee?G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),ke(Me))}:void 0,"aria-label":y("leaderboard.profile_modal.row_aria",{name:z})}:{};if(H){const G=!!h?.is_pinned;return c.jsxs("tr",{...le,className:L("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",G?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",ee&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[c.jsx("td",{className:L($t(!0),"relative font-semibold text-oai-brand-600 dark:text-oai-brand-400",G&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:c.jsx(xr,{rank:h?.rank,placeholder:k})}),c.jsx("td",{className:Ft(!0),children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(Lt,{avatarUrl:h?.avatar_url,displayName:z,seed:yr(h,z)}),c.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:z}),h?.github_url&&c.jsx(wr,{githubUrl:h.github_url})]})}),c.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:c.jsx(pr,{value:h?.total_tokens})}),c.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:br(h?.estimated_cost_usd,u,g)}),mr(h,!0,R)]},`row-${h?.rank}-${z}${G?"-pin":""}`)}return c.jsxs("tr",{...le,className:L("group transition-colors",ee&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[c.jsx("td",{className:L($t(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(xr,{rank:h?.rank,placeholder:k})}),c.jsx("td",{className:Ft(!1),children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(Lt,{avatarUrl:h?.avatar_url,displayName:z,seed:yr(h,z)}),c.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:z}),h?.github_url&&c.jsx(wr,{githubUrl:h.github_url})]})}),c.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:c.jsx(pr,{value:h?.total_tokens})}),c.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:br(h?.estimated_cost_usd,u,g)}),mr(h,!1,R)]},`row-${h?.rank}-${z}`)})})]})})}):Ee=c.jsx("div",{className:"px-6 py-12 text-center",children:c.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.empty")})});let Xe=null;return typeof Q=="number"?Xe=lt.map((h,A)=>h==null?c.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:y("leaderboard.pagination.ellipsis")},`ellipsis-${A}`):c.jsx("button",{className:L("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",h===se?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>I(h),disabled:O.loading,children:String(h)},`page-${h}`)):Xe=c.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.pagination.page_unknown",{page:String(se)})}),c.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[c.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:c.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[c.jsxs("div",{className:"mb-5 sm:mb-6",children:[c.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-2 sm:mb-3",children:y("leaderboard.title")}),c.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[K==="total"?y("leaderboard.range.total"):Ye&&Be?y("leaderboard.range",{period:Ne,from:Ye,to:Be}):y("leaderboard.range_loading",{period:Ne}),be&&c.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 hidden sm:inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:y("leaderboard.generated_at",{ts:be})})]})]}),c.jsxs("div",{className:"mb-6 sm:mb-8 flex flex-row items-center justify-between gap-3",children:[c.jsx("div",{className:"inline-flex h-9 p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-full items-center relative",children:["week","month","total"].map(h=>{const A=K===h;return c.jsxs("button",{onClick:()=>Oe(h),disabled:O.loading,className:L("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",A?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[c.jsx("span",{className:"relative z-10",children:h==="week"?We:h==="month"?dt:ut}),A&&c.jsx(fn.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},h)})}),c.jsx(ja,{me:de,totalEntries:De,meLabel:Ce,onOpenProfile:de?.user_id?()=>ke(de.user_id):void 0,onJumpToMe:ve,canJump:ue!=null&&!ft&&!O.loading,className:"shrink-0"})]}),!t&&c.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[c.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.signin_prompt")}),c.jsx("button",{onClick:a,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:y("leaderboard.signin_button")})]}),b&&x&&!Le&&c.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[c.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.sync_prompt")}),c.jsx("button",{onClick:gt,disabled:U,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:U?y("leaderboard.sync_button.busy"):y("leaderboard.sync_button.idle")})]}),c.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[O.error&&je?c.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:c.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:O.error})}):null,Ee,c.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-end gap-x-4 gap-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[c.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:y("leaderboard.pagination.page_size_label")}),c.jsx(kn,{id:"leaderboard-page-size",value:j,onValueChange:h=>V(Number(h)),disabled:O.loading,ariaLabel:y("leaderboard.pagination.page_size_label"),options:Ut.map(h=>({value:h,label:String(h)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),c.jsx("div",{className:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),c.jsx("button",{className:L("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",ht&&!O.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>I(h=>Math.max(1,h-1)),disabled:!ht||O.loading,children:y("leaderboard.pagination.prev")}),c.jsx("div",{className:"flex flex-wrap items-center gap-1",children:Xe}),c.jsx("button",{className:L("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",bt&&!O.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>I(h=>h+1),disabled:!bt||O.loading,children:y("leaderboard.pagination.next")})]})]})]})}),c.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:c.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[c.jsx("p",{children:y("landing.v2.footer.line")}),c.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:y("landing.v2.nav.github")})]})}),c.jsx(s.Suspense,{fallback:null,children:c.jsx(Ea,{isOpen:!!Z,userId:Z,period:K,accessToken:m,onClose:Pe})})]})}export{Ka as LeaderboardPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as t,V as L,G as n,N as z,r as h,U as W,aK as B,i as U,L as V,aL as X}from"./main-C5qSiLnL.js";import{u as Y}from"./use-usage-limits-CCu4bGI4.js";import{L as p,a as q,l as b,b as J,u as Q}from"./use-limits-display-prefs-Bh7PFn6x.js";import{C as O}from"./Card-Cg-6DDbN.js";import{F as Z}from"./FadeIn-RZKrtHup.js";import{L as ee}from"./LocalOnlyNotice-Dvcf7F9s.js";import"./arrow-up-right-9sot4sNP.js";import"./download-3O0nnnqv.js";const te=[3,2,3,3,2,2,3];function y({className:e}){return t.jsx("div",{className:L("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function ie(){return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(y,{className:"h-3 w-12 shrink-0"}),t.jsx(y,{className:"flex-1 h-1.5 rounded-full min-w-0"}),t.jsx(y,{className:"h-3 w-[30px] shrink-0"}),t.jsx(y,{className:"h-3 w-6 shrink-0"})]})}function ae({bars:e,index:i}){const a=i%3===0?"w-24":i%3===1?"w-20":"w-[4.5rem]";return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(y,{className:"h-[14px] w-[14px] rounded shrink-0"}),t.jsx(y,{className:L("h-4",a)})]}),Array.from({length:e},(o,r)=>t.jsx(ie,{},r))]})}function re(){return t.jsx(O,{children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(y,{className:"h-3.5 w-28"}),te.map((e,i)=>t.jsx(ae,{bars:e,index:i},i))]})})}function ne(e,i){if(!(e>0))return null;const a=(e-i)/e;return Number.isFinite(a)?Math.min(Math.max(a,0),1):null}function oe(e,i,a=.03){return e>i+a}function le(e){const i=Math.max(0,Math.floor(e)),a=Math.floor(i/3600);return a>24?`${Math.floor(a/24)}d`:a>0?`${a}h`:`${Math.floor(i/60)}m`}function se(e,i){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&i){const a=i[e.windowSecondsField];return typeof a=="number"&&a>0?a:null}return null}function R(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function de({usedPercent:e,windowSeconds:i,resetMs:a,mode:o,now:r=Date.now()}){const s=Math.min(Math.max(Number(e)||0,0),100)/100,d={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(i>0)||!Number.isFinite(a))return d;const c=Math.max(0,(a-r)/1e3),l=ne(i,c);if(l==null)return d;if(d.expectedPercent=Math.round(l*100),d.paceOver=oe(s,l),s>=.05){const u=o==="remaining"?1-l:l;d.pacePercent=u*100}if(l>.02&&s>0){const u=i*l,m=s/u,x=s/l;x>=1&&m>0?d.runsOutEta=le((1-s)/m):d.projectedEnd=Math.round(Math.min(x,1)*100)}return d}const _=100;function S(e){const i=Date.parse(e);return Number.isFinite(i)?i:null}function ce(e){return Math.max(0,Math.min(_,Math.round(e)))}function ue(e){return new Intl.DateTimeFormat(z(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function me(e,i,a){if(e==null||e>=i)return _;const o=i-e,r=i-a;return ce(r/o*_)}function xe(e){const i=e.available_count;return i===null?null:Number.isInteger(i)&&i>=0?i:void 0}function pe(e,{now:i}={}){if(!e||typeof e!="object")return null;const a=xe(e);if(a===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],r=i instanceof Date?i.getTime():Number(i??Date.now()),s=[];for(const d of o){const c=S(d?.expires_at);if(c==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:n("limits.codex_reset_bank.row_label",{index:l}),expiresAt:ue(c),percent:me(S(d?.granted_at),c,r)})}return a===0?null:s.length>0?{kind:"rows",availableCount:a??s.length,rows:s}:a>0?{kind:"count_only",availableCount:a,rows:[]}:null}const K={claude:{windows(e){return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400}]}},codex:{extra:"codex_reset_bank",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude-weekly",labelKey:"limits.label.antigravity_claude_weekly",window:e.primary_window},{key:"claude-5h",labelKey:"limits.label.antigravity_claude_5h",window:e.secondary_window},{key:"gemini-weekly",labelKey:"limits.label.antigravity_gemini_weekly",window:e.tertiary_window},{key:"gemini-5h",labelKey:"limits.label.antigravity_gemini_5h",window:e.quaternary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}}},ge="shrink-0 text-oai-black dark:text-oai-white";function ye(e){const i=R(e);if(!Number.isFinite(i))return null;const a=i-Date.now();if(a<=0)return n("shared.time.now");const o=Math.floor(a/6e4);if(o<60)return`${o}m`;const r=Math.floor(o/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function he(e,i){const a=i===p.REMAINING?100-e:e;return a>=90?"bg-red-500":a>=70?"bg-amber-500":"bg-emerald-500"}function f(e,i="used_percent"){return e?i==="utilization"?e.utilization:e.used_percent:null}function F(e,i="reset_at"){return e?i==="resets_at"?e.resets_at:e.reset_at:null}function we(e,i){return de({usedPercent:f(e.window,e.pctField),windowSeconds:se(e,e.window),resetMs:R(F(e.window,e.resetField)),mode:i})}function fe({label:e,pct:i,reset:a,mode:o=p.USED,pacePercent:r=null,paceOver:s=!1}){const d=Math.max(0,Math.min(100,Number(i)||0)),c=o===p.REMAINING?100-d:d,l=Math.round(c),u=c>0&&l===0?Math.max(c,.35):c;let m=String(l);c>0&&l===0&&(m=n("limits.bar.sub_one_percent"));const x=r==null?null:Math.max(0,Math.min(100,r));return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),t.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[t.jsx("div",{className:`${he(c,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:c>0?"3px":0}}),x!=null&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${x}% - 3px)`,width:"6px"}}),t.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${x}% - 1px)`,width:"2px"}})]})]}),t.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[m,"%"]}),a&&t.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:a})]})}function be(e,i,a){const o=e.label??n(e.labelKey),r=a===p.REMAINING,s=l=>r?100-l:l;if(i.expectedPercent==null){const l=Math.round(Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0)));return r?n("limits.explain.remaining",{label:o,used:s(l)}):n("limits.explain.used",{label:o,used:l})}if(i.paceOver){if(i.runsOutEta)return n("limits.explain.ahead_eta",{label:o,eta:i.runsOutEta});const l=s(i.projectedEnd??100);return n(r?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const d=Math.round(Math.max(0,Math.min(100,Number(f(e.window,e.pctField))||0))),c=s(i.projectedEnd??d);return n(r?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:c})}function ke({rows:e,mode:i}){if(e.length===0)return null;const a=i===p.REMAINING;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:o,pace:r})=>t.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:be(o,r,i)},o.key)),t.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:n(a?"limits.explain.body_remaining":"limits.explain.body")})]})}function _e(e){if(!e)return null;const i=Date.now()-new Date(e).getTime();if(i<0)return null;const a=Math.floor(i/6e4);if(a<1)return n("shared.time.now");if(a<60)return n("shared.time.m_ago",{n:a});const o=Math.floor(a/60);if(o<24)return n("shared.time.h_ago",{n:o});const r=Math.floor(o/24);return n("shared.time.d_ago",{n:r})}function j({name:e,providerId:i,children:a,expandable:o=!1,expanded:r=!1,onToggle:s,badge:d=null}){const c=J(i),l=t.jsxs("div",{className:"flex items-center gap-1.5",children:[c?t.jsx(W,{provider:c,size:14,className:ge}):null,t.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e}),d]});return o?t.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":r,onClick:s,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[l,a]}):t.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,a]})}const je=q;function w({children:e,tone:i="neutral"}){const a=i==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return t.jsx("div",{className:`text-[11px] leading-snug ${a}`,children:e})}function ve({rows:e,mode:i,extra:a=null}){const o=e.length===0&&!a;return t.jsxs(t.Fragment,{children:[e.map(({spec:r,pace:s})=>t.jsx(fe,{label:r.label??n(r.labelKey),pct:f(r.window,r.pctField),reset:ye(F(r.window,r.resetField)),mode:i,pacePercent:s.pacePercent,paceOver:s.paceOver},r.key)),o?t.jsx(w,{children:n("limits.status.no_data")}):null,a]})}function Ne({row:e}){const i=Math.max(0,Math.min(100,Number(e.percent)||0));return t.jsxs("div",{className:"flex items-center gap-2","data-reset-bank-row":"",children:[t.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e.label}),t.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:t.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${i}%`,minWidth:i>0?"3px":0}})}),t.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:e.expiresAt})]})}function Me({model:e}){const i=e.kind==="count_only"?n("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[t.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.codex_reset_bank.title")}),i?t.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:i}):e.rows.map(a=>t.jsx(Ne,{row:a},a.key))]})}function Ee(e,i){if(e==="codex_reset_bank"){const a=pe(i.reset_credits);return a?t.jsx(Me,{model:a}):null}return e==="kimi_parallel"&&i.parallel_limit?t.jsx(w,{children:n("limits.label.kimi_parallel",{count:i.parallel_limit})}):e==="copilot_otel"&&!i.otel_has_files&&!i.otel_enabled?t.jsx(Ie,{defaultDir:i.otel_default_dir}):null}function Pe(e,i,a,o,r,s,d=null){const c=K[e];if(!c)return null;const l=c.windows(i).filter(m=>m.window).map(m=>({spec:m,pace:we(m,o)})),u=Ee(c.extra,i);return t.jsxs(j,{name:a,providerId:e,expandable:l.length>0,expanded:r,onToggle:s,badge:d,children:[t.jsx(ve,{mode:o,rows:l,extra:u}),r?t.jsx(ke,{rows:l,mode:o}):null]},e)}function Se(e,i,a,o,r){if(!K[e])return null;if(!i?.configured)return t.jsxs(j,{name:b(e),providerId:e,children:[t.jsx(w,{children:n("limits.status.not_connected")}),e==="opencodeGo"?t.jsx(I,{}):null]},e);if(i.error)return t.jsxs(j,{name:b(e),providerId:e,children:[t.jsx(w,{tone:"error",children:n("shared.error.prefix",{error:i.error})}),e==="opencodeGo"?t.jsx(I,{}):null]},e);const s=b(e),d=i.plan_label?`${s} ${i.plan_label}`:s;let c=null;if(e==="antigravity")if(i.cached){const l=_e(i.cached_at);c=t.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:u=>u.stopPropagation(),children:[t.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider bg-oai-gray-100 dark:bg-oai-gray-800 border border-oai-gray-200/50 dark:border-oai-gray-700/50 text-oai-gray-500 dark:text-oai-gray-400 leading-normal",children:[t.jsx("span",{className:"h-1 w-1 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"}),n("limits.label.antigravity_cached"),l?t.jsxs(t.Fragment,{children:[" · ",l]}):null]}),t.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[n("limits.tooltip.antigravity_cached"),t.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]})]})}else c=t.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:l=>l.stopPropagation(),children:[t.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider bg-emerald-500/10 dark:bg-emerald-500/15 border border-emerald-500/20 text-emerald-600 dark:text-emerald-400 leading-normal",children:[t.jsxs("span",{className:"relative flex h-1 w-1",children:[t.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),t.jsx("span",{className:"relative inline-flex rounded-full h-1 w-1 bg-emerald-500"})]}),n("limits.label.antigravity_live")]}),t.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[n("limits.tooltip.antigravity_live"),t.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]})]});return Pe(e,i,d,a,o,r,c)}function Ie({defaultDir:e}){const[i,a]=h.useState(!1),r=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
2
|
-
`),s=async d=>{d.stopPropagation();try{await navigator.clipboard.writeText(r),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n("limits.copilot.otelHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug",children:n("limits.copilot.otelHint.body")}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:r}),t.jsx("button",{type:"button",onClick:s,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:i?n("limits.copilot.otelHint.copied"):n("limits.copilot.otelHint.copy")})]})}function k({n:e,children:i}){return t.jsxs("li",{className:"flex gap-2.5",children:[t.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:e}),t.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:i})]})}function Le(){return t.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function I(){const[e,i]=h.useState(!1),a=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
|
|
3
|
-
`),o=async r=>{r.stopPropagation();try{await navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:n("limits.opencodeGo.setupHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:n("limits.opencodeGo.setupHint.subtitle")}),t.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[t.jsxs(k,{n:"1",children:[t.jsx("div",{children:n("limits.opencodeGo.setupHint.step1")}),t.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:r=>r.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[n("limits.opencodeGo.setupHint.cta"),t.jsx(Le,{})]})]}),t.jsxs(k,{n:"2",children:[t.jsx("div",{children:n("limits.opencodeGo.setupHint.step2")}),t.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[t.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_workspace")}),t.jsx("li",{children:n("limits.opencodeGo.setupHint.step2_cookie")})]})]}),t.jsxs(k,{n:"3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{children:n("limits.opencodeGo.setupHint.step3")}),t.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?n("limits.opencodeGo.setupHint.copied"):n("limits.opencodeGo.setupHint.copy")})]}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:a}),t.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Oe(e){const[i,a]=h.useState(0);return h.useLayoutEffect(()=>{const o=e.current;if(!o)return;const r=o.querySelectorAll("[data-limit-label]");let s=0,d=null;if(r.length>0)try{d=document.createElement("canvas").getContext("2d")}catch{d=null}if(d){const l=window.getComputedStyle(r[0]);d.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of r)s=Math.max(s,d.measureText(u.textContent).width)}const c=Math.ceil(s);a(l=>l===c?l:c)}),i}function Re({claude:e,codex:i,cursor:a,gemini:o,kimi:r,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m,order:x,visibility:v,displayMode:C}){const T={claude:e,codex:i,cursor:a,gemini:o,kimi:r,kiro:s,grok:d,antigravity:c,copilot:l,zcode:u,opencodeGo:m},N=h.useRef(null),M=Oe(N),[D,G]=h.useState(null),A=Array.isArray(x)&&x.length>0?x:je,E=C===p.REMAINING?p.REMAINING:p.USED,$=E===p.REMAINING?n("limits.settings.display_mode_remaining"):n("limits.settings.display_mode_used"),P=A.filter(g=>!v||v[g]!==!1).map(g=>Se(g,T[g],E,D===g,()=>G(H=>H===g?null:g))).filter(Boolean);return t.jsx(Z,{delay:.15,children:t.jsx(O,{children:t.jsxs("div",{ref:N,className:"flex flex-col gap-3",style:M>0?{"--tt-limits-label-w":`${M}px`}:void 0,children:[t.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[n("limits.panel.title"),n("limits.panel.mode_separator"),$]}),P.length>0?P:t.jsx(w,{children:n("limits.status.all_hidden")})]})})})}const Ke=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function ze(){const e=B(),{data:i,error:a,isLoading:o}=Y(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),r=Q();return!Ke&&!U()?t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx(ee,{})}):t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:t.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[t.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.limits")}),t.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("limits.page.subtitle")})]}),t.jsx(V,{to:"/settings","aria-label":n("limits.page.openSettings"),title:n("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:t.jsx(X,{className:"h-4 w-4","aria-hidden":!0})})]}),o?t.jsx(re,{}):t.jsxs(t.Fragment,{children:[a?t.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:n("shared.error.prefix",{error:a})}):null,t.jsx(Re,{claude:i?.claude,codex:i?.codex,cursor:i?.cursor,gemini:i?.gemini,kimi:i?.kimi,kiro:i?.kiro,grok:i?.grok,antigravity:i?.antigravity,copilot:i?.copilot,zcode:i?.zcode,opencodeGo:i?.opencodeGo,order:r.order,visibility:r.visibility,displayMode:r.displayMode})]})]})})})}export{ze as LimitsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as k,r as l,as as J,am as X,aP as L,j as t,m as P,U as ee,V as j,G as s,Y as te,az as ne,aQ as ae,aD as ie,aE as se,aF as O,aR as oe,aS as re,W as le,R as ce,S as ue,T as de,a5 as ge,aT as he,aU as pe,a1 as me,aV as be,K as xe,aW as fe,aX as ye,aY as ve,aZ as je,a_ as ke,a$ as Ne,b0 as Se,ak as we}from"./main-C5qSiLnL.js";import{b as G,l as E,u as Ce,L as A}from"./use-limits-display-prefs-Bh7PFn6x.js";import{S as N,T as v,a as m,b as _,u as D}from"./use-native-settings-MKCjJWeQ.js";import{u as Le,P as Ge}from"./use-quality-per-dollar-pref-D-m9WqCz.js";import{C as Ee}from"./useScrollLock-BdBmNNmw.js";import{u as Ae}from"./useCurrency-BZmZ49MO.js";import{S as T}from"./Select-9oplHX46.js";import{I as Ie}from"./info-CfCBZRtQ.js";import{D as Pe}from"./download-3O0nnnqv.js";import"./Card-Cg-6DDbN.js";import"./SelectItemText-CnL08w_W.js";const Oe=[["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"}]],_e=k("activity",Oe);const De=[["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"}]],Te=k("copy",De);const Ue=[["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"}]],Me=k("grip-vertical",Ue);const Re=[["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"}]],Fe=k("languages",Re);const He=[["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"}]],$e=k("log-out",He),Be=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,n=new WeakMap,a=()=>e.forEach(Be);return{add:i=>{e.add(i),n.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=n.get(i);o&&(o(),n.delete(i)),a()},dirty:a}}const ze=l.createContext(null);function Ve(){const e=l.useRef(!1);return J(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function We(){const e=Ve(),[n,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(n+1)},[n]);return[l.useCallback(()=>X.postRender(i),[i]),n]}const U=e=>e===!0,Ze=e=>U(e===!0)||e==="id",Ke=({children:e,id:n,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&&(n=n?g+"-"+n:g),u.current={id:n,group:U(a)&&i.group||I()});const p=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return t.jsx(L.Provider,{value:p,children:e})},qe="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Ye({checked:e,onChange:n,ariaLabel:a}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:n,className:j("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:j("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:n,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),p=d=>h=>{c(d),h.dataTransfer.effectAllowed="move",h.dataTransfer.setData("text/plain",d)},b=d=>h=>{h.preventDefault(),h.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},x=()=>{c(null),g(null)},f=d=>{d.preventDefault(),c(null),g(null)};return t.jsx(Ke,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const h=a[d]!==!1,y=r===d;return t.jsxs(P.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:p(d),onDragOver:b(d),onDragEnd:x,onDrop:f,className:j("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",y&&"opacity-40"),style:{cursor:y?"grabbing":"grab"},children:[t.jsx(Me,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),G(d)?t.jsx(ee,{provider:G(d),size:18,className:j("pointer-events-none",qe)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:E(d)}),t.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:t.jsx(Ye,{checked:h,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${E(d)}`})})]},d)})})})}function Je(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=n.full_name||n.name||a.name||n.user_name||n.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 Xe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function et(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const a=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=n.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,n){console.warn(`[tokentracker] settings ${e}:`,n)}function tt(e,n,a){const[i,o]=l.useState(()=>ne()),r=n&&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[n,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[p,b]=l.useState(null),[x,f]=l.useState(!1),[d,h]=l.useState(""),[y,S]=l.useState(!1),[H,C]=l.useState(""),[$,B]=l.useState(""),[z,V]=l.useState(!1),[W,Z]=l.useState(null),K=l.useMemo(()=>Je(e),[e]),q=l.useMemo(()=>Xe(e),[e]),Y=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:b,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:p,displayName:K,editingGithub:z,editingName:x,email:q,githubError:W,githubInput:$,githubUrl:H,loadSetters:Q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:b,setEditingGithub:V,setEditingName:f,setGithubError:Z,setGithubInput:B,setGithubUrl:C,setNameInput:h,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:y,userId:Y}}function at(e,n,a){l.useEffect(()=>{if(!n)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await O({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,n,a])}function it(e,n){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const c=await O({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{n.setProfileSaving(!1)}},[e,n])}function st(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function ot(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function rt(e,n){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:a}}function lt(e,n,a){const i=l.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),a?.()}})},[n,e,a]),o=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function ct(e,n){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),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 n({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)}})},[n,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(),n=nt(e.user),a=tt(e.getAccessToken,e.enabled,e.signedIn);at(e.getAccessToken,e.signedIn,n.loadSetters);const i=it(e.getAccessToken,n),o=rt(n,i),r=lt(n,i,e.refreshDisplayName),c=ct(n,i);return{...e,...a,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:st(n,{...o,...r}),github:ot(n,c),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function M({disabled:e,onCancel:n,onSave:a,saveLabel:i=s("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.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}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function dt({nameInput:e,setEditingName:n,setNameInput:a,profileSaving:i,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),t.jsx(M,{disabled:i||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function gt({githubError:e,githubInput:n,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{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")}),t.jsx(M,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function R({disabled:e=!1,label:n,onClick:a,title:i}){return t.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:[t.jsx(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function F({actions:e,editing:n,editor:a,hint:i,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?a:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),n?null:e]})})}function ht({name:e}){const n=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(R,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(v,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function pt({name:e}){const{anonymousOn:n,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:p,setEditingName:b,setNameInput:x,startEditingName:f}=e,d=n?s("settings.account.displayNameAnonymousHint"):a||i;return t.jsx(F,{label:s("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(dt,{nameInput:u,setEditingName:b,setNameInput:x,profileSaving:p,handleSaveName:c}),actions:t.jsx(ht,{name:e})})}function mt({github:e}){const{editingGithub:n,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:p,setGithubError:b,setGithubInput:x,showGithubOn:f,startEditingGithub:d}=e,{enabled:h,toggle:y}=Le();return t.jsxs(t.Fragment,{children:[t.jsx(F,{label:s("settings.account.githubUrl"),editing:n,hint:o||s("settings.account.githubUrlHint"),editor:t.jsx(gt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:p,setGithubError:b,setGithubInput:x}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(R,{label:s("settings.account.edit"),onClick:d}),t.jsx(v,{checked:f,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})}),o&&t.jsx(m,{label:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:s("settings.labs.qpd.label")}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:s("qpd.card.badge")})]}),hint:s("settings.labs.qpd.hint"),control:t.jsx(v,{checked:h,onChange:y,ariaLabel:s("settings.labs.qpd.aria")})})]})}function bt(){const{openLoginModal:e}=le();return t.jsx(N,{title:s("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function xt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(pt,{name:e}),t.jsx(mt,{github:n})]})}function ft(){const e=ut();return e.enabled?e.signedIn?t.jsxs(N,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(vt,{onSignOut:e.signOut}),children:[t.jsx(yt,{userId:e.userId}),t.jsx(jt,{settings:e}),t.jsx(kt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(Nt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(bt,{}):null}function yt({userId:e}){const[n,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 t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick: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:[n?t.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?s("settings.account.copied"):s("settings.account.copy")]})]})}function vt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function jt({settings:e}){return e.showLocalCloudSync?t.jsx(m,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:t.jsx(v,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function kt({checked:e,disabled:n,onChange:a}){return t.jsx(m,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:t.jsx(v,{checked:e,onChange:a,disabled:n,ariaLabel:s("settings.account.publicProfile")})})}function Nt({visible:e,name:n,github:a}){return t.jsx(ue,{initial:!1,children:e?t.jsx(P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(xt,{name:n,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:fe,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 n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function Lt(e,n){const a=s(`settings.appearance.currency.rate_source.${e}`),i=Ct(n),o=i?s("settings.appearance.currency.rate_updated",{when:i}):s("settings.appearance.currency.rate_never");return`${a} · ${o}`}function Gt({locale:e,setLocale:n}){const a=wt();return t.jsx(T,{value:e,onValueChange:n,options:a,ariaLabel:s("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(Fe,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function Et({currency:e,setCurrency:n}){const a=be().map(i=>({value:i.code,label:s(i.labelKey)}));return t.jsx(T,{value:e,onValueChange:n,options:a,ariaLabel:s("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function At({currency:e,rate:n,rateSource:a,rateFetchedAt:i}){if(e===xe)return t.jsx(t.Fragment,{children:s("settings.appearance.currency.hint")});const o=Lt(a,i);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function It(){const{theme:e,setTheme:n}=de(),{locale:a,setLocale:i}=ge(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ae();return t.jsxs(N,{title:s("settings.section.appearance"),children:[t.jsx(m,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:t.jsx(_,{options:St(),value:e,onChange:n})}),t.jsx(m,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:t.jsx(Gt,{locale:a,setLocale:i})}),t.jsx(m,{label:s("settings.appearance.currency.label"),hint:t.jsx(At,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:t.jsx(Et,{currency:o,setCurrency:g})})]})}function Pt(){const{available:e,settings:n,setSetting:a,runAction:i}=D();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,c=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(N,{title:s("settings.section.menubar"),children:[r?t.jsx(m,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:t.jsx(v,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,t.jsx(m,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:t.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:[t.jsx(Se,{className:j("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),t.jsx(m,{label:s("settings.menubar.updates"),hint:c||void 0,control:t.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:[t.jsx(Pe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Ot(){const{available:e,settings:n,runAction:a}=D(),i=e&&n?.version;return t.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?t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["TokenTrackerBar v",n.version]}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.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"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,t.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:[t.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function _t({prefs:e}){return t.jsx(_,{options:[{value:A.USED,label:s("limits.settings.display_mode_used")},{value:A.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Wt(){const e=Ce();return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(It,{}),t.jsx(Pt,{}),t.jsx(ft,{}),t.jsx(N,{title:s("settings.section.limits"),action:t.jsx(_t,{prefs:e}),children:t.jsx(Qe,{prefs:e})})]}),t.jsx(Ot,{})]})})})}export{Wt as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as Ue,r as n,a as Ze,j as e,M as U,V as W,b5 as nt,X as Se,G as s,b6 as la,b7 as _a,b8 as ot,u as lt,b9 as xa,ba as dt,bb as ct,bc as ut,bd as ha,be as gt,bf as mt,b as xt,bg as ht,bh as pt,bi as yt,S as ft,e as bt,m as pa,ag as kt,I as wt,U as be,bj as vt,bk as jt,bl as Nt,bm as Ct,bn as St,bo as _t,i as Rt,b0 as Pt,bp as da,R as Lt,bq as It,br as ya,bs as Ce,bt as fa,bu as ba,bv as Dt,bw as ka,bx as wa,by as $t,bz as Et}from"./main-C5qSiLnL.js";import{L as Bt}from"./LocalOnlyNotice-Dvcf7F9s.js";import{C as Mt}from"./Card-Cg-6DDbN.js";import{u as Tt,D as Ot,a as Ut,b as zt,c as Ft,d as At,e as Kt}from"./DialogTitle-COVyZQVB.js";import{u as We,t as Vt,a as qt,C as _e}from"./useScrollLock-BdBmNNmw.js";import{I as Ra}from"./info-CfCBZRtQ.js";import{u as Ht}from"./useCurrency-BZmZ49MO.js";import{L as ee,P as Pa,a as La,b as Ia,c as Da,d as $a,C as Gt}from"./PopoverPopup-BsBKLiJu.js";import{u as Wt,s as Qt,f as Ea,a as Xt,b as Yt,c as Jt,d as Zt,e as er,g as ar,S as Ba,h as Ma,i as Ta,C as ua,j as Oa,k as Ua,l as za,m as Qe,n as Xe,o as Ye}from"./SelectItemText-CnL08w_W.js";import{D as Fa}from"./download-3O0nnnqv.js";import"./arrow-up-right-9sot4sNP.js";const tr=[["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=Ue("circle-arrow-up",tr);const rr=[["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"}]],ca=Ue("external-link",rr);const sr=[["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"}]],ir=Ue("flame",sr);const nr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ka=Ue("plus",nr);const or=[["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"}]],ga=Ue("trash-2",or),lr=n.forwardRef(function(r,o){const{render:g,className:c,style:h,id:u,...m}=r,{store:x}=Tt(),f=We(u);return x.useSyncedValueWithCleanup("descriptionElementId",f),Ze("p",r,{ref:o,props:[{id:f},m]})});function va({open:a,title:r,description:o,confirmLabel:g,cancelLabel:c,destructive:h=!1,busy:u=!1,onConfirm:m,onCancel:x}){return e.jsx(Ot,{open:a,onOpenChange:f=>{!f&&!u&&x?.()},children:e.jsxs(Ut,{children:[e.jsx(zt,{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(Ft,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(At,{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(Kt,{className:"text-base font-semibold text-oai-black dark:text-white",children:r}),o?e.jsx(lr,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:o}):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 ma({id:a,value:r,onChange:o,placeholder:g,disabled:c=!1,type:h="text",label:u,error:m,className:x="",...f}){const l=n.useId(),k=a||l,N=m?`${k}-error`:void 0,C=`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:r,onChange:o,placeholder:g,disabled:c,"aria-invalid":m?!0:void 0,"aria-describedby":N,className:C,...f}),m&&e.jsx("p",{id:N,className:"mt-1.5 text-sm text-oai-error",children:m})]})}const Va=n.forwardRef(function(r,o){const{render:g,className:c,style:h,...u}=r,{store:m}=Wt(),f={open:nt(m,Qt.open)};return Ze("span",r,{state:f,ref:o,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:Vt})}),dr="tt:hint:dismissed:";function qa(a){return dr+a}function cr(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(qa(a))==="1"}catch{return!1}}function ur({id:a,children:r,className:o,ariaLabel:g}){const[c,h]=n.useState(()=>cr(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||s("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",o),children:[e.jsx("button",{type:"button",onClick:u,"aria-label":s("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children: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(Ra,{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:r})]})]})}function gr(a){if(!a)return null;for(const r of a.elements){const o=r.tagName;if(o==="BUTTON"||o==="INPUT"){const g=r;if(g.type==="submit")return g}}return null}let ja=(function(a){return a.checked="data-checked",a.unchecked="data-unchecked",a.indeterminate="data-indeterminate",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a})({});function Ha(a){return n.useMemo(()=>({checked(r){return a.indeterminate?{}:r?{[ja.checked]:""}:{[ja.unchecked]:""}},...Ea}),[a.indeterminate])}const mr=n.createContext({disabled:!1});function xr(){return n.useContext(mr)}function hr(a,r,o,g=!0,c){const[h,u]=n.useState(),m=We(c?`${c}-label`:void 0),x=a??r??h;return la(()=>{const f=a||r||!g?void 0:pr(o.current,m);h!==f&&u(f)}),x}function pr(a,r){const o=yr(a);if(o)return!o.id&&r&&(o.id=r),o.id||void 0}function yr(a){if(!a)return;const r=a.parentElement;if(r&&r.tagName==="LABEL")return r;const o=a.id;if(o){const c=a.nextElementSibling;if(c&&c.htmlFor===o)return c}const g=a.labels;return g&&g[0]}const fr=n.createContext(void 0);function br(a=!0){const r=n.useContext(fr);if(r===void 0&&!a)throw new Error(_a(3));return r}const Ga=n.createContext(void 0);function kr(){const a=n.useContext(Ga);if(a===void 0)throw new Error(_a(14));return a}const wr="data-parent",vr=n.forwardRef(function(r,o){const{checked:g,className:c,defaultChecked:h=!1,"aria-labelledby":u,disabled:m=!1,form:x,id:f,indeterminate:l=!1,inputRef:k,name:N,onCheckedChange:w,parent:v=!1,readOnly:b=!1,render:C,required:D=!1,uncheckedValue:z,value:Q,nativeButton:F=!1,style:me,...j}=r,{clearErrors:ae}=Xt(),{disabled:$,name:V,setDirty:X,setFilled:te,setFocused:A,setTouched:ke,state:we,validationMode:ze,validityData:Re,validation:Fe}=Yt(),Ae=xr(),{labelId:M,controlId:re,registerControlId:Y,getDescriptionProps:ve}=Jt(),R=br(),q=R?.parent,se=q&&R.allValues,I=$||Ae.disabled||R?.disabled||m,ie=V??N,P=Q??ie,Pe=We(),je=We();let ne=re;se?ne=v?je:`${q.id}-${P}`:f&&(ne=f);let pe={};se&&(v?pe=R.parent.getParentProps():P&&(pe=R.parent.getChildProps(P)));const{checked:Le=g,indeterminate:Ie=l,onCheckedChange:De,...Ne}=pe,H=R?.value,oe=R?.setValue,ye=R?.defaultValue,le=n.useRef(null),de=ot(()=>Symbol("checkbox-control")),xe=n.useRef(!1),{getButtonProps:ea,buttonRef:Ke}=lt({disabled:I,native:F}),ce=R?.validation??Fe,[_,aa]=Zt({controlled:P&&H&&!v?H.includes(P):Le,default:P&&ye&&!v?ye.includes(P):h,name:"Checkbox",state:"checked"}),$e=se?!!Le:_,fe=se&&Ie||l;la(()=>{Y!==xa&&(xe.current=!0,Y(de.current,ne))},[ne,Y,de]),n.useEffect(()=>{const y=de.current;return()=>{!xe.current||Y===xa||(xe.current=!1,Y(y,void 0))}},[Y,de]),er(le,Pe,_,void 0,!R&&!I,N);const J=n.useRef(null),Ee=dt(k,J,ce.inputRef,ce.registerInput),ta=hr(u,M,J,!F,ne??void 0);la(()=>{J.current&&(J.current.indeterminate=fe,_&&te(!0))},[_,fe,te]),ar(_,()=>{R||(ae(ie),te(_),X(_!==Re.initialValue),ce.change(_))});const Ve=ct({checked:_,disabled:I,form:x,name:v?void 0:ie,id:F?void 0:ne??void 0,required:D,ref:Ee,style:ie?gt:mt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(y){if(y.nativeEvent.defaultPrevented)return;if(b){y.preventDefault();return}const T=y.currentTarget.checked,ue=xt(ht,y.nativeEvent);if(w?.(T,ue),!ue.isCanceled&&(De?.(T,ue),!ue.isCanceled&&(aa(T),P&&H&&oe&&!v&&!se))){const ge=T?[...H,P]:H.filter(E=>E!==P);oe(ge,ue)}},onFocus(){le.current?.focus()}},Q!==void 0?{value:(R?_&&Q:Q)||""}:ut,ve,y=>ce.getValidationProps(I,y));n.useEffect(()=>{if(!q||!P)return;const y=q.disabledStatesRef.current;return y.set(P,I),()=>{y.delete(P)}},[q,I,P]);const Be=n.useMemo(()=>({...we,checked:$e,disabled:I,readOnly:b,required:D,indeterminate:fe}),[we,$e,I,b,D,fe]),ra=Ha(Be),sa=Ze("span",r,{state:Be,ref:[Ke,le,o,R?.registerControlRef],props:[{id:F?ne??void 0:Pe,role:"checkbox","aria-checked":fe?"mixed":$e,"aria-readonly":b||void 0,"aria-required":D||void 0,"aria-labelledby":ta,[wr]:v?"":void 0,onFocus(){I||A(!0)},onBlur(){const y=J.current;y&&(ke(!0),A(!1),ze==="onBlur"&&ce.commit(R?H:y.checked))},onKeyDown(y){if(y.key!=="Enter"||(y.preventBaseUIHandler(),y.defaultPrevented))return;const T=J.current?.form??null,ue=y.currentTarget,ge=y.nativeEvent,E=y.preventDefault,G=ge.preventDefault;let Me=!1;y.preventDefault=()=>{Me=!0,E.call(y)},ge.preventDefault=()=>{Me=!0,G.call(ge)},G.call(ge),ha(ue).queueMicrotask(()=>{y.preventDefault=E,ge.preventDefault=G,Me||gr(T)?.click()})},onClick(y){if(b||I)return;y.preventDefault();const T=J.current;T&&T.dispatchEvent(new(ha(T)).PointerEvent("click",{bubbles:!0,shiftKey:y.shiftKey,ctrlKey:y.ctrlKey,altKey:y.altKey,metaKey:y.metaKey}))}},j,Ne,ea,ve,y=>ce.getValidationProps(I,y)],stateAttributesMapping:ra});return e.jsxs(Ga.Provider,{value:Be,children:[sa,!_&&!R&&ie&&!v&&z!==void 0&&e.jsx("input",{type:"hidden",form:x,name:ie,value:z,disabled:I}),e.jsx("input",{...Ve,suppressHydrationWarning:!0})]})}),jr=n.forwardRef(function(r,o){const{render:g,className:c,style:h,keepMounted:u=!1,...m}=r,x=kr(),f=x.checked||x.indeterminate,{mounted:l,transitionStatus:k,setMounted:N}=qt(f),w=n.useRef(null),v={...x,transitionStatus:k};pt({open:f,ref:w,onComplete(){f||N(!1)}});const C={...Ha(x),...yt,...Ea},D=u||l,z=Ze("span",r,{ref:[o,w],state:v,stateAttributesMapping:C,props:m});return D?z:null});function Nr(a,r){return`target:${a}:${r}`}function Cr(a){return`remove:${a.id||a.directory}`}function Wa(a){if(!a)return null;const r=new Date(a).getTime();return Number.isFinite(r)?Math.floor((Date.now()-r)/864e5):null}function Sr(a){const r=Wa(a);if(r==null)return null;if(r<=0)return s("skills.usage.today");if(r<30)return s("skills.usage.days_ago",{days:r});const o=Math.max(1,Math.floor(r/30));return s("skills.usage.months_ago",{months:o})}function _r(a){const r=Wa(a);return r==null?"bg-oai-gray-300 dark:bg-oai-gray-600":r<=7?"bg-emerald-500":r<=30?"bg-amber-500":"bg-oai-gray-300 dark:bg-oai-gray-600"}function na({label:a,children:r}){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:r})]})}function Rr({skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:h,onUpdate:u,onClose:m,onToggleTarget:x,onRemove:f}){return e.jsx(ft,{children:a?e.jsx(Pr,{skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:h,onUpdate:u,onClose:m,onToggleTarget:x,onRemove:f},a.id||a.directory):null})}function Pr({skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:h,onUpdate:u,onClose:m,onToggleTarget:x,onRemove:f}){const l=bt(),{currency:k,rate:N}=Ht(),w=n.useRef(null);n.useEffect(()=>{const j=$=>{$.key==="Escape"&&($.stopPropagation(),m?.())},ae=$=>{const V=$.target;V instanceof Element&&(w.current?.contains(V)||V.closest('[data-skill-row="1"]')||m?.())};return document.addEventListener("keydown",j),document.addEventListener("mousedown",ae),()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousedown",ae)}},[m]);const v=a.name||a.directory,b=!!(a.repoOwner&&a.repoName),C=b?`https://github.com/${a.repoOwner}/${a.repoName}`:null,D=new Set(a.targets||[]),z=o===Cr(a),Q=Sr(g?.lastUsedAt),F=!!(g&&g.invocations>0),me=l?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(pa.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:l?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:l?0:.15},onClick:m,"aria-hidden":!0}),e.jsxs(pa.aside,{ref:w,role:"complementary","aria-label":v,initial:l?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:l?{opacity:0}:{opacity:0,x:24,scale:.98},transition:me,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}),b?e.jsxs("a",{href:C,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:C,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(ca,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==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":s("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children: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:s("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(ee,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,s("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:s("skills.usage.section_title")}),e.jsxs("dl",{className:"divide-y divide-oai-gray-200/60 dark:divide-white/[0.06]",children:[e.jsx(na,{label:s("skills.usage.invocations"),children:kt(g?.invocations||0)}),e.jsx(na,{label:s("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",_r(g?.lastUsedAt)),"aria-hidden":!0}),F?Q||s("skills.usage.unknown"):s("skills.usage.never")]})}),e.jsx(na,{label:e.jsxs(e.Fragment,{children:[s("skills.usage.cost"),e.jsx("span",{title:s("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(Ra,{className:"h-3 w-3","aria-label":s("skills.usage.disclaimer")})})]}),children:wt(g?.cost||0,{currency:k,rate:N})})]}),F?null:e.jsx("p",{className:"mt-2 text-[11px] leading-4 text-oai-gray-400 dark:text-oai-gray-500",children:s("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:s("skills.detail.sync_section_title")}),e.jsx("div",{children:(r||[]).map(j=>{const ae=D.has(j.id),$=o===Nr(a.id,j.id),V=`skill-detail-sync-${a.id||a.directory}-${j.id}`;return e.jsxs("label",{htmlFor:V,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(vr,{id:V,checked:ae,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(jr,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(_e,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center","aria-hidden":!0,children:e.jsx(be,{provider:j.id,size:16})}),e.jsx("span",{className:"flex-1",children:j.label}),$?e.jsx(ee,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},j.id)})})]})]}),e.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[e.jsxs("button",{type:"button",onClick:()=>f?.(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(ee,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ga,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("skills.detail.remove_button")]}),e.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.detail.remove_confirm_hint")})]})]})]})}const Lr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),oa=["claude","codex"],O="popular",Ir={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},he="all",B="skillssh";function Je(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Qa(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function Dr(a){return Qa(a).split("/").filter(Boolean).pop()||""}function $r(a){if(a.repoOwner||a.repoName)return"";const r=Qa(a.directory);return!r||r.includes("/")?"":`dir:${r}`}function Na(a){const r=Dr(a.directory);return r?`dir:${r}`:""}function Ca(a){const r=new Set([Je(a).toLowerCase()]);a.repoOwner&&a.repoName&&r.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const o=$r(a);return o&&r.add(o),r}function Ge(a){return`install:${Je(a)}`}function Sa(a){return`remove:${a.id||a.directory}`}function Xa(a,r){return`target:${a}:${r}`}function Er({target:a,state:r,busy:o,onToggle:g}){const c=r==="synced",h=r==="orphan",u=h?s("skills.dot.orphan_aria",{agent:a.label}):c?s("skills.dot.synced_aria",{agent:a.label}):s("skills.dot.off_aria",{agent:a.label});return e.jsxs("button",{type:"button",title:u,"aria-label":u,"aria-pressed":c,disabled:o,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:[o?e.jsx(ee,{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&&Ir[a.id],!c&&!h&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(be,{provider:a.id,size:18})}),h&&!o?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 Br({skill:a,targets:r,onToggleTarget:o,busyKey:g}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:r.map(c=>e.jsx(Er,{target:c,state:a.targetStates?.[c.id]||"off",busy:g===Xa(a.id,c.id),onToggle:(h,u)=>o?.(a,h,u)},c.id))})}function Mr({skill:a,targets:r,selected:o,onSelect:g,selectable:c,checked:h,onToggleSelect:u,onToggleTarget:m,hasUpdate:x,busyKey:f}){const l=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,k=l?`${a.directory} · ${l}`:a.directory,N=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),g?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":o,"aria-label":s("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>g?.(a),onKeyDown:N,className:W("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",o?"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":s("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}),s("skills.update.badge")]}):null,e.jsx(Br,{skill:a,targets:r,onToggleTarget:m,busyKey:f}),e.jsx(Gt,{className:W("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",o&&"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 Tr({agentFilter:a,agentOptions:r,onAgentFilter:o,filteredCount:g,totalCount:c,anyFilter:h,onClearFilters:u,searchQuery:m,onSearchQuery:x,searchPlaceholder:f}){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(Ba,{value:a,onValueChange:o,children:[e.jsxs(Ma,{"aria-label":s("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[s("skills.filter.agent_label"),":"]}),e.jsx(Ta,{children:l=>l==="all"?s("skills.filter.agent_all"):r.find(k=>k.id===l)?.label||l}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ua,{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(Qe,{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(Xe,{children:s("skills.filter.agent_all")}),e.jsx(Ye,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),r.map(l=>e.jsxs(Qe,{value:l.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{provider:l.id,size:14}),e.jsx(Xe,{children:l.label})]}),e.jsx(Ye,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},l.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(da,{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(ma,{type:"search",value:m,onChange:l=>x(l.target.value),onKeyDown:l=>{l.key==="Escape"&&m&&(l.preventDefault(),x(""))},"aria-label":s("skills.action.search_aria"),placeholder:f,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:l=>l.preventDefault(),onClick:()=>x(""),"aria-label":s("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:s("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}),s("skills.filter.clear")]}):null]})}function Or({count:a,targets:r,busy:o,onBulkSync:g,onBulkRemove:c,onClear:h}){return e.jsxs("div",{role:"toolbar","aria-label":s("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:s("skills.select.count",{count:a})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs(Pa,{children:[e.jsxs(La,{disabled:o,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}),s("skills.select.bulk_sync"),e.jsx(ua,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Ia,{children:e.jsx(Da,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs($a,{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:s("skills.select.bulk_sync_hint")}),r.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(be,{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:o,onClick:c,children:[e.jsx(ga,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("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}),s("skills.select.clear")]})]})]})}function Ur({items:a,totalCount:r,targets:o,agentOptions:g,agentFilter:c,onAgentFilter:h,anyFilter:u,onClearFilters:m,searchQuery:x,onSearchQuery:f,searchPlaceholder:l,selectedId:k,onSelect:N,onToggleTarget:w,busyKey:v,updates:b,selectedIds:C,onToggleSelect:D,onClearSelection:z,onBulkSync:Q,onBulkRemove:F}){const me=C.size;return e.jsxs("div",{children:[me>0?e.jsx(Or,{count:me,targets:o,busy:v==="batch",onBulkSync:Q,onBulkRemove:F,onClear:z}):e.jsx(Tr,{agentFilter:c,agentOptions:g,onAgentFilter:h,filteredCount:a.length,totalCount:r,anyFilter:u,onClearFilters:m,searchQuery:x,onSearchQuery:f,searchPlaceholder:l}),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:s("skills.empty.no_match")}),e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:m,children:s("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(Mr,{skill:j,targets:o,selected:k===(j.id||j.directory),onSelect:N,selectable:!0,checked:C.has(j.id),onToggleSelect:D,onToggleTarget:w,hasUpdate:!!(j.id&&b?.[j.id]),busyKey:v},j.id||j.key))})]})}const zr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Fr=Lt.memo(function({skill:r,installed:o,installing:g,allTargets:c,defaultTargets:h,onInstall:u,onManage:m}){const[x,f]=n.useState(()=>(h||[]).filter(b=>c.some(C=>C.id===b))),l=b=>{f(C=>C.includes(b)?C.filter(D=>D!==b):[...C,b])},k=r.repoOwner&&r.repoName?`${r.repoOwner}/${r.repoName}`:null,N=k?`https://github.com/${r.repoOwner}/${r.repoName}`:null,w=r.installs!=null?s("skills.card.installs",{count:Number(r.installs||0).toLocaleString()}):null,v=x.length?x.map(b=>c.find(C=>C.id===b)?.label||b).join(", "):s("skills.action.choose_targets");return e.jsxs(Mt,{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:[r.readmeUrl?e.jsxs("a",{href:r.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:r.readmeUrl,children:[e.jsx("span",{className:"truncate",children:r.name||r.directory}),e.jsx(ca,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:r.name||r.directory}),k||w?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[N?e.jsxs("a",{href:N,target:"_blank",rel:"noopener noreferrer",onClick:b=>b.stopPropagation(),className:"inline-flex items-center gap-1 truncate rounded text-oai-gray-500 hover:text-oai-black hover:underline focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",title:N,children:[e.jsx("span",{className:"truncate",children:k}),e.jsx(ca,{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]})}),r.description?e.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:r.description}):null,e.jsx("div",{className:"mt-auto pt-5",children:o?e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>m?.(r),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}),s("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:s("skills.card.targets_prefix")}),e.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:x.length?v:s("skills.target.none")}),e.jsxs(Pa,{children:[e.jsx(La,{disabled:g,"aria-label":s("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:s("skills.card.targets_change")}),e.jsx(Ia,{children:e.jsx(Da,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs($a,{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:s("skills.target.menu_label")}),c.map(b=>{const C=x.includes(b.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:C,onChange:()=>l(b.id)}),e.jsx(be,{provider:b.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:b.label})]},b.id)})]})})})]})]}),e.jsxs(U,{type:"button",size:"sm",onClick:()=>u(r,x),disabled:g||x.length===0,className:"w-full",children:[g?e.jsx(ee,{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}),s("skills.action.install")]})]})})]})});function Ar({repos:a,repoInput:r,onRepoInput:o,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(ma,{value:r,onChange:u=>o(u.target.value),placeholder:s("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(ee,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Ka,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),s("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(ee,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ga,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:s("skills.repo.remove")})]})]},`${u.owner}/${u.name}`)})}):null]})}function Kr(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function as(){const[a,r]=n.useState(Kr),[o,g]=n.useState({skills:[],targets:[]}),[c,h]=n.useState([]),[u,m]=n.useState([]),[x,f]=n.useState([]),[l,k]=n.useState(he),[N,w]=n.useState(""),[v,b]=n.useState(""),[C,D]=n.useState(""),[z,Q]=n.useState(""),[F,me]=n.useState(""),[j,ae]=n.useState(!1),[$,V]=n.useState("all"),[X,te]=n.useState(null),[A,ke]=n.useState(""),[we,ze]=n.useState(!0),[Re,Fe]=n.useState(!1),[Ae,M]=n.useState(""),[re,Y]=n.useState(null),[ve,R]=n.useState(null),[q,se]=n.useState(()=>new Set),[I,ie]=n.useState({}),[P,Pe]=n.useState({}),[je,ne]=n.useState([]),[pe,Le]=n.useState(!1),Ie=n.useRef(!1),De=n.useMemo(()=>{const t=new Set;for(const i of o.skills||[])for(const d of Ca(i))t.add(d);return t},[o.skills]),Ne=n.useCallback(async()=>{const t=await vt();g({skills:t.skills||[],targets:t.targets||[]})},[]),H=n.useCallback(async()=>{const t=await jt();f(t.repos||[])},[]),oe=n.useCallback(async({force:t=!1}={})=>{Fe(!0);try{const i=await Nt({force:t});h(i.skills||[])}finally{Fe(!1)}},[]),ye=n.useCallback(async({force:t=!1}={})=>{Le(!0);try{const i=await Ct({force:t});ne(i.skills||[])}finally{Le(!1)}},[]),le=n.useCallback(async()=>{try{const t=await St();ie(t?.updates||{})}catch{ie({})}},[]),de=n.useCallback(async()=>{try{const t=await _t(),i={};for(const d of t?.skills||[])d.installed&&(d.directory&&(i[String(d.directory).toLowerCase()]=d),i[String(d.skill).toLowerCase()]=d);Pe(i)}catch{Pe({})}},[]),xe=n.useCallback(async()=>{ze(!0),M("");try{await Promise.all([Ne(),H()])}catch(t){M(t?.message||s("skills.error.generic"))}finally{ze(!1)}},[Ne,H]),ea=n.useCallback(async()=>{await xe();const t=i=>M(i?.message||s("skills.error.generic"));a==="my"?(le(),de()):l===O?ye({force:!0}).catch(t):l!==B&&oe({force:!0}).catch(t)},[oe,xe,ye,le,de,l,a]);n.useEffect(()=>{xe()},[xe]),n.useEffect(()=>{if(Ie.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("skill");if(!i){Ie.current=!0;return}const d=o.skills||[];if(!d.length)return;const p=d.find(S=>S.directory===i||S.id===i);p&&(r("my"),te(p.id||p.directory)),Ie.current=!0,t.delete("skill");const L=t.toString();window.history.replaceState({},"",`${window.location.pathname}${L?`?${L}`:""}${window.location.hash}`)},[o.skills]),n.useEffect(()=>{a==="browse"&&(l===B||l===O||c.length===0&&oe().catch(t=>M(t?.message||s("skills.error.generic"))))},[c.length,oe,l,a]),n.useEffect(()=>{a!=="browse"||l!==O||je.length===0&&ye().catch(t=>M(t?.message||s("skills.error.generic")))},[ye,je.length,l,a]);const Ke=Object.keys(I).length>0,ce=Object.keys(P).length>0;if(n.useEffect(()=>{a==="my"&&(Ke||le(),ce||de())},[a,Ke,ce,le,de]),n.useEffect(()=>{const t=setTimeout(()=>b(N),200);return()=>clearTimeout(t)},[N]),n.useEffect(()=>{const t=setTimeout(()=>Q(C),120);return()=>clearTimeout(t)},[C]),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]),!Lr&&!Rt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(Bt,{})});const _=async(t,i)=>{ke(t),M("");try{await i(),await Ne()}catch(d){M(d?.message||s("skills.error.generic"))}finally{ke("")}},aa=(t,i)=>{const d=(i&&i.length?i:oa).filter(p=>(o.targets||[]).some(L=>L.id===p));_(Ge(t),async()=>{await ya(t,d);const p=d.map(L=>(o.targets||[]).find(S=>S.id===L)?.label||L).join(", ");Ce({title:s("skills.toast.installed",{name:t.name||t.directory,targets:p||s("skills.target.none")}),timeout:4e3})})},$e=t=>{Y(t)},fe=()=>{const t=re;t&&(Y(null),_(Sa(t),async()=>{let i=null;t.managed?i=await fa(t.id):await ba(t.directory,t.targets||[]);const d=!!(i?.trashed&&t.managed&&t.id);Ce({title:s("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:d?{onUndo:async()=>{try{await Dt(t.id),await Ne()}catch(p){M(p?.message||s("skills.error.generic"))}}}:void 0})}))},J=(t,i,d)=>_(Xa(t.id,i),async()=>{const p=new Set(t.targets||[]);d?p.add(i):p.delete(i),t.managed?await ka(t.id,Array.from(p)):await wa(t.directory,Array.from(p));const L={name:t.name||t.directory,agent:Ve(i)};Ce({title:d?s("skills.toast.synced_one",L):s("skills.toast.unsynced_one",L),timeout:3e3})}),Ee=n.useCallback(()=>se(new Set),[]),ta=n.useCallback((t,i)=>{se(d=>{const p=new Set(d);return i?p.add(t.id):p.delete(t.id),p})},[]),Ve=t=>(o.targets||[]).find(i=>i.id===t)?.label||t,Be=t=>{const i=(o.skills||[]).filter(d=>q.has(d.id));i.length&&_("batch",async()=>{for(const d of i){const p=new Set(d.targets||[]);p.add(t),d.managed?await ka(d.id,Array.from(p)):await wa(d.directory,Array.from(p))}Ee(),Ce({title:s("skills.toast.bulk_synced",{count:i.length,agent:Ve(t)}),timeout:4e3})})},ra=()=>{const t=(o.skills||[]).filter(i=>q.has(i.id));t.length&&R(t)},sa=()=>{const t=ve;t&&(R(null),_("batch",async()=>{for(const i of t)i.managed?await fa(i.id):await ba(i.directory,i.targets||[]);Ee(),Ce({title:s("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},y=t=>{!t?.repoOwner||!t?.repoName||_(Ge(t),async()=>{await ya({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:oa),await le(),Ce({title:s("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},T=async()=>{const t=N.trim();if(!(t.length<2)){ke("search"),M("");try{const i=await It(t);m(i.skills||[])}catch(i){M(i?.message||s("skills.error.generic"))}finally{ke("")}}},ue=async()=>{const t=F.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[i,d]=t.split("/");if(!i||!d){M(s("skills.repo.invalid"));return}await _("repo:add",async()=>{await Et({owner:i,name:d,branch:"main",enabled:!0}),me(""),await H(),await oe()})},ge=async t=>{await _(`repo:${t.owner}/${t.name}`,async()=>{await $t(t.owner,t.name),await H(),await oe()})},E=o.targets||[],G=o.skills||[],Me=n.useMemo(()=>{const t=$==="all"?G:G.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},[G,$,z]),Ya=$!=="all",Z=n.useMemo(()=>X&&G.find(t=>(t.id||t.directory)===X)||null,[G,X]),Ja=n.useCallback(()=>{V("all"),D("")},[]),Za=n.useCallback(t=>{te(i=>{const d=t?.id||t?.directory||null;return i===d?null:d})},[]),et=n.useCallback(()=>te(null),[]),at=n.useCallback(t=>{const i=Je(t).toLowerCase(),d=Na(t),p=(o.skills||[]).find(L=>{const S=Ca(L);return S.has(i)||d&&S.has(d)});p&&te(p.id||p.directory)},[o.skills]);n.useEffect(()=>{a!=="my"&&q.size&&se(new Set)},[a,q.size]),n.useEffect(()=>{X&&!Z&&te(null)},[Z,X]);const Te=n.useMemo(()=>{const t=l===B?u:l===O?je:c,d=l===B||l===O||l===he?t:t.filter(S=>`${S.repoOwner}/${S.repoName}`===l),p=v.trim().toLowerCase();return(l===B||!p?d:d.filter(S=>(S.name||"").toLowerCase().includes(p)||(S.directory||"").toLowerCase().includes(p)||(S.description||"").toLowerCase().includes(p))).map(S=>{const ia=Je(S).toLowerCase(),K=Na(S);return{...S,installed:De.has(ia)||K&&De.has(K)}})},[v,c,De,je,u,l]),tt=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(ee,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),rt=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(ee,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.browse.loading_hint")})]}),qe=(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:s(t)}),i]});let He;if(we)He=tt;else if(a==="my")He=G.length?e.jsx(Ur,{items:Me,totalCount:G.length,targets:E,agentOptions:E,agentFilter:$,onAgentFilter:V,anyFilter:Ya,onClearFilters:Ja,searchQuery:C,onSearchQuery:D,searchPlaceholder:s("skills.my.placeholder"),selectedId:X,onSelect:Za,onToggleTarget:J,busyKey:A,updates:I,selectedIds:q,onToggleSelect:ta,onClearSelection:Ee,onBulkSync:Be,onBulkRemove:ra}):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:[E.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:[...E,...E].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(be,{provider:t.id,size:30})},`b-${i}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...E,...E].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(be,{provider:t.id,size:30})},`c-${i}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.empty.my")}),e.jsx(U,{type:"button",size:"sm",onClick:()=>r("browse"),children:s("skills.empty.my_cta")})]});else{const t=l===B,i=l===O,d=x.length===0&&!t&&!i,p=Re&&!t&&!i||i&&pe,L=!t&&!i&&(v.trim()!==""||l!==he),S=()=>{w(""),k(he)},ia=!d&&!p&&(Te.length>0||L)?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:s("skills.filter.result_count_browse",{count:Te.length})}),L?e.jsxs("button",{type:"button",onClick:S,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}),s("skills.filter.clear")]}):null]}):null;let K;d?K=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:s("skills.browse.empty_sources")})}):p?K=rt:t&&N.trim().length<2?K=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:s("skills.browse.hint_skillssh")}):Te.length?K=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Te.map(Oe=>e.jsx("div",{style:zr,children:e.jsx(Fr,{skill:Oe,installed:!!Oe.installed,installing:A===Ge(Oe),allTargets:E,defaultTargets:oa,onInstall:aa,onManage:at})},Oe.id||Oe.key))}):L?K=qe("skills.empty.no_match",e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:S,children:s("skills.filter.clear")})):t?K=qe("skills.empty.search"):i?K=qe("skills.empty.popular"):K=qe("skills.empty.browse");const st=d||j?e.jsx("div",{className:"mb-5",children:e.jsx(Ar,{repos:x,repoInput:F,onRepoInput:me,busyKey:A,onAdd:ue,onRemove:ge})}):null,it=!j&&!t&&!i&&x.length<=1&&Te.length>0?e.jsx(ur,{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:s("skills.browse.add_repo_hint")}),e.jsx("button",{type:"button",onClick:()=>ae(!0),className:"rounded font-medium text-oai-gray-700 underline decoration-dotted underline-offset-2 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-200 dark:hover:text-white",children:s("skills.browse.manage_sources")})]})}):null;He=e.jsxs(e.Fragment,{children:[st,ia,K,it]})}return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("skills.page.title")}),e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:ea,disabled:we||Re||pe,children:[e.jsx(Pt,{className:W("mr-1.5 h-3.5 w-3.5",(we||Re||pe)&&"animate-spin"),"aria-hidden":!0}),s("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",s("skills.tab.my")],["browse",s("skills.tab.browse")]].map(([t,i])=>e.jsx("button",{type:"button","aria-pressed":a===t,onClick:()=>r(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))}),Ae?e.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:Ae}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("div",{role:"tablist","aria-label":s("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",s("skills.mode.repo"),l!==B&&l!==O],["popular",s("skills.mode.popular"),l===O],["skillssh",s("skills.mode.skillssh"),l===B]].map(([t,i,d])=>e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>{t==="skillssh"?k(B):t==="popular"?k(O):(l===B||l===O)&&k(he)},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(ir,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,i]},t))}),l!==B&&l!==O?e.jsxs(Ba,{value:l,onValueChange:k,children:[e.jsxs(Ma,{"aria-label":s("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Ta,{children:t=>t===he?s("skills.source.all"):t}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ua,{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(Qe,{value:he,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Xe,{children:s("skills.source.all")}),e.jsx(Ye,{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(Qe,{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(Xe,{children:i}),e.jsx(Ye,{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(da,{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(ma,{type:"search",value:N,onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Enter"&&l===B&&T()},"aria-label":s("skills.action.search_aria"),placeholder:l===B?s("skills.browse.placeholder_skillssh"):l===O?s("skills.browse.placeholder_popular"):l===he?s("skills.browse.placeholder_all"):s("skills.browse.placeholder_repo",{repo:l}),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"})]}),l===B?e.jsxs(U,{type:"button",onClick:T,disabled:N.trim().length<2||A==="search",className:"focus:!ring-oai-gray-400/30",children:[A==="search"?e.jsx(ee,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(da,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),s("skills.action.search")]}):l===O?null:e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>ae(t=>!t),"aria-expanded":j,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(Ka,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("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,He,e.jsx(Rr,{skill:Z,targets:E,busyKey:A,usage:Z&&(P[String(Z.directory||"").toLowerCase()]||P[String(Z.name||"").toLowerCase()])||null,hasUpdate:!!(Z?.id&&I?.[Z.id]),updating:Z?A===Ge(Z):!1,onUpdate:y,onClose:et,onToggleTarget:J,onRemove:$e})]})}),e.jsx(va,{open:!!re,title:s("skills.confirm.remove_title",{name:re?.name||re?.directory||""}),description:re?re.managed?s("skills.confirm.remove_managed"):s("skills.confirm.remove_local"):"",confirmLabel:s("skills.action.remove"),cancelLabel:s("shared.action.cancel"),destructive:!0,busy:A===Sa(re||{}),onCancel:()=>Y(null),onConfirm:fe}),e.jsx(va,{open:!!ve,title:s("skills.confirm.bulk_remove_title",{count:ve?.length||0}),description:s("skills.confirm.bulk_remove_desc"),confirmLabel:s("skills.action.remove"),cancelLabel:s("shared.action.cancel"),destructive:!0,busy:A==="batch",onCancel:()=>R(null),onConfirm:sa})]})}export{as as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,G as o,c5 as I,a1 as P,r as u,b1 as B,R as D,V as W}from"./main-C5qSiLnL.js";import{S as E}from"./Select-9oplHX46.js";import{u as K,T as G}from"./use-native-settings-MKCjJWeQ.js";import{F as L,S as R,a as O}from"./FadeIn-RZKrtHup.js";import{A as $}from"./arrow-up-right-9sot4sNP.js";import{D as z}from"./download-3O0nnnqv.js";import"./SelectItemText-CnL08w_W.js";import"./useScrollLock-BdBmNNmw.js";import"./Card-Cg-6DDbN.js";const H=["todayTokens","todayCost"],_=[{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:"codexSpark5h",label:"Codex Spark 5h Limit",shortLabel:"Cx Spark 5h",category:"limits"},{id:"codexSpark7d",label:"Codex Spark 7d Limit",shortLabel:"Cx Spark 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaudeWeekly",label:"Antigravity Claude 7d Limit",shortLabel:"Ag Cl 7d",category:"limits"},{id:"antigravityClaude5h",label:"Antigravity Claude 5h Limit",shortLabel:"Ag Cl 5h",category:"limits"},{id:"antigravityGeminiWeekly",label:"Antigravity Gemini 7d Limit",shortLabel:"Ag Gm 7d",category:"limits"},{id:"antigravityGemini5h",label:"Antigravity Gemini 5h Limit",shortLabel:"Ag Gm 5h",category:"limits"}];function C(t,a=_,r=2){const i=new Set(a.map(n=>n.id)),l=new Set,s=Array.isArray(t)?t.filter(n=>!i.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 U=264,V=124,h="ui-rounded, -apple-system, system-ui",N=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],X={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Y(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function b({size:t="sm",children:a}){const r=t==="lg",i=r?560:264,l=r?32:22;return e.jsx("div",{className:W("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",r?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:i,aspectRatio:`${U} / ${V}`,borderRadius:l},children:a})})}function Z({size:t="sm"}){const a="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=`${a} L264,124 L0,124 Z`,i=`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:i,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:h,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:h,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:h,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:h,children:"$673.61"}),e.jsx("path",{d:r,fill:`url(#${i})`,stroke:"none"}),e.jsx("path",{d:a,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const S=(()=>{const r=[];for(let i=0;i<26;i++)for(let l=0;l<7;l++){const s=Math.sin((i+1)*12.9898+(l+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(s-Math.floor(s))*100);r.push({w:i,d:l,v:c})}return r})();function A(t,a){return t<18?a?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function q(){return e.jsx(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:S.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:A(s.v,!0)},`d-${s.w}-${s.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:S.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:A(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:h,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 J(){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}],a=22,r=28,i=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*a,g=N[c%N.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:g}),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:h,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:h,children:[s.pct,"%"]}),e.jsx("rect",{x:i,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:i,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:g})]},s.name)})})})}function Q(){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}],a=22,r=28,i=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*a,g=X[s.source],y=Y(s.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:g}),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:h,children:s.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:h,children:[s.pct,"%"]}),e.jsx("rect",{x:i,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:i,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},s.label)})})})}function ee(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function te(t,a){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");case"codexSpark5h":return o("menubar.metric.codex_spark_5h");case"codexSpark7d":return o("menubar.metric.codex_spark_7d");default:return a}}function ae(t,a){const r=new Set(a.map(l=>l.id)),i=t.filter(l=>r.has(l));for(const l of a){if(i.length>=2)break;i.includes(l.id)||i.push(l.id)}return i.slice(0,2)}function ie({slotConfigs:t,showStats:a}){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"})}),a?t.map(({slot:r,item:i},l)=>e.jsxs(D.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:W("flex min-w-[52px] flex-col items-center justify-center py-1.5",l===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:i?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:i?.shortLabel||"Metric"})]})]},r)):null]})})}function se({slot:t,value:a,options:r,disabled:i,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(E,{value:a,disabled:i,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 p({label:t,hint:a,checked:r,disabled:i,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}),a?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a}):null]}),e.jsx(G,{checked:r,disabled:i,onChange:l,ariaLabel:t})]})}function re(){const{available:t,settings:a,setSetting:r}=K(),i=u.useMemo(()=>(Array.isArray(a?.menuBarAvailableItems)?a.menuBarAvailableItems:_).map(m=>({...m,displayLabel:te(m.id,m.label),previewValue:ee(m)})),[a?.menuBarAvailableItems]),l=Number(a?.menuBarMaxItems)||2,s=u.useMemo(()=>C(a?.menuBarItems,i,l),[i,l,a?.menuBarItems]),c=u.useMemo(()=>ae(s,i),[i,s]),n=a?.showStats!==!1,g=d=>{r("menuBarItems",C(d,i,l))},y=(d,m)=>{const x=[...c];x[d===0?1:0]!==m&&(x[d]=m,g(x))},k=[0,1].map(d=>{const m=c[d]||i[d]?.id||"",v=c[d===0?1:0],T=i.filter(f=>f.id===m||f.id!==v),F=i.find(f=>f.id===m);return{slot:d,currentValue:m,options:T,item:F}}),w=a?.animatedIcon!==!1,j=a?.confettiOnReset!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(ie,{slotConfigs:k,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:k.map(({slot:d,currentValue:m,options:x})=>e.jsx(se,{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(p,{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(p,{label:o("settings.menubar.animatedIcon"),hint:o("settings.menubar.animatedIconHint"),checked:w,disabled:!t,onChange:()=>r("animatedIcon",!w)}),e.jsx(p,{label:o("settings.menubar.confettiOnReset"),hint:o("settings.menubar.confettiOnResetHint"),checked:j,disabled:!t,onChange:()=>r("confettiOnReset",!j)})]})]})}function le(){const[t,a]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(B()){a("native");return}const r=(navigator.userAgent||"").toLowerCase(),i=/mac/.test(r)&&!/iphone|ipad/.test(r);a(i?"mac-web":"other")},[]),t}function oe(){const t=le();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>I("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[o("widgets.cta.open_gallery"),e.jsx($,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(z,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(P,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.macos_only")]})}const ne=[{id:"summary",Preview:Z,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:q,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:J,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:Q,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function ce({Preview:t,nameKey:a,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(a)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:o(r)})]})]})}function M({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:o(t)})}function pe(){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(L,{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(oe,{})})]})}),e.jsx(L,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":o("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(M,{titleKey:"widgets.menubar.section.title"}),e.jsx(re,{})]})}),e.jsxs("section",{"aria-label":o("widgets.gallery.section.title"),children:[e.jsx(M,{titleKey:"widgets.gallery.section.title"}),e.jsx(R,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:ne.map(({id:t,Preview:a,nameKey:r,descKey:i})=>e.jsx(O,{children:e.jsx(ce,{Preview:a,nameKey:r,descKey:i})},t))})})]})]})})})}export{pe as WidgetsPage};
|