tokentracker-cli 0.21.1 → 0.21.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dashboard/dist/assets/{Card-Dqh7NgC7.js → Card-Cv4wn6W8.js} +1 -1
  2. package/dashboard/dist/assets/{DashboardPage-DvOSzWq2.js → DashboardPage-DsfcNgai.js} +1 -1
  3. package/dashboard/dist/assets/{FadeIn-Ba4HDg1-.js → FadeIn-DjQyRfLZ.js} +1 -1
  4. package/dashboard/dist/assets/{HeaderGithubStar-jb65AnnV.js → HeaderGithubStar-D2BjLT1b.js} +1 -1
  5. package/dashboard/dist/assets/{IpCheckPage-BopoeRF9.js → IpCheckPage-D0uvbHPe.js} +1 -1
  6. package/dashboard/dist/assets/{LandingPage-xBEC-7TO.js → LandingPage-DGJcVAg7.js} +1 -1
  7. package/dashboard/dist/assets/LeaderboardPage-Dnt_YLsP.js +5 -0
  8. package/dashboard/dist/assets/{LeaderboardProfilePage-BJ6rhisC.js → LeaderboardProfilePage-DM7S9_kG.js} +1 -1
  9. package/dashboard/dist/assets/{LimitsPage-BfN5T40h.js → LimitsPage-COomwRa6.js} +1 -1
  10. package/dashboard/dist/assets/{LoginPage-BPTGJynP.js → LoginPage-k0k50kws.js} +1 -1
  11. package/dashboard/dist/assets/{PopoverPopup-DhX9NeCF.js → PopoverPopup-DctOj5-q.js} +1 -1
  12. package/dashboard/dist/assets/{ProviderIcon-CrjWjnUl.js → ProviderIcon-DGlYzr9I.js} +1 -1
  13. package/dashboard/dist/assets/{SettingsPage-Bk7duO5H.js → SettingsPage-D2sqM9g_.js} +1 -1
  14. package/dashboard/dist/assets/{SkillsPage-Csd3kUk8.js → SkillsPage-B8K--edc.js} +1 -1
  15. package/dashboard/dist/assets/{WidgetsPage-t4SzNlBi.js → WidgetsPage-DsMj8Qcz.js} +1 -1
  16. package/dashboard/dist/assets/{chevron-down-D6dxVls1.js → chevron-down-kcaroSaH.js} +1 -1
  17. package/dashboard/dist/assets/{download-qtsjFNo5.js → download-DKMK6oF8.js} +1 -1
  18. package/dashboard/dist/assets/{leaderboard-columns-BejzbNvX.js → leaderboard-columns-BZ06dD2h.js} +1 -1
  19. package/dashboard/dist/assets/{main-Bvv7-8LC.js → main-DKVBnAOd.js} +4 -2
  20. package/dashboard/dist/assets/main-DX38hz5f.css +1 -0
  21. package/dashboard/dist/assets/{use-limits-display-prefs-qSJ1Ys0_.js → use-limits-display-prefs-Bx-K-27B.js} +1 -1
  22. package/dashboard/dist/assets/{use-native-settings-ClfTqea2.js → use-native-settings-DtuifRKC.js} +1 -1
  23. package/dashboard/dist/assets/{use-reduced-motion-DOaOYeS3.js → use-reduced-motion-Cen-UCKO.js} +1 -1
  24. package/dashboard/dist/assets/{use-usage-limits-CeShSkoj.js → use-usage-limits-CAWz6ijv.js} +1 -1
  25. package/dashboard/dist/index.html +2 -2
  26. package/dashboard/dist/share.html +2 -2
  27. package/package.json +1 -1
  28. package/src/lib/pricing/seed-snapshot.json +1 -1
  29. package/dashboard/dist/assets/LeaderboardPage-BChhkcv2.js +0 -5
  30. package/dashboard/dist/assets/main-CnN_a-Nl.css +0 -1
