tokentracker-cli 0.5.87 → 0.5.88

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 (35) hide show
  1. package/README.md +10 -1
  2. package/README.zh-CN.md +3 -1
  3. package/dashboard/dist/assets/{Card-BbXzY-fw.js → Card-Cwz-PEn8.js} +1 -1
  4. package/dashboard/dist/assets/DashboardPage-qwG6gudg.js +1 -0
  5. package/dashboard/dist/assets/FadeIn-CKfrd1Vn.js +1 -0
  6. package/dashboard/dist/assets/{IpCheckPage-FulDeMPC.js → IpCheckPage-D0qJYbXD.js} +1 -1
  7. package/dashboard/dist/assets/{LeaderboardPage-BQSqJVlP.js → LeaderboardPage-Dkpcb_0Q.js} +2 -2
  8. package/dashboard/dist/assets/LeaderboardProfilePage-DHxne8i3.js +1 -0
  9. package/dashboard/dist/assets/LimitsPage-Dvo_YUik.js +2 -0
  10. package/dashboard/dist/assets/PopoverPopup-CAeHe-sn.js +12 -0
  11. package/dashboard/dist/assets/{ProviderIcon-DChRpzX_.js → ProviderIcon-Bz-JlVCc.js} +1 -1
  12. package/dashboard/dist/assets/SettingsPage-M4ONOKBT.js +1 -0
  13. package/dashboard/dist/assets/SkillsPage-QB4a2NKJ.js +1 -0
  14. package/dashboard/dist/assets/{WidgetsPage-D5guzG01.js → WidgetsPage-Dqd4z_tl.js} +1 -1
  15. package/dashboard/dist/assets/chevron-down-Bj2POypL.js +1 -0
  16. package/dashboard/dist/assets/{download-w3j__M5u.js → download-1Kz0otkw.js} +1 -1
  17. package/dashboard/dist/assets/leaderboard-columns-DRc_1zw2.js +1 -0
  18. package/dashboard/dist/assets/main-PEflgXnj.css +1 -0
  19. package/dashboard/dist/assets/{main-CJeNIc4Q.js → main-jua4nv-E.js} +236 -187
  20. package/dashboard/dist/assets/refresh-cw-Dpw9ponb.js +1 -0
  21. package/dashboard/dist/assets/{use-limits-display-prefs-BzI5WJEo.js → use-limits-display-prefs-CtpaNbnl.js} +1 -1
  22. package/dashboard/dist/assets/{use-usage-limits-CuoJnC-V.js → use-usage-limits-B0OYz2eA.js} +1 -1
  23. package/dashboard/dist/brand-logos/hermes.svg +11 -0
  24. package/dashboard/dist/index.html +2 -2
  25. package/dashboard/dist/share.html +2 -2
  26. package/package.json +1 -1
  27. package/src/lib/local-api.js +83 -0
  28. package/src/lib/skills-manager.js +739 -0
  29. package/dashboard/dist/assets/DashboardPage-B_Yvna3-.js +0 -12
  30. package/dashboard/dist/assets/FadeIn-Dz3MVtMG.js +0 -1
  31. package/dashboard/dist/assets/LeaderboardProfilePage-DP8bewz7.js +0 -1
  32. package/dashboard/dist/assets/LimitsPage-BXDoE-jU.js +0 -2
  33. package/dashboard/dist/assets/SettingsPage-XFSmA7VB.js +0 -1
  34. package/dashboard/dist/assets/leaderboard-columns-ChIW6uNZ.js +0 -1
  35. package/dashboard/dist/assets/main-Cyta3wIj.css +0 -1