@@ -0,0 +1,5 @@
1
+ import{c as Jr,r as s,R as V,a7 as Ge,D as c,a5 as L,B as w,a8 as Zr,a9 as Qr,P as en,Q as tn,aa as rn,h as nn,j as on,ab as an,T as sn,a3 as At,E as ln,L as cn,ac as dn,ad as un,ae as Jt,af as fn}from"./main-DKVBnAOd.js";import{P as gn}from"./ProviderIcon-DGlYzr9I.js";import{L as xr,a as vr,b as ft,l as Mt,c as It,d as _t,e as hn}from"./leaderboard-columns-BZ06dD2h.js";import{C as bn}from"./chevron-down-kcaroSaH.js";const pn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],mn=Jr("arrow-right",pn);function xn(){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 mt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ze(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ut(e){return"nodeType"in e}function q(e){var t,r;return e?ze(e)?e:Ut(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Yt(e){const{Document:t}=q(e);return e instanceof t}function nt(e){return ze(e)?!1:e instanceof q(e).HTMLElement}function yr(e){return e instanceof q(e).SVGElement}function Be(e){return e?ze(e)?e.document:Ut(e)?Yt(e)?e:nt(e)||yr(e)?e.ownerDocument:document:document:document}const ve=mt?s.useLayoutEffect:s.useEffect;function Wt(e){const t=s.useRef(e);return ve(()=>{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 vn(){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 Ze(e,t){t===void 0&&(t=[e]);const r=s.useRef(e);return ve(()=>{r.current!==e&&(r.current=e)},t),r}function ot(e,t){const r=s.useRef();return s.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function gt(e){const t=Wt(e),r=s.useRef(null),n=s.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function Tt(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let Ct={};function at(e,t){return s.useMemo(()=>{if(t)return t;const r=Ct[e]==null?0:Ct[e]+1;return Ct[e]=r,e+"-"+r},[e,t])}function wr(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 Pe=wr(1),Qe=wr(-1);function yn(e){return"clientX"in e&&"clientY"in e}function Xt(e){if(!e)return!1;const{KeyboardEvent:t}=q(e.target);return t&&e instanceof t}function wn(e){if(!e)return!1;const{TouchEvent:t}=q(e.target);return t&&e instanceof t}function Lt(e){if(wn(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 yn(e)?{x:e.clientX,y:e.clientY}:null}const et=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[et.Translate.toString(e),et.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Zt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function kn(e){return e.matches(Zt)?e:e.querySelector(Zt)}const Sn={display:"none"};function Nn(e){let{id:t,value:r}=e;return V.createElement("div",{id:t,style:Sn},r)}function Cn(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 V.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Rn(){const[e,t]=s.useState("");return{announce:s.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const kr=s.createContext(null);function Dn(e){const t=s.useContext(kr);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function En(){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 jn={draggable:`
2
+ To pick up a draggable item, press the space bar.
3
+ While dragging, use the arrow keys to move the item.
4
+ Press space again to drop the item in its new position, or press escape to cancel.
5
+ `},An={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 Mn(e){let{announcements:t=An,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=jn}=e;const{announce:a,announcement:i}=Rn(),l=at("DndLiveRegion"),[d,u]=s.useState(!1);if(s.useEffect(()=>{u(!0)},[]),Dn(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=V.createElement(V.Fragment,null,V.createElement(Nn,{id:n,value:o.draggable}),V.createElement(Cn,{id:l,announcement:i}));return r?Ge.createPortal(g,r):g}var z;(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"})(z||(z={}));function ht(){}function Qt(e,t){return s.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function In(){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 ge=Object.freeze({x:0,y:0});function Sr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Nr(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 er(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 Cr(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function tr(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 Tn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=tr(t,t.left,t.top),a=[];for(const i of n){const{id:l}=i,d=r.get(l);if(d){const u=Sr(tr(d),o);a.push({id:l,data:{droppableContainer:i,value:u}})}}return a.sort(Nr)},Ln=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=er(t),a=[];for(const i of n){const{id:l}=i,d=r.get(l);if(d){const u=er(d),g=o.reduce((p,b,D)=>p+Sr(u[D],b),0),f=Number((g/4).toFixed(4));a.push({id:l,data:{droppableContainer:i,value:f}})}}return a.sort(Nr)};function On(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 Pn=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=On(l,t);d>0&&o.push({id:i,data:{droppableContainer:a,value:d}})}}return o.sort(_n)};function zn(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Rr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ge}function Bn(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 $n=Bn(1);function Fn(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 Un(e,t,r){const n=Fn(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 Yn={ignoreTransform:!1};function $e(e,t){t===void 0&&(t=Yn);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=q(e).getComputedStyle(e);u&&(r=Un(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 rr(e){return $e(e,{ignoreTransform:!0})}function Wn(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Xn(e,t){return t===void 0&&(t=q(e).getComputedStyle(e)),t.position==="fixed"}function Kn(e,t){t===void 0&&(t=q(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 xt(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(Yt(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!nt(o)||yr(o)||r.includes(o))return r;const a=q(e).getComputedStyle(o);return o!==e&&Kn(o,a)&&r.push(o),Xn(o,a)?r:n(o.parentNode)}return e?n(e):r}function Dr(e){const[t]=xt(e,1);return t??null}function Rt(e){return!mt||!e?null:ze(e)?e:Ut(e)?Yt(e)||e===Be(e).scrollingElement?window:nt(e)?e:null:null}function Er(e){return ze(e)?e.scrollX:e.scrollLeft}function jr(e){return ze(e)?e.scrollY:e.scrollTop}function Ot(e){return{x:Er(e),y:jr(e)}}var $;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})($||($={}));function Ar(e){return!mt||!e?!1:e===document.scrollingElement}function Mr(e){const t={x:0,y:0},r=Ar(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 Hn={x:.2,y:.2};function Gn(e,t,r,n,o){let{top:a,left:i,right:l,bottom:d}=r;n===void 0&&(n=10),o===void 0&&(o=Hn);const{isTop:u,isBottom:g,isLeft:f,isRight:p}=Mr(e),b={x:0,y:0},D={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&a<=t.top+m.height?(b.y=$.Backward,D.y=n*Math.abs((t.top+m.height-a)/m.height)):!g&&d>=t.bottom-m.height&&(b.y=$.Forward,D.y=n*Math.abs((t.bottom-m.height-d)/m.height)),!p&&l>=t.right-m.width?(b.x=$.Forward,D.x=n*Math.abs((t.right-m.width-l)/m.width)):!f&&i<=t.left+m.width&&(b.x=$.Backward,D.x=n*Math.abs((t.left+m.width-i)/m.width)),{direction:b,speed:D}}function Vn(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 Ir(e){return e.reduce((t,r)=>Pe(t,Ot(r)),ge)}function qn(e){return e.reduce((t,r)=>t+Er(r),0)}function Jn(e){return e.reduce((t,r)=>t+jr(r),0)}function Zn(e,t){if(t===void 0&&(t=$e),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);Dr(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Qn=[["x",["left","right"],qn],["y",["top","bottom"],Jn]];class Kt{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=xt(r),o=Ir(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of Qn)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 Ve{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 eo(e){const{EventTarget:t}=q(e);return e instanceof t?e:Be(e)}function Dt(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 le;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(le||(le={}));function nr(e){e.preventDefault()}function to(e){e.stopPropagation()}var R;(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"})(R||(R={}));const _r={start:[R.Space,R.Enter],cancel:[R.Esc],end:[R.Space,R.Enter,R.Tab]},ro=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case R.Right:return{...r,x:r.x+25};case R.Left:return{...r,x:r.x-25};case R.Down:return{...r,y:r.y+25};case R.Up:return{...r,y:r.y-25}}};class Ht{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 Ve(Be(r)),this.windowListeners=new Ve(q(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(le.Resize,this.handleCancel),this.windowListeners.add(le.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(le.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&Zn(n),r(ge)}handleKeyDown(t){if(Xt(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=_r,coordinateGetter:i=ro,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}:ge;this.referenceCoordinates||(this.referenceCoordinates=g);const f=i(t,{active:r,context:n.current,currentCoordinates:g});if(f){const p=Qe(f,g),b={x:0,y:0},{scrollableAncestors:D}=n.current;for(const m of D){const x=t.code,{isTop:k,isRight:N,isLeft:v,isBottom:C,maxScroll:E,minScroll:j}=Mr(m),S=Vn(m),y={x:Math.min(x===R.Right?S.right-S.width/2:S.right,Math.max(x===R.Right?S.left:S.left+S.width/2,f.x)),y:Math.min(x===R.Down?S.bottom-S.height/2:S.bottom,Math.max(x===R.Down?S.top:S.top+S.height/2,f.y))},I=x===R.Right&&!N||x===R.Left&&!v,O=x===R.Down&&!C||x===R.Up&&!k;if(I&&y.x!==f.x){const _=m.scrollLeft+p.x,J=x===R.Right&&_<=E.x||x===R.Left&&_>=j.x;if(J&&!p.y){m.scrollTo({left:_,behavior:l});return}J?b.x=m.scrollLeft-_:b.x=x===R.Right?m.scrollLeft-E.x:m.scrollLeft-j.x,b.x&&m.scrollBy({left:-b.x,behavior:l});break}else if(O&&y.y!==f.y){const _=m.scrollTop+p.y,J=x===R.Down&&_<=E.y||x===R.Up&&_>=j.y;if(J&&!p.x){m.scrollTo({top:_,behavior:l});return}J?b.y=m.scrollTop-_:b.y=x===R.Down?m.scrollTop-E.y:m.scrollTop-j.y,b.y&&m.scrollBy({top:-b.y,behavior:l});break}}this.handleMove(t,Pe(Qe(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()}}Ht.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=_r,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 or(e){return!!(e&&"distance"in e)}function ar(e){return!!(e&&"delay"in e)}class Gt{constructor(t,r,n){var o;n===void 0&&(n=eo(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=Be(i),this.documentListeners=new Ve(this.document),this.listeners=new Ve(n),this.windowListeners=new Ve(q(i)),this.initialCoordinates=(o=Lt(a))!=null?o:ge,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(le.Resize,this.handleCancel),this.windowListeners.add(le.DragStart,nr),this.windowListeners.add(le.VisibilityChange,this.handleCancel),this.windowListeners.add(le.ContextMenu,nr),this.documentListeners.add(le.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ar(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(or(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(le.Click,to,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(le.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=Lt(t))!=null?r:ge,u=Qe(o,d);if(!n&&l){if(or(l)){if(l.tolerance!=null&&Dt(u,l.tolerance))return this.handleCancel();if(Dt(u,l.distance))return this.handleStart()}if(ar(l)&&Dt(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===R.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const no={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vt extends Gt{constructor(t){const{event:r}=t,n=Be(r.target);super(t,no,n)}}Vt.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 oo={move:{name:"mousemove"},end:{name:"mouseup"}};var Pt;(function(e){e[e.RightClick=2]="RightClick"})(Pt||(Pt={}));class ao extends Gt{constructor(t){super(t,oo,Be(t.event.target))}}ao.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Pt.RightClick?!1:(n?.({event:r}),!0)}}];const Et={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class io extends Gt{constructor(t){super(t,Et)}static setup(){return window.addEventListener(Et.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Et.move.name,t)};function t(){}}}io.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 qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var bt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(bt||(bt={}));function so(e){let{acceleration:t,activator:r=qe.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:i=5,order:l=bt.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:p}=e;const b=co({delta:f,disabled:!a}),[D,m]=vn(),x=s.useRef({x:0,y:0}),k=s.useRef({x:0,y:0}),N=s.useMemo(()=>{switch(r){case qe.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case qe.DraggableRect:return o}},[r,o,d]),v=s.useRef(null),C=s.useCallback(()=>{const j=v.current;if(!j)return;const S=x.current.x*k.current.x,y=x.current.y*k.current.y;j.scrollBy(S,y)},[]),E=s.useMemo(()=>l===bt.TreeOrder?[...u].reverse():u,[l,u]);s.useEffect(()=>{if(!a||!u.length||!N){m();return}for(const j of E){if(n?.(j)===!1)continue;const S=u.indexOf(j),y=g[S];if(!y)continue;const{direction:I,speed:O}=Gn(j,y,N,t,p);for(const _ of["x","y"])b[_][I[_]]||(O[_]=0,I[_]=0);if(O.x>0||O.y>0){m(),v.current=j,D(C,i),x.current=O,k.current=I;return}}x.current={x:0,y:0},k.current={x:0,y:0},m()},[t,C,n,m,a,i,JSON.stringify(N),JSON.stringify(b),D,u,E,g,JSON.stringify(p)])}const lo={x:{[$.Backward]:!1,[$.Forward]:!1},y:{[$.Backward]:!1,[$.Forward]:!1}};function co(e){let{delta:t,disabled:r}=e;const n=Tt(t);return ot(o=>{if(r||!n||!o)return lo;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[$.Backward]:o.x[$.Backward]||a.x===-1,[$.Forward]:o.x[$.Forward]||a.x===1},y:{[$.Backward]:o.y[$.Backward]||a.y===-1,[$.Forward]:o.y[$.Forward]||a.y===1}}},[r,t,n])}function uo(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return ot(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function fo(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 tt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(tt||(tt={}));var zt;(function(e){e.Optimized="optimized"})(zt||(zt={}));const ir=new Map;function go(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=Ze(f),b=s.useCallback(function(k){k===void 0&&(k=[]),!p.current&&i(N=>N===null?k:N.concat(k.filter(v=>!N.includes(v))))},[p]),D=s.useRef(null),m=ot(k=>{if(f&&!r)return ir;if(!k||k===ir||g.current!==e||a!=null){const N=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){N.set(v.id,v.rect.current);continue}const C=v.node.current,E=C?new Kt(d(C),C):null;v.rect.current=E,E&&N.set(v.id,E)}return N}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"||D.current!==null||(D.current=setTimeout(()=>{b(),D.current=null},l))},[l,f,b,...n]),{droppableRects:m,measureDroppableContainers:b,measuringScheduled:a!=null};function x(){switch(u){case tt.Always:return!1;case tt.BeforeDragging:return r;default:return!r}}}function Tr(e,t){return ot(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function ho(e,t){return Tr(e,t)}function bo(e){let{callback:t,disabled:r}=e;const n=Wt(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 vt(e){let{callback:t,disabled:r}=e;const n=Wt(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 po(e){return new Kt($e(e),e)}function sr(e,t,r){t===void 0&&(t=po);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=bo({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=vt({callback:a});return ve(()=>{a(),e?(l?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),i?.disconnect())},[e]),n}function mo(e){const t=Tr(e);return Rr(e,t)}const lr=[];function xo(e){const t=s.useRef(e),r=ot(n=>e?n&&n!==lr&&e&&t.current&&e.parentNode===t.current.parentNode?n:xt(e):lr,[e]);return s.useEffect(()=>{t.current=e},[e]),r}function vo(e){const[t,r]=s.useState(null),n=s.useRef(e),o=s.useCallback(a=>{const i=Rt(a.target);i&&r(l=>l?(l.set(i,Ot(i)),new Map(l)):null)},[]);return s.useEffect(()=>{const a=n.current;if(e!==a){i(a);const l=e.map(d=>{const u=Rt(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Ot(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=Rt(d);u?.removeEventListener("scroll",o)})}},[o,e]),s.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Pe(a,i),ge):Ir(e):ge,[e,t])}function cr(e,t){t===void 0&&(t=[]);const r=s.useRef(null);return s.useEffect(()=>{r.current=null},t),s.useEffect(()=>{const n=e!==ge;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?Qe(e,r.current):ge}function yo(e){s.useEffect(()=>{if(!mt)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 wo(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 Lr(e){return s.useMemo(()=>e?Wn(e):null,[e])}const dr=[];function ko(e,t){t===void 0&&(t=$e);const[r]=e,n=Lr(r?q(r):null),[o,a]=s.useState(dr);function i(){a(()=>e.length?e.map(d=>Ar(d)?n:new Kt(t(d),d)):dr)}const l=vt({callback:i});return ve(()=>{l?.disconnect(),i(),e.forEach(d=>l?.observe(d))},[e]),o}function So(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return nt(t)?t:e}function No(e){let{measure:t}=e;const[r,n]=s.useState(null),o=s.useCallback(u=>{for(const{target:g}of u)if(nt(g)){n(f=>{const p=t(g);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=vt({callback:o}),i=s.useCallback(u=>{const g=So(u);a?.disconnect(),g&&a?.observe(g),n(g?t(g):null)},[t,a]),[l,d]=gt(i);return s.useMemo(()=>({nodeRef:l,rect:r,setRef:d}),[r,l,d])}const Co=[{sensor:Vt,options:{}},{sensor:Ht,options:{}}],Ro={current:{}},ut={draggable:{measure:rr},droppable:{measure:rr,strategy:tt.WhileDragging,frequency:zt.Optimized},dragOverlay:{measure:$e}};class Je 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 Do={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Je,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ht},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ut,measureDroppableContainers:ht,windowRect:null,measuringScheduled:!1},Eo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ht,draggableNodes:new Map,over:null,measureDroppableContainers:ht},yt=s.createContext(Eo),Or=s.createContext(Do);function jo(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Je}}}function Ao(e,t){switch(t.type){case z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case z.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 z.DragEnd:case z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case z.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new Je(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case z.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 Je(e.droppable.containers);return i.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case z.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new Je(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Mo(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=s.useContext(yt),a=Tt(n),i=Tt(r?.id);return s.useEffect(()=>{if(!t&&!n&&a&&i!=null){if(!Xt(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=kn(g);if(f){f.focus();break}}})}},[n,t,o,i,a]),null}function Io(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:{...ut.draggable,...e?.draggable},droppable:{...ut.droppable,...e?.droppable},dragOverlay:{...ut.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function To(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;ve(()=>{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=Rr(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=Dr(u);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,l,n,r])}const Pr=s.createContext({...ge,scaleX:1,scaleY:1});var Ee;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ee||(Ee={}));const Lo=s.memo(function(t){var r,n,o,a;let{id:i,accessibility:l,autoScroll:d=!0,children:u,sensors:g=Co,collisionDetection:f=Pn,measuring:p,modifiers:b,...D}=t;const m=s.useReducer(Ao,void 0,jo),[x,k]=m,[N,v]=En(),[C,E]=s.useState(Ee.Uninitialized),j=C===Ee.Initialized,{draggable:{active:S,nodes:y,translate:I},droppable:{containers:O}}=x,_=S!=null?y.get(S):null,J=s.useRef({initial:null,translated:null}),Z=s.useMemo(()=>{var W;return S!=null?{id:S,data:(W=_?.data)!=null?W:Ro,rect:J}:null},[S,_]),T=s.useRef(null),[ye,Ie]=s.useState(null),[X,je]=s.useState(null),re=Ze(D,Object.values(D)),K=at("DndDescribedBy",i),_e=s.useMemo(()=>O.getEnabled(),[O]),U=_o(p),{droppableRects:ne,measureDroppableContainers:B,measuringScheduled:he}=go(_e,{dragging:j,dependencies:[I.x,I.y],config:U.droppable}),G=uo(y,S),ce=s.useMemo(()=>X?Lt(X):null,[X]),be=qr(),oe=ho(G,U.draggable.measure);To({activeNode:S!=null?y.get(S):null,config:be.layoutShiftCompensation,initialRect:oe,measure:U.draggable.measure});const A=sr(G,U.draggable.measure,oe),Ne=sr(G?G.parentElement:null),Y=s.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:ne,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),de=O.getNodeFor((r=Y.current.over)==null?void 0:r.id),ue=No({measure:U.dragOverlay.measure}),we=(n=ue.nodeRef.current)!=null?n:G,ke=j?(o=ue.rect)!=null?o:A:null,Fe=!!(ue.nodeRef.current&&ue.rect),Ue=mo(Fe?null:A),Ae=Lr(we?q(we):null),H=xo(j?de??G:null),Te=ko(H),Le=Io(b,{transform:{x:I.x-Ue.x,y:I.y-Ue.y,scaleX:1,scaleY:1},activatorEvent:X,active:Z,activeNodeRect:A,containerNodeRect:Ne,draggingNodeRect:ke,over:Y.current.over,overlayNodeRect:ue.rect,scrollableAncestors:H,scrollableAncestorRects:Te,windowRect:Ae}),it=ce?Pe(ce,I):null,Ye=vo(H),st=cr(Ye),wt=cr(Ye,[A]),ae=Pe(Le,st),pe=ke?$n(ke,Le):null,h=Z&&pe?f({active:Z,collisionRect:pe,droppableRects:ne,droppableContainers:_e,pointerCoordinates:it}):null,M=Cr(h,"id"),[P,We]=s.useState(null),lt=Fe?Le:Pe(Le,wt),kt=zn(lt,(a=P?.rect)!=null?a:null,A),ie=s.useRef(null),St=s.useCallback((W,Q)=>{let{sensor:ee,options:Ce}=Q;if(T.current==null)return;const se=y.get(T.current);if(!se)return;const te=W.nativeEvent,me=new ee({active:T.current,activeNode:se,event:te,options:Ce,context:Y,onAbort(F){if(!y.get(F))return;const{onDragAbort:xe}=re.current,Se={id:F};xe?.(Se),N({type:"onDragAbort",event:Se})},onPending(F,Re,xe,Se){if(!y.get(F))return;const{onDragPending:Ke}=re.current,De={id:F,constraint:Re,initialCoordinates:xe,offset:Se};Ke?.(De),N({type:"onDragPending",event:De})},onStart(F){const Re=T.current;if(Re==null)return;const xe=y.get(Re);if(!xe)return;const{onDragStart:Se}=re.current,Xe={activatorEvent:te,active:{id:Re,data:xe.data,rect:J}};Ge.unstable_batchedUpdates(()=>{Se?.(Xe),E(Ee.Initializing),k({type:z.DragStart,initialCoordinates:F,active:Re}),N({type:"onDragStart",event:Xe}),Ie(ie.current),je(te)})},onMove(F){k({type:z.DragMove,coordinates:F})},onEnd:Oe(z.DragEnd),onCancel:Oe(z.DragCancel)});ie.current=me;function Oe(F){return async function(){const{active:xe,collisions:Se,over:Xe,scrollAdjustedTranslate:Ke}=Y.current;let De=null;if(xe&&Ke){const{cancelDrop:He}=re.current;De={activatorEvent:te,active:xe,collisions:Se,delta:Ke,over:Xe},F===z.DragEnd&&typeof He=="function"&&await Promise.resolve(He(De))&&(F=z.DragCancel)}T.current=null,Ge.unstable_batchedUpdates(()=>{k({type:F}),E(Ee.Uninitialized),We(null),Ie(null),je(null),ie.current=null;const He=F===z.DragEnd?"onDragEnd":"onDragCancel";if(De){const Nt=re.current[He];Nt?.(De),N({type:He,event:De})}})}}},[y]),Me=s.useCallback((W,Q)=>(ee,Ce)=>{const se=ee.nativeEvent,te=y.get(Ce);if(T.current!==null||!te||se.dndKit||se.defaultPrevented)return;const me={active:te};W(ee,Q.options,me)===!0&&(se.dndKit={capturedBy:Q.sensor},T.current=Ce,St(ee,Q))},[y,St]),qt=fo(g,Me);yo(g),ve(()=>{A&&C===Ee.Initializing&&E(Ee.Initialized)},[A,C]),s.useEffect(()=>{const{onDragMove:W}=re.current,{active:Q,activatorEvent:ee,collisions:Ce,over:se}=Y.current;if(!Q||!ee)return;const te={active:Q,activatorEvent:ee,collisions:Ce,delta:{x:ae.x,y:ae.y},over:se};Ge.unstable_batchedUpdates(()=>{W?.(te),N({type:"onDragMove",event:te})})},[ae.x,ae.y]),s.useEffect(()=>{const{active:W,activatorEvent:Q,collisions:ee,droppableContainers:Ce,scrollAdjustedTranslate:se}=Y.current;if(!W||T.current==null||!Q||!se)return;const{onDragOver:te}=re.current,me=Ce.get(M),Oe=me&&me.rect.current?{id:me.id,rect:me.rect.current,data:me.data,disabled:me.disabled}:null,F={active:W,activatorEvent:Q,collisions:ee,delta:{x:se.x,y:se.y},over:Oe};Ge.unstable_batchedUpdates(()=>{We(Oe),te?.(F),N({type:"onDragOver",event:F})})},[M]),ve(()=>{Y.current={activatorEvent:X,active:Z,activeNode:G,collisionRect:pe,collisions:h,droppableRects:ne,draggableNodes:y,draggingNode:we,draggingNodeRect:ke,droppableContainers:O,over:P,scrollableAncestors:H,scrollAdjustedTranslate:ae},J.current={initial:ke,translated:pe}},[Z,G,h,pe,y,we,ke,ne,O,P,H,ae]),so({...be,delta:I,draggingRect:pe,pointerCoordinates:it,scrollableAncestors:H,scrollableAncestorRects:Te});const Gr=s.useMemo(()=>({active:Z,activeNode:G,activeNodeRect:A,activatorEvent:X,collisions:h,containerNodeRect:Ne,dragOverlay:ue,draggableNodes:y,droppableContainers:O,droppableRects:ne,over:P,measureDroppableContainers:B,scrollableAncestors:H,scrollableAncestorRects:Te,measuringConfiguration:U,measuringScheduled:he,windowRect:Ae}),[Z,G,A,X,h,Ne,ue,y,O,ne,P,B,H,Te,U,he,Ae]),Vr=s.useMemo(()=>({activatorEvent:X,activators:qt,active:Z,activeNodeRect:A,ariaDescribedById:{draggable:K},dispatch:k,draggableNodes:y,over:P,measureDroppableContainers:B}),[X,qt,Z,A,k,K,y,P,B]);return V.createElement(kr.Provider,{value:v},V.createElement(yt.Provider,{value:Vr},V.createElement(Or.Provider,{value:Gr},V.createElement(Pr.Provider,{value:kt},u)),V.createElement(Mo,{disabled:l?.restoreFocus===!1})),V.createElement(Mn,{...l,hiddenTextDescribedById:K}));function qr(){const W=ye?.autoScrollEnabled===!1,Q=typeof d=="object"?d.enabled===!1:d===!1,ee=j&&!W&&!Q;return typeof d=="object"?{...d,enabled:ee}:{enabled:ee}}}),Oo=s.createContext(null),ur="button",Po="Draggable";function zo(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=at(Po),{activators:i,activatorEvent:l,active:d,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:p}=s.useContext(yt),{role:b=ur,roleDescription:D="draggable",tabIndex:m=0}=o??{},x=d?.id===t,k=s.useContext(x?Pr:Oo),[N,v]=gt(),[C,E]=gt(),j=wo(i,t),S=Ze(r);ve(()=>(f.set(t,{id:t,key:a,node:N,activatorNode:C,data:S}),()=>{const I=f.get(t);I&&I.key===a&&f.delete(t)}),[f,t]);const y=s.useMemo(()=>({role:b,tabIndex:m,"aria-disabled":n,"aria-pressed":x&&b===ur?!0:void 0,"aria-roledescription":D,"aria-describedby":g.draggable}),[n,b,m,x,D,g.draggable]);return{active:d,activatorEvent:l,activeNodeRect:u,attributes:y,isDragging:x,listeners:n?void 0:j,node:N,over:p,setNodeRef:v,setActivatorNodeRef:E,transform:k}}function Bo(){return s.useContext(Or)}const $o="Droppable",Fo={timeout:25};function Uo(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=at($o),{active:i,dispatch:l,over:d,measureDroppableContainers:u}=s.useContext(yt),g=s.useRef({disabled:r}),f=s.useRef(!1),p=s.useRef(null),b=s.useRef(null),{disabled:D,updateMeasurementsFor:m,timeout:x}={...Fo,...o},k=Ze(m??n),N=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=vt({callback:N,disabled:D||!i}),C=s.useCallback((y,I)=>{v&&(I&&(v.unobserve(I),f.current=!1),y&&v.observe(y))},[v]),[E,j]=gt(C),S=Ze(t);return s.useEffect(()=>{!v||!E.current||(v.disconnect(),f.current=!1,v.observe(E.current))},[E,v]),s.useEffect(()=>(l({type:z.RegisterDroppable,element:{id:n,key:a,disabled:r,node:E,rect:p,data:S}}),()=>l({type:z.UnregisterDroppable,key:a,id:n})),[n]),s.useEffect(()=>{r!==g.current.disabled&&(l({type:z.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,l]),{active:i,rect:p,isOver:d?.id===n,node:E,over:d,setNodeRef:j}}const Yo=e=>{let{transform:t}=e;return{...t,y:0}};function zr(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Wo(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function ct(e){return e!==null&&e>=0}function Xo(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 Ko(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const dt={scaleX:1,scaleY:1},Ho=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=Go(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,...dt}:null}return i>o&&i<=a?{x:-l.width-d,y:0,...dt}:i<o&&i>=a?{x:l.width+d,y:0,...dt}:{x:0,y:0,...dt}};function Go(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 Br=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=zr(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}},$r="Sortable",Fr=V.createContext({activeIndex:-1,containerId:$r,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Br,disabled:{draggable:!1,droppable:!1}});function Vo(e){let{children:t,id:r,items:n,strategy:o=Br,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:d,over:u,measureDroppableContainers:g}=Bo(),f=at($r,r),p=l.rect!==null,b=s.useMemo(()=>n.map(j=>typeof j=="object"&&"id"in j?j.id:j),[n]),D=i!=null,m=i?b.indexOf(i.id):-1,x=u?b.indexOf(u.id):-1,k=s.useRef(b),N=!Xo(b,k.current),v=x!==-1&&m===-1||N,C=Ko(a);ve(()=>{N&&D&&g(b)},[N,b,D,g]),s.useEffect(()=>{k.current=b},[b]);const E=s.useMemo(()=>({activeIndex:m,containerId:f,disabled:C,disableTransforms:v,items:b,overIndex:x,useDragOverlay:p,sortedRects:Wo(b,d),strategy:o}),[m,f,C.draggable,C.droppable,v,b,x,d,p,o]);return V.createElement(Fr.Provider,{value:E},t)}const qo=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return zr(r,n,o).indexOf(t)},Jo=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},Zo={duration:200,easing:"ease"},Ur="transform",Qo=et.Transition.toString({property:Ur,duration:0,easing:"linear"}),ea={roleDescription:"sortable"};function ta(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,i]=s.useState(null),l=s.useRef(r);return ve(()=>{if(!t&&r!==l.current&&n.current){const d=o.current;if(d){const u=$e(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 ra(e){let{animateLayoutChanges:t=Jo,attributes:r,disabled:n,data:o,getNewIndex:a=qo,id:i,strategy:l,resizeObserverConfig:d,transition:u=Zo}=e;const{items:g,containerId:f,activeIndex:p,disabled:b,disableTransforms:D,sortedRects:m,overIndex:x,useDragOverlay:k,strategy:N}=s.useContext(Fr),v=na(n,b),C=g.indexOf(i),E=s.useMemo(()=>({sortable:{containerId:f,index:C,items:g},...o}),[f,o,C,g]),j=s.useMemo(()=>g.slice(g.indexOf(i)),[g,i]),{rect:S,node:y,isOver:I,setNodeRef:O}=Uo({id:i,data:E,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...d}}),{active:_,activatorEvent:J,activeNodeRect:Z,attributes:T,setNodeRef:ye,listeners:Ie,isDragging:X,over:je,setActivatorNodeRef:re,transform:K}=zo({id:i,data:E,attributes:{...ea,...r},disabled:v.draggable}),_e=xn(O,ye),U=!!_,ne=U&&!D&&ct(p)&&ct(x),B=!k&&X,he=B&&ne?K:null,ce=ne?he??(l??N)({rects:m,activeNodeRect:Z,activeIndex:p,overIndex:x,index:C}):null,be=ct(p)&&ct(x)?a({id:i,items:g,activeIndex:p,overIndex:x}):C,oe=_?.id,A=s.useRef({activeId:oe,items:g,newIndex:be,containerId:f}),Ne=g!==A.current.items,Y=t({active:_,containerId:f,isDragging:X,isSorting:U,id:i,index:C,items:g,newIndex:A.current.newIndex,previousItems:A.current.items,previousContainerId:A.current.containerId,transition:u,wasDragging:A.current.activeId!=null}),de=ta({disabled:!Y,index:C,node:y,rect:S});return s.useEffect(()=>{U&&A.current.newIndex!==be&&(A.current.newIndex=be),f!==A.current.containerId&&(A.current.containerId=f),g!==A.current.items&&(A.current.items=g)},[U,be,f,g]),s.useEffect(()=>{if(oe===A.current.activeId)return;if(oe&&!A.current.activeId){A.current.activeId=oe;return}const we=setTimeout(()=>{A.current.activeId=oe},50);return()=>clearTimeout(we)},[oe]),{active:_,activeIndex:p,attributes:T,data:E,rect:S,index:C,newIndex:be,items:g,isOver:I,isSorting:U,isDragging:X,listeners:Ie,node:y,overIndex:x,over:je,setNodeRef:_e,setActivatorNodeRef:re,setDroppableNodeRef:O,setDraggableNodeRef:ye,transform:de??ce,transition:ue()};function ue(){if(de||Ne&&A.current.newIndex===C)return Qo;if(!(B&&!Xt(J)||!u)&&(U||Y))return et.Transition.toString({...u,property:Ur})}}function na(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 pt(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 oa=[R.Down,R.Right,R.Up,R.Left],aa=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:i,scrollableAncestors:l}}=t;if(oa.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 R.Down:n.top<p.top&&d.push(f);break;case R.Up:n.top>p.top&&d.push(f);break;case R.Left:n.left>p.left&&d.push(f);break;case R.Right:n.left<p.left&&d.push(f);break}});const u=Ln({collisionRect:n,droppableRects:o,droppableContainers:d});let g=Cr(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,D=p?.node.current;if(D&&b&&f&&p){const x=xt(D).some((j,S)=>l[S]!==j),k=Yr(f,p),N=ia(f,p),v=x||!k?{x:0,y:0}:{x:N?n.width-b.width:0,y:N?n.height-b.height:0},C={x:b.left,y:b.top};return v.x&&v.y?C:Qe(C,v)}}}};function Yr(e,t){return!pt(e)||!pt(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ia(e,t){return!pt(e)||!pt(t)||!Yr(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function rt(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 sa(e,t){const r=rt(t,{min:0,max:1e6,fallback:0}),n=rt(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 la({page:e,totalPages:t}){const r=typeof t=="number"&&Number.isFinite(t)&&t>=0,n=r?rt(t,{min:0,max:1e6,fallback:0}):null,o=rt(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 ca({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 da(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)}function fe({className:e}){return c.jsx("div",{className:L("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function ua({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(Mt(!1),"!group-hover:bg-transparent"),children:c.jsx(fe,{className:"h-4 w-6"})}),c.jsx("td",{className:L(It(!1),"!group-hover:bg-transparent"),children:c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(fe,{className:"h-8 w-8 min-w-8 rounded-full"}),c.jsx(fe,{className:L("h-4",t)})]})}),c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(fe,{className:L("h-4",r)})}),c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(fe,{className:"h-4 w-12"})}),ft.map(o=>c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(fe,{className:L("h-4",n)})},o.key))]})}function fa({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(xr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(fe,{className:"h-3.5 w-6"})}),c.jsx("th",{className:L(vr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(fe,{className:"h-3.5 w-12"})}),c.jsx("th",{className:"px-4 py-4",children:c.jsx(fe,{className:"h-3.5 w-10"})}),c.jsx("th",{className:"px-4 py-4",children:c.jsx(fe,{className:"h-3.5 w-14"})}),ft.map(t=>c.jsx("th",{className:"px-4 py-4",children:c.jsx(fe,{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(ua,{index:r},r))})]})})}function ga({id:e,thClassName:t,children:r}){const{attributes:n,listeners:o,setNodeRef:a,transform:i,transition:l,isDragging:d}=ra({id:e}),u=et.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 Wr="tokentracker.leaderboard.columnOrder.v1";function ha(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Wr);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>typeof r=="string"):null}catch{return null}}function jt(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Wr,JSON.stringify(e))}catch{}}function fr(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 ba(e){const t=s.useMemo(()=>e.join("|"),[e]),[r,n]=s.useState(()=>fr(ha(),e));s.useEffect(()=>{n(i=>{const l=fr(i,e);return l.length===i.length&&l.every((u,g)=>u===i[g])?i:(jt(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),jt(f),f})},[]),a=s.useCallback(()=>{jt(e),n(e)},[e]);return{order:r,reorder:o,reset:a}}function pa(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 Xr(e){return typeof e=="string"?e.trim():""}function ma(e){const t=Xr(e);return t?t.toLowerCase()==="anonymous":!0}function xa({me:e,totalEntries:t,meLabel:r,onJumpToMe:n,canJump:o}){const a=e&&typeof e.rank=="number"?e.rank:null;if(!a)return null;const i=Number(t)||0,l=pa(a,i),d=Xr(e?.display_name),u=!d||ma(d)?r||"You":d,g=e?.user_id||u,f=!!o&&typeof n=="function",p=f?"button":"div",b=f?{type:"button",onClick:n,"aria-label":w("leaderboard.summary.jump_to_me")}:{};return c.jsxs(p,{...b,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)]",f?"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]"),children:[c.jsx(_t,{size:"sm",avatarUrl:e?.avatar_url,displayName:u,seed:g}),c.jsx("span",{className:"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:u}),c.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",a.toLocaleString()]}),l!=null&&c.jsx("span",{className:L("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",l<=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:w("leaderboard.summary.percentile",{p:String(l)})}),f?c.jsx(mn,{"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 Bt=[10,20,50,100],$t=20,Kr="tokentracker:leaderboard:pageSize";function va(){if(typeof window>"u")return $t;try{const e=window.localStorage.getItem(Kr),t=Number(e);if(Bt.includes(t))return t}catch{}return $t}function gr(e){const t=Number(e);return!Number.isFinite(t)||t<=0?"-":t>=1e3?`$${Math.round(t).toLocaleString()}`:t>=10?`$${Math.round(t)}`:`$${t.toFixed(2)}`}function hr(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("px-4 py-4 whitespace-nowrap text-right tabular-nums",n,o),children:At(e?.[a.key])},a.key))}const ya={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 br({rank:e,placeholder:t}){const r=ya[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 Ft(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t==="week"||t==="month"||t==="total"?t:null}function wa(e){if(!e)return w("shared.error.prefix",{error:w("leaderboard.error.unknown")});const t=e?.message||String(e),r=String(t||"").trim()||w("leaderboard.error.unknown");return w("shared.error.prefix",{error:r})}function Hr(e){return typeof e!="string"?"":e.trim()}function ka(e){const t=Hr(e);return t?t.toLowerCase()==="anonymous":!0}function Sa(e,t=""){if(typeof e!="string")return null;const r=e.trim().toLowerCase();if(!r)return null;const n=new URLSearchParams(typeof t=="string"?t:""),o=Ft(n.get("period")),a=o?`?period=${o}`:"";return`/share/pv1-${r}${a}`}function pr(e,t){const r=typeof e?.user_id=="string"?e.user_id.trim():"";return r||`${e?.rank??""}:${t}`}function mr({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":w("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:w("leaderboard.github.tooltipAction")}),c.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[w("leaderboard.github.tooltipPrefix")," ",c.jsx(cn,{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:w("leaderboard.github.tooltipSettingsLink")}),w("leaderboard.github.tooltipSuffix")]})]})]})}function Ea({auth:e,signedIn:t,sessionSoftExpired:r}){const n=Zr(),o=Qr(),{openLoginModal:a}=en(),{signedIn:i,loading:l,user:d}=tn(),u=s.useMemo(()=>rn(),[]),g=nn(),f=t&&!r,p=s.useMemo(()=>f&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,f]),b=f?p:null,D=f&&on(b),m=w("shared.placeholder.short"),x=s.useMemo(()=>ft.map(h=>h.key),[]),{order:k,reorder:N}=ba(x),v=s.useMemo(()=>{const h=new Map;for(const M of ft)h.set(M.key,M);return h},[]),C=s.useMemo(()=>k.map(h=>v.get(h)).filter(Boolean),[k,v]),E=In(Qt(Vt,{activationConstraint:{distance:6}}),Qt(Ht,{coordinateGetter:aa})),j=s.useCallback(h=>{const{active:M,over:P}=h;!P||M.id===P.id||N(String(M.id),String(P.id))},[N]),[S,y]=s.useState(1),[I,O]=s.useState(va),_=s.useCallback(h=>{const M=Bt.includes(h)?h:$t;O(M),y(1);try{window.localStorage.setItem(Kr,String(M))}catch{}},[]),[J,Z]=s.useState(0),[T,ye]=s.useState(()=>({loading:!1,error:null,data:null})),[Ie,X]=s.useState(()=>an()),[je,re]=s.useState(!1),K=s.useMemo(()=>{const h=new URLSearchParams(n?.search||"");return Ft(h.get("period"))||"total"},[n?.search]),_e=n?.search||"",U=h=>{const M=Ft(h);if(!M||M===K)return;const P=new URLSearchParams(n?.search||"");P.set("period",M),y(1),o(`${n?.pathname||"/leaderboard"}?${P.toString()}`,{replace:!0})};s.useEffect(()=>{l||g||i||a()},[i,l,g,a]),s.useEffect(()=>{y(1)},[K]);const ne=s.useMemo(()=>(rt(S,{min:1,max:1e6,fallback:1})-1)*I,[S,I]);s.useEffect(()=>{if(!u&&!g)return;let h=!0;return ye(M=>({...M,loading:!0,error:null})),(async()=>{const M=await sn({userId:d?.id||null,period:K,limit:I,offset:ne});h&&ye({loading:!1,error:null,data:M})})().catch(M=>{h&&ye({loading:!1,error:wa(M),data:null})}),()=>{h=!1}},[u,d?.id,ne,J,g,K,I]);const B=T.data,he=B?.total_pages??null,G=B?.total_entries??0,ce=B?.page??S,be=s.useMemo(()=>sa(ce,he),[ce,he]),oe=B?.from||null,A=B?.to||null,Ne=B?.generated_at||null,Y=B?.me||null,de=w("leaderboard.me_label"),ue=w("leaderboard.anon_label"),we=w("leaderboard.period.week"),ke=w("leaderboard.period.month"),Fe=w("leaderboard.period.total"),Ue=K==="month"?ke:K==="total"?Fe:we,Ae=s.useMemo(()=>{const h=Array.isArray(B?.entries)?B.entries:[];return ca({entries:h,me:Y,meLabel:de})},[B?.entries,Y,de]),H=s.useMemo(()=>da(Y?.rank,I),[Y?.rank,I]),Te=H!=null&&H===ce,Le=s.useCallback(()=>{H!=null&&y(H)},[H]),it=async()=>{re(!0);try{dn(!0),X(!0),await un(()=>Jt(b));const h=await Jt(b);h&&await fn({accessToken:h,period:K,source:"leaderboard-enable-sync"}),Z(M=>M+1)}catch(h){console.warn("[tokentracker] sync:",h)}finally{re(!1)}},{canPrev:Ye,canNext:st}=la({page:ce,totalPages:he}),wt=Array.isArray(Ae)&&Ae.length!==0;let ae=null;T.loading?ae=c.jsx(fa,{rows:I}):T.error?ae=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:T.error})}):wt?ae=c.jsx(Lo,{sensors:E,collisionDetection:Tn,modifiers:[Yo],onDragEnd:j,children: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(xr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:w("leaderboard.column.rank")}),c.jsx("th",{className:L(vr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:w("leaderboard.column.user")}),c.jsx("th",{className:"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:w("leaderboard.column.total")}),c.jsx("th",{className:"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:w("leaderboard.column.est_cost")}),c.jsx(Vo,{items:k,strategy:Ho,children:C.map(h=>c.jsx(ga,{id:h.key,thClassName:"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(hn,{iconSrc:h.icon,label:w(h.copyKey)})},h.key))})]})}),c.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Ae.map((h,M)=>{if(h?.is_ellipsis){const Me=4+C.length;return c.jsx("tr",{"aria-hidden":"true",children:c.jsx("td",{colSpan:Me,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-${M}`)}const P=!!h?.is_me,We=typeof h?.user_id=="string"?h.user_id:null,lt=Hr(h?.display_name),kt=ka(lt)?ue:lt,ie=P?de:kt;if(!!We&&!P&&!!h?.is_public&&Sa(We,_e),P){const Me=!!h?.is_pinned;return c.jsxs("tr",{className:L("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",Me?"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"),children:[c.jsx("td",{className:L(Mt(!0),"relative font-semibold text-oai-brand-600 dark:text-oai-brand-400",Me&&"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(br,{rank:h?.rank,placeholder:m})}),c.jsx("td",{className:It(!0),children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(_t,{avatarUrl:h?.avatar_url,displayName:ie,seed:pr(h,ie)}),c.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:ie}),h?.github_url&&c.jsx(mr,{githubUrl:h.github_url})]})}),c.jsx("td",{className:"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:At(h?.total_tokens)}),c.jsx("td",{className:"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:gr(h?.estimated_cost_usd)}),hr(h,!0,C)]},`row-${h?.rank}-${ie}${Me?"-pin":""}`)}return c.jsxs("tr",{className:"group transition-colors",children:[c.jsx("td",{className:L(Mt(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(br,{rank:h?.rank,placeholder:m})}),c.jsx("td",{className:It(!1),children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(_t,{avatarUrl:h?.avatar_url,displayName:ie,seed:pr(h,ie)}),c.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:ie}),h?.github_url&&c.jsx(mr,{githubUrl:h.github_url})]})}),c.jsx("td",{className:"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:At(h?.total_tokens)}),c.jsx("td",{className:"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:gr(h?.estimated_cost_usd)}),hr(h,!1,C)]},`row-${h?.rank}-${ie}`)})})]})})}):ae=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:w("leaderboard.empty")})});let pe=null;return typeof he=="number"?pe=be.map((h,M)=>h==null?c.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:w("leaderboard.pagination.ellipsis")},`ellipsis-${M}`):c.jsx("button",{className:L("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",h===ce?"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:()=>y(h),disabled:T.loading,children:String(h)},`page-${h}`)):pe=c.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:w("leaderboard.pagination.page_unknown",{page:String(ce)})}),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:"flex flex-col md:flex-row md:items-end justify-between gap-6 mb-8",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:w("leaderboard.title")}),c.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[K==="total"?w("leaderboard.range.total"):oe&&A?w("leaderboard.range",{period:Ue,from:oe,to:A}):w("leaderboard.range_loading",{period:Ue}),Ne&&c.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:w("leaderboard.generated_at",{ts:Ne})})]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx(xa,{me:Y,totalEntries:G,meLabel:de,onJumpToMe:Le,canJump:H!=null&&!Te&&!T.loading}),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 M=K===h;return c.jsxs("button",{onClick:()=>U(h),disabled:T.loading,className:L("px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",M?"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"?ke:Fe}),M&&c.jsx(ln.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)})})]})]}),!t&&c.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[c.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:w("leaderboard.signin_prompt")}),c.jsx("button",{onClick:a,className:"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:w("leaderboard.signin_button")})]}),f&&D&&!Ie&&c.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[c.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:w("leaderboard.sync_prompt")}),c.jsx("button",{onClick:it,disabled:je,className:"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:je?w("leaderboard.sync_button.busy"):w("leaderboard.sync_button.idle")})]}),c.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[ae,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:w("leaderboard.pagination.page_size_label")}),c.jsxs("div",{className:"relative",children:[c.jsx("select",{id:"leaderboard-page-size",value:I,onChange:h=>_(Number(h.target.value)),disabled:T.loading,className:"appearance-none pl-3 pr-8 py-1 rounded-md bg-white dark:bg-oai-gray-950 border border-oai-gray-300 dark:border-oai-gray-700 text-oai-gray-700 dark:text-oai-gray-300 hover:border-oai-gray-400 dark:hover:border-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500 disabled:opacity-50 transition-colors",children:Bt.map(h=>c.jsx("option",{value:h,children:h},h))}),c.jsx(bn,{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:2,"aria-hidden":"true"})]})]}),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",Ye&&!T.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:()=>y(h=>Math.max(1,h-1)),disabled:!Ye||T.loading,children:w("leaderboard.pagination.prev")}),c.jsx("div",{className:"flex flex-wrap items-center gap-1",children:pe}),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",st&&!T.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:()=>y(h=>h+1),disabled:!st||T.loading,children:w("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:w("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:w("landing.v2.nav.github")})]})})]})}export{Ea as LeaderboardPage};
@@ -1 +1 @@
1
- import{r as n,D as e,a8 as D,C as K,aa as W,h as Y,j as Z,ae as G,ag as q,B as a,a5 as L,a3 as B,L as E,a6 as F}from"./main-Bvv7-8LC.js";import{H as J}from"./HeaderGithubStar-jb65AnnV.js";import{b as I,d as Q,l as V,f as X,e as ee,L as re,g as ae}from"./leaderboard-columns-BejzbNvX.js";const y=18;function O(){return e.jsxs("svg",{"aria-hidden":!0,width:y,height:y,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2v2"}),e.jsx("path",{d:"M12 20v2"}),e.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),e.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),e.jsx("path",{d:"M2 12h2"}),e.jsx("path",{d:"M20 12h2"}),e.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),e.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function P(){return e.jsx("svg",{"aria-hidden":!0,width:y,height:y,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function te(){return e.jsxs("svg",{"aria-hidden":!0,width:y,height:y,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8"}),e.jsx("path",{d:"M12 17v4"})]})}const oe=[{value:"light",label:"Light",Icon:O},{value:"dark",label:"Dark",Icon:P},{value:"system",label:"System",Icon:te}];function se(r){return r==="dark"?P:O}function ne({theme:r,resolvedTheme:s,onSetTheme:p,className:d="",direction:b="down",align:T="right"}){const[c,k]=n.useState(!1),h=n.useRef(null),x=n.useCallback(()=>k(!1),[]);n.useEffect(()=>{if(!c)return;const t=l=>{h.current&&!h.current.contains(l.target)&&x()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[c,x]),n.useEffect(()=>{if(!c)return;const t=l=>{l.key==="Escape"&&x()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[c,x]);const i=se(s);return e.jsxs("div",{ref:h,className:`relative ${d}`,children:[e.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":c,onClick:()=>k(t=>!t),className:"flex items-center justify-center w-9 h-9 rounded-lg 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",children:e.jsx(i,{})}),c&&e.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${b==="up"?"bottom-full mb-1":"top-full mt-1"} ${T==="left"?"left-0":"right-0"}`,children:oe.map(({value:t,label:l,Icon:j})=>{const m=r===t;return e.jsxs("button",{type:"button",onClick:()=>{p(t),x()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${m?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[e.jsx(j,{}),e.jsx("span",{children:l})]},t)})})]})}function ie(r){if(!r)return a("shared.error.prefix",{error:a("leaderboard.error.unknown")});const s=r?.message||String(r),p=String(s||"").trim()||a("leaderboard.error.unknown");return a("shared.error.prefix",{error:p})}function le(r){return typeof r!="string"?"":r.trim()}function de(r){if(typeof r!="string")return null;const s=r.trim().toLowerCase();return s==="week"||s==="month"||s==="total"?s:null}function he({auth:r,signedIn:s,sessionSoftExpired:p,userId:d}){const b=D(),{theme:T,resolvedTheme:c,setTheme:k}=K(),h=n.useMemo(()=>W(),[]),x=Y(),i=s&&!p,t=n.useMemo(()=>i&&(typeof r=="function"||typeof r=="string"||r&&typeof r=="object")?r:null,[r,i]),l=i?t:null,j=i&&Z(l),m=n.useMemo(()=>{const o=new URLSearchParams(b?.search||"");return de(o.get("period"))||"week"},[b?.search]),_=b?.search||"",[v,w]=n.useState(()=>({loading:!1,error:null,data:null}));n.useEffect(()=>{if(!h&&!x||!d||i&&!j)return;let o=!0;return w(f=>({...f,loading:!0,error:null})),(async()=>{const f=i?await G(l):null;if(!o)return;const $=await q({accessToken:f,userId:d,period:m});o&&w({loading:!1,error:null,data:$})})().catch(f=>{if(o){if(f?.status===404){w({loading:!1,error:null,data:null});return}w({loading:!1,error:ie(f),data:null})}}),()=>{o=!1}},[i,j,h,l,x,m,d]);const N=v.data,C=N?.from||null,M=N?.to||null,A=N?.generated_at||null,g=N?.entry||null,S=le(g?.display_name)||a("leaderboard.anon_label"),z=a("leaderboard.period.week"),H=a("leaderboard.period.month"),U=a("leaderboard.period.total"),R=m==="month"?H:m==="total"?U:z;let u=null;return d?v.loading?u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.loading")})}):v.error?u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):g?u=e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:L(re,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:a("leaderboard.column.rank")}),e.jsx("th",{className:L(ae,"font-medium text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap"),children:a("leaderboard.column.total")}),I.map(o=>e.jsx("th",{className:"px-4 py-4 font-medium text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap",children:e.jsx(Q,{iconSrc:o.icon,label:a(o.copyKey)})},o.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:e.jsxs("tr",{className:"transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60",children:[e.jsx("td",{className:L(V(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:g?.rank??a("shared.placeholder.short")}),e.jsx("td",{className:L(X(),"text-oai-gray-700 dark:text-oai-gray-300"),children:B(g?.total_tokens)}),I.map(o=>e.jsx("td",{className:"px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap",children:B(g?.[o.key])},o.key))]})})]})}):u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.empty")})}):u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.empty")})}),e.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[e.jsx("header",{className:"sticky top-0 z-50 bg-white/80 dark:bg-oai-gray-950/80 backdrop-blur-md border-b border-oai-gray-200 dark:border-oai-gray-900 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex h-14 max-w-6xl items-center justify-between px-4 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsxs(E,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:ring-offset-oai-gray-950 transition-opacity hover:opacity-80",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),e.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),e.jsx("div",{className:"hidden sm:block",children:e.jsx(J,{})})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx(E,{to:`/leaderboard${_}`,className:"no-underline inline-flex items-center justify-center h-9 px-5 text-sm font-medium rounded-full shadow-sm ring-1 ring-oai-gray-200 dark:ring-white/10 bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-900 hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors",children:a("leaderboard.profile.nav.back")}),e.jsx(ne,{theme:T,resolvedTheme:c,onSetTheme:k}),e.jsx(F,{})]})]})}),e.jsx("main",{className:"flex-1 py-12 sm:py-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-6 mb-10",children:[e.jsx(ee,{avatarUrl:g?.avatar_url,displayName:S,seed:typeof d=="string"?d:S,size:"lg",className:"shrink-0 ring-2 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:S}),e.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[m==="total"?a("leaderboard.range.total"):C&&M?a("leaderboard.range",{period:R,from:C,to:M}):a("leaderboard.range_loading",{period:R}),A&&e.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:a("leaderboard.generated_at",{ts:A})})]})]})]}),e.jsx("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:u})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.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:[e.jsx("p",{children:a("landing.v2.footer.line")}),e.jsx(E,{to:`/leaderboard${_}`,className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:a("leaderboard.profile.nav.back")})]})})]})}export{he as LeaderboardProfilePage};
1
+ import{r as n,D as e,a8 as D,C as K,aa as W,h as Y,j as Z,ae as G,ag as q,B as a,a5 as L,a3 as B,L as E,a6 as F}from"./main-DKVBnAOd.js";import{H as J}from"./HeaderGithubStar-D2BjLT1b.js";import{b as I,e as Q,l as V,f as X,d as ee,L as re,g as ae}from"./leaderboard-columns-BZ06dD2h.js";const y=18;function O(){return e.jsxs("svg",{"aria-hidden":!0,width:y,height:y,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2v2"}),e.jsx("path",{d:"M12 20v2"}),e.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),e.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),e.jsx("path",{d:"M2 12h2"}),e.jsx("path",{d:"M20 12h2"}),e.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),e.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function P(){return e.jsx("svg",{"aria-hidden":!0,width:y,height:y,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function te(){return e.jsxs("svg",{"aria-hidden":!0,width:y,height:y,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8"}),e.jsx("path",{d:"M12 17v4"})]})}const oe=[{value:"light",label:"Light",Icon:O},{value:"dark",label:"Dark",Icon:P},{value:"system",label:"System",Icon:te}];function se(r){return r==="dark"?P:O}function ne({theme:r,resolvedTheme:s,onSetTheme:p,className:d="",direction:b="down",align:T="right"}){const[c,k]=n.useState(!1),h=n.useRef(null),x=n.useCallback(()=>k(!1),[]);n.useEffect(()=>{if(!c)return;const t=l=>{h.current&&!h.current.contains(l.target)&&x()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[c,x]),n.useEffect(()=>{if(!c)return;const t=l=>{l.key==="Escape"&&x()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[c,x]);const i=se(s);return e.jsxs("div",{ref:h,className:`relative ${d}`,children:[e.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":c,onClick:()=>k(t=>!t),className:"flex items-center justify-center w-9 h-9 rounded-lg 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",children:e.jsx(i,{})}),c&&e.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${b==="up"?"bottom-full mb-1":"top-full mt-1"} ${T==="left"?"left-0":"right-0"}`,children:oe.map(({value:t,label:l,Icon:j})=>{const m=r===t;return e.jsxs("button",{type:"button",onClick:()=>{p(t),x()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${m?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[e.jsx(j,{}),e.jsx("span",{children:l})]},t)})})]})}function ie(r){if(!r)return a("shared.error.prefix",{error:a("leaderboard.error.unknown")});const s=r?.message||String(r),p=String(s||"").trim()||a("leaderboard.error.unknown");return a("shared.error.prefix",{error:p})}function le(r){return typeof r!="string"?"":r.trim()}function de(r){if(typeof r!="string")return null;const s=r.trim().toLowerCase();return s==="week"||s==="month"||s==="total"?s:null}function he({auth:r,signedIn:s,sessionSoftExpired:p,userId:d}){const b=D(),{theme:T,resolvedTheme:c,setTheme:k}=K(),h=n.useMemo(()=>W(),[]),x=Y(),i=s&&!p,t=n.useMemo(()=>i&&(typeof r=="function"||typeof r=="string"||r&&typeof r=="object")?r:null,[r,i]),l=i?t:null,j=i&&Z(l),m=n.useMemo(()=>{const o=new URLSearchParams(b?.search||"");return de(o.get("period"))||"week"},[b?.search]),_=b?.search||"",[v,w]=n.useState(()=>({loading:!1,error:null,data:null}));n.useEffect(()=>{if(!h&&!x||!d||i&&!j)return;let o=!0;return w(f=>({...f,loading:!0,error:null})),(async()=>{const f=i?await G(l):null;if(!o)return;const $=await q({accessToken:f,userId:d,period:m});o&&w({loading:!1,error:null,data:$})})().catch(f=>{if(o){if(f?.status===404){w({loading:!1,error:null,data:null});return}w({loading:!1,error:ie(f),data:null})}}),()=>{o=!1}},[i,j,h,l,x,m,d]);const N=v.data,C=N?.from||null,M=N?.to||null,A=N?.generated_at||null,g=N?.entry||null,S=le(g?.display_name)||a("leaderboard.anon_label"),z=a("leaderboard.period.week"),H=a("leaderboard.period.month"),U=a("leaderboard.period.total"),R=m==="month"?H:m==="total"?U:z;let u=null;return d?v.loading?u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.loading")})}):v.error?u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):g?u=e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:L(re,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:a("leaderboard.column.rank")}),e.jsx("th",{className:L(ae,"font-medium text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap"),children:a("leaderboard.column.total")}),I.map(o=>e.jsx("th",{className:"px-4 py-4 font-medium text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap",children:e.jsx(Q,{iconSrc:o.icon,label:a(o.copyKey)})},o.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:e.jsxs("tr",{className:"transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60",children:[e.jsx("td",{className:L(V(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:g?.rank??a("shared.placeholder.short")}),e.jsx("td",{className:L(X(),"text-oai-gray-700 dark:text-oai-gray-300"),children:B(g?.total_tokens)}),I.map(o=>e.jsx("td",{className:"px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap",children:B(g?.[o.key])},o.key))]})})]})}):u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.empty")})}):u=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("leaderboard.empty")})}),e.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[e.jsx("header",{className:"sticky top-0 z-50 bg-white/80 dark:bg-oai-gray-950/80 backdrop-blur-md border-b border-oai-gray-200 dark:border-oai-gray-900 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex h-14 max-w-6xl items-center justify-between px-4 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsxs(E,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:ring-offset-oai-gray-950 transition-opacity hover:opacity-80",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),e.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),e.jsx("div",{className:"hidden sm:block",children:e.jsx(J,{})})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx(E,{to:`/leaderboard${_}`,className:"no-underline inline-flex items-center justify-center h-9 px-5 text-sm font-medium rounded-full shadow-sm ring-1 ring-oai-gray-200 dark:ring-white/10 bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-900 hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors",children:a("leaderboard.profile.nav.back")}),e.jsx(ne,{theme:T,resolvedTheme:c,onSetTheme:k}),e.jsx(F,{})]})]})}),e.jsx("main",{className:"flex-1 py-12 sm:py-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-6 mb-10",children:[e.jsx(ee,{avatarUrl:g?.avatar_url,displayName:S,seed:typeof d=="string"?d:S,size:"lg",className:"shrink-0 ring-2 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:S}),e.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[m==="total"?a("leaderboard.range.total"):C&&M?a("leaderboard.range",{period:R,from:C,to:M}):a("leaderboard.range_loading",{period:R}),A&&e.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:a("leaderboard.generated_at",{ts:A})})]})]})]}),e.jsx("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:u})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.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:[e.jsx("p",{children:a("landing.v2.footer.line")}),e.jsx(E,{to:`/leaderboard${_}`,className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:a("leaderboard.profile.nav.back")})]})})]})}export{he as LeaderboardProfilePage};
@@ -1,2 +1,2 @@
1
- import{D as r,a5 as g,B as n,r as j,L as v,ai as k}from"./main-Bvv7-8LC.js";import{u as N}from"./use-usage-limits-CeShSkoj.js";import{u as L}from"./use-limits-display-prefs-qSJ1Ys0_.js";import{C as h}from"./Card-Dqh7NgC7.js";import{F as E}from"./FadeIn-Ba4HDg1-.js";import"./use-reduced-motion-DOaOYeS3.js";const P=[3,2,3,3,2,2,3];function m({className:s}){return r.jsx("div",{className:g("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",s)})}function C(){return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(m,{className:"h-3 w-12 shrink-0"}),r.jsx(m,{className:"flex-1 h-1.5 rounded-full min-w-0"}),r.jsx(m,{className:"h-3 w-[30px] shrink-0"}),r.jsx(m,{className:"h-3 w-6 shrink-0"})]})}function O({bars:s,index:e}){const i=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(m,{className:"h-[14px] w-[14px] rounded shrink-0"}),r.jsx(m,{className:g("h-4",i)})]}),Array.from({length:s},(l,a)=>r.jsx(C,{},a))]})}function T(){return r.jsx(h,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(m,{className:"h-3.5 w-28"}),P.map((s,e)=>r.jsx(O,{bars:s,index:e},e))]})})}function t(s){if(!s)return null;const e=typeof s=="number"?s*1e3:Date.parse(s);if(!Number.isFinite(e))return null;const i=e-Date.now();if(i<=0)return n("shared.time.now");const l=Math.floor(i/6e4);if(l<60)return`${l}m`;const a=Math.floor(l/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function R(s){return s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500"}function o({label:s,pct:e,reset:i}){const l=Math.max(0,Math.min(100,Number(e)||0)),a=Math.round(l),u=l>0&&a===0?Math.max(l,.35):l,x=l>0&&a===0?"<1":String(a);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:s}),r.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:r.jsx("div",{className:`${R(a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:l>0?"3px":0}})}),r.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-[30px] text-right shrink-0",children:[x,"%"]}),i?r.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i}):null]})}function d({name:s,icon:e,children:i}){const a=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[e?r.jsx("img",{src:e,alt:"",className:a}):null,r.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:s})]}),i]})}const D=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],I={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:s,tone:e="neutral"}){const i=e==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return r.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:s})}function S(s,e){const i=I[s];if(!i)return null;if(!e?.configured)return r.jsx(d,{name:i.name,icon:i.icon,children:r.jsx(c,{children:n("limits.status.not_connected")})},s);if(e.error)return r.jsx(d,{name:i.name,icon:i.icon,children:r.jsx(c,{tone:"error",children:n("shared.error.prefix",{error:e.error})})},s);switch(s){case"claude":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.five_hour?r.jsx(o,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?r.jsx(o,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?r.jsx(o,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?r.jsx(c,{children:n("limits.status.no_data")}):null]},"claude");case"codex":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"codex");case"cursor":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:n("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"cursor");case"gemini":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"gemini");case"kimi":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:n("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,e.parallel_limit?r.jsx(c,{children:n("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"kimi");case"kiro":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"kiro");case"antigravity":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"antigravity");case"copilot":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:r.jsx(A,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function A({defaultDir:s}){const[e,i]=j.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${s||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
1
+ import{D as r,a5 as g,B as n,r as j,L as v,ai as k}from"./main-DKVBnAOd.js";import{u as N}from"./use-usage-limits-CAWz6ijv.js";import{u as L}from"./use-limits-display-prefs-Bx-K-27B.js";import{C as h}from"./Card-Cv4wn6W8.js";import{F as E}from"./FadeIn-DjQyRfLZ.js";import"./use-reduced-motion-Cen-UCKO.js";const P=[3,2,3,3,2,2,3];function m({className:s}){return r.jsx("div",{className:g("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",s)})}function C(){return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(m,{className:"h-3 w-12 shrink-0"}),r.jsx(m,{className:"flex-1 h-1.5 rounded-full min-w-0"}),r.jsx(m,{className:"h-3 w-[30px] shrink-0"}),r.jsx(m,{className:"h-3 w-6 shrink-0"})]})}function O({bars:s,index:e}){const i=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(m,{className:"h-[14px] w-[14px] rounded shrink-0"}),r.jsx(m,{className:g("h-4",i)})]}),Array.from({length:s},(l,a)=>r.jsx(C,{},a))]})}function T(){return r.jsx(h,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(m,{className:"h-3.5 w-28"}),P.map((s,e)=>r.jsx(O,{bars:s,index:e},e))]})})}function t(s){if(!s)return null;const e=typeof s=="number"?s*1e3:Date.parse(s);if(!Number.isFinite(e))return null;const i=e-Date.now();if(i<=0)return n("shared.time.now");const l=Math.floor(i/6e4);if(l<60)return`${l}m`;const a=Math.floor(l/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function R(s){return s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500"}function o({label:s,pct:e,reset:i}){const l=Math.max(0,Math.min(100,Number(e)||0)),a=Math.round(l),u=l>0&&a===0?Math.max(l,.35):l,x=l>0&&a===0?"<1":String(a);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:s}),r.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:r.jsx("div",{className:`${R(a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:l>0?"3px":0}})}),r.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-[30px] text-right shrink-0",children:[x,"%"]}),i?r.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i}):null]})}function d({name:s,icon:e,children:i}){const a=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[e?r.jsx("img",{src:e,alt:"",className:a}):null,r.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:s})]}),i]})}const D=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],I={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:s,tone:e="neutral"}){const i=e==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return r.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:s})}function S(s,e){const i=I[s];if(!i)return null;if(!e?.configured)return r.jsx(d,{name:i.name,icon:i.icon,children:r.jsx(c,{children:n("limits.status.not_connected")})},s);if(e.error)return r.jsx(d,{name:i.name,icon:i.icon,children:r.jsx(c,{tone:"error",children:n("shared.error.prefix",{error:e.error})})},s);switch(s){case"claude":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.five_hour?r.jsx(o,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?r.jsx(o,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?r.jsx(o,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?r.jsx(c,{children:n("limits.status.no_data")}):null]},"claude");case"codex":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"codex");case"cursor":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:n("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"cursor");case"gemini":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"gemini");case"kimi":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:n("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,e.parallel_limit?r.jsx(c,{children:n("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"kimi");case"kiro":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"kiro");case"antigravity":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"antigravity");case"copilot":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:r.jsx(A,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function A({defaultDir:s}){const[e,i]=j.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${s||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
2
2
  `),u=async()=>{try{await navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return r.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:[r.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n("limits.copilot.otelHint.title")}),r.jsx("div",{className:"mt-0.5 leading-snug",children:n("limits.copilot.otelHint.body")}),r.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:a}),r.jsx("button",{type:"button",onClick:u,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:e?n("limits.copilot.otelHint.copied"):n("limits.copilot.otelHint.copy")})]})}function M({claude:s,codex:e,cursor:i,gemini:l,kimi:a,kiro:u,antigravity:x,copilot:b,order:w,visibility:_}){const f={claude:s,codex:e,cursor:i,gemini:l,kimi:a,kiro:u,antigravity:x,copilot:b},y=(Array.isArray(w)&&w.length>0?w:D).filter(p=>!_||_[p]!==!1).map(p=>S(p,f[p])).filter(Boolean);return r.jsx(E,{delay:.15,children:r.jsx(h,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:n("limits.panel.title")}),y.length>0?y:r.jsx(c,{children:n("limits.status.all_hidden")})]})})})}function V(){const{data:s,error:e,isLoading:i}=N({initialRefresh:!0}),l=L();return r.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:r.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:r.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[r.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.limits")}),r.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("limits.page.subtitle")})]}),r.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:r.jsx(k,{className:"h-4 w-4","aria-hidden":!0})})]}),i?r.jsx(T,{}):r.jsxs(r.Fragment,{children:[e?r.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:n("shared.error.prefix",{error:e})}):null,r.jsx(M,{claude:s?.claude,codex:s?.codex,cursor:s?.cursor,gemini:s?.gemini,kimi:s?.kimi,kiro:s?.kiro,antigravity:s?.antigravity,copilot:s?.copilot,order:l.order,visibility:l.visibility})]})]})})})}export{V as LimitsPage};
@@ -1 +1 @@
1
- import{a9 as Y,ak as Z,Q as ee,r,B as s,D as e,L as G,a5 as v}from"./main-Bvv7-8LC.js";function te(n){const a=new URLSearchParams(n).get("next");return typeof a!="string"||a.length===0||!a.startsWith("/")||a.startsWith("//")?"/dashboard":a}const Q={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",linkedin:"LinkedIn",facebook:"Facebook",instagram:"Instagram",tiktok:"TikTok",apple:"Apple",x:"X",spotify:"Spotify"};function V(n){const a=String(n||"").trim();return Q[a]?Q[a]:a.replace(/-/g," ")}function ie(){const n=Y(),[a,A]=Z(),{enabled:o,loading:g,signedIn:f,refreshUser:C,signInWithPassword:E,signUp:M,signInWithOAuth:I,getPublicAuthConfig:F}=ee(),m=r.useMemo(()=>te(a.toString()),[a]),[l,j]=r.useState("signin"),[x,$]=r.useState(""),[h,H]=r.useState(""),[N,X]=r.useState(""),[k,p]=r.useState(!1),[O,c]=r.useState(null),[B,b]=r.useState(null),[S,U]=r.useState(!0),[_,R]=r.useState([]),[P,T]=r.useState([]),[W,z]=r.useState(8);r.useEffect(()=>{const t=a.get("insforge_status"),i=a.get("insforge_type"),u=a.get("insforge_error");t==="success"&&i==="verify_email"?b(s("login.verify_email_success")):t==="error"&&i==="verify_email"&&u&&b(s("shared.error.prefix",{error:u}))},[a]),r.useEffect(()=>{if(!o){U(!1);return}let t=!0;return(async()=>{const{data:i,error:u}=await F();t&&(u||!i?(R(["google","github"]),T([])):(R(Array.isArray(i.oAuthProviders)?i.oAuthProviders:[]),T(Array.isArray(i.customOAuthProviders)?i.customOAuthProviders:[]),typeof i.passwordMinLength=="number"&&i.passwordMinLength>0&&z(i.passwordMinLength)),U(!1))})(),()=>{t=!1}},[o,F]);const d=r.useMemo(()=>a.get("native")==="1",[a]),y=r.useMemo(()=>a.get("provider")||null,[a]);r.useEffect(()=>{if(!(!o||g)&&f){if(d){window.location.href="/auth/native-callback";return}n(m,{replace:!0})}},[o,g,f,n,m,d]),r.useEffect(()=>{o&&C()},[o,C]);const q=r.useMemo(()=>typeof window>"u"||d?"":`${window.location.origin}/`,[d]),D=r.useMemo(()=>typeof window>"u"?"":`${window.location.origin}/`,[]),J=r.useCallback(async t=>{t.preventDefault(),c(null),p(!0);try{if(l==="signup"){const{data:u,error:L}=await M({email:x.trim(),password:h,name:N.trim()||void 0,redirectTo:D});if(L){c(L.message||String(L));return}if(u?.requireEmailVerification){b(s("login.verify_email_pending")),j("signin");return}n(m,{replace:!0});return}const{error:i}=await E({email:x.trim(),password:h});if(i){c(i.message||String(i));return}n(m,{replace:!0})}finally{p(!1)}},[l,x,h,N,M,E,n,m,D]),w=r.useCallback(async t=>{c(null),p(!0);try{const{error:i}=await I(t,q);i&&c(i.message||String(i))}finally{p(!1)}},[I,q]);r.useEffect(()=>{if(d&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[d]),r.useEffect(()=>{if(!o||g||f||S||!d||!y)return;[..._,...P].includes(y)&&w(y)},[o,g,f,S,d,y,_,P,w]);const K=r.useCallback(()=>{A(t=>{const i=new URLSearchParams(t);return i.delete("insforge_status"),i.delete("insforge_type"),i.delete("insforge_error"),i},{replace:!0}),b(null)},[A]);return o?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(G,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold text-white tracking-tight",children:s("login.title")}),e.jsx("p",{className:"mt-2 text-sm text-oai-gray-500",children:s("login.subtitle")})]}),B?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:B}),e.jsx("button",{type:"button",onClick:K,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,O?e.jsx("p",{className:"text-sm text-red-400",role:"alert",children:s("shared.error.prefix",{error:O})}):null,e.jsx("div",{className:"space-y-3",children:S?e.jsx("div",{className:"h-11 rounded-lg bg-oai-gray-900 animate-pulse","aria-hidden":!0}):e.jsxs(e.Fragment,{children:[_.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>w(t),className:v("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t)),P.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>w(t),className:v("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t))]})}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center","aria-hidden":!0,children:e.jsx("span",{className:"w-full border-t border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-oai-gray-950 px-3 text-oai-gray-600",children:s("login.divider")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-800 p-0.5 bg-oai-gray-900/50",children:[e.jsx("button",{type:"button",className:v("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signin"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signin"),c(null)},children:s("login.tab.sign_in")}),e.jsx("button",{type:"button",className:v("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signup"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signup"),c(null)},children:s("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:J,className:"space-y-4",children:[l==="signup"?e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.name")}),e.jsx("input",{id:"login-name",type:"text",autoComplete:"name",value:N,onChange:t=>X(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:s("login.field.name_placeholder")})]}):null,e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.email")}),e.jsx("input",{id:"login-email",type:"email",autoComplete:"email",required:!0,value:x,onChange:t=>$(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.password")}),e.jsx("input",{id:"login-password",type:"password",autoComplete:l==="signup"?"new-password":"current-password",required:!0,minLength:l==="signup"?W:void 0,value:h,onChange:t=>H(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),l==="signup"?e.jsx("p",{className:"mt-1 text-xs text-oai-gray-600",children:s("login.password_hint",{min:String(W)})}):null]}),e.jsx("button",{type:"submit",disabled:k||g,className:"w-full h-11 rounded-lg bg-white text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:l==="signup"?s("login.submit.sign_up"):s("login.submit.sign_in")})]})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(G,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{ie as LoginPage};
1
+ import{a9 as Y,ak as Z,Q as ee,r,B as s,D as e,L as G,a5 as v}from"./main-DKVBnAOd.js";function te(n){const a=new URLSearchParams(n).get("next");return typeof a!="string"||a.length===0||!a.startsWith("/")||a.startsWith("//")?"/dashboard":a}const Q={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",linkedin:"LinkedIn",facebook:"Facebook",instagram:"Instagram",tiktok:"TikTok",apple:"Apple",x:"X",spotify:"Spotify"};function V(n){const a=String(n||"").trim();return Q[a]?Q[a]:a.replace(/-/g," ")}function ie(){const n=Y(),[a,A]=Z(),{enabled:o,loading:g,signedIn:f,refreshUser:C,signInWithPassword:E,signUp:M,signInWithOAuth:I,getPublicAuthConfig:F}=ee(),m=r.useMemo(()=>te(a.toString()),[a]),[l,j]=r.useState("signin"),[x,$]=r.useState(""),[h,H]=r.useState(""),[N,X]=r.useState(""),[k,p]=r.useState(!1),[O,c]=r.useState(null),[B,b]=r.useState(null),[S,U]=r.useState(!0),[_,R]=r.useState([]),[P,T]=r.useState([]),[W,z]=r.useState(8);r.useEffect(()=>{const t=a.get("insforge_status"),i=a.get("insforge_type"),u=a.get("insforge_error");t==="success"&&i==="verify_email"?b(s("login.verify_email_success")):t==="error"&&i==="verify_email"&&u&&b(s("shared.error.prefix",{error:u}))},[a]),r.useEffect(()=>{if(!o){U(!1);return}let t=!0;return(async()=>{const{data:i,error:u}=await F();t&&(u||!i?(R(["google","github"]),T([])):(R(Array.isArray(i.oAuthProviders)?i.oAuthProviders:[]),T(Array.isArray(i.customOAuthProviders)?i.customOAuthProviders:[]),typeof i.passwordMinLength=="number"&&i.passwordMinLength>0&&z(i.passwordMinLength)),U(!1))})(),()=>{t=!1}},[o,F]);const d=r.useMemo(()=>a.get("native")==="1",[a]),y=r.useMemo(()=>a.get("provider")||null,[a]);r.useEffect(()=>{if(!(!o||g)&&f){if(d){window.location.href="/auth/native-callback";return}n(m,{replace:!0})}},[o,g,f,n,m,d]),r.useEffect(()=>{o&&C()},[o,C]);const q=r.useMemo(()=>typeof window>"u"||d?"":`${window.location.origin}/`,[d]),D=r.useMemo(()=>typeof window>"u"?"":`${window.location.origin}/`,[]),J=r.useCallback(async t=>{t.preventDefault(),c(null),p(!0);try{if(l==="signup"){const{data:u,error:L}=await M({email:x.trim(),password:h,name:N.trim()||void 0,redirectTo:D});if(L){c(L.message||String(L));return}if(u?.requireEmailVerification){b(s("login.verify_email_pending")),j("signin");return}n(m,{replace:!0});return}const{error:i}=await E({email:x.trim(),password:h});if(i){c(i.message||String(i));return}n(m,{replace:!0})}finally{p(!1)}},[l,x,h,N,M,E,n,m,D]),w=r.useCallback(async t=>{c(null),p(!0);try{const{error:i}=await I(t,q);i&&c(i.message||String(i))}finally{p(!1)}},[I,q]);r.useEffect(()=>{if(d&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[d]),r.useEffect(()=>{if(!o||g||f||S||!d||!y)return;[..._,...P].includes(y)&&w(y)},[o,g,f,S,d,y,_,P,w]);const K=r.useCallback(()=>{A(t=>{const i=new URLSearchParams(t);return i.delete("insforge_status"),i.delete("insforge_type"),i.delete("insforge_error"),i},{replace:!0}),b(null)},[A]);return o?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(G,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold text-white tracking-tight",children:s("login.title")}),e.jsx("p",{className:"mt-2 text-sm text-oai-gray-500",children:s("login.subtitle")})]}),B?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:B}),e.jsx("button",{type:"button",onClick:K,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,O?e.jsx("p",{className:"text-sm text-red-400",role:"alert",children:s("shared.error.prefix",{error:O})}):null,e.jsx("div",{className:"space-y-3",children:S?e.jsx("div",{className:"h-11 rounded-lg bg-oai-gray-900 animate-pulse","aria-hidden":!0}):e.jsxs(e.Fragment,{children:[_.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>w(t),className:v("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t)),P.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>w(t),className:v("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t))]})}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center","aria-hidden":!0,children:e.jsx("span",{className:"w-full border-t border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-oai-gray-950 px-3 text-oai-gray-600",children:s("login.divider")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-800 p-0.5 bg-oai-gray-900/50",children:[e.jsx("button",{type:"button",className:v("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signin"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signin"),c(null)},children:s("login.tab.sign_in")}),e.jsx("button",{type:"button",className:v("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signup"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signup"),c(null)},children:s("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:J,className:"space-y-4",children:[l==="signup"?e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.name")}),e.jsx("input",{id:"login-name",type:"text",autoComplete:"name",value:N,onChange:t=>X(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:s("login.field.name_placeholder")})]}):null,e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.email")}),e.jsx("input",{id:"login-email",type:"email",autoComplete:"email",required:!0,value:x,onChange:t=>$(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.password")}),e.jsx("input",{id:"login-password",type:"password",autoComplete:l==="signup"?"new-password":"current-password",required:!0,minLength:l==="signup"?W:void 0,value:h,onChange:t=>H(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),l==="signup"?e.jsx("p",{className:"mt-1 text-xs text-oai-gray-600",children:s("login.password_hint",{min:String(W)})}):null]}),e.jsx("button",{type:"submit",disabled:k||g,className:"w-full h-11 rounded-lg bg-white text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:l==="signup"?s("login.submit.sign_up"):s("login.submit.sign_in")})]})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(G,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{ie as LoginPage};