@@ -1,5 +1,5 @@
1
- import{e as Jn,r as s,ad as V,S as Ge,D as d,aA as P,aB as Zn,aC as Qn,ah as er,ai as tr,aD as nr,h as rr,j as or,B as C,aE as ar,am as ir,ay as Rt,a9 as sr,aF as lr,aG as cr,aH as Gt,aI as dr}from"./main-CJeNIc4Q.js";import{P as ur}from"./ProviderIcon-DChRpzX_.js";import{L as mn,a as xn,b as ct,l as Et,c as jt,d as fr,e as Vt}from"./leaderboard-columns-ChIW6uNZ.js";const gr=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],hr=Jn("chevron-down",gr);function pr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const ht=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $e(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function zt(e){return"nodeType"in e}function q(e){var t,n;return e?$e(e)?e:zt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Bt(e){const{Document:t}=q(e);return e instanceof t}function nt(e){return $e(e)?!1:e instanceof q(e).HTMLElement}function vn(e){return e instanceof q(e).SVGElement}function Fe(e){return e?$e(e)?e.document:zt(e)?Bt(e)?e:nt(e)||vn(e)?e.ownerDocument:document:document:document}const pe=ht?s.useLayoutEffect:s.useEffect;function $t(e){const t=s.useRef(e);return pe(()=>{t.current=e}),s.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function br(){const e=s.useRef(null),t=s.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=s.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ze(e,t){t===void 0&&(t=[e]);const n=s.useRef(e);return pe(()=>{n.current!==e&&(n.current=e)},t),n}function rt(e,t){const n=s.useRef();return s.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function dt(e){const t=$t(e),n=s.useRef(null),r=s.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function At(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let kt={};function ot(e,t){return s.useMemo(()=>{if(t)return t;const n=kt[e]==null?0:kt[e]+1;return kt[e]=n,e+"-"+n},[e,t])}function yn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((a,i)=>{const l=Object.entries(i);for(const[c,u]of l){const g=a[c];g!=null&&(a[c]=g+e*u)}return a},{...t})}}const ze=yn(1),Qe=yn(-1);function mr(e){return"clientX"in e&&"clientY"in e}function Ft(e){if(!e)return!1;const{KeyboardEvent:t}=q(e.target);return t&&e instanceof t}function xr(e){if(!e)return!1;const{TouchEvent:t}=q(e.target);return t&&e instanceof t}function It(e){if(xr(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return mr(e)?{x:e.clientX,y:e.clientY}:null}const et=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[et.Translate.toString(e),et.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),qt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function vr(e){return e.matches(qt)?e:e.querySelector(qt)}const yr={display:"none"};function wr(e){let{id:t,value:n}=e;return V.createElement("div",{id:t,style:yr},n)}function kr(e){let{id:t,announcement:n,ariaLiveType:r="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":r,"aria-atomic":!0},n)}function Sr(){const[e,t]=s.useState("");return{announce:s.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const wn=s.createContext(null);function Cr(e){const t=s.useContext(wn);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Nr(){const[e]=s.useState(()=>new Set),t=s.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[s.useCallback(r=>{let{type:o,event:a}=r;e.forEach(i=>{var l;return(l=i[o])==null?void 0:l.call(i,a)})},[e]),t]}const Dr={draggable:`
1
+ import{r as s,R as V,a6 as Ge,D as d,a7 as P,a8 as Jn,a9 as Zn,N as Qn,O as er,aa as tr,h as nr,j as rr,B as C,ab as or,S as ar,a4 as Dt,L as ir,ac as sr,ad as lr,ae as Gt,af as cr}from"./main-jua4nv-E.js";import{P as dr}from"./ProviderIcon-Bz-JlVCc.js";import{L as mn,a as xn,b as ct,l as Et,c as jt,d as ur,e as Vt}from"./leaderboard-columns-DRc_1zw2.js";import{C as fr}from"./chevron-down-Bj2POypL.js";function gr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const ht=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $e(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function zt(e){return"nodeType"in e}function q(e){var t,n;return e?$e(e)?e:zt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Bt(e){const{Document:t}=q(e);return e instanceof t}function nt(e){return $e(e)?!1:e instanceof q(e).HTMLElement}function vn(e){return e instanceof q(e).SVGElement}function Fe(e){return e?$e(e)?e.document:zt(e)?Bt(e)?e:nt(e)||vn(e)?e.ownerDocument:document:document:document}const pe=ht?s.useLayoutEffect:s.useEffect;function $t(e){const t=s.useRef(e);return pe(()=>{t.current=e}),s.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function hr(){const e=s.useRef(null),t=s.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=s.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ze(e,t){t===void 0&&(t=[e]);const n=s.useRef(e);return pe(()=>{n.current!==e&&(n.current=e)},t),n}function rt(e,t){const n=s.useRef();return s.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function dt(e){const t=$t(e),n=s.useRef(null),r=s.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function At(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let kt={};function ot(e,t){return s.useMemo(()=>{if(t)return t;const n=kt[e]==null?0:kt[e]+1;return kt[e]=n,e+"-"+n},[e,t])}function yn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((a,i)=>{const l=Object.entries(i);for(const[c,u]of l){const g=a[c];g!=null&&(a[c]=g+e*u)}return a},{...t})}}const ze=yn(1),Qe=yn(-1);function pr(e){return"clientX"in e&&"clientY"in e}function Ft(e){if(!e)return!1;const{KeyboardEvent:t}=q(e.target);return t&&e instanceof t}function br(e){if(!e)return!1;const{TouchEvent:t}=q(e.target);return t&&e instanceof t}function It(e){if(br(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return pr(e)?{x:e.clientX,y:e.clientY}:null}const et=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[et.Translate.toString(e),et.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),qt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function mr(e){return e.matches(qt)?e:e.querySelector(qt)}const xr={display:"none"};function vr(e){let{id:t,value:n}=e;return V.createElement("div",{id:t,style:xr},n)}function yr(e){let{id:t,announcement:n,ariaLiveType:r="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":r,"aria-atomic":!0},n)}function wr(){const[e,t]=s.useState("");return{announce:s.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const wn=s.createContext(null);function kr(e){const t=s.useContext(wn);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Sr(){const[e]=s.useState(()=>new Set),t=s.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[s.useCallback(r=>{let{type:o,event:a}=r;e.forEach(i=>{var l;return(l=i[o])==null?void 0:l.call(i,a)})},[e]),t]}const Cr={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
5
- `},Rr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Er(e){let{announcements:t=Rr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Dr}=e;const{announce:a,announcement:i}=Sr(),l=ot("DndLiveRegion"),[c,u]=s.useState(!1);if(s.useEffect(()=>{u(!0)},[]),Cr(s.useMemo(()=>({onDragStart(f){let{active:b}=f;a(t.onDragStart({active:b}))},onDragMove(f){let{active:b,over:p}=f;t.onDragMove&&a(t.onDragMove({active:b,over:p}))},onDragOver(f){let{active:b,over:p}=f;a(t.onDragOver({active:b,over:p}))},onDragEnd(f){let{active:b,over:p}=f;a(t.onDragEnd({active:b,over:p}))},onDragCancel(f){let{active:b,over:p}=f;a(t.onDragCancel({active:b,over:p}))}}),[a,t])),!c)return null;const g=V.createElement(V.Fragment,null,V.createElement(wr,{id:r,value:o.draggable}),V.createElement(kr,{id:l,announcement:i}));return n?Ge.createPortal(g,n):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 ut(){}function Jt(e,t){return s.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function jr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ue=Object.freeze({x:0,y:0});function kn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Sn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Ar(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Zt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Cn(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Qt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Ir=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Qt(t,t.left,t.top),a=[];for(const i of r){const{id:l}=i,c=n.get(l);if(c){const u=kn(Qt(c),o);a.push({id:l,data:{droppableContainer:i,value:u}})}}return a.sort(Sn)},Mr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Zt(t),a=[];for(const i of r){const{id:l}=i,c=n.get(l);if(c){const u=Zt(c),g=o.reduce((b,p,w)=>b+kn(u[w],p),0),f=Number((g/4).toFixed(4));a.push({id:l,data:{droppableContainer:i,value:f}})}}return a.sort(Sn)};function Tr(e,t){const n=Math.max(t.top,e.top),r=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-r,l=a-n;if(r<o&&n<a){const c=t.width*t.height,u=e.width*e.height,g=i*l,f=g/(c+u-g);return Number(f.toFixed(4))}return 0}const Lr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const a of r){const{id:i}=a,l=n.get(i);if(l){const c=Tr(l,t);c>0&&o.push({id:i,data:{droppableContainer:a,value:c}})}}return o.sort(Ar)};function Or(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Nn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ue}function _r(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;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}),{...n})}}const Pr=_r(1);function zr(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 Br(e,t,n){const r=zr(t);if(!r)return e;const{scaleX:o,scaleY:a,x:i,y:l}=r,c=e.left-i-(1-o)*parseFloat(n),u=e.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=a?e.height/a:e.height;return{width:g,height:f,top:u,right:c+g,bottom:u+f,left:c}}const $r={ignoreTransform:!1};function Ue(e,t){t===void 0&&(t=$r);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=q(e).getComputedStyle(e);u&&(n=Br(n,u,g))}const{top:r,left:o,width:a,height:i,bottom:l,right:c}=n;return{top:r,left:o,width:a,height:i,bottom:l,right:c}}function en(e){return Ue(e,{ignoreTransform:!0})}function Fr(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Ur(e,t){return t===void 0&&(t=q(e).getComputedStyle(e)),t.position==="fixed"}function Yr(e,t){t===void 0&&(t=q(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?n.test(a):!1})}function pt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Bt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!nt(o)||vn(o)||n.includes(o))return n;const a=q(e).getComputedStyle(o);return o!==e&&Yr(o,a)&&n.push(o),Ur(o,a)?n:r(o.parentNode)}return e?r(e):n}function Dn(e){const[t]=pt(e,1);return t??null}function St(e){return!ht||!e?null:$e(e)?e:zt(e)?Bt(e)||e===Fe(e).scrollingElement?window:nt(e)?e:null:null}function Rn(e){return $e(e)?e.scrollX:e.scrollLeft}function En(e){return $e(e)?e.scrollY:e.scrollTop}function Mt(e){return{x:Rn(e),y:En(e)}}var B;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(B||(B={}));function jn(e){return!ht||!e?!1:e===document.scrollingElement}function An(e){const t={x:0,y:0},n=jn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:a,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const Wr={x:.2,y:.2};function Xr(e,t,n,r,o){let{top:a,left:i,right:l,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=Wr);const{isTop:u,isBottom:g,isLeft:f,isRight:b}=An(e),p={x:0,y:0},w={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&a<=t.top+m.height?(p.y=B.Backward,w.y=r*Math.abs((t.top+m.height-a)/m.height)):!g&&c>=t.bottom-m.height&&(p.y=B.Forward,w.y=r*Math.abs((t.bottom-m.height-c)/m.height)),!b&&l>=t.right-m.width?(p.x=B.Forward,w.x=r*Math.abs((t.right-m.width-l)/m.width)):!f&&i<=t.left+m.width&&(p.x=B.Backward,w.x=r*Math.abs((t.left+m.width-i)/m.width)),{direction:p,speed:w}}function Hr(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:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function In(e){return e.reduce((t,n)=>ze(t,Mt(n)),ue)}function Kr(e){return e.reduce((t,n)=>t+Rn(n),0)}function Gr(e){return e.reduce((t,n)=>t+En(n),0)}function Vr(e,t){if(t===void 0&&(t=Ue),!e)return;const{top:n,left:r,bottom:o,right:a}=t(e);Dn(e)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const qr=[["x",["left","right"],Kr],["y",["top","bottom"],Gr]];class Ut{constructor(t,n){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 r=pt(n),o=In(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of qr)for(const c of i)Object.defineProperty(this,c,{get:()=>{const u=l(r),g=o[a]-u;return this.rect[c]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ve{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Jr(e){const{EventTarget:t}=q(e);return e instanceof t?e:Fe(e)}function Ct(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var se;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(se||(se={}));function tn(e){e.preventDefault()}function Zr(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 Mn={start:[R.Space,R.Enter],cancel:[R.Esc],end:[R.Space,R.Enter,R.Tab]},Qr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case R.Right:return{...n,x:n.x+25};case R.Left:return{...n,x:n.x-25};case R.Down:return{...n,y:n.y+25};case R.Up:return{...n,y:n.y-25}}};class Yt{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:n}}=t;this.props=t,this.listeners=new Ve(Fe(n)),this.windowListeners=new Ve(q(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(se.Resize,this.handleCancel),this.windowListeners.add(se.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(se.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Vr(r),n(ue)}handleKeyDown(t){if(Ft(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:a=Mn,coordinateGetter:i=Qr,scrollBehavior:l="smooth"}=o,{code:c}=t;if(a.end.includes(c)){this.handleEnd(t);return}if(a.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,g=u?{x:u.left,y:u.top}:ue;this.referenceCoordinates||(this.referenceCoordinates=g);const f=i(t,{active:n,context:r.current,currentCoordinates:g});if(f){const b=Qe(f,g),p={x:0,y:0},{scrollableAncestors:w}=r.current;for(const m of w){const x=t.code,{isTop:k,isRight:N,isLeft:v,isBottom:D,maxScroll:E,minScroll:j}=An(m),S=Hr(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&&!D||x===R.Up&&!k;if(I&&y.x!==f.x){const M=m.scrollLeft+b.x,J=x===R.Right&&M<=E.x||x===R.Left&&M>=j.x;if(J&&!b.y){m.scrollTo({left:M,behavior:l});return}J?p.x=m.scrollLeft-M:p.x=x===R.Right?m.scrollLeft-E.x:m.scrollLeft-j.x,p.x&&m.scrollBy({left:-p.x,behavior:l});break}else if(O&&y.y!==f.y){const M=m.scrollTop+b.y,J=x===R.Down&&M<=E.y||x===R.Up&&M>=j.y;if(J&&!b.x){m.scrollTo({top:M,behavior:l});return}J?p.y=m.scrollTop-M:p.y=x===R.Down?m.scrollTop-E.y:m.scrollTop-j.y,p.y&&m.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,ze(Qe(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Yt.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Mn,onActivation:o}=t,{active:a}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function nn(e){return!!(e&&"distance"in e)}function rn(e){return!!(e&&"delay"in e)}class Wt{constructor(t,n,r){var o;r===void 0&&(r=Jr(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=n;const{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=Fe(i),this.documentListeners=new Ve(this.document),this.listeners=new Ve(r),this.windowListeners=new Ve(q(i)),this.initialCoordinates=(o=It(a))!=null?o:ue,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:n,bypassActivationConstraint:r}}}=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(se.Resize,this.handleCancel),this.windowListeners.add(se.DragStart,tn),this.windowListeners.add(se.VisibilityChange,this.handleCancel),this.windowListeners.add(se.ContextMenu,tn),this.documentListeners.add(se.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(nn(n)){this.handlePending(n);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,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(se.Click,Zr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(se.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!o)return;const c=(n=It(t))!=null?n:ue,u=Qe(o,c);if(!r&&l){if(nn(l)){if(l.tolerance!=null&&Ct(u,l.tolerance))return this.handleCancel();if(Ct(u,l.distance))return this.handleStart()}if(rn(l)&&Ct(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===R.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const eo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Xt extends Wt{constructor(t){const{event:n}=t,r=Fe(n.target);super(t,eo,r)}}Xt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const to={move:{name:"mousemove"},end:{name:"mouseup"}};var Tt;(function(e){e[e.RightClick=2]="RightClick"})(Tt||(Tt={}));class no extends Wt{constructor(t){super(t,to,Fe(t.event.target))}}no.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Tt.RightClick?!1:(r?.({event:n}),!0)}}];const Nt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ro extends Wt{constructor(t){super(t,Nt)}static setup(){return window.addEventListener(Nt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Nt.move.name,t)};function t(){}}}ro.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var ft;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ft||(ft={}));function oo(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:a,interval:i=5,order:l=ft.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:b}=e;const p=io({delta:f,disabled:!a}),[w,m]=br(),x=s.useRef({x:0,y:0}),k=s.useRef({x:0,y:0}),N=s.useMemo(()=>{switch(n){case qe.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case qe.DraggableRect:return o}},[n,o,c]),v=s.useRef(null),D=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===ft.TreeOrder?[...u].reverse():u,[l,u]);s.useEffect(()=>{if(!a||!u.length||!N){m();return}for(const j of E){if(r?.(j)===!1)continue;const S=u.indexOf(j),y=g[S];if(!y)continue;const{direction:I,speed:O}=Xr(j,y,N,t,b);for(const M of["x","y"])p[M][I[M]]||(O[M]=0,I[M]=0);if(O.x>0||O.y>0){m(),v.current=j,w(D,i),x.current=O,k.current=I;return}}x.current={x:0,y:0},k.current={x:0,y:0},m()},[t,D,r,m,a,i,JSON.stringify(N),JSON.stringify(p),w,u,E,g,JSON.stringify(b)])}const ao={x:{[B.Backward]:!1,[B.Forward]:!1},y:{[B.Backward]:!1,[B.Forward]:!1}};function io(e){let{delta:t,disabled:n}=e;const r=At(t);return rt(o=>{if(n||!r||!o)return ao;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[B.Backward]:o.x[B.Backward]||a.x===-1,[B.Forward]:o.x[B.Forward]||a.x===1},y:{[B.Backward]:o.y[B.Backward]||a.y===-1,[B.Forward]:o.y[B.Forward]||a.y===1}}},[n,t,r])}function so(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return rt(o=>{var a;return t==null?null:(a=r??o)!=null?a:null},[r,t])}function lo(e,t){return s.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,a=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...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 Lt;(function(e){e.Optimized="optimized"})(Lt||(Lt={}));const on=new Map;function co(e,t){let{dragging:n,dependencies:r,config:o}=t;const[a,i]=s.useState(null),{frequency:l,measure:c,strategy:u}=o,g=s.useRef(e),f=x(),b=Ze(f),p=s.useCallback(function(k){k===void 0&&(k=[]),!b.current&&i(N=>N===null?k:N.concat(k.filter(v=>!N.includes(v))))},[b]),w=s.useRef(null),m=rt(k=>{if(f&&!n)return on;if(!k||k===on||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 D=v.node.current,E=D?new Ut(c(D),D):null;v.rect.current=E,E&&N.set(v.id,E)}return N}return k},[e,a,n,f,c]);return s.useEffect(()=>{g.current=e},[e]),s.useEffect(()=>{f||p()},[n,f]),s.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),s.useEffect(()=>{f||typeof l!="number"||w.current!==null||(w.current=setTimeout(()=>{p(),w.current=null},l))},[l,f,p,...r]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:a!=null};function x(){switch(u){case tt.Always:return!1;case tt.BeforeDragging:return n;default:return!n}}}function Tn(e,t){return rt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function uo(e,t){return Tn(e,t)}function fo(e){let{callback:t,disabled:n}=e;const r=$t(t),o=s.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function bt(e){let{callback:t,disabled:n}=e;const r=$t(t),o=s.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function go(e){return new Ut(Ue(e),e)}function an(e,t,n){t===void 0&&(t=go);const[r,o]=s.useState(null);function a(){o(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const g=t(e);return JSON.stringify(c)===JSON.stringify(g)?c:g})}const i=fo({callback(c){if(e)for(const u of c){const{type:g,target:f}=u;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=bt({callback:a});return pe(()=>{a(),e?(l?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),i?.disconnect())},[e]),r}function ho(e){const t=Tn(e);return Nn(e,t)}const sn=[];function po(e){const t=s.useRef(e),n=rt(r=>e?r&&r!==sn&&e&&t.current&&e.parentNode===t.current.parentNode?r:pt(e):sn,[e]);return s.useEffect(()=>{t.current=e},[e]),n}function bo(e){const[t,n]=s.useState(null),r=s.useRef(e),o=s.useCallback(a=>{const i=St(a.target);i&&n(l=>l?(l.set(i,Mt(i)),new Map(l)):null)},[]);return s.useEffect(()=>{const a=r.current;if(e!==a){i(a);const l=e.map(c=>{const u=St(c);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Mt(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(c=>{const u=St(c);u?.removeEventListener("scroll",o)})}},[o,e]),s.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>ze(a,i),ue):In(e):ue,[e,t])}function ln(e,t){t===void 0&&(t=[]);const n=s.useRef(null);return s.useEffect(()=>{n.current=null},t),s.useEffect(()=>{const r=e!==ue;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Qe(e,n.current):ue}function mo(e){s.useEffect(()=>{if(!ht)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function xo(e,t){return s.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:a}=r;return n[o]=i=>{a(i,t)},n},{}),[e,t])}function Ln(e){return s.useMemo(()=>e?Fr(e):null,[e])}const cn=[];function vo(e,t){t===void 0&&(t=Ue);const[n]=e,r=Ln(n?q(n):null),[o,a]=s.useState(cn);function i(){a(()=>e.length?e.map(c=>jn(c)?r:new Ut(t(c),c)):cn)}const l=bt({callback:i});return pe(()=>{l?.disconnect(),i(),e.forEach(c=>l?.observe(c))},[e]),o}function yo(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return nt(t)?t:e}function wo(e){let{measure:t}=e;const[n,r]=s.useState(null),o=s.useCallback(u=>{for(const{target:g}of u)if(nt(g)){r(f=>{const b=t(g);return f?{...f,width:b.width,height:b.height}:b});break}},[t]),a=bt({callback:o}),i=s.useCallback(u=>{const g=yo(u);a?.disconnect(),g&&a?.observe(g),r(g?t(g):null)},[t,a]),[l,c]=dt(i);return s.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const ko=[{sensor:Xt,options:{}},{sensor:Yt,options:{}}],So={current:{}},lt={draggable:{measure:en},droppable:{measure:en,strategy:tt.WhileDragging,frequency:Lt.Optimized},dragOverlay:{measure:Ue}};class Je extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Co={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:ut},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:lt,measureDroppableContainers:ut,windowRect:null,measuringScheduled:!1},No={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ut,draggableNodes:new Map,over:null,measureDroppableContainers:ut},mt=s.createContext(No),On=s.createContext(Co);function Do(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Je}}}function Ro(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:n}=t,{id:r}=n,o=new Je(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new Je(e.droppable.containers);return i.set(n,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new Je(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Eo(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=s.useContext(mt),a=At(r),i=At(n?.id);return s.useEffect(()=>{if(!t&&!r&&a&&i!=null){if(!Ft(a)||document.activeElement===a.target)return;const l=o.get(i);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[c.current,u.current]){if(!g)continue;const f=vr(g);if(f){f.focus();break}}})}},[r,t,o,i,a]),null}function jo(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...r}),n):n}function Ao(e){return s.useMemo(()=>({draggable:{...lt.draggable,...e?.draggable},droppable:{...lt.droppable,...e?.droppable},dragOverlay:{...lt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Io(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const a=s.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;pe(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const g=n(u),f=Nn(g,r);if(i||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const b=Dn(u);b&&b.scrollBy({top:f.y,left:f.x})}},[t,i,l,r,n])}const _n=s.createContext({...ue,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 Mo=s.memo(function(t){var n,r,o,a;let{id:i,accessibility:l,autoScroll:c=!0,children:u,sensors:g=ko,collisionDetection:f=Lr,measuring:b,modifiers:p,...w}=t;const m=s.useReducer(Ro,void 0,Do),[x,k]=m,[N,v]=Nr(),[D,E]=s.useState(Ee.Uninitialized),j=D===Ee.Initialized,{draggable:{active:S,nodes:y,translate:I},droppable:{containers:O}}=x,M=S!=null?y.get(S):null,J=s.useRef({initial:null,translated:null}),Z=s.useMemo(()=>{var X;return S!=null?{id:S,data:(X=M?.data)!=null?X:So,rect:J}:null},[S,M]),L=s.useRef(null),[be,Ie]=s.useState(null),[H,je]=s.useState(null),ne=Ze(w,Object.values(w)),K=ot("DndDescribedBy",i),Me=s.useMemo(()=>O.getEnabled(),[O]),W=Ao(b),{droppableRects:re,measureDroppableContainers:$,measuringScheduled:fe}=co(Me,{dragging:j,dependencies:[I.x,I.y],config:W.droppable}),_=so(y,S),Te=s.useMemo(()=>H?It(H):null,[H]),le=qn(),oe=uo(_,W.draggable.measure);Io({activeNode:S!=null?y.get(S):null,config:le.layoutShiftCompensation,initialRect:oe,measure:W.draggable.measure});const A=an(_,W.draggable.measure,oe),we=an(_?_.parentElement:null),G=s.useRef({activatorEvent:null,active:null,activeNode:_,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ke=O.getNodeFor((n=G.current.over)==null?void 0:n.id),ae=wo({measure:W.dragOverlay.measure}),me=(r=ae.nodeRef.current)!=null?r:_,xe=j?(o=ae.rect)!=null?o:A:null,Ye=!!(ae.nodeRef.current&&ae.rect),Le=ho(Ye?null:A),We=Ln(me?q(me):null),ce=po(j?ke??_:null),Ae=vo(ce),Oe=jo(p,{transform:{x:I.x-Le.x,y:I.y-Le.y,scaleX:1,scaleY:1},activatorEvent:H,active:Z,activeNodeRect:A,containerNodeRect:we,draggingNodeRect:xe,over:G.current.over,overlayNodeRect:ae.rect,scrollableAncestors:ce,scrollableAncestorRects:Ae,windowRect:We}),Se=Te?ze(Te,I):null,_e=bo(ce),h=ln(_e),T=ln(_e,[A]),F=ze(Oe,h),ve=xe?Pr(xe,Oe):null,Ce=Z&&ve?f({active:Z,collisionRect:ve,droppableRects:re,droppableContainers:Me,pointerCoordinates:Se}):null,at=Cn(Ce,"id"),[U,xt]=s.useState(null),vt=Ye?Oe:ze(Oe,T),Hn=Or(vt,(a=U?.rect)!=null?a:null,A),yt=s.useRef(null),Ht=s.useCallback((X,Q)=>{let{sensor:ee,options:Ne}=Q;if(L.current==null)return;const ie=y.get(L.current);if(!ie)return;const te=X.nativeEvent,ge=new ee({active:L.current,activeNode:ie,event:te,options:Ne,context:G,onAbort(Y){if(!y.get(Y))return;const{onDragAbort:he}=ne.current,ye={id:Y};he?.(ye),N({type:"onDragAbort",event:ye})},onPending(Y,De,he,ye){if(!y.get(Y))return;const{onDragPending:He}=ne.current,Re={id:Y,constraint:De,initialCoordinates:he,offset:ye};He?.(Re),N({type:"onDragPending",event:Re})},onStart(Y){const De=L.current;if(De==null)return;const he=y.get(De);if(!he)return;const{onDragStart:ye}=ne.current,Xe={activatorEvent:te,active:{id:De,data:he.data,rect:J}};Ge.unstable_batchedUpdates(()=>{ye?.(Xe),E(Ee.Initializing),k({type:z.DragStart,initialCoordinates:Y,active:De}),N({type:"onDragStart",event:Xe}),Ie(yt.current),je(te)})},onMove(Y){k({type:z.DragMove,coordinates:Y})},onEnd:Pe(z.DragEnd),onCancel:Pe(z.DragCancel)});yt.current=ge;function Pe(Y){return async function(){const{active:he,collisions:ye,over:Xe,scrollAdjustedTranslate:He}=G.current;let Re=null;if(he&&He){const{cancelDrop:Ke}=ne.current;Re={activatorEvent:te,active:he,collisions:ye,delta:He,over:Xe},Y===z.DragEnd&&typeof Ke=="function"&&await Promise.resolve(Ke(Re))&&(Y=z.DragCancel)}L.current=null,Ge.unstable_batchedUpdates(()=>{k({type:Y}),E(Ee.Uninitialized),xt(null),Ie(null),je(null),yt.current=null;const Ke=Y===z.DragEnd?"onDragEnd":"onDragCancel";if(Re){const wt=ne.current[Ke];wt?.(Re),N({type:Ke,event:Re})}})}}},[y]),Kn=s.useCallback((X,Q)=>(ee,Ne)=>{const ie=ee.nativeEvent,te=y.get(Ne);if(L.current!==null||!te||ie.dndKit||ie.defaultPrevented)return;const ge={active:te};X(ee,Q.options,ge)===!0&&(ie.dndKit={capturedBy:Q.sensor},L.current=Ne,Ht(ee,Q))},[y,Ht]),Kt=lo(g,Kn);mo(g),pe(()=>{A&&D===Ee.Initializing&&E(Ee.Initialized)},[A,D]),s.useEffect(()=>{const{onDragMove:X}=ne.current,{active:Q,activatorEvent:ee,collisions:Ne,over:ie}=G.current;if(!Q||!ee)return;const te={active:Q,activatorEvent:ee,collisions:Ne,delta:{x:F.x,y:F.y},over:ie};Ge.unstable_batchedUpdates(()=>{X?.(te),N({type:"onDragMove",event:te})})},[F.x,F.y]),s.useEffect(()=>{const{active:X,activatorEvent:Q,collisions:ee,droppableContainers:Ne,scrollAdjustedTranslate:ie}=G.current;if(!X||L.current==null||!Q||!ie)return;const{onDragOver:te}=ne.current,ge=Ne.get(at),Pe=ge&&ge.rect.current?{id:ge.id,rect:ge.rect.current,data:ge.data,disabled:ge.disabled}:null,Y={active:X,activatorEvent:Q,collisions:ee,delta:{x:ie.x,y:ie.y},over:Pe};Ge.unstable_batchedUpdates(()=>{xt(Pe),te?.(Y),N({type:"onDragOver",event:Y})})},[at]),pe(()=>{G.current={activatorEvent:H,active:Z,activeNode:_,collisionRect:ve,collisions:Ce,droppableRects:re,draggableNodes:y,draggingNode:me,draggingNodeRect:xe,droppableContainers:O,over:U,scrollableAncestors:ce,scrollAdjustedTranslate:F},J.current={initial:xe,translated:ve}},[Z,_,Ce,ve,y,me,xe,re,O,U,ce,F]),oo({...le,delta:I,draggingRect:ve,pointerCoordinates:Se,scrollableAncestors:ce,scrollableAncestorRects:Ae});const Gn=s.useMemo(()=>({active:Z,activeNode:_,activeNodeRect:A,activatorEvent:H,collisions:Ce,containerNodeRect:we,dragOverlay:ae,draggableNodes:y,droppableContainers:O,droppableRects:re,over:U,measureDroppableContainers:$,scrollableAncestors:ce,scrollableAncestorRects:Ae,measuringConfiguration:W,measuringScheduled:fe,windowRect:We}),[Z,_,A,H,Ce,we,ae,y,O,re,U,$,ce,Ae,W,fe,We]),Vn=s.useMemo(()=>({activatorEvent:H,activators:Kt,active:Z,activeNodeRect:A,ariaDescribedById:{draggable:K},dispatch:k,draggableNodes:y,over:U,measureDroppableContainers:$}),[H,Kt,Z,A,k,K,y,U,$]);return V.createElement(wn.Provider,{value:v},V.createElement(mt.Provider,{value:Vn},V.createElement(On.Provider,{value:Gn},V.createElement(_n.Provider,{value:Hn},u)),V.createElement(Eo,{disabled:l?.restoreFocus===!1})),V.createElement(Er,{...l,hiddenTextDescribedById:K}));function qn(){const X=be?.autoScrollEnabled===!1,Q=typeof c=="object"?c.enabled===!1:c===!1,ee=j&&!X&&!Q;return typeof c=="object"?{...c,enabled:ee}:{enabled:ee}}}),To=s.createContext(null),dn="button",Lo="Draggable";function Oo(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const a=ot(Lo),{activators:i,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:b}=s.useContext(mt),{role:p=dn,roleDescription:w="draggable",tabIndex:m=0}=o??{},x=c?.id===t,k=s.useContext(x?_n:To),[N,v]=dt(),[D,E]=dt(),j=xo(i,t),S=Ze(n);pe(()=>(f.set(t,{id:t,key:a,node:N,activatorNode:D,data:S}),()=>{const I=f.get(t);I&&I.key===a&&f.delete(t)}),[f,t]);const y=s.useMemo(()=>({role:p,tabIndex:m,"aria-disabled":r,"aria-pressed":x&&p===dn?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[r,p,m,x,w,g.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:y,isDragging:x,listeners:r?void 0:j,node:N,over:b,setNodeRef:v,setActivatorNodeRef:E,transform:k}}function _o(){return s.useContext(On)}const Po="Droppable",zo={timeout:25};function Bo(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const a=ot(Po),{active:i,dispatch:l,over:c,measureDroppableContainers:u}=s.useContext(mt),g=s.useRef({disabled:n}),f=s.useRef(!1),b=s.useRef(null),p=s.useRef(null),{disabled:w,updateMeasurementsFor:m,timeout:x}={...zo,...o},k=Ze(m??r),N=s.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(k.current)?k.current:[k.current]),p.current=null},x)},[x]),v=bt({callback:N,disabled:w||!i}),D=s.useCallback((y,I)=>{v&&(I&&(v.unobserve(I),f.current=!1),y&&v.observe(y))},[v]),[E,j]=dt(D),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:r,key:a,disabled:n,node:E,rect:b,data:S}}),()=>l({type:z.UnregisterDroppable,key:a,id:r})),[r]),s.useEffect(()=>{n!==g.current.disabled&&(l({type:z.SetDroppableDisabled,id:r,key:a,disabled:n}),g.current.disabled=n)},[r,a,n,l]),{active:i,rect:b,isOver:c?.id===r,node:E,over:c,setNodeRef:j}}const $o=e=>{let{transform:t}=e;return{...t,y:0}};function Pn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Fo(e,t){return e.reduce((n,r,o)=>{const a=t.get(r);return a&&(n[o]=a),n},Array(e.length))}function it(e){return e!==null&&e>=0}function Uo(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Yo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const st={scaleX:1,scaleY:1},Wo=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:a,index:i}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const c=Xo(n,i,o);if(i===o){const u=n[a];return u?{x:o<a?u.left+u.width-(l.left+l.width):u.left-l.left,y:0,...st}:null}return i>o&&i<=a?{x:-l.width-c,y:0,...st}:i<o&&i>=a?{x:l.width+c,y:0,...st}:{x:0,y:0,...st}};function Xo(e,t,n){const r=e[t],o=e[t-1],a=e[t+1];return!r||!o&&!a?0:n<t?o?r.left-(o.left+o.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(o.left+o.width)}const zn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const a=Pn(t,r,n),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}},Bn="Sortable",$n=V.createContext({activeIndex:-1,containerId:Bn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:zn,disabled:{draggable:!1,droppable:!1}});function Ho(e){let{children:t,id:n,items:r,strategy:o=zn,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:c,over:u,measureDroppableContainers:g}=_o(),f=ot(Bn,n),b=l.rect!==null,p=s.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),w=i!=null,m=i?p.indexOf(i.id):-1,x=u?p.indexOf(u.id):-1,k=s.useRef(p),N=!Uo(p,k.current),v=x!==-1&&m===-1||N,D=Yo(a);pe(()=>{N&&w&&g(p)},[N,p,w,g]),s.useEffect(()=>{k.current=p},[p]);const E=s.useMemo(()=>({activeIndex:m,containerId:f,disabled:D,disableTransforms:v,items:p,overIndex:x,useDragOverlay:b,sortedRects:Fo(p,c),strategy:o}),[m,f,D.draggable,D.droppable,v,p,x,c,b,o]);return V.createElement($n.Provider,{value:E},t)}const Ko=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Pn(n,r,o).indexOf(t)},Go=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:a,newIndex:i,previousItems:l,previousContainerId:c,transition:u}=e;return!u||!r||l!==a&&o===i?!1:n?!0:i!==o&&t===c},Vo={duration:200,easing:"ease"},Fn="transform",qo=et.Transition.toString({property:Fn,duration:0,easing:"linear"}),Jo={roleDescription:"sortable"};function Zo(e){let{disabled:t,index:n,node:r,rect:o}=e;const[a,i]=s.useState(null),l=s.useRef(n);return pe(()=>{if(!t&&n!==l.current&&r.current){const c=o.current;if(c){const u=Ue(r.current,{ignoreTransform:!0}),g={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(g.x||g.y)&&i(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),s.useEffect(()=>{a&&i(null)},[a]),a}function Qo(e){let{animateLayoutChanges:t=Go,attributes:n,disabled:r,data:o,getNewIndex:a=Ko,id:i,strategy:l,resizeObserverConfig:c,transition:u=Vo}=e;const{items:g,containerId:f,activeIndex:b,disabled:p,disableTransforms:w,sortedRects:m,overIndex:x,useDragOverlay:k,strategy:N}=s.useContext($n),v=ea(r,p),D=g.indexOf(i),E=s.useMemo(()=>({sortable:{containerId:f,index:D,items:g},...o}),[f,o,D,g]),j=s.useMemo(()=>g.slice(g.indexOf(i)),[g,i]),{rect:S,node:y,isOver:I,setNodeRef:O}=Bo({id:i,data:E,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...c}}),{active:M,activatorEvent:J,activeNodeRect:Z,attributes:L,setNodeRef:be,listeners:Ie,isDragging:H,over:je,setActivatorNodeRef:ne,transform:K}=Oo({id:i,data:E,attributes:{...Jo,...n},disabled:v.draggable}),Me=pr(O,be),W=!!M,re=W&&!w&&it(b)&&it(x),$=!k&&H,fe=$&&re?K:null,Te=re?fe??(l??N)({rects:m,activeNodeRect:Z,activeIndex:b,overIndex:x,index:D}):null,le=it(b)&&it(x)?a({id:i,items:g,activeIndex:b,overIndex:x}):D,oe=M?.id,A=s.useRef({activeId:oe,items:g,newIndex:le,containerId:f}),we=g!==A.current.items,G=t({active:M,containerId:f,isDragging:H,isSorting:W,id:i,index:D,items:g,newIndex:A.current.newIndex,previousItems:A.current.items,previousContainerId:A.current.containerId,transition:u,wasDragging:A.current.activeId!=null}),ke=Zo({disabled:!G,index:D,node:y,rect:S});return s.useEffect(()=>{W&&A.current.newIndex!==le&&(A.current.newIndex=le),f!==A.current.containerId&&(A.current.containerId=f),g!==A.current.items&&(A.current.items=g)},[W,le,f,g]),s.useEffect(()=>{if(oe===A.current.activeId)return;if(oe&&!A.current.activeId){A.current.activeId=oe;return}const me=setTimeout(()=>{A.current.activeId=oe},50);return()=>clearTimeout(me)},[oe]),{active:M,activeIndex:b,attributes:L,data:E,rect:S,index:D,newIndex:le,items:g,isOver:I,isSorting:W,isDragging:H,listeners:Ie,node:y,overIndex:x,over:je,setNodeRef:Me,setActivatorNodeRef:ne,setDroppableNodeRef:O,setDraggableNodeRef:be,transform:ke??Te,transition:ae()};function ae(){if(ke||we&&A.current.newIndex===D)return qo;if(!($&&!Ft(J)||!u)&&(W||G))return et.Transition.toString({...u,property:Fn})}}function ea(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function gt(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 ta=[R.Down,R.Right,R.Up,R.Left],na=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:a,over:i,scrollableAncestors:l}}=t;if(ta.includes(e.code)){if(e.preventDefault(),!n||!r)return;const c=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const b=o.get(f.id);if(b)switch(e.code){case R.Down:r.top<b.top&&c.push(f);break;case R.Up:r.top>b.top&&c.push(f);break;case R.Left:r.left>b.left&&c.push(f);break;case R.Right:r.left<b.left&&c.push(f);break}});const u=Mr({collisionRect:r,droppableRects:o,droppableContainers:c});let g=Cn(u,"id");if(g===i?.id&&u.length>1&&(g=u[1].id),g!=null){const f=a.get(n.id),b=a.get(g),p=b?o.get(b.id):null,w=b?.node.current;if(w&&p&&f&&b){const x=pt(w).some((j,S)=>l[S]!==j),k=Un(f,b),N=ra(f,b),v=x||!k?{x:0,y:0}:{x:N?r.width-p.width:0,y:N?r.height-p.height:0},D={x:p.left,y:p.top};return v.x&&v.y?D:Qe(D,v)}}}};function Un(e,t){return!gt(e)||!gt(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ra(e,t){return!gt(e)||!gt(t)||!Un(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Be(e,{min:t,max:n,fallback:r}){const o=Number(e);if(!Number.isFinite(o))return r;const a=Math.floor(o);return a<t?t:a>n?n:a}function oa(e,t){const n=Be(t,{min:0,max:1e6,fallback:0}),r=Be(e,{min:1,max:Math.max(1,n||1),fallback:1});if(n<=1)return[1];const o=new Set([1,n,r-2,r-1,r,r+1,r+2]),a=Array.from(o).filter(c=>Number.isInteger(c)&&c>=1&&c<=n).sort((c,u)=>c-u),i=[];let l=null;for(const c of a)l!=null&&c-l>1&&i.push(null),i.push(c),l=c;return i}function aa({page:e,totalPages:t}){const n=typeof t=="number"&&Number.isFinite(t)&&t>=0,r=n?Be(t,{min:0,max:1e6,fallback:0}):null,o=Be(e,{min:1,max:n?Math.max(1,r||1):1e6,fallback:1}),a=o>1,i=n?o<r:!0;return{canPrev:a,canNext:i,safePage:o,safeTotal:r}}function ia({entries:e,me:t,meLabel:n,limit:r}){const o=Be(r,{min:1,max:1e3,fallback:20}),a=Array.isArray(e)?e.slice(0,o):[],i=t&&typeof t.rank=="number"?t.rank:null,l=a.some(w=>!!w?.is_me);if(!i||l)return a;const c={rank:i,is_me:!0,display_name:n,avatar_url:null,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"},u=a.filter(w=>!w?.is_me),g=u[u.length-1],f=g&&typeof g.rank=="number"?g.rank:0;return i>f+1?[...u.slice(0,Math.max(0,o-2)),{is_ellipsis:!0,rank:null,display_name:""},c]:[...u.slice(0,Math.max(0,o-1)),c]}function de({className:e}){return d.jsx("div",{className:P("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function sa({index:e}){const t=e<3?"w-24":e<8?"w-20":"w-16",n=e<3?"w-16":"w-12",r=e<5?"w-14":"w-10";return d.jsxs("tr",{className:"group",children:[d.jsx("td",{className:P(Et(!1),"!group-hover:bg-transparent"),children:d.jsx(de,{className:"h-4 w-6"})}),d.jsx("td",{className:P(jt(!1),"!group-hover:bg-transparent"),children:d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(de,{className:"h-8 w-8 min-w-8 rounded-full"}),d.jsx(de,{className:P("h-4",t)})]})}),d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:P("h-4",n)})}),d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:"h-4 w-12"})}),ct.map(o=>d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:P("h-4",r)})},o.key))]})}function la({rows:e=10}){return d.jsx("div",{className:"w-full overflow-x-auto",children:d.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:d.jsxs("tr",{children:[d.jsx("th",{className:P(mn,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(de,{className:"h-3.5 w-6"})}),d.jsx("th",{className:P(xn,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(de,{className:"h-3.5 w-12"})}),d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-10"})}),d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-14"})}),ct.map(t=>d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-12"})},t.key))]})}),d.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:e},(t,n)=>d.jsx(sa,{index:n},n))})]})})}function ca({id:e,thClassName:t,children:n}){const{attributes:r,listeners:o,setNodeRef:a,transform:i,transition:l,isDragging:c}=Qo({id:e}),u=et.Transform.toString(i)||"";s.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${e}"]`),b="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(p=>{p.style.transform=u,p.style.transition=l||"",p.style.zIndex=c?"20":"",p.style.position=u?"relative":"",p.style.boxShadow=c?b:""}),()=>{f.forEach(p=>{p.style.transform="",p.style.transition="",p.style.zIndex="",p.style.position="",p.style.boxShadow=""})}},[e,u,l,c]);const g={transform:u,transition:l,position:u?"relative":void 0,zIndex:c?20:void 0,boxShadow:c?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return d.jsx("th",{ref:a,style:g,className:P(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...r,...o,children:d.jsxs("div",{className:"flex items-center justify-end gap-2",children:[d.jsx("span",{"aria-hidden":"true",className:P("-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",c&&"opacity-100"),children:d.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[d.jsx("circle",{cx:"2",cy:"2",r:"1"}),d.jsx("circle",{cx:"6",cy:"2",r:"1"}),d.jsx("circle",{cx:"2",cy:"7",r:"1"}),d.jsx("circle",{cx:"6",cy:"7",r:"1"}),d.jsx("circle",{cx:"2",cy:"12",r:"1"}),d.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),n]})})}const Yn="tokentracker.leaderboard.columnOrder.v1";function da(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Yn);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):null}catch{return null}}function Dt(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Yn,JSON.stringify(e))}catch{}}function un(e,t){if(!e)return t;const n=new Set(t),r=e.filter(a=>n.has(a)),o=t.filter(a=>!r.includes(a));return[...r,...o]}function ua(e){const t=s.useMemo(()=>e.join("|"),[e]),[n,r]=s.useState(()=>un(da(),e));s.useEffect(()=>{r(i=>{const l=un(i,e);return l.length===i.length&&l.every((u,g)=>u===i[g])?i:(Dt(l),l)})},[t,e]);const o=s.useCallback((i,l)=>{!i||!l||i===l||r(c=>{const u=c.indexOf(i),g=c.indexOf(l);if(u===-1||g===-1)return c;const f=c.slice(),[b]=f.splice(u,1);return f.splice(g,0,b),Dt(f),f})},[]),a=s.useCallback(()=>{Dt(e),r(e)},[e]);return{order:n,reorder:o,reset:a}}const Ot=[10,20,50,100],_t=20,Wn="tokentracker:leaderboard:pageSize";function fa(){if(typeof window>"u")return _t;try{const e=window.localStorage.getItem(Wn),t=Number(e);if(Ot.includes(t))return t}catch{}return _t}function fn(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 gn(e,t,n){const r=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 n.map(a=>d.jsx("td",{"data-column-key":a.key,className:P("px-4 py-4 whitespace-nowrap text-right tabular-nums",r,o),children:Rt(e?.[a.key])},a.key))}const ga={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 hn({rank:e,placeholder:t}){const n=ga[e];return n?d.jsx("span",{className:P("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",n.text,n.badge),children:e}):d.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:e??t})}function Pt(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t==="week"||t==="month"||t==="total"?t:null}function ha(e){if(!e)return C("shared.error.prefix",{error:C("leaderboard.error.unknown")});const t=e?.message||String(e),n=String(t||"").trim()||C("leaderboard.error.unknown");return C("shared.error.prefix",{error:n})}function Xn(e){return typeof e!="string"?"":e.trim()}function pa(e){const t=Xn(e);return t?t.toLowerCase()==="anonymous":!0}function ba(e,t=""){if(typeof e!="string")return null;const n=e.trim().toLowerCase();if(!n)return null;const r=new URLSearchParams(typeof t=="string"?t:""),o=Pt(r.get("period")),a=o?`?period=${o}`:"";return`/share/pv1-${n}${a}`}function pn(e,t){const n=typeof e?.user_id=="string"?e.user_id.trim():"";return n||`${e?.rank??""}:${t}`}function bn({githubUrl:e}){return d.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[d.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:t=>t.stopPropagation(),"aria-label":C("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:d.jsx(ur,{provider:"GITHUB",size:16})}),d.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:[d.jsx("span",{className:"block",children:C("leaderboard.github.tooltipAction")}),d.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[C("leaderboard.github.tooltipPrefix")," ",d.jsx(sr,{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:C("leaderboard.github.tooltipSettingsLink")}),C("leaderboard.github.tooltipSuffix")]})]})]})}function ya({auth:e,signedIn:t,sessionSoftExpired:n}){const r=Zn(),o=Qn(),{openLoginModal:a}=er(),{signedIn:i,loading:l,user:c}=tr(),u=s.useMemo(()=>nr(),[]),g=rr(),f=t&&!n,b=s.useMemo(()=>f&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,f]),p=f?b:null,w=f&&or(p),m=C("shared.placeholder.short"),x=s.useMemo(()=>ct.map(h=>h.key),[]),{order:k,reorder:N}=ua(x),v=s.useMemo(()=>{const h=new Map;for(const T of ct)h.set(T.key,T);return h},[]),D=s.useMemo(()=>k.map(h=>v.get(h)).filter(Boolean),[k,v]),E=jr(Jt(Xt,{activationConstraint:{distance:6}}),Jt(Yt,{coordinateGetter:na})),j=s.useCallback(h=>{const{active:T,over:F}=h;!F||T.id===F.id||N(String(T.id),String(F.id))},[N]),[S,y]=s.useState(1),[I,O]=s.useState(fa),M=s.useCallback(h=>{const T=Ot.includes(h)?h:_t;O(T),y(1);try{window.localStorage.setItem(Wn,String(T))}catch{}},[]),[J,Z]=s.useState(0),[L,be]=s.useState(()=>({loading:!1,error:null,data:null})),[Ie,H]=s.useState(()=>ar()),[je,ne]=s.useState(!1),K=s.useMemo(()=>{const h=new URLSearchParams(r?.search||"");return Pt(h.get("period"))||"total"},[r?.search]),Me=r?.search||"",W=h=>{const T=Pt(h);if(!T||T===K)return;const F=new URLSearchParams(r?.search||"");F.set("period",T),y(1),o(`${r?.pathname||"/leaderboard"}?${F.toString()}`,{replace:!0})};s.useEffect(()=>{l||g||i||a()},[i,l,g,a]),s.useEffect(()=>{y(1)},[K]);const re=s.useMemo(()=>(Be(S,{min:1,max:1e6,fallback:1})-1)*I,[S,I]);s.useEffect(()=>{if(!u&&!g)return;let h=!0;return be(T=>({...T,loading:!0,error:null})),(async()=>{const T=await ir({userId:c?.id||null,period:K,limit:I,offset:re});h&&be({loading:!1,error:null,data:T})})().catch(T=>{h&&be({loading:!1,error:ha(T),data:null})}),()=>{h=!1}},[u,c?.id,re,J,g,K,I]);const $=L.data,fe=$?.total_pages??null,_=$?.page??S,Te=s.useMemo(()=>oa(_,fe),[_,fe]),le=$?.from||null,oe=$?.to||null,A=$?.generated_at||null,we=$?.me||null,G=C("leaderboard.me_label"),ke=C("leaderboard.anon_label"),ae=C("leaderboard.period.week"),me=C("leaderboard.period.month"),xe=C("leaderboard.period.total"),Ye=K==="month"?me:K==="total"?xe:ae,Le=s.useMemo(()=>{const h=Array.isArray($?.entries)?$.entries:[];return _!==1?h:ia({entries:h,me:we,meLabel:G,limit:I})},[_,$?.entries,we,G,I]),We=async()=>{ne(!0);try{lr(!0),H(!0),await cr(()=>Gt(p));const h=await Gt(p);h&&await dr({accessToken:h,period:K,source:"leaderboard-enable-sync"}),Z(T=>T+1)}catch(h){console.warn("[tokentracker] sync:",h)}finally{ne(!1)}},{canPrev:ce,canNext:Ae}=aa({page:_,totalPages:fe}),Oe=Array.isArray(Le)&&Le.length!==0;let Se=null;L.loading?Se=d.jsx(la,{rows:I}):L.error?Se=d.jsx("div",{className:"px-6 py-12 text-center",children:d.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:L.error})}):Oe?Se=d.jsx(Mo,{sensors:E,collisionDetection:Ir,modifiers:[$o],onDragEnd:j,children:d.jsx("div",{className:"w-full overflow-x-auto",children:d.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:d.jsxs("tr",{children:[d.jsx("th",{className:P(mn,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:C("leaderboard.column.rank")}),d.jsx("th",{className:P(xn,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:C("leaderboard.column.user")}),d.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:C("leaderboard.column.total")}),d.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:C("leaderboard.column.est_cost")}),d.jsx(Ho,{items:k,strategy:Wo,children:D.map(h=>d.jsx(ca,{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:d.jsx(fr,{iconSrc:h.icon,label:C(h.copyKey)})},h.key))})]})}),d.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Le.map((h,T)=>{if(h?.is_ellipsis){const vt=4+D.length;return d.jsx("tr",{"aria-hidden":"true",children:d.jsx("td",{colSpan:vt,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-${T}`)}const F=!!h?.is_me,ve=typeof h?.user_id=="string"?h.user_id:null,Ce=Xn(h?.display_name),at=pa(Ce)?ke:Ce,U=F?G:at;return!!ve&&!F&&!!h?.is_public&&ba(ve,Me),F?d.jsxs("tr",{className:"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30 bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",children:[d.jsx("td",{className:P(Et(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400"),children:d.jsx(hn,{rank:h?.rank,placeholder:m})}),d.jsx("td",{className:jt(!0),children:d.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[d.jsx(Vt,{avatarUrl:h?.avatar_url,displayName:U,seed:pn(h,U)}),d.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:U}),h?.github_url&&d.jsx(bn,{githubUrl:h.github_url})]})}),d.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:Rt(h?.total_tokens)}),d.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:fn(h?.estimated_cost_usd)}),gn(h,!0,D)]},`row-${h?.rank}-${U}`):d.jsxs("tr",{className:"group transition-colors",children:[d.jsx("td",{className:P(Et(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(hn,{rank:h?.rank,placeholder:m})}),d.jsx("td",{className:jt(!1),children:d.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[d.jsx(Vt,{avatarUrl:h?.avatar_url,displayName:U,seed:pn(h,U)}),d.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:U}),h?.github_url&&d.jsx(bn,{githubUrl:h.github_url})]})}),d.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:Rt(h?.total_tokens)}),d.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:fn(h?.estimated_cost_usd)}),gn(h,!1,D)]},`row-${h?.rank}-${U}`)})})]})})}):Se=d.jsx("div",{className:"px-6 py-12 text-center",children:d.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:C("leaderboard.empty")})});let _e=null;return typeof fe=="number"?_e=Te.map((h,T)=>h==null?d.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:C("leaderboard.pagination.ellipsis")},`ellipsis-${T}`):d.jsx("button",{className:P("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",h===_?"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:L.loading,children:String(h)},`page-${h}`)):_e=d.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:C("leaderboard.pagination.page_unknown",{page:String(_)})}),d.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[d.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:d.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[d.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-6 mb-8",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:C("leaderboard.title")}),d.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[K==="total"?C("leaderboard.range.total"):le&&oe?C("leaderboard.range",{period:Ye,from:le,to:oe}):C("leaderboard.range_loading",{period:Ye}),A&&d.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:C("leaderboard.generated_at",{ts:A})})]})]}),d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("div",{className:"inline-flex p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-lg",children:["week","month","total"].map(h=>d.jsx("button",{onClick:()=>W(h),disabled:L.loading,className:P("px-4 py-1.5 text-sm font-medium rounded-md transition-colors",K===h?"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:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:h==="week"?ae:h==="month"?me:xe},h))})})]}),!t&&d.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[d.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:C("leaderboard.signin_prompt")}),d.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:C("leaderboard.signin_button")})]}),f&&w&&!Ie&&d.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[d.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:C("leaderboard.sync_prompt")}),d.jsx("button",{onClick:We,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?C("leaderboard.sync_button.busy"):C("leaderboard.sync_button.idle")})]}),d.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[Se,d.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:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[d.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:C("leaderboard.pagination.page_size_label")}),d.jsxs("div",{className:"relative",children:[d.jsx("select",{id:"leaderboard-page-size",value:I,onChange:h=>M(Number(h.target.value)),disabled:L.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:Ot.map(h=>d.jsx("option",{value:h,children:h},h))}),d.jsx(hr,{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"})]})]}),d.jsx("div",{className:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),d.jsx("button",{className:P("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",ce&&!L.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:!ce||L.loading,children:C("leaderboard.pagination.prev")}),d.jsx("div",{className:"flex flex-wrap items-center gap-1",children:_e}),d.jsx("button",{className:P("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Ae&&!L.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:!Ae||L.loading,children:C("leaderboard.pagination.next")})]})]})]})}),d.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:d.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:[d.jsx("p",{children:C("landing.v2.footer.line")}),d.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:C("landing.v2.nav.github")})]})})]})}export{ya as LeaderboardPage};
5
+ `},Nr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Rr(e){let{announcements:t=Nr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Cr}=e;const{announce:a,announcement:i}=wr(),l=ot("DndLiveRegion"),[c,u]=s.useState(!1);if(s.useEffect(()=>{u(!0)},[]),kr(s.useMemo(()=>({onDragStart(f){let{active:b}=f;a(t.onDragStart({active:b}))},onDragMove(f){let{active:b,over:p}=f;t.onDragMove&&a(t.onDragMove({active:b,over:p}))},onDragOver(f){let{active:b,over:p}=f;a(t.onDragOver({active:b,over:p}))},onDragEnd(f){let{active:b,over:p}=f;a(t.onDragEnd({active:b,over:p}))},onDragCancel(f){let{active:b,over:p}=f;a(t.onDragCancel({active:b,over:p}))}}),[a,t])),!c)return null;const g=V.createElement(V.Fragment,null,V.createElement(vr,{id:r,value:o.draggable}),V.createElement(yr,{id:l,announcement:i}));return n?Ge.createPortal(g,n):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 ut(){}function Jt(e,t){return s.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Dr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ue=Object.freeze({x:0,y:0});function kn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Sn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Er(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Zt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Cn(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Qt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const jr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Qt(t,t.left,t.top),a=[];for(const i of r){const{id:l}=i,c=n.get(l);if(c){const u=kn(Qt(c),o);a.push({id:l,data:{droppableContainer:i,value:u}})}}return a.sort(Sn)},Ar=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Zt(t),a=[];for(const i of r){const{id:l}=i,c=n.get(l);if(c){const u=Zt(c),g=o.reduce((b,p,w)=>b+kn(u[w],p),0),f=Number((g/4).toFixed(4));a.push({id:l,data:{droppableContainer:i,value:f}})}}return a.sort(Sn)};function Ir(e,t){const n=Math.max(t.top,e.top),r=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-r,l=a-n;if(r<o&&n<a){const c=t.width*t.height,u=e.width*e.height,g=i*l,f=g/(c+u-g);return Number(f.toFixed(4))}return 0}const Mr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const a of r){const{id:i}=a,l=n.get(i);if(l){const c=Ir(l,t);c>0&&o.push({id:i,data:{droppableContainer:a,value:c}})}}return o.sort(Er)};function Tr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Nn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ue}function Lr(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;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}),{...n})}}const Or=Lr(1);function _r(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 Pr(e,t,n){const r=_r(t);if(!r)return e;const{scaleX:o,scaleY:a,x:i,y:l}=r,c=e.left-i-(1-o)*parseFloat(n),u=e.top-l-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),g=o?e.width/o:e.width,f=a?e.height/a:e.height;return{width:g,height:f,top:u,right:c+g,bottom:u+f,left:c}}const zr={ignoreTransform:!1};function Ue(e,t){t===void 0&&(t=zr);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=q(e).getComputedStyle(e);u&&(n=Pr(n,u,g))}const{top:r,left:o,width:a,height:i,bottom:l,right:c}=n;return{top:r,left:o,width:a,height:i,bottom:l,right:c}}function en(e){return Ue(e,{ignoreTransform:!0})}function Br(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $r(e,t){return t===void 0&&(t=q(e).getComputedStyle(e)),t.position==="fixed"}function Fr(e,t){t===void 0&&(t=q(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?n.test(a):!1})}function pt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Bt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!nt(o)||vn(o)||n.includes(o))return n;const a=q(e).getComputedStyle(o);return o!==e&&Fr(o,a)&&n.push(o),$r(o,a)?n:r(o.parentNode)}return e?r(e):n}function Rn(e){const[t]=pt(e,1);return t??null}function St(e){return!ht||!e?null:$e(e)?e:zt(e)?Bt(e)||e===Fe(e).scrollingElement?window:nt(e)?e:null:null}function Dn(e){return $e(e)?e.scrollX:e.scrollLeft}function En(e){return $e(e)?e.scrollY:e.scrollTop}function Mt(e){return{x:Dn(e),y:En(e)}}var B;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(B||(B={}));function jn(e){return!ht||!e?!1:e===document.scrollingElement}function An(e){const t={x:0,y:0},n=jn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:a,isBottom:i,isRight:l,maxScroll:r,minScroll:t}}const Ur={x:.2,y:.2};function Yr(e,t,n,r,o){let{top:a,left:i,right:l,bottom:c}=n;r===void 0&&(r=10),o===void 0&&(o=Ur);const{isTop:u,isBottom:g,isLeft:f,isRight:b}=An(e),p={x:0,y:0},w={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&a<=t.top+m.height?(p.y=B.Backward,w.y=r*Math.abs((t.top+m.height-a)/m.height)):!g&&c>=t.bottom-m.height&&(p.y=B.Forward,w.y=r*Math.abs((t.bottom-m.height-c)/m.height)),!b&&l>=t.right-m.width?(p.x=B.Forward,w.x=r*Math.abs((t.right-m.width-l)/m.width)):!f&&i<=t.left+m.width&&(p.x=B.Backward,w.x=r*Math.abs((t.left+m.width-i)/m.width)),{direction:p,speed:w}}function Wr(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:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function In(e){return e.reduce((t,n)=>ze(t,Mt(n)),ue)}function Xr(e){return e.reduce((t,n)=>t+Dn(n),0)}function Kr(e){return e.reduce((t,n)=>t+En(n),0)}function Hr(e,t){if(t===void 0&&(t=Ue),!e)return;const{top:n,left:r,bottom:o,right:a}=t(e);Rn(e)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Gr=[["x",["left","right"],Xr],["y",["top","bottom"],Kr]];class Ut{constructor(t,n){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 r=pt(n),o=In(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of Gr)for(const c of i)Object.defineProperty(this,c,{get:()=>{const u=l(r),g=o[a]-u;return this.rect[c]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ve{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Vr(e){const{EventTarget:t}=q(e);return e instanceof t?e:Fe(e)}function Ct(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var se;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(se||(se={}));function tn(e){e.preventDefault()}function qr(e){e.stopPropagation()}var D;(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"})(D||(D={}));const Mn={start:[D.Space,D.Enter],cancel:[D.Esc],end:[D.Space,D.Enter,D.Tab]},Jr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case D.Right:return{...n,x:n.x+25};case D.Left:return{...n,x:n.x-25};case D.Down:return{...n,y:n.y+25};case D.Up:return{...n,y:n.y-25}}};class Yt{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:n}}=t;this.props=t,this.listeners=new Ve(Fe(n)),this.windowListeners=new Ve(q(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(se.Resize,this.handleCancel),this.windowListeners.add(se.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(se.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Hr(r),n(ue)}handleKeyDown(t){if(Ft(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:a=Mn,coordinateGetter:i=Jr,scrollBehavior:l="smooth"}=o,{code:c}=t;if(a.end.includes(c)){this.handleEnd(t);return}if(a.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,g=u?{x:u.left,y:u.top}:ue;this.referenceCoordinates||(this.referenceCoordinates=g);const f=i(t,{active:n,context:r.current,currentCoordinates:g});if(f){const b=Qe(f,g),p={x:0,y:0},{scrollableAncestors:w}=r.current;for(const m of w){const x=t.code,{isTop:k,isRight:N,isLeft:v,isBottom:R,maxScroll:E,minScroll:j}=An(m),S=Wr(m),y={x:Math.min(x===D.Right?S.right-S.width/2:S.right,Math.max(x===D.Right?S.left:S.left+S.width/2,f.x)),y:Math.min(x===D.Down?S.bottom-S.height/2:S.bottom,Math.max(x===D.Down?S.top:S.top+S.height/2,f.y))},I=x===D.Right&&!N||x===D.Left&&!v,O=x===D.Down&&!R||x===D.Up&&!k;if(I&&y.x!==f.x){const M=m.scrollLeft+b.x,J=x===D.Right&&M<=E.x||x===D.Left&&M>=j.x;if(J&&!b.y){m.scrollTo({left:M,behavior:l});return}J?p.x=m.scrollLeft-M:p.x=x===D.Right?m.scrollLeft-E.x:m.scrollLeft-j.x,p.x&&m.scrollBy({left:-p.x,behavior:l});break}else if(O&&y.y!==f.y){const M=m.scrollTop+b.y,J=x===D.Down&&M<=E.y||x===D.Up&&M>=j.y;if(J&&!b.x){m.scrollTo({top:M,behavior:l});return}J?p.y=m.scrollTop-M:p.y=x===D.Down?m.scrollTop-E.y:m.scrollTop-j.y,p.y&&m.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,ze(Qe(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Yt.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Mn,onActivation:o}=t,{active:a}=n;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function nn(e){return!!(e&&"distance"in e)}function rn(e){return!!(e&&"delay"in e)}class Wt{constructor(t,n,r){var o;r===void 0&&(r=Vr(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=n;const{event:a}=t,{target:i}=a;this.props=t,this.events=n,this.document=Fe(i),this.documentListeners=new Ve(this.document),this.listeners=new Ve(r),this.windowListeners=new Ve(q(i)),this.initialCoordinates=(o=It(a))!=null?o:ue,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:n,bypassActivationConstraint:r}}}=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(se.Resize,this.handleCancel),this.windowListeners.add(se.DragStart,tn),this.windowListeners.add(se.VisibilityChange,this.handleCancel),this.windowListeners.add(se.ContextMenu,tn),this.documentListeners.add(se.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(nn(n)){this.handlePending(n);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,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(se.Click,qr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(se.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:a}=this,{onMove:i,options:{activationConstraint:l}}=a;if(!o)return;const c=(n=It(t))!=null?n:ue,u=Qe(o,c);if(!r&&l){if(nn(l)){if(l.tolerance!=null&&Ct(u,l.tolerance))return this.handleCancel();if(Ct(u,l.distance))return this.handleStart()}if(rn(l)&&Ct(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),i(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===D.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Zr={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Xt extends Wt{constructor(t){const{event:n}=t,r=Fe(n.target);super(t,Zr,r)}}Xt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Qr={move:{name:"mousemove"},end:{name:"mouseup"}};var Tt;(function(e){e[e.RightClick=2]="RightClick"})(Tt||(Tt={}));class eo extends Wt{constructor(t){super(t,Qr,Fe(t.event.target))}}eo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Tt.RightClick?!1:(r?.({event:n}),!0)}}];const Nt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class to extends Wt{constructor(t){super(t,Nt)}static setup(){return window.addEventListener(Nt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Nt.move.name,t)};function t(){}}}to.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var qe;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(qe||(qe={}));var ft;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ft||(ft={}));function no(e){let{acceleration:t,activator:n=qe.Pointer,canScroll:r,draggingRect:o,enabled:a,interval:i=5,order:l=ft.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:b}=e;const p=oo({delta:f,disabled:!a}),[w,m]=hr(),x=s.useRef({x:0,y:0}),k=s.useRef({x:0,y:0}),N=s.useMemo(()=>{switch(n){case qe.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case qe.DraggableRect:return o}},[n,o,c]),v=s.useRef(null),R=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===ft.TreeOrder?[...u].reverse():u,[l,u]);s.useEffect(()=>{if(!a||!u.length||!N){m();return}for(const j of E){if(r?.(j)===!1)continue;const S=u.indexOf(j),y=g[S];if(!y)continue;const{direction:I,speed:O}=Yr(j,y,N,t,b);for(const M of["x","y"])p[M][I[M]]||(O[M]=0,I[M]=0);if(O.x>0||O.y>0){m(),v.current=j,w(R,i),x.current=O,k.current=I;return}}x.current={x:0,y:0},k.current={x:0,y:0},m()},[t,R,r,m,a,i,JSON.stringify(N),JSON.stringify(p),w,u,E,g,JSON.stringify(b)])}const ro={x:{[B.Backward]:!1,[B.Forward]:!1},y:{[B.Backward]:!1,[B.Forward]:!1}};function oo(e){let{delta:t,disabled:n}=e;const r=At(t);return rt(o=>{if(n||!r||!o)return ro;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[B.Backward]:o.x[B.Backward]||a.x===-1,[B.Forward]:o.x[B.Forward]||a.x===1},y:{[B.Backward]:o.y[B.Backward]||a.y===-1,[B.Forward]:o.y[B.Forward]||a.y===1}}},[n,t,r])}function ao(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return rt(o=>{var a;return t==null?null:(a=r??o)!=null?a:null},[r,t])}function io(e,t){return s.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,a=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,r)}));return[...n,...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 Lt;(function(e){e.Optimized="optimized"})(Lt||(Lt={}));const on=new Map;function so(e,t){let{dragging:n,dependencies:r,config:o}=t;const[a,i]=s.useState(null),{frequency:l,measure:c,strategy:u}=o,g=s.useRef(e),f=x(),b=Ze(f),p=s.useCallback(function(k){k===void 0&&(k=[]),!b.current&&i(N=>N===null?k:N.concat(k.filter(v=>!N.includes(v))))},[b]),w=s.useRef(null),m=rt(k=>{if(f&&!n)return on;if(!k||k===on||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 R=v.node.current,E=R?new Ut(c(R),R):null;v.rect.current=E,E&&N.set(v.id,E)}return N}return k},[e,a,n,f,c]);return s.useEffect(()=>{g.current=e},[e]),s.useEffect(()=>{f||p()},[n,f]),s.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),s.useEffect(()=>{f||typeof l!="number"||w.current!==null||(w.current=setTimeout(()=>{p(),w.current=null},l))},[l,f,p,...r]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:a!=null};function x(){switch(u){case tt.Always:return!1;case tt.BeforeDragging:return n;default:return!n}}}function Tn(e,t){return rt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function lo(e,t){return Tn(e,t)}function co(e){let{callback:t,disabled:n}=e;const r=$t(t),o=s.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(r)},[r,n]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function bt(e){let{callback:t,disabled:n}=e;const r=$t(t),o=s.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(r)},[n]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function uo(e){return new Ut(Ue(e),e)}function an(e,t,n){t===void 0&&(t=uo);const[r,o]=s.useState(null);function a(){o(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const g=t(e);return JSON.stringify(c)===JSON.stringify(g)?c:g})}const i=co({callback(c){if(e)for(const u of c){const{type:g,target:f}=u;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=bt({callback:a});return pe(()=>{a(),e?(l?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),i?.disconnect())},[e]),r}function fo(e){const t=Tn(e);return Nn(e,t)}const sn=[];function go(e){const t=s.useRef(e),n=rt(r=>e?r&&r!==sn&&e&&t.current&&e.parentNode===t.current.parentNode?r:pt(e):sn,[e]);return s.useEffect(()=>{t.current=e},[e]),n}function ho(e){const[t,n]=s.useState(null),r=s.useRef(e),o=s.useCallback(a=>{const i=St(a.target);i&&n(l=>l?(l.set(i,Mt(i)),new Map(l)):null)},[]);return s.useEffect(()=>{const a=r.current;if(e!==a){i(a);const l=e.map(c=>{const u=St(c);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Mt(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(c=>{const u=St(c);u?.removeEventListener("scroll",o)})}},[o,e]),s.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>ze(a,i),ue):In(e):ue,[e,t])}function ln(e,t){t===void 0&&(t=[]);const n=s.useRef(null);return s.useEffect(()=>{n.current=null},t),s.useEffect(()=>{const r=e!==ue;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Qe(e,n.current):ue}function po(e){s.useEffect(()=>{if(!ht)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function bo(e,t){return s.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:a}=r;return n[o]=i=>{a(i,t)},n},{}),[e,t])}function Ln(e){return s.useMemo(()=>e?Br(e):null,[e])}const cn=[];function mo(e,t){t===void 0&&(t=Ue);const[n]=e,r=Ln(n?q(n):null),[o,a]=s.useState(cn);function i(){a(()=>e.length?e.map(c=>jn(c)?r:new Ut(t(c),c)):cn)}const l=bt({callback:i});return pe(()=>{l?.disconnect(),i(),e.forEach(c=>l?.observe(c))},[e]),o}function xo(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return nt(t)?t:e}function vo(e){let{measure:t}=e;const[n,r]=s.useState(null),o=s.useCallback(u=>{for(const{target:g}of u)if(nt(g)){r(f=>{const b=t(g);return f?{...f,width:b.width,height:b.height}:b});break}},[t]),a=bt({callback:o}),i=s.useCallback(u=>{const g=xo(u);a?.disconnect(),g&&a?.observe(g),r(g?t(g):null)},[t,a]),[l,c]=dt(i);return s.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const yo=[{sensor:Xt,options:{}},{sensor:Yt,options:{}}],wo={current:{}},lt={draggable:{measure:en},droppable:{measure:en,strategy:tt.WhileDragging,frequency:Lt.Optimized},dragOverlay:{measure:Ue}};class Je extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const ko={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:ut},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:lt,measureDroppableContainers:ut,windowRect:null,measuringScheduled:!1},So={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ut,draggableNodes:new Map,over:null,measureDroppableContainers:ut},mt=s.createContext(So),On=s.createContext(ko);function Co(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Je}}}function No(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:n}=t,{id:r}=n,o=new Je(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case z.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const i=new Je(e.droppable.containers);return i.set(n,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case z.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new Je(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Ro(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=s.useContext(mt),a=At(r),i=At(n?.id);return s.useEffect(()=>{if(!t&&!r&&a&&i!=null){if(!Ft(a)||document.activeElement===a.target)return;const l=o.get(i);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[c.current,u.current]){if(!g)continue;const f=mr(g);if(f){f.focus();break}}})}},[r,t,o,i,a]),null}function Do(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...r}),n):n}function Eo(e){return s.useMemo(()=>({draggable:{...lt.draggable,...e?.draggable},droppable:{...lt.droppable,...e?.droppable},dragOverlay:{...lt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function jo(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const a=s.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;pe(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const g=n(u),f=Nn(g,r);if(i||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const b=Rn(u);b&&b.scrollBy({top:f.y,left:f.x})}},[t,i,l,r,n])}const _n=s.createContext({...ue,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 Ao=s.memo(function(t){var n,r,o,a;let{id:i,accessibility:l,autoScroll:c=!0,children:u,sensors:g=yo,collisionDetection:f=Mr,measuring:b,modifiers:p,...w}=t;const m=s.useReducer(No,void 0,Co),[x,k]=m,[N,v]=Sr(),[R,E]=s.useState(Ee.Uninitialized),j=R===Ee.Initialized,{draggable:{active:S,nodes:y,translate:I},droppable:{containers:O}}=x,M=S!=null?y.get(S):null,J=s.useRef({initial:null,translated:null}),Z=s.useMemo(()=>{var X;return S!=null?{id:S,data:(X=M?.data)!=null?X:wo,rect:J}:null},[S,M]),L=s.useRef(null),[be,Ie]=s.useState(null),[K,je]=s.useState(null),ne=Ze(w,Object.values(w)),H=ot("DndDescribedBy",i),Me=s.useMemo(()=>O.getEnabled(),[O]),W=Eo(b),{droppableRects:re,measureDroppableContainers:$,measuringScheduled:fe}=so(Me,{dragging:j,dependencies:[I.x,I.y],config:W.droppable}),_=ao(y,S),Te=s.useMemo(()=>K?It(K):null,[K]),le=qn(),oe=lo(_,W.draggable.measure);jo({activeNode:S!=null?y.get(S):null,config:le.layoutShiftCompensation,initialRect:oe,measure:W.draggable.measure});const A=an(_,W.draggable.measure,oe),we=an(_?_.parentElement:null),G=s.useRef({activatorEvent:null,active:null,activeNode:_,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ke=O.getNodeFor((n=G.current.over)==null?void 0:n.id),ae=vo({measure:W.dragOverlay.measure}),me=(r=ae.nodeRef.current)!=null?r:_,xe=j?(o=ae.rect)!=null?o:A:null,Ye=!!(ae.nodeRef.current&&ae.rect),Le=fo(Ye?null:A),We=Ln(me?q(me):null),ce=go(j?ke??_:null),Ae=mo(ce),Oe=Do(p,{transform:{x:I.x-Le.x,y:I.y-Le.y,scaleX:1,scaleY:1},activatorEvent:K,active:Z,activeNodeRect:A,containerNodeRect:we,draggingNodeRect:xe,over:G.current.over,overlayNodeRect:ae.rect,scrollableAncestors:ce,scrollableAncestorRects:Ae,windowRect:We}),Se=Te?ze(Te,I):null,_e=ho(ce),h=ln(_e),T=ln(_e,[A]),F=ze(Oe,h),ve=xe?Or(xe,Oe):null,Ce=Z&&ve?f({active:Z,collisionRect:ve,droppableRects:re,droppableContainers:Me,pointerCoordinates:Se}):null,at=Cn(Ce,"id"),[U,xt]=s.useState(null),vt=Ye?Oe:ze(Oe,T),Kn=Tr(vt,(a=U?.rect)!=null?a:null,A),yt=s.useRef(null),Kt=s.useCallback((X,Q)=>{let{sensor:ee,options:Ne}=Q;if(L.current==null)return;const ie=y.get(L.current);if(!ie)return;const te=X.nativeEvent,ge=new ee({active:L.current,activeNode:ie,event:te,options:Ne,context:G,onAbort(Y){if(!y.get(Y))return;const{onDragAbort:he}=ne.current,ye={id:Y};he?.(ye),N({type:"onDragAbort",event:ye})},onPending(Y,Re,he,ye){if(!y.get(Y))return;const{onDragPending:Ke}=ne.current,De={id:Y,constraint:Re,initialCoordinates:he,offset:ye};Ke?.(De),N({type:"onDragPending",event:De})},onStart(Y){const Re=L.current;if(Re==null)return;const he=y.get(Re);if(!he)return;const{onDragStart:ye}=ne.current,Xe={activatorEvent:te,active:{id:Re,data:he.data,rect:J}};Ge.unstable_batchedUpdates(()=>{ye?.(Xe),E(Ee.Initializing),k({type:z.DragStart,initialCoordinates:Y,active:Re}),N({type:"onDragStart",event:Xe}),Ie(yt.current),je(te)})},onMove(Y){k({type:z.DragMove,coordinates:Y})},onEnd:Pe(z.DragEnd),onCancel:Pe(z.DragCancel)});yt.current=ge;function Pe(Y){return async function(){const{active:he,collisions:ye,over:Xe,scrollAdjustedTranslate:Ke}=G.current;let De=null;if(he&&Ke){const{cancelDrop:He}=ne.current;De={activatorEvent:te,active:he,collisions:ye,delta:Ke,over:Xe},Y===z.DragEnd&&typeof He=="function"&&await Promise.resolve(He(De))&&(Y=z.DragCancel)}L.current=null,Ge.unstable_batchedUpdates(()=>{k({type:Y}),E(Ee.Uninitialized),xt(null),Ie(null),je(null),yt.current=null;const He=Y===z.DragEnd?"onDragEnd":"onDragCancel";if(De){const wt=ne.current[He];wt?.(De),N({type:He,event:De})}})}}},[y]),Hn=s.useCallback((X,Q)=>(ee,Ne)=>{const ie=ee.nativeEvent,te=y.get(Ne);if(L.current!==null||!te||ie.dndKit||ie.defaultPrevented)return;const ge={active:te};X(ee,Q.options,ge)===!0&&(ie.dndKit={capturedBy:Q.sensor},L.current=Ne,Kt(ee,Q))},[y,Kt]),Ht=io(g,Hn);po(g),pe(()=>{A&&R===Ee.Initializing&&E(Ee.Initialized)},[A,R]),s.useEffect(()=>{const{onDragMove:X}=ne.current,{active:Q,activatorEvent:ee,collisions:Ne,over:ie}=G.current;if(!Q||!ee)return;const te={active:Q,activatorEvent:ee,collisions:Ne,delta:{x:F.x,y:F.y},over:ie};Ge.unstable_batchedUpdates(()=>{X?.(te),N({type:"onDragMove",event:te})})},[F.x,F.y]),s.useEffect(()=>{const{active:X,activatorEvent:Q,collisions:ee,droppableContainers:Ne,scrollAdjustedTranslate:ie}=G.current;if(!X||L.current==null||!Q||!ie)return;const{onDragOver:te}=ne.current,ge=Ne.get(at),Pe=ge&&ge.rect.current?{id:ge.id,rect:ge.rect.current,data:ge.data,disabled:ge.disabled}:null,Y={active:X,activatorEvent:Q,collisions:ee,delta:{x:ie.x,y:ie.y},over:Pe};Ge.unstable_batchedUpdates(()=>{xt(Pe),te?.(Y),N({type:"onDragOver",event:Y})})},[at]),pe(()=>{G.current={activatorEvent:K,active:Z,activeNode:_,collisionRect:ve,collisions:Ce,droppableRects:re,draggableNodes:y,draggingNode:me,draggingNodeRect:xe,droppableContainers:O,over:U,scrollableAncestors:ce,scrollAdjustedTranslate:F},J.current={initial:xe,translated:ve}},[Z,_,Ce,ve,y,me,xe,re,O,U,ce,F]),no({...le,delta:I,draggingRect:ve,pointerCoordinates:Se,scrollableAncestors:ce,scrollableAncestorRects:Ae});const Gn=s.useMemo(()=>({active:Z,activeNode:_,activeNodeRect:A,activatorEvent:K,collisions:Ce,containerNodeRect:we,dragOverlay:ae,draggableNodes:y,droppableContainers:O,droppableRects:re,over:U,measureDroppableContainers:$,scrollableAncestors:ce,scrollableAncestorRects:Ae,measuringConfiguration:W,measuringScheduled:fe,windowRect:We}),[Z,_,A,K,Ce,we,ae,y,O,re,U,$,ce,Ae,W,fe,We]),Vn=s.useMemo(()=>({activatorEvent:K,activators:Ht,active:Z,activeNodeRect:A,ariaDescribedById:{draggable:H},dispatch:k,draggableNodes:y,over:U,measureDroppableContainers:$}),[K,Ht,Z,A,k,H,y,U,$]);return V.createElement(wn.Provider,{value:v},V.createElement(mt.Provider,{value:Vn},V.createElement(On.Provider,{value:Gn},V.createElement(_n.Provider,{value:Kn},u)),V.createElement(Ro,{disabled:l?.restoreFocus===!1})),V.createElement(Rr,{...l,hiddenTextDescribedById:H}));function qn(){const X=be?.autoScrollEnabled===!1,Q=typeof c=="object"?c.enabled===!1:c===!1,ee=j&&!X&&!Q;return typeof c=="object"?{...c,enabled:ee}:{enabled:ee}}}),Io=s.createContext(null),dn="button",Mo="Draggable";function To(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const a=ot(Mo),{activators:i,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:b}=s.useContext(mt),{role:p=dn,roleDescription:w="draggable",tabIndex:m=0}=o??{},x=c?.id===t,k=s.useContext(x?_n:Io),[N,v]=dt(),[R,E]=dt(),j=bo(i,t),S=Ze(n);pe(()=>(f.set(t,{id:t,key:a,node:N,activatorNode:R,data:S}),()=>{const I=f.get(t);I&&I.key===a&&f.delete(t)}),[f,t]);const y=s.useMemo(()=>({role:p,tabIndex:m,"aria-disabled":r,"aria-pressed":x&&p===dn?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[r,p,m,x,w,g.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:y,isDragging:x,listeners:r?void 0:j,node:N,over:b,setNodeRef:v,setActivatorNodeRef:E,transform:k}}function Lo(){return s.useContext(On)}const Oo="Droppable",_o={timeout:25};function Po(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const a=ot(Oo),{active:i,dispatch:l,over:c,measureDroppableContainers:u}=s.useContext(mt),g=s.useRef({disabled:n}),f=s.useRef(!1),b=s.useRef(null),p=s.useRef(null),{disabled:w,updateMeasurementsFor:m,timeout:x}={..._o,...o},k=Ze(m??r),N=s.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(k.current)?k.current:[k.current]),p.current=null},x)},[x]),v=bt({callback:N,disabled:w||!i}),R=s.useCallback((y,I)=>{v&&(I&&(v.unobserve(I),f.current=!1),y&&v.observe(y))},[v]),[E,j]=dt(R),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:r,key:a,disabled:n,node:E,rect:b,data:S}}),()=>l({type:z.UnregisterDroppable,key:a,id:r})),[r]),s.useEffect(()=>{n!==g.current.disabled&&(l({type:z.SetDroppableDisabled,id:r,key:a,disabled:n}),g.current.disabled=n)},[r,a,n,l]),{active:i,rect:b,isOver:c?.id===r,node:E,over:c,setNodeRef:j}}const zo=e=>{let{transform:t}=e;return{...t,y:0}};function Pn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Bo(e,t){return e.reduce((n,r,o)=>{const a=t.get(r);return a&&(n[o]=a),n},Array(e.length))}function it(e){return e!==null&&e>=0}function $o(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Fo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const st={scaleX:1,scaleY:1},Uo=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:a,index:i}=e;const l=(t=n[o])!=null?t:r;if(!l)return null;const c=Yo(n,i,o);if(i===o){const u=n[a];return u?{x:o<a?u.left+u.width-(l.left+l.width):u.left-l.left,y:0,...st}:null}return i>o&&i<=a?{x:-l.width-c,y:0,...st}:i<o&&i>=a?{x:l.width+c,y:0,...st}:{x:0,y:0,...st}};function Yo(e,t,n){const r=e[t],o=e[t-1],a=e[t+1];return!r||!o&&!a?0:n<t?o?r.left-(o.left+o.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(o.left+o.width)}const zn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const a=Pn(t,r,n),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}},Bn="Sortable",$n=V.createContext({activeIndex:-1,containerId:Bn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:zn,disabled:{draggable:!1,droppable:!1}});function Wo(e){let{children:t,id:n,items:r,strategy:o=zn,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:c,over:u,measureDroppableContainers:g}=Lo(),f=ot(Bn,n),b=l.rect!==null,p=s.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),w=i!=null,m=i?p.indexOf(i.id):-1,x=u?p.indexOf(u.id):-1,k=s.useRef(p),N=!$o(p,k.current),v=x!==-1&&m===-1||N,R=Fo(a);pe(()=>{N&&w&&g(p)},[N,p,w,g]),s.useEffect(()=>{k.current=p},[p]);const E=s.useMemo(()=>({activeIndex:m,containerId:f,disabled:R,disableTransforms:v,items:p,overIndex:x,useDragOverlay:b,sortedRects:Bo(p,c),strategy:o}),[m,f,R.draggable,R.droppable,v,p,x,c,b,o]);return V.createElement($n.Provider,{value:E},t)}const Xo=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Pn(n,r,o).indexOf(t)},Ko=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:a,newIndex:i,previousItems:l,previousContainerId:c,transition:u}=e;return!u||!r||l!==a&&o===i?!1:n?!0:i!==o&&t===c},Ho={duration:200,easing:"ease"},Fn="transform",Go=et.Transition.toString({property:Fn,duration:0,easing:"linear"}),Vo={roleDescription:"sortable"};function qo(e){let{disabled:t,index:n,node:r,rect:o}=e;const[a,i]=s.useState(null),l=s.useRef(n);return pe(()=>{if(!t&&n!==l.current&&r.current){const c=o.current;if(c){const u=Ue(r.current,{ignoreTransform:!0}),g={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(g.x||g.y)&&i(g)}}n!==l.current&&(l.current=n)},[t,n,r,o]),s.useEffect(()=>{a&&i(null)},[a]),a}function Jo(e){let{animateLayoutChanges:t=Ko,attributes:n,disabled:r,data:o,getNewIndex:a=Xo,id:i,strategy:l,resizeObserverConfig:c,transition:u=Ho}=e;const{items:g,containerId:f,activeIndex:b,disabled:p,disableTransforms:w,sortedRects:m,overIndex:x,useDragOverlay:k,strategy:N}=s.useContext($n),v=Zo(r,p),R=g.indexOf(i),E=s.useMemo(()=>({sortable:{containerId:f,index:R,items:g},...o}),[f,o,R,g]),j=s.useMemo(()=>g.slice(g.indexOf(i)),[g,i]),{rect:S,node:y,isOver:I,setNodeRef:O}=Po({id:i,data:E,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...c}}),{active:M,activatorEvent:J,activeNodeRect:Z,attributes:L,setNodeRef:be,listeners:Ie,isDragging:K,over:je,setActivatorNodeRef:ne,transform:H}=To({id:i,data:E,attributes:{...Vo,...n},disabled:v.draggable}),Me=gr(O,be),W=!!M,re=W&&!w&&it(b)&&it(x),$=!k&&K,fe=$&&re?H:null,Te=re?fe??(l??N)({rects:m,activeNodeRect:Z,activeIndex:b,overIndex:x,index:R}):null,le=it(b)&&it(x)?a({id:i,items:g,activeIndex:b,overIndex:x}):R,oe=M?.id,A=s.useRef({activeId:oe,items:g,newIndex:le,containerId:f}),we=g!==A.current.items,G=t({active:M,containerId:f,isDragging:K,isSorting:W,id:i,index:R,items:g,newIndex:A.current.newIndex,previousItems:A.current.items,previousContainerId:A.current.containerId,transition:u,wasDragging:A.current.activeId!=null}),ke=qo({disabled:!G,index:R,node:y,rect:S});return s.useEffect(()=>{W&&A.current.newIndex!==le&&(A.current.newIndex=le),f!==A.current.containerId&&(A.current.containerId=f),g!==A.current.items&&(A.current.items=g)},[W,le,f,g]),s.useEffect(()=>{if(oe===A.current.activeId)return;if(oe&&!A.current.activeId){A.current.activeId=oe;return}const me=setTimeout(()=>{A.current.activeId=oe},50);return()=>clearTimeout(me)},[oe]),{active:M,activeIndex:b,attributes:L,data:E,rect:S,index:R,newIndex:le,items:g,isOver:I,isSorting:W,isDragging:K,listeners:Ie,node:y,overIndex:x,over:je,setNodeRef:Me,setActivatorNodeRef:ne,setDroppableNodeRef:O,setDraggableNodeRef:be,transform:ke??Te,transition:ae()};function ae(){if(ke||we&&A.current.newIndex===R)return Go;if(!($&&!Ft(J)||!u)&&(W||G))return et.Transition.toString({...u,property:Fn})}}function Zo(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function gt(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 Qo=[D.Down,D.Right,D.Up,D.Left],ea=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:a,over:i,scrollableAncestors:l}}=t;if(Qo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const c=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const b=o.get(f.id);if(b)switch(e.code){case D.Down:r.top<b.top&&c.push(f);break;case D.Up:r.top>b.top&&c.push(f);break;case D.Left:r.left>b.left&&c.push(f);break;case D.Right:r.left<b.left&&c.push(f);break}});const u=Ar({collisionRect:r,droppableRects:o,droppableContainers:c});let g=Cn(u,"id");if(g===i?.id&&u.length>1&&(g=u[1].id),g!=null){const f=a.get(n.id),b=a.get(g),p=b?o.get(b.id):null,w=b?.node.current;if(w&&p&&f&&b){const x=pt(w).some((j,S)=>l[S]!==j),k=Un(f,b),N=ta(f,b),v=x||!k?{x:0,y:0}:{x:N?r.width-p.width:0,y:N?r.height-p.height:0},R={x:p.left,y:p.top};return v.x&&v.y?R:Qe(R,v)}}}};function Un(e,t){return!gt(e)||!gt(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ta(e,t){return!gt(e)||!gt(t)||!Un(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Be(e,{min:t,max:n,fallback:r}){const o=Number(e);if(!Number.isFinite(o))return r;const a=Math.floor(o);return a<t?t:a>n?n:a}function na(e,t){const n=Be(t,{min:0,max:1e6,fallback:0}),r=Be(e,{min:1,max:Math.max(1,n||1),fallback:1});if(n<=1)return[1];const o=new Set([1,n,r-2,r-1,r,r+1,r+2]),a=Array.from(o).filter(c=>Number.isInteger(c)&&c>=1&&c<=n).sort((c,u)=>c-u),i=[];let l=null;for(const c of a)l!=null&&c-l>1&&i.push(null),i.push(c),l=c;return i}function ra({page:e,totalPages:t}){const n=typeof t=="number"&&Number.isFinite(t)&&t>=0,r=n?Be(t,{min:0,max:1e6,fallback:0}):null,o=Be(e,{min:1,max:n?Math.max(1,r||1):1e6,fallback:1}),a=o>1,i=n?o<r:!0;return{canPrev:a,canNext:i,safePage:o,safeTotal:r}}function oa({entries:e,me:t,meLabel:n,limit:r}){const o=Be(r,{min:1,max:1e3,fallback:20}),a=Array.isArray(e)?e.slice(0,o):[],i=t&&typeof t.rank=="number"?t.rank:null,l=a.some(w=>!!w?.is_me);if(!i||l)return a;const c={rank:i,is_me:!0,display_name:n,avatar_url:null,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"},u=a.filter(w=>!w?.is_me),g=u[u.length-1],f=g&&typeof g.rank=="number"?g.rank:0;return i>f+1?[...u.slice(0,Math.max(0,o-2)),{is_ellipsis:!0,rank:null,display_name:""},c]:[...u.slice(0,Math.max(0,o-1)),c]}function de({className:e}){return d.jsx("div",{className:P("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function aa({index:e}){const t=e<3?"w-24":e<8?"w-20":"w-16",n=e<3?"w-16":"w-12",r=e<5?"w-14":"w-10";return d.jsxs("tr",{className:"group",children:[d.jsx("td",{className:P(Et(!1),"!group-hover:bg-transparent"),children:d.jsx(de,{className:"h-4 w-6"})}),d.jsx("td",{className:P(jt(!1),"!group-hover:bg-transparent"),children:d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(de,{className:"h-8 w-8 min-w-8 rounded-full"}),d.jsx(de,{className:P("h-4",t)})]})}),d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:P("h-4",n)})}),d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:"h-4 w-12"})}),ct.map(o=>d.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:d.jsx(de,{className:P("h-4",r)})},o.key))]})}function ia({rows:e=10}){return d.jsx("div",{className:"w-full overflow-x-auto",children:d.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:d.jsxs("tr",{children:[d.jsx("th",{className:P(mn,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(de,{className:"h-3.5 w-6"})}),d.jsx("th",{className:P(xn,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(de,{className:"h-3.5 w-12"})}),d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-10"})}),d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-14"})}),ct.map(t=>d.jsx("th",{className:"px-4 py-4",children:d.jsx(de,{className:"h-3.5 w-12"})},t.key))]})}),d.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:e},(t,n)=>d.jsx(aa,{index:n},n))})]})})}function sa({id:e,thClassName:t,children:n}){const{attributes:r,listeners:o,setNodeRef:a,transform:i,transition:l,isDragging:c}=Jo({id:e}),u=et.Transform.toString(i)||"";s.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${e}"]`),b="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(p=>{p.style.transform=u,p.style.transition=l||"",p.style.zIndex=c?"20":"",p.style.position=u?"relative":"",p.style.boxShadow=c?b:""}),()=>{f.forEach(p=>{p.style.transform="",p.style.transition="",p.style.zIndex="",p.style.position="",p.style.boxShadow=""})}},[e,u,l,c]);const g={transform:u,transition:l,position:u?"relative":void 0,zIndex:c?20:void 0,boxShadow:c?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return d.jsx("th",{ref:a,style:g,className:P(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...r,...o,children:d.jsxs("div",{className:"flex items-center justify-end gap-2",children:[d.jsx("span",{"aria-hidden":"true",className:P("-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",c&&"opacity-100"),children:d.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[d.jsx("circle",{cx:"2",cy:"2",r:"1"}),d.jsx("circle",{cx:"6",cy:"2",r:"1"}),d.jsx("circle",{cx:"2",cy:"7",r:"1"}),d.jsx("circle",{cx:"6",cy:"7",r:"1"}),d.jsx("circle",{cx:"2",cy:"12",r:"1"}),d.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),n]})})}const Yn="tokentracker.leaderboard.columnOrder.v1";function la(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Yn);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):null}catch{return null}}function Rt(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Yn,JSON.stringify(e))}catch{}}function un(e,t){if(!e)return t;const n=new Set(t),r=e.filter(a=>n.has(a)),o=t.filter(a=>!r.includes(a));return[...r,...o]}function ca(e){const t=s.useMemo(()=>e.join("|"),[e]),[n,r]=s.useState(()=>un(la(),e));s.useEffect(()=>{r(i=>{const l=un(i,e);return l.length===i.length&&l.every((u,g)=>u===i[g])?i:(Rt(l),l)})},[t,e]);const o=s.useCallback((i,l)=>{!i||!l||i===l||r(c=>{const u=c.indexOf(i),g=c.indexOf(l);if(u===-1||g===-1)return c;const f=c.slice(),[b]=f.splice(u,1);return f.splice(g,0,b),Rt(f),f})},[]),a=s.useCallback(()=>{Rt(e),r(e)},[e]);return{order:n,reorder:o,reset:a}}const Ot=[10,20,50,100],_t=20,Wn="tokentracker:leaderboard:pageSize";function da(){if(typeof window>"u")return _t;try{const e=window.localStorage.getItem(Wn),t=Number(e);if(Ot.includes(t))return t}catch{}return _t}function fn(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 gn(e,t,n){const r=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 n.map(a=>d.jsx("td",{"data-column-key":a.key,className:P("px-4 py-4 whitespace-nowrap text-right tabular-nums",r,o),children:Dt(e?.[a.key])},a.key))}const ua={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 hn({rank:e,placeholder:t}){const n=ua[e];return n?d.jsx("span",{className:P("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",n.text,n.badge),children:e}):d.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:e??t})}function Pt(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t==="week"||t==="month"||t==="total"?t:null}function fa(e){if(!e)return C("shared.error.prefix",{error:C("leaderboard.error.unknown")});const t=e?.message||String(e),n=String(t||"").trim()||C("leaderboard.error.unknown");return C("shared.error.prefix",{error:n})}function Xn(e){return typeof e!="string"?"":e.trim()}function ga(e){const t=Xn(e);return t?t.toLowerCase()==="anonymous":!0}function ha(e,t=""){if(typeof e!="string")return null;const n=e.trim().toLowerCase();if(!n)return null;const r=new URLSearchParams(typeof t=="string"?t:""),o=Pt(r.get("period")),a=o?`?period=${o}`:"";return`/share/pv1-${n}${a}`}function pn(e,t){const n=typeof e?.user_id=="string"?e.user_id.trim():"";return n||`${e?.rank??""}:${t}`}function bn({githubUrl:e}){return d.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[d.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:t=>t.stopPropagation(),"aria-label":C("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:d.jsx(dr,{provider:"GITHUB",size:16})}),d.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:[d.jsx("span",{className:"block",children:C("leaderboard.github.tooltipAction")}),d.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[C("leaderboard.github.tooltipPrefix")," ",d.jsx(ir,{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:C("leaderboard.github.tooltipSettingsLink")}),C("leaderboard.github.tooltipSuffix")]})]})]})}function va({auth:e,signedIn:t,sessionSoftExpired:n}){const r=Jn(),o=Zn(),{openLoginModal:a}=Qn(),{signedIn:i,loading:l,user:c}=er(),u=s.useMemo(()=>tr(),[]),g=nr(),f=t&&!n,b=s.useMemo(()=>f&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,f]),p=f?b:null,w=f&&rr(p),m=C("shared.placeholder.short"),x=s.useMemo(()=>ct.map(h=>h.key),[]),{order:k,reorder:N}=ca(x),v=s.useMemo(()=>{const h=new Map;for(const T of ct)h.set(T.key,T);return h},[]),R=s.useMemo(()=>k.map(h=>v.get(h)).filter(Boolean),[k,v]),E=Dr(Jt(Xt,{activationConstraint:{distance:6}}),Jt(Yt,{coordinateGetter:ea})),j=s.useCallback(h=>{const{active:T,over:F}=h;!F||T.id===F.id||N(String(T.id),String(F.id))},[N]),[S,y]=s.useState(1),[I,O]=s.useState(da),M=s.useCallback(h=>{const T=Ot.includes(h)?h:_t;O(T),y(1);try{window.localStorage.setItem(Wn,String(T))}catch{}},[]),[J,Z]=s.useState(0),[L,be]=s.useState(()=>({loading:!1,error:null,data:null})),[Ie,K]=s.useState(()=>or()),[je,ne]=s.useState(!1),H=s.useMemo(()=>{const h=new URLSearchParams(r?.search||"");return Pt(h.get("period"))||"total"},[r?.search]),Me=r?.search||"",W=h=>{const T=Pt(h);if(!T||T===H)return;const F=new URLSearchParams(r?.search||"");F.set("period",T),y(1),o(`${r?.pathname||"/leaderboard"}?${F.toString()}`,{replace:!0})};s.useEffect(()=>{l||g||i||a()},[i,l,g,a]),s.useEffect(()=>{y(1)},[H]);const re=s.useMemo(()=>(Be(S,{min:1,max:1e6,fallback:1})-1)*I,[S,I]);s.useEffect(()=>{if(!u&&!g)return;let h=!0;return be(T=>({...T,loading:!0,error:null})),(async()=>{const T=await ar({userId:c?.id||null,period:H,limit:I,offset:re});h&&be({loading:!1,error:null,data:T})})().catch(T=>{h&&be({loading:!1,error:fa(T),data:null})}),()=>{h=!1}},[u,c?.id,re,J,g,H,I]);const $=L.data,fe=$?.total_pages??null,_=$?.page??S,Te=s.useMemo(()=>na(_,fe),[_,fe]),le=$?.from||null,oe=$?.to||null,A=$?.generated_at||null,we=$?.me||null,G=C("leaderboard.me_label"),ke=C("leaderboard.anon_label"),ae=C("leaderboard.period.week"),me=C("leaderboard.period.month"),xe=C("leaderboard.period.total"),Ye=H==="month"?me:H==="total"?xe:ae,Le=s.useMemo(()=>{const h=Array.isArray($?.entries)?$.entries:[];return _!==1?h:oa({entries:h,me:we,meLabel:G,limit:I})},[_,$?.entries,we,G,I]),We=async()=>{ne(!0);try{sr(!0),K(!0),await lr(()=>Gt(p));const h=await Gt(p);h&&await cr({accessToken:h,period:H,source:"leaderboard-enable-sync"}),Z(T=>T+1)}catch(h){console.warn("[tokentracker] sync:",h)}finally{ne(!1)}},{canPrev:ce,canNext:Ae}=ra({page:_,totalPages:fe}),Oe=Array.isArray(Le)&&Le.length!==0;let Se=null;L.loading?Se=d.jsx(ia,{rows:I}):L.error?Se=d.jsx("div",{className:"px-6 py-12 text-center",children:d.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:L.error})}):Oe?Se=d.jsx(Ao,{sensors:E,collisionDetection:jr,modifiers:[zo],onDragEnd:j,children:d.jsx("div",{className:"w-full overflow-x-auto",children:d.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[d.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:d.jsxs("tr",{children:[d.jsx("th",{className:P(mn,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:C("leaderboard.column.rank")}),d.jsx("th",{className:P(xn,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:C("leaderboard.column.user")}),d.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:C("leaderboard.column.total")}),d.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:C("leaderboard.column.est_cost")}),d.jsx(Wo,{items:k,strategy:Uo,children:R.map(h=>d.jsx(sa,{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:d.jsx(ur,{iconSrc:h.icon,label:C(h.copyKey)})},h.key))})]})}),d.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Le.map((h,T)=>{if(h?.is_ellipsis){const vt=4+R.length;return d.jsx("tr",{"aria-hidden":"true",children:d.jsx("td",{colSpan:vt,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-${T}`)}const F=!!h?.is_me,ve=typeof h?.user_id=="string"?h.user_id:null,Ce=Xn(h?.display_name),at=ga(Ce)?ke:Ce,U=F?G:at;return!!ve&&!F&&!!h?.is_public&&ha(ve,Me),F?d.jsxs("tr",{className:"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30 bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",children:[d.jsx("td",{className:P(Et(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400"),children:d.jsx(hn,{rank:h?.rank,placeholder:m})}),d.jsx("td",{className:jt(!0),children:d.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[d.jsx(Vt,{avatarUrl:h?.avatar_url,displayName:U,seed:pn(h,U)}),d.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:U}),h?.github_url&&d.jsx(bn,{githubUrl:h.github_url})]})}),d.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:Dt(h?.total_tokens)}),d.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:fn(h?.estimated_cost_usd)}),gn(h,!0,R)]},`row-${h?.rank}-${U}`):d.jsxs("tr",{className:"group transition-colors",children:[d.jsx("td",{className:P(Et(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:d.jsx(hn,{rank:h?.rank,placeholder:m})}),d.jsx("td",{className:jt(!1),children:d.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[d.jsx(Vt,{avatarUrl:h?.avatar_url,displayName:U,seed:pn(h,U)}),d.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:U}),h?.github_url&&d.jsx(bn,{githubUrl:h.github_url})]})}),d.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:Dt(h?.total_tokens)}),d.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:fn(h?.estimated_cost_usd)}),gn(h,!1,R)]},`row-${h?.rank}-${U}`)})})]})})}):Se=d.jsx("div",{className:"px-6 py-12 text-center",children:d.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:C("leaderboard.empty")})});let _e=null;return typeof fe=="number"?_e=Te.map((h,T)=>h==null?d.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:C("leaderboard.pagination.ellipsis")},`ellipsis-${T}`):d.jsx("button",{className:P("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",h===_?"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:L.loading,children:String(h)},`page-${h}`)):_e=d.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:C("leaderboard.pagination.page_unknown",{page:String(_)})}),d.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[d.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:d.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[d.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-6 mb-8",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:C("leaderboard.title")}),d.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[H==="total"?C("leaderboard.range.total"):le&&oe?C("leaderboard.range",{period:Ye,from:le,to:oe}):C("leaderboard.range_loading",{period:Ye}),A&&d.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:C("leaderboard.generated_at",{ts:A})})]})]}),d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("div",{className:"inline-flex p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-lg",children:["week","month","total"].map(h=>d.jsx("button",{onClick:()=>W(h),disabled:L.loading,className:P("px-4 py-1.5 text-sm font-medium rounded-md transition-colors",H===h?"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:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:h==="week"?ae:h==="month"?me:xe},h))})})]}),!t&&d.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[d.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:C("leaderboard.signin_prompt")}),d.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:C("leaderboard.signin_button")})]}),f&&w&&!Ie&&d.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[d.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:C("leaderboard.sync_prompt")}),d.jsx("button",{onClick:We,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?C("leaderboard.sync_button.busy"):C("leaderboard.sync_button.idle")})]}),d.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[Se,d.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:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[d.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:C("leaderboard.pagination.page_size_label")}),d.jsxs("div",{className:"relative",children:[d.jsx("select",{id:"leaderboard-page-size",value:I,onChange:h=>M(Number(h.target.value)),disabled:L.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:Ot.map(h=>d.jsx("option",{value:h,children:h},h))}),d.jsx(fr,{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"})]})]}),d.jsx("div",{className:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),d.jsx("button",{className:P("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",ce&&!L.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:!ce||L.loading,children:C("leaderboard.pagination.prev")}),d.jsx("div",{className:"flex flex-wrap items-center gap-1",children:_e}),d.jsx("button",{className:P("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Ae&&!L.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:!Ae||L.loading,children:C("leaderboard.pagination.next")})]})]})]})}),d.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:d.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:[d.jsx("p",{children:C("landing.v2.footer.line")}),d.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:C("landing.v2.nav.github")})]})})]})}export{va as LeaderboardPage};
@@ -0,0 +1 @@
1
+ import{r as n,D as e,a8 as H,C as K,aa as W,h as Y,j as Z,ae as G,ag as q,B as a,a7 as L,a4 as B,L as E,ah as F,ai as J}from"./main-jua4nv-E.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-DRc_1zw2.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:b,className:d="",direction:p="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 ${p==="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:()=>{b(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),b=String(s||"").trim()||a("leaderboard.error.unknown");return a("shared.error.prefix",{error:b})}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 me({auth:r,signedIn:s,sessionSoftExpired:b,userId:d}){const p=H(),{theme:T,resolvedTheme:c,setTheme:k}=K(),h=n.useMemo(()=>W(),[]),x=Y(),i=s&&!b,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(p?.search||"");return de(o.get("period"))||"week"},[p?.search]),_=p?.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 D=await q({accessToken:f,userId:d,period:m});o&&w({loading:!1,error:null,data:D})})().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"),U=a("leaderboard.period.month"),$=a("leaderboard.period.total"),R=m==="month"?U:m==="total"?$: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(F,{})})]}),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(J,{})]})]})}),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{me as LeaderboardProfilePage};
@@ -0,0 +1,2 @@
1
+ import{D as r,a7 as _,B as o,r as b,L as f,aj as j}from"./main-jua4nv-E.js";import{u as v}from"./use-usage-limits-B0OYz2eA.js";import{u as k}from"./use-limits-display-prefs-CtpaNbnl.js";import{C as y}from"./Card-Cwz-PEn8.js";import{F as N}from"./FadeIn-CKfrd1Vn.js";const L=[3,2,3,3,2,2,3];function d({className:s}){return r.jsx("div",{className:_("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",s)})}function P(){return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(d,{className:"h-3 w-12 shrink-0"}),r.jsx(d,{className:"flex-1 h-1.5 rounded-full min-w-0"}),r.jsx(d,{className:"h-3 w-[30px] shrink-0"}),r.jsx(d,{className:"h-3 w-6 shrink-0"})]})}function C({bars:s,index:e}){const l=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(d,{className:"h-[14px] w-[14px] rounded shrink-0"}),r.jsx(d,{className:_("h-4",l)})]}),Array.from({length:s},(i,a)=>r.jsx(P,{},a))]})}function E(){return r.jsx(y,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(d,{className:"h-3.5 w-28"}),L.map((s,e)=>r.jsx(C,{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 l=e-Date.now();if(l<=0)return o("shared.time.now");const i=Math.floor(l/6e4);if(i<60)return`${i}m`;const a=Math.floor(i/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function O(s){return s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500"}function n({label:s,pct:e,reset:l}){const i=Math.max(0,Math.min(100,Number(e)||0)),a=Math.round(i),x=i>0&&a===0?Math.max(i,.35):i,u=i>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:`${O(a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${x}%`,minWidth:i>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:[u,"%"]}),l?r.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:l}):null]})}function c({name:s,icon:e,children:l}){const a=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.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})]}),l]})}const T=["claude","codex","cursor","gemini","kiro","copilot","antigravity"];function R(s,e){if(!(i=>i?.configured&&!i.error)(e))return null;switch(s){case"claude":return r.jsxs(c,{name:"Claude",icon:"/brand-logos/claude-code.svg",children:[e.five_hour?r.jsx(n,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?r.jsx(n,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?r.jsx(n,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null]},"claude");case"codex":return r.jsxs(c,{name:"Codex",icon:"/brand-logos/codex.svg",children:[e.primary_window?r.jsx(n,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null]},"codex");case"cursor":return r.jsxs(c,{name:"Cursor",icon:"/brand-logos/cursor.svg",children:[e.primary_window?r.jsx(n,{label:o("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:o("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(n,{label:o("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null]},"cursor");case"gemini":return r.jsxs(c,{name:"Gemini",icon:"/brand-logos/gemini.svg",children:[e.primary_window?r.jsx(n,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(n,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null]},"gemini");case"kiro":return r.jsxs(c,{name:"Kiro",icon:"/brand-logos/kiro.svg",children:[e.primary_window?r.jsx(n,{label:o("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:o("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null]},"kiro");case"antigravity":return r.jsxs(c,{name:"Antigravity",icon:"/brand-logos/antigravity.svg",children:[e.primary_window?r.jsx(n,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(n,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null]},"antigravity");case"copilot":return r.jsxs(c,{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg",children:[e.primary_window?r.jsx(n,{label:o("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(n,{label:o("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.otel_has_files||e.otel_enabled?null:r.jsx(D,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function D({defaultDir:s}){const[e,l]=b.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
+ `),x=async()=>{try{await navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!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:o("limits.copilot.otelHint.title")}),r.jsx("div",{className:"mt-0.5 leading-snug",children:o("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:x,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?o("limits.copilot.otelHint.copied"):o("limits.copilot.otelHint.copy")})]})}function I({claude:s,codex:e,cursor:l,gemini:i,kiro:a,antigravity:x,copilot:u,order:p,visibility:w}){const h={claude:s,codex:e,cursor:l,gemini:i,kiro:a,antigravity:x,copilot:u},g=(Array.isArray(p)&&p.length>0?p:T).filter(m=>!w||w[m]!==!1).map(m=>R(m,h[m])).filter(Boolean);return g.length===0?null:r.jsx(N,{delay:.15,children:r.jsx(y,{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:o("limits.panel.title")}),g]})})})}function $(){const{data:s,error:e,isLoading:l}=v({initialRefresh:!0}),i=k();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:o("nav.limits")}),r.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:o("limits.page.subtitle")})]}),r.jsx(f,{to:"/settings","aria-label":o("limits.page.openSettings"),title:o("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(j,{className:"h-4 w-4","aria-hidden":!0})})]}),l?r.jsx(E,{}):r.jsxs(r.Fragment,{children:[e?r.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:o("shared.error.prefix",{error:e})}):null,r.jsx(I,{claude:s?.claude,codex:s?.codex,cursor:s?.cursor,gemini:s?.gemini,kiro:s?.kiro,antigravity:s?.antigravity,copilot:s?.copilot,order:i.order,visibility:i.visibility})]})]})})})}export{$ as LimitsPage};