tokentracker-cli 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dashboard/dist/assets/{ActivityHeatmap-ByU2hUad.js → ActivityHeatmap-DUgsI1KA.js} +1 -1
- package/dashboard/dist/assets/{Card-Ca3xp-bE.js → Card-DQ4KSzOX.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-Bcw_9-IO.js → DashboardPage-mXGQVJX7.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-Ck-viWfZ.js → DevicePage-DXZ8_moI.js} +1 -1
- package/dashboard/dist/assets/{DialogTitle-BL4bLqSk.js → DialogTitle-CTBUN69H.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CzwCZV5v.js → FadeIn-tXZ_F06C.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-DMVEHsGB.js → HeaderGithubStar-Cx90zSdj.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-Kue6GQzA.js → IpCheckPage-CALEO2vH.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-DMM_pvjg.js → LandingPage-Dj1I4sGB.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-eipAcwXo.js → LeaderboardAvatar-BMyPO6e0.js} +1 -1
- package/dashboard/dist/assets/LeaderboardPage-CsXiMWQt.js +6 -0
- package/dashboard/dist/assets/LeaderboardProfileModal-CGLKlwLV.js +72 -0
- package/dashboard/dist/assets/LeaderboardProfilePage-BQKgb92h.js +1 -0
- package/dashboard/dist/assets/{LimitsPage-C7BNYXFU.js → LimitsPage-BbP-OgyM.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-BQZX-oGe.js → LocalOnlyNotice-CiR5RLtx.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-DCeTFjDp.js → LoginPage-DrHY8Nz8.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-CkuS9QnS.js → PopoverPopup-B-pG30bS.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-L6z81yHi.js → ProviderIcon-BX8tNkV1.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-jMeX-2mJ.js +1 -0
- package/dashboard/dist/assets/{SkillsPage-DRENeHeR.js → SkillsPage-CuIVvKSg.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-CzGqO3Nj.js → WidgetsPage-B4qxj2fO.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-BklzxKVW.js → WrappedPage-BSt0DgNG.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-DVWbxoR_.js → arrow-up-right-DZbOFuAl.js} +1 -1
- package/dashboard/dist/assets/check-Ce_bYWhj.js +1 -0
- package/dashboard/dist/assets/{chevron-down-DtOT9b1q.js → chevron-down-XmOalYxj.js} +1 -1
- package/dashboard/dist/assets/{download-CMXwYo7E.js → download-DnBTdIEl.js} +1 -1
- package/dashboard/dist/assets/{info-CxuBFHAT.js → info-86V2x0oj.js} +1 -1
- package/dashboard/dist/assets/main-B4LHBtUR.js +854 -0
- package/dashboard/dist/assets/main-ClqhPPd3.css +1 -0
- package/dashboard/dist/assets/{use-limits-display-prefs-B6zAQQ9V.js → use-limits-display-prefs-CKZVfJaX.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-C0ZhPtTY.js → use-native-settings-D6FpZmw6.js} +1 -1
- package/dashboard/dist/assets/{use-reduced-motion-Y1TUDKSE.js → use-reduced-motion-Cg57a_M3.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-D1NiUjpg.js → use-usage-limits-CqQQaZ8g.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-BCgpAcqK.js → useCurrency-D4WRq_Qm.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/LeaderboardPage-Dr-vs4Wk.js +0 -6
- package/dashboard/dist/assets/LeaderboardProfileModal-CuALURRh.js +0 -72
- package/dashboard/dist/assets/LeaderboardProfilePage-ZXEbQGx5.js +0 -1
- package/dashboard/dist/assets/SettingsPage-Dwz2e9_F.js +0 -1
- package/dashboard/dist/assets/check-CQ-rAjt3.js +0 -1
- package/dashboard/dist/assets/main-DUAOJz8d.css +0 -1
- package/dashboard/dist/assets/main-ucQlYWcW.js +0 -847
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-CuALURRh.js","assets/main-ucQlYWcW.js","assets/main-DUAOJz8d.css","assets/useCurrency-BCgpAcqK.js","assets/LeaderboardAvatar-eipAcwXo.js","assets/ProviderIcon-L6z81yHi.js","assets/ActivityHeatmap-ByU2hUad.js","assets/info-CxuBFHAT.js","assets/arrow-up-right-DVWbxoR_.js","assets/DialogTitle-BL4bLqSk.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as Jr,r as i,R as q,aa as rt,C as c,S as T,B as y,ab as Zr,ac as Qr,T as en,U as tn,ad as rn,h as nn,j as on,ae as an,W as sn,a6 as Tt,D as ln,L as cn,E as dn,af as un,ag as fn,ah as Qt,ai as gn,_ as hn,H as bn}from"./main-ucQlYWcW.js";import{P as pn}from"./ProviderIcon-L6z81yHi.js";import{u as mn}from"./useCurrency-BCgpAcqK.js";import{L as Lt}from"./LeaderboardAvatar-eipAcwXo.js";import{C as xn}from"./chevron-down-DtOT9b1q.js";const vn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],yn=Jr("arrow-right",vn);function wn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const kt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ye(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Wt(e){return"nodeType"in e}function J(e){var t,r;return e?Ye(e)?e:Wt(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Xt(e){const{Document:t}=J(e);return e instanceof t}function ut(e){return Ye(e)?!1:e instanceof J(e).HTMLElement}function wr(e){return e instanceof J(e).SVGElement}function We(e){return e?Ye(e)?e.document:Wt(e)?Xt(e)?e:ut(e)||wr(e)?e.ownerDocument:document:document:document}const pe=kt?i.useLayoutEffect:i.useEffect;function Ht(e){const t=i.useRef(e);return pe(()=>{t.current=e}),i.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function kn(){const e=i.useRef(null),t=i.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=i.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function it(e,t){t===void 0&&(t=[e]);const r=i.useRef(e);return pe(()=>{r.current!==e&&(r.current=e)},t),r}function ft(e,t){const r=i.useRef();return i.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function mt(e){const t=Ht(e),r=i.useRef(null),n=i.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function Ot(e){const t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}let jt={};function gt(e,t){return i.useMemo(()=>{if(t)return t;const r=jt[e]==null?0:jt[e]+1;return jt[e]=r,e+"-"+r},[e,t])}function kr(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,s)=>{const l=Object.entries(s);for(const[d,u]of l){const g=a[d];g!=null&&(a[d]=g+e*u)}return a},{...t})}}const Ke=kr(1),st=kr(-1);function Sn(e){return"clientX"in e&&"clientY"in e}function Gt(e){if(!e)return!1;const{KeyboardEvent:t}=J(e.target);return t&&e instanceof t}function Cn(e){if(!e)return!1;const{TouchEvent:t}=J(e.target);return t&&e instanceof t}function Pt(e){if(Cn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Sn(e)?{x:e.clientX,y:e.clientY}:null}const lt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[lt.Translate.toString(e),lt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),er="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Nn(e){return e.matches(er)?e:e.querySelector(er)}const Rn={display:"none"};function Dn(e){let{id:t,value:r}=e;return q.createElement("div",{id:t,style:Rn},r)}function En(e){let{id:t,announcement:r,ariaLiveType:n="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return q.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function jn(){const[e,t]=i.useState("");return{announce:i.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Sr=i.createContext(null);function _n(e){const t=i.useContext(Sr);i.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function An(){const[e]=i.useState(()=>new Set),t=i.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[i.useCallback(n=>{let{type:o,event:a}=n;e.forEach(s=>{var l;return(l=s[o])==null?void 0:l.call(s,a)})},[e]),t]}const Mn={draggable:`
|
|
3
|
-
To pick up a draggable item, press the space bar.
|
|
4
|
-
While dragging, use the arrow keys to move the item.
|
|
5
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
6
|
-
`},In={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Tn(e){let{announcements:t=In,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Mn}=e;const{announce:a,announcement:s}=jn(),l=gt("DndLiveRegion"),[d,u]=i.useState(!1);if(i.useEffect(()=>{u(!0)},[]),_n(i.useMemo(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:b}=f;t.onDragMove&&a(t.onDragMove({active:p,over:b}))},onDragOver(f){let{active:p,over:b}=f;a(t.onDragOver({active:p,over:b}))},onDragEnd(f){let{active:p,over:b}=f;a(t.onDragEnd({active:p,over:b}))},onDragCancel(f){let{active:p,over:b}=f;a(t.onDragCancel({active:p,over:b}))}}),[a,t])),!d)return null;const g=q.createElement(q.Fragment,null,q.createElement(Dn,{id:n,value:o.draggable}),q.createElement(En,{id:l,announcement:s}));return r?rt.createPortal(g,r):g}var z;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(z||(z={}));function xt(){}function tr(e,t){return i.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Ln(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const ue=Object.freeze({x:0,y:0});function Cr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Nr(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function On(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function rr(e){let{left:t,top:r,height:n,width:o}=e;return[{x:t,y:r},{x:t+o,y:r},{x:t,y:r+n},{x:t+o,y:r+n}]}function Rr(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function nr(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Pn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=nr(t,t.left,t.top),a=[];for(const s of n){const{id:l}=s,d=r.get(l);if(d){const u=Cr(nr(d),o);a.push({id:l,data:{droppableContainer:s,value:u}})}}return a.sort(Nr)},zn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=rr(t),a=[];for(const s of n){const{id:l}=s,d=r.get(l);if(d){const u=rr(d),g=o.reduce((p,b,E)=>p+Cr(u[E],b),0),f=Number((g/4).toFixed(4));a.push({id:l,data:{droppableContainer:s,value:f}})}}return a.sort(Nr)};function Bn(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=o-n,l=a-r;if(n<o&&r<a){const d=t.width*t.height,u=e.width*e.height,g=s*l,f=g/(d+u-g);return Number(f.toFixed(4))}return 0}const $n=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:s}=a,l=r.get(s);if(l){const d=Bn(l,t);d>0&&o.push({id:s,data:{droppableContainer:a,value:d}})}}return o.sort(On)};function Fn(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Dr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ue}function Un(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((s,l)=>({...s,top:s.top+e*l.y,bottom:s.bottom+e*l.y,left:s.left+e*l.x,right:s.right+e*l.x}),{...r})}}const Kn=Un(1);function Yn(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 Wn(e,t,r){const n=Yn(t);if(!n)return e;const{scaleX:o,scaleY:a,x:s,y:l}=n,d=e.left-s-(1-o)*parseFloat(r),u=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),g=o?e.width/o:e.width,f=a?e.height/a:e.height;return{width:g,height:f,top:u,right:d+g,bottom:u+f,left:d}}const Xn={ignoreTransform:!1};function Xe(e,t){t===void 0&&(t=Xn);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=J(e).getComputedStyle(e);u&&(r=Wn(r,u,g))}const{top:n,left:o,width:a,height:s,bottom:l,right:d}=r;return{top:n,left:o,width:a,height:s,bottom:l,right:d}}function or(e){return Xe(e,{ignoreTransform:!0})}function Hn(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Gn(e,t){return t===void 0&&(t=J(e).getComputedStyle(e)),t.position==="fixed"}function Vn(e,t){t===void 0&&(t=J(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?r.test(a):!1})}function St(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(Xt(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!ut(o)||wr(o)||r.includes(o))return r;const a=J(e).getComputedStyle(o);return o!==e&&Vn(o,a)&&r.push(o),Gn(o,a)?r:n(o.parentNode)}return e?n(e):r}function Er(e){const[t]=St(e,1);return t??null}function _t(e){return!kt||!e?null:Ye(e)?e:Wt(e)?Xt(e)||e===We(e).scrollingElement?window:ut(e)?e:null:null}function jr(e){return Ye(e)?e.scrollX:e.scrollLeft}function _r(e){return Ye(e)?e.scrollY:e.scrollTop}function zt(e){return{x:jr(e),y:_r(e)}}var F;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(F||(F={}));function Ar(e){return!kt||!e?!1:e===document.scrollingElement}function Mr(e){const t={x:0,y:0},r=Ar(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,l=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:s,isRight:l,maxScroll:n,minScroll:t}}const qn={x:.2,y:.2};function Jn(e,t,r,n,o){let{top:a,left:s,right:l,bottom:d}=r;n===void 0&&(n=10),o===void 0&&(o=qn);const{isTop:u,isBottom:g,isLeft:f,isRight:p}=Mr(e),b={x:0,y:0},E={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&a<=t.top+m.height?(b.y=F.Backward,E.y=n*Math.abs((t.top+m.height-a)/m.height)):!g&&d>=t.bottom-m.height&&(b.y=F.Forward,E.y=n*Math.abs((t.bottom-m.height-d)/m.height)),!p&&l>=t.right-m.width?(b.x=F.Forward,E.x=n*Math.abs((t.right-m.width-l)/m.width)):!f&&s<=t.left+m.width&&(b.x=F.Backward,E.x=n*Math.abs((t.left+m.width-s)/m.width)),{direction:b,speed:E}}function Zn(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}const{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Ir(e){return e.reduce((t,r)=>Ke(t,zt(r)),ue)}function Qn(e){return e.reduce((t,r)=>t+jr(r),0)}function eo(e){return e.reduce((t,r)=>t+_r(r),0)}function to(e,t){if(t===void 0&&(t=Xe),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);Er(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ro=[["x",["left","right"],Qn],["y",["top","bottom"],eo]];class Vt{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=St(r),o=Ir(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,l]of ro)for(const d of s)Object.defineProperty(this,d,{get:()=>{const u=l(n),g=o[a]-u;return this.rect[d]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class nt{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var o;(o=this.target)==null||o.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function no(e){const{EventTarget:t}=J(e);return e instanceof t?e:We(e)}function At(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var oe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(oe||(oe={}));function ar(e){e.preventDefault()}function oo(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 Tr={start:[D.Space,D.Enter],cancel:[D.Esc],end:[D.Space,D.Enter,D.Tab]},ao=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case D.Right:return{...r,x:r.x+25};case D.Left:return{...r,x:r.x-25};case D.Down:return{...r,y:r.y+25};case D.Up:return{...r,y:r.y-25}}};class qt{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new nt(We(r)),this.windowListeners=new nt(J(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(oe.Resize,this.handleCancel),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(oe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&to(n),r(ue)}handleKeyDown(t){if(Gt(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=Tr,coordinateGetter:s=ao,scrollBehavior:l="smooth"}=o,{code:d}=t;if(a.end.includes(d)){this.handleEnd(t);return}if(a.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:u}=n.current,g=u?{x:u.left,y:u.top}:ue;this.referenceCoordinates||(this.referenceCoordinates=g);const f=s(t,{active:r,context:n.current,currentCoordinates:g});if(f){const p=st(f,g),b={x:0,y:0},{scrollableAncestors:E}=n.current;for(const m of E){const x=t.code,{isTop:w,isRight:k,isLeft:v,isBottom:C,maxScroll:j,minScroll:N}=Mr(m),S=Zn(m),R={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))},L=x===D.Right&&!k||x===D.Left&&!v,I=x===D.Down&&!C||x===D.Up&&!w;if(L&&R.x!==f.x){const _=m.scrollLeft+p.x,Z=x===D.Right&&_<=j.x||x===D.Left&&_>=N.x;if(Z&&!p.y){m.scrollTo({left:_,behavior:l});return}Z?b.x=m.scrollLeft-_:b.x=x===D.Right?m.scrollLeft-j.x:m.scrollLeft-N.x,b.x&&m.scrollBy({left:-b.x,behavior:l});break}else if(I&&R.y!==f.y){const _=m.scrollTop+p.y,Z=x===D.Down&&_<=j.y||x===D.Up&&_>=N.y;if(Z&&!p.x){m.scrollTo({top:_,behavior:l});return}Z?b.y=m.scrollTop-_:b.y=x===D.Down?m.scrollTop-j.y:m.scrollTop-N.y,b.y&&m.scrollBy({top:-b.y,behavior:l});break}}this.handleMove(t,Ke(st(f,this.referenceCoordinates),b))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}qt.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Tr,onActivation:o}=t,{active:a}=r;const{code:s}=e.nativeEvent;if(n.start.includes(s)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function ir(e){return!!(e&&"distance"in e)}function sr(e){return!!(e&&"delay"in e)}class Jt{constructor(t,r,n){var o;n===void 0&&(n=no(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:s}=a;this.props=t,this.events=r,this.document=We(s),this.documentListeners=new nt(this.document),this.listeners=new nt(n),this.windowListeners=new nt(J(s)),this.initialCoordinates=(o=Pt(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:r,bypassActivationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(oe.Resize,this.handleCancel),this.windowListeners.add(oe.DragStart,ar),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),this.windowListeners.add(oe.ContextMenu,ar),this.documentListeners.add(oe.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(sr(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(ir(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:n,onPending:o}=this.props;o(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(oe.Click,oo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(oe.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:s,options:{activationConstraint:l}}=a;if(!o)return;const d=(r=Pt(t))!=null?r:ue,u=st(o,d);if(!n&&l){if(ir(l)){if(l.tolerance!=null&&At(u,l.tolerance))return this.handleCancel();if(At(u,l.distance))return this.handleStart()}if(sr(l)&&At(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),s(d)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===D.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const io={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Zt extends Jt{constructor(t){const{event:r}=t,n=We(r.target);super(t,io,n)}}Zt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];const so={move:{name:"mousemove"},end:{name:"mouseup"}};var Bt;(function(e){e[e.RightClick=2]="RightClick"})(Bt||(Bt={}));class lo extends Jt{constructor(t){super(t,so,We(t.event.target))}}lo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===Bt.RightClick?!1:(n?.({event:r}),!0)}}];const Mt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class co extends Jt{constructor(t){super(t,Mt)}static setup(){return window.addEventListener(Mt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Mt.move.name,t)};function t(){}}}co.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:o}=r;return o.length>1?!1:(n?.({event:r}),!0)}}];var ot;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ot||(ot={}));var vt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(vt||(vt={}));function uo(e){let{acceleration:t,activator:r=ot.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:s=5,order:l=vt.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:p}=e;const b=go({delta:f,disabled:!a}),[E,m]=kn(),x=i.useRef({x:0,y:0}),w=i.useRef({x:0,y:0}),k=i.useMemo(()=>{switch(r){case ot.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case ot.DraggableRect:return o}},[r,o,d]),v=i.useRef(null),C=i.useCallback(()=>{const N=v.current;if(!N)return;const S=x.current.x*w.current.x,R=x.current.y*w.current.y;N.scrollBy(S,R)},[]),j=i.useMemo(()=>l===vt.TreeOrder?[...u].reverse():u,[l,u]);i.useEffect(()=>{if(!a||!u.length||!k){m();return}for(const N of j){if(n?.(N)===!1)continue;const S=u.indexOf(N),R=g[S];if(!R)continue;const{direction:L,speed:I}=Jn(N,R,k,t,p);for(const _ of["x","y"])b[_][L[_]]||(I[_]=0,L[_]=0);if(I.x>0||I.y>0){m(),v.current=N,E(C,s),x.current=I,w.current=L;return}}x.current={x:0,y:0},w.current={x:0,y:0},m()},[t,C,n,m,a,s,JSON.stringify(k),JSON.stringify(b),E,u,j,g,JSON.stringify(p)])}const fo={x:{[F.Backward]:!1,[F.Forward]:!1},y:{[F.Backward]:!1,[F.Forward]:!1}};function go(e){let{delta:t,disabled:r}=e;const n=Ot(t);return ft(o=>{if(r||!n||!o)return fo;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[F.Backward]:o.x[F.Backward]||a.x===-1,[F.Forward]:o.x[F.Forward]||a.x===1},y:{[F.Backward]:o.y[F.Backward]||a.y===-1,[F.Forward]:o.y[F.Forward]||a.y===1}}},[r,t,n])}function ho(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return ft(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function bo(e,t){return i.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,n)}));return[...r,...a]},[]),[e,t])}var ct;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ct||(ct={}));var $t;(function(e){e.Optimized="optimized"})($t||($t={}));const lr=new Map;function po(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,s]=i.useState(null),{frequency:l,measure:d,strategy:u}=o,g=i.useRef(e),f=x(),p=it(f),b=i.useCallback(function(w){w===void 0&&(w=[]),!p.current&&s(k=>k===null?w:k.concat(w.filter(v=>!k.includes(v))))},[p]),E=i.useRef(null),m=ft(w=>{if(f&&!r)return lr;if(!w||w===lr||g.current!==e||a!=null){const k=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){k.set(v.id,v.rect.current);continue}const C=v.node.current,j=C?new Vt(d(C),C):null;v.rect.current=j,j&&k.set(v.id,j)}return k}return w},[e,a,r,f,d]);return i.useEffect(()=>{g.current=e},[e]),i.useEffect(()=>{f||b()},[r,f]),i.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),i.useEffect(()=>{f||typeof l!="number"||E.current!==null||(E.current=setTimeout(()=>{b(),E.current=null},l))},[l,f,b,...n]),{droppableRects:m,measureDroppableContainers:b,measuringScheduled:a!=null};function x(){switch(u){case ct.Always:return!1;case ct.BeforeDragging:return r;default:return!r}}}function Lr(e,t){return ft(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function mo(e,t){return Lr(e,t)}function xo(e){let{callback:t,disabled:r}=e;const n=Ht(t),o=i.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function Ct(e){let{callback:t,disabled:r}=e;const n=Ht(t),o=i.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function vo(e){return new Vt(Xe(e),e)}function cr(e,t,r){t===void 0&&(t=vo);const[n,o]=i.useState(null);function a(){o(d=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=d??r)!=null?u:null}const g=t(e);return JSON.stringify(d)===JSON.stringify(g)?d:g})}const s=xo({callback(d){if(e)for(const u of d){const{type:g,target:f}=u;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),l=Ct({callback:a});return pe(()=>{a(),e?(l?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),s?.disconnect())},[e]),n}function yo(e){const t=Lr(e);return Dr(e,t)}const dr=[];function wo(e){const t=i.useRef(e),r=ft(n=>e?n&&n!==dr&&e&&t.current&&e.parentNode===t.current.parentNode?n:St(e):dr,[e]);return i.useEffect(()=>{t.current=e},[e]),r}function ko(e){const[t,r]=i.useState(null),n=i.useRef(e),o=i.useCallback(a=>{const s=_t(a.target);s&&r(l=>l?(l.set(s,zt(s)),new Map(l)):null)},[]);return i.useEffect(()=>{const a=n.current;if(e!==a){s(a);const l=e.map(d=>{const u=_t(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,zt(u)]):null}).filter(d=>d!=null);r(l.length?new Map(l):null),n.current=e}return()=>{s(e),s(a)};function s(l){l.forEach(d=>{const u=_t(d);u?.removeEventListener("scroll",o)})}},[o,e]),i.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>Ke(a,s),ue):Ir(e):ue,[e,t])}function ur(e,t){t===void 0&&(t=[]);const r=i.useRef(null);return i.useEffect(()=>{r.current=null},t),i.useEffect(()=>{const n=e!==ue;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?st(e,r.current):ue}function So(e){i.useEffect(()=>{if(!kt)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function Co(e,t){return i.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=s=>{a(s,t)},r},{}),[e,t])}function Or(e){return i.useMemo(()=>e?Hn(e):null,[e])}const fr=[];function No(e,t){t===void 0&&(t=Xe);const[r]=e,n=Or(r?J(r):null),[o,a]=i.useState(fr);function s(){a(()=>e.length?e.map(d=>Ar(d)?n:new Vt(t(d),d)):fr)}const l=Ct({callback:s});return pe(()=>{l?.disconnect(),s(),e.forEach(d=>l?.observe(d))},[e]),o}function Ro(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ut(t)?t:e}function Do(e){let{measure:t}=e;const[r,n]=i.useState(null),o=i.useCallback(u=>{for(const{target:g}of u)if(ut(g)){n(f=>{const p=t(g);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=Ct({callback:o}),s=i.useCallback(u=>{const g=Ro(u);a?.disconnect(),g&&a?.observe(g),n(g?t(g):null)},[t,a]),[l,d]=mt(s);return i.useMemo(()=>({nodeRef:l,rect:r,setRef:d}),[r,l,d])}const Eo=[{sensor:Zt,options:{}},{sensor:qt,options:{}}],jo={current:{}},pt={draggable:{measure:or},droppable:{measure:or,strategy:ct.WhileDragging,frequency:$t.Optimized},dragOverlay:{measure:Xe}};class at extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const _o={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new at,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:xt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pt,measureDroppableContainers:xt,windowRect:null,measuringScheduled:!1},Ao={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:xt,draggableNodes:new Map,over:null,measureDroppableContainers:xt},Nt=i.createContext(Ao),Pr=i.createContext(_o);function Mo(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new at}}}function Io(e,t){switch(t.type){case z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case z.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case z.DragEnd:case z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case z.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new at(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case z.SetDroppableDisabled:{const{id:r,key:n,disabled:o}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const s=new at(e.droppable.containers);return s.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case z.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new at(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function To(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=i.useContext(Nt),a=Ot(n),s=Ot(r?.id);return i.useEffect(()=>{if(!t&&!n&&a&&s!=null){if(!Gt(a)||document.activeElement===a.target)return;const l=o.get(s);if(!l)return;const{activatorNode:d,node:u}=l;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[d.current,u.current]){if(!g)continue;const f=Nn(g);if(f){f.focus();break}}})}},[n,t,o,s,a]),null}function Lo(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function Oo(e){return i.useMemo(()=>({draggable:{...pt.draggable,...e?.draggable},droppable:{...pt.droppable,...e?.droppable},dragOverlay:{...pt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Po(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=i.useRef(!1),{x:s,y:l}=typeof o=="boolean"?{x:o,y:o}:o;pe(()=>{if(!s&&!l||!t){a.current=!1;return}if(a.current||!n)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const g=r(u),f=Dr(g,n);if(s||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=Er(u);p&&p.scrollBy({top:f.y,left:f.x})}},[t,s,l,n,r])}const zr=i.createContext({...ue,scaleX:1,scaleY:1});var Me;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Me||(Me={}));const zo=i.memo(function(t){var r,n,o,a;let{id:s,accessibility:l,autoScroll:d=!0,children:u,sensors:g=Eo,collisionDetection:f=$n,measuring:p,modifiers:b,...E}=t;const m=i.useReducer(Io,void 0,Mo),[x,w]=m,[k,v]=An(),[C,j]=i.useState(Me.Uninitialized),N=C===Me.Initialized,{draggable:{active:S,nodes:R,translate:L},droppable:{containers:I}}=x,_=S!=null?R.get(S):null,Z=i.useRef({initial:null,translated:null}),G=i.useMemo(()=>{var K;return S!=null?{id:S,data:(K=_?.data)!=null?K:jo,rect:Z}:null},[S,_]),Q=i.useRef(null),[ye,ze]=i.useState(null),[H,Be]=i.useState(null),ae=it(E,Object.values(E)),B=gt("DndDescribedBy",s),we=i.useMemo(()=>I.getEnabled(),[I]),W=Oo(p),{droppableRects:ie,measureDroppableContainers:fe,measuringScheduled:ke}=po(we,{dragging:N,dependencies:[L.x,L.y],config:W.droppable}),O=ho(R,S),$e=i.useMemo(()=>H?Pt(H):null,[H]),se=Pe(),P=mo(O,W.draggable.measure);Po({activeNode:S!=null?R.get(S):null,config:se.layoutShiftCompensation,initialRect:P,measure:W.draggable.measure});const A=cr(O,W.draggable.measure,P),Ie=cr(O?O.parentElement:null),U=i.useRef({activatorEvent:null,active:null,activeNode:O,collisionRect:null,collisions:null,droppableRects:ie,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Se=I.getNodeFor((r=U.current.over)==null?void 0:r.id),te=Do({measure:W.dragOverlay.measure}),me=(n=te.nodeRef.current)!=null?n:O,xe=N?(o=te.rect)!=null?o:A:null,Ce=!!(te.nodeRef.current&&te.rect),Te=yo(Ce?null:A),He=Or(me?J(me):null),le=wo(N?Se??O:null),Le=No(le),Oe=Lo(b,{transform:{x:L.x-Te.x,y:L.y-Te.y,scaleX:1,scaleY:1},activatorEvent:H,active:G,activeNodeRect:A,containerNodeRect:Ie,draggingNodeRect:xe,over:U.current.over,overlayNodeRect:te.rect,scrollableAncestors:le,scrollableAncestorRects:Le,windowRect:He}),Ge=$e?Ke($e,L):null,Fe=ko(le),Ne=ur(Fe),Rt=ur(Fe,[A]),Re=Ke(Oe,Ne),De=xe?Kn(xe,Oe):null,Ee=G&&De?f({active:G,collisionRect:De,droppableRects:ie,droppableContainers:we,pointerCoordinates:Ge}):null,Ve=Rr(Ee,"id"),[ge,je]=i.useState(null),qe=Ce?Oe:Ke(Oe,Rt),h=Fn(qe,(a=ge?.rect)!=null?a:null,A),M=i.useRef(null),re=i.useCallback((K,V)=>{let{sensor:X,options:$}=V;if(Q.current==null)return;const ne=R.get(Q.current);if(!ne)return;const ee=K.nativeEvent,he=new X({active:Q.current,activeNode:ne,event:ee,options:$,context:U,onAbort(Y){if(!R.get(Y))return;const{onDragAbort:be}=ae.current,ve={id:Y};be?.(ve),k({type:"onDragAbort",event:ve})},onPending(Y,_e,be,ve){if(!R.get(Y))return;const{onDragPending:et}=ae.current,Ae={id:Y,constraint:_e,initialCoordinates:be,offset:ve};et?.(Ae),k({type:"onDragPending",event:Ae})},onStart(Y){const _e=Q.current;if(_e==null)return;const be=R.get(_e);if(!be)return;const{onDragStart:ve}=ae.current,Qe={activatorEvent:ee,active:{id:_e,data:be.data,rect:Z}};rt.unstable_batchedUpdates(()=>{ve?.(Qe),j(Me.Initializing),w({type:z.DragStart,initialCoordinates:Y,active:_e}),k({type:"onDragStart",event:Qe}),ze(M.current),Be(ee)})},onMove(Y){w({type:z.DragMove,coordinates:Y})},onEnd:Ue(z.DragEnd),onCancel:Ue(z.DragCancel)});M.current=he;function Ue(Y){return async function(){const{active:be,collisions:ve,over:Qe,scrollAdjustedTranslate:et}=U.current;let Ae=null;if(be&&et){const{cancelDrop:tt}=ae.current;Ae={activatorEvent:ee,active:be,collisions:ve,delta:et,over:Qe},Y===z.DragEnd&&typeof tt=="function"&&await Promise.resolve(tt(Ae))&&(Y=z.DragCancel)}Q.current=null,rt.unstable_batchedUpdates(()=>{w({type:Y}),j(Me.Uninitialized),je(null),ze(null),Be(null),M.current=null;const tt=Y===z.DragEnd?"onDragEnd":"onDragCancel";if(Ae){const Et=ae.current[tt];Et?.(Ae),k({type:tt,event:Ae})}})}}},[R]),Je=i.useCallback((K,V)=>(X,$)=>{const ne=X.nativeEvent,ee=R.get($);if(Q.current!==null||!ee||ne.dndKit||ne.defaultPrevented)return;const he={active:ee};K(X,V.options,he)===!0&&(ne.dndKit={capturedBy:V.sensor},Q.current=$,re(X,V))},[R,re]),Ze=bo(g,Je);So(g),pe(()=>{A&&C===Me.Initializing&&j(Me.Initialized)},[A,C]),i.useEffect(()=>{const{onDragMove:K}=ae.current,{active:V,activatorEvent:X,collisions:$,over:ne}=U.current;if(!V||!X)return;const ee={active:V,activatorEvent:X,collisions:$,delta:{x:Re.x,y:Re.y},over:ne};rt.unstable_batchedUpdates(()=>{K?.(ee),k({type:"onDragMove",event:ee})})},[Re.x,Re.y]),i.useEffect(()=>{const{active:K,activatorEvent:V,collisions:X,droppableContainers:$,scrollAdjustedTranslate:ne}=U.current;if(!K||Q.current==null||!V||!ne)return;const{onDragOver:ee}=ae.current,he=$.get(Ve),Ue=he&&he.rect.current?{id:he.id,rect:he.rect.current,data:he.data,disabled:he.disabled}:null,Y={active:K,activatorEvent:V,collisions:X,delta:{x:ne.x,y:ne.y},over:Ue};rt.unstable_batchedUpdates(()=>{je(Ue),ee?.(Y),k({type:"onDragOver",event:Y})})},[Ve]),pe(()=>{U.current={activatorEvent:H,active:G,activeNode:O,collisionRect:De,collisions:Ee,droppableRects:ie,draggableNodes:R,draggingNode:me,draggingNodeRect:xe,droppableContainers:I,over:ge,scrollableAncestors:le,scrollAdjustedTranslate:Re},Z.current={initial:xe,translated:De}},[G,O,Ee,De,R,me,xe,ie,I,ge,le,Re]),uo({...se,delta:L,draggingRect:De,pointerCoordinates:Ge,scrollableAncestors:le,scrollableAncestorRects:Le});const Dt=i.useMemo(()=>({active:G,activeNode:O,activeNodeRect:A,activatorEvent:H,collisions:Ee,containerNodeRect:Ie,dragOverlay:te,draggableNodes:R,droppableContainers:I,droppableRects:ie,over:ge,measureDroppableContainers:fe,scrollableAncestors:le,scrollableAncestorRects:Le,measuringConfiguration:W,measuringScheduled:ke,windowRect:He}),[G,O,A,H,Ee,Ie,te,R,I,ie,ge,fe,le,Le,W,ke,He]),ce=i.useMemo(()=>({activatorEvent:H,activators:Ze,active:G,activeNodeRect:A,ariaDescribedById:{draggable:B},dispatch:w,draggableNodes:R,over:ge,measureDroppableContainers:fe}),[H,Ze,G,A,w,B,R,ge,fe]);return q.createElement(Sr.Provider,{value:v},q.createElement(Nt.Provider,{value:ce},q.createElement(Pr.Provider,{value:Dt},q.createElement(zr.Provider,{value:h},u)),q.createElement(To,{disabled:l?.restoreFocus===!1})),q.createElement(Tn,{...l,hiddenTextDescribedById:B}));function Pe(){const K=ye?.autoScrollEnabled===!1,V=typeof d=="object"?d.enabled===!1:d===!1,X=N&&!K&&!V;return typeof d=="object"?{...d,enabled:X}:{enabled:X}}}),Bo=i.createContext(null),gr="button",$o="Draggable";function Fo(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=gt($o),{activators:s,activatorEvent:l,active:d,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:p}=i.useContext(Nt),{role:b=gr,roleDescription:E="draggable",tabIndex:m=0}=o??{},x=d?.id===t,w=i.useContext(x?zr:Bo),[k,v]=mt(),[C,j]=mt(),N=Co(s,t),S=it(r);pe(()=>(f.set(t,{id:t,key:a,node:k,activatorNode:C,data:S}),()=>{const L=f.get(t);L&&L.key===a&&f.delete(t)}),[f,t]);const R=i.useMemo(()=>({role:b,tabIndex:m,"aria-disabled":n,"aria-pressed":x&&b===gr?!0:void 0,"aria-roledescription":E,"aria-describedby":g.draggable}),[n,b,m,x,E,g.draggable]);return{active:d,activatorEvent:l,activeNodeRect:u,attributes:R,isDragging:x,listeners:n?void 0:N,node:k,over:p,setNodeRef:v,setActivatorNodeRef:j,transform:w}}function Uo(){return i.useContext(Pr)}const Ko="Droppable",Yo={timeout:25};function Wo(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=gt(Ko),{active:s,dispatch:l,over:d,measureDroppableContainers:u}=i.useContext(Nt),g=i.useRef({disabled:r}),f=i.useRef(!1),p=i.useRef(null),b=i.useRef(null),{disabled:E,updateMeasurementsFor:m,timeout:x}={...Yo,...o},w=it(m??n),k=i.useCallback(()=>{if(!f.current){f.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{u(Array.isArray(w.current)?w.current:[w.current]),b.current=null},x)},[x]),v=Ct({callback:k,disabled:E||!s}),C=i.useCallback((R,L)=>{v&&(L&&(v.unobserve(L),f.current=!1),R&&v.observe(R))},[v]),[j,N]=mt(C),S=it(t);return i.useEffect(()=>{!v||!j.current||(v.disconnect(),f.current=!1,v.observe(j.current))},[j,v]),i.useEffect(()=>(l({type:z.RegisterDroppable,element:{id:n,key:a,disabled:r,node:j,rect:p,data:S}}),()=>l({type:z.UnregisterDroppable,key:a,id:n})),[n]),i.useEffect(()=>{r!==g.current.disabled&&(l({type:z.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,l]),{active:s,rect:p,isOver:d?.id===n,node:j,over:d,setNodeRef:N}}const Xo=e=>{let{transform:t}=e;return{...t,y:0}};function Br(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Ho(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function ht(e){return e!==null&&e>=0}function Go(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function Vo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const bt={scaleX:1,scaleY:1},qo=e=>{var t;let{rects:r,activeNodeRect:n,activeIndex:o,overIndex:a,index:s}=e;const l=(t=r[o])!=null?t:n;if(!l)return null;const d=Jo(r,s,o);if(s===o){const u=r[a];return u?{x:o<a?u.left+u.width-(l.left+l.width):u.left-l.left,y:0,...bt}:null}return s>o&&s<=a?{x:-l.width-d,y:0,...bt}:s<o&&s>=a?{x:l.width+d,y:0,...bt}:{x:0,y:0,...bt}};function Jo(e,t,r){const n=e[t],o=e[t-1],a=e[t+1];return!n||!o&&!a?0:r<t?o?n.left-(o.left+o.width):a.left-(n.left+n.width):a?a.left-(n.left+n.width):n.left-(o.left+o.width)}const $r=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=Br(t,n,r),s=t[o],l=a[o];return!l||!s?null:{x:l.left-s.left,y:l.top-s.top,scaleX:l.width/s.width,scaleY:l.height/s.height}},Fr="Sortable",Ur=q.createContext({activeIndex:-1,containerId:Fr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:$r,disabled:{draggable:!1,droppable:!1}});function Zo(e){let{children:t,id:r,items:n,strategy:o=$r,disabled:a=!1}=e;const{active:s,dragOverlay:l,droppableRects:d,over:u,measureDroppableContainers:g}=Uo(),f=gt(Fr,r),p=l.rect!==null,b=i.useMemo(()=>n.map(N=>typeof N=="object"&&"id"in N?N.id:N),[n]),E=s!=null,m=s?b.indexOf(s.id):-1,x=u?b.indexOf(u.id):-1,w=i.useRef(b),k=!Go(b,w.current),v=x!==-1&&m===-1||k,C=Vo(a);pe(()=>{k&&E&&g(b)},[k,b,E,g]),i.useEffect(()=>{w.current=b},[b]);const j=i.useMemo(()=>({activeIndex:m,containerId:f,disabled:C,disableTransforms:v,items:b,overIndex:x,useDragOverlay:p,sortedRects:Ho(b,d),strategy:o}),[m,f,C.draggable,C.droppable,v,b,x,d,p,o]);return q.createElement(Ur.Provider,{value:j},t)}const Qo=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return Br(r,n,o).indexOf(t)},ea=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:s,previousItems:l,previousContainerId:d,transition:u}=e;return!u||!n||l!==a&&o===s?!1:r?!0:s!==o&&t===d},ta={duration:200,easing:"ease"},Kr="transform",ra=lt.Transition.toString({property:Kr,duration:0,easing:"linear"}),na={roleDescription:"sortable"};function oa(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,s]=i.useState(null),l=i.useRef(r);return pe(()=>{if(!t&&r!==l.current&&n.current){const d=o.current;if(d){const u=Xe(n.current,{ignoreTransform:!0}),g={x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height};(g.x||g.y)&&s(g)}}r!==l.current&&(l.current=r)},[t,r,n,o]),i.useEffect(()=>{a&&s(null)},[a]),a}function aa(e){let{animateLayoutChanges:t=ea,attributes:r,disabled:n,data:o,getNewIndex:a=Qo,id:s,strategy:l,resizeObserverConfig:d,transition:u=ta}=e;const{items:g,containerId:f,activeIndex:p,disabled:b,disableTransforms:E,sortedRects:m,overIndex:x,useDragOverlay:w,strategy:k}=i.useContext(Ur),v=ia(n,b),C=g.indexOf(s),j=i.useMemo(()=>({sortable:{containerId:f,index:C,items:g},...o}),[f,o,C,g]),N=i.useMemo(()=>g.slice(g.indexOf(s)),[g,s]),{rect:S,node:R,isOver:L,setNodeRef:I}=Wo({id:s,data:j,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...d}}),{active:_,activatorEvent:Z,activeNodeRect:G,attributes:Q,setNodeRef:ye,listeners:ze,isDragging:H,over:Be,setActivatorNodeRef:ae,transform:B}=Fo({id:s,data:j,attributes:{...na,...r},disabled:v.draggable}),we=wn(I,ye),W=!!_,ie=W&&!E&&ht(p)&&ht(x),fe=!w&&H,ke=fe&&ie?B:null,$e=ie?ke??(l??k)({rects:m,activeNodeRect:G,activeIndex:p,overIndex:x,index:C}):null,se=ht(p)&&ht(x)?a({id:s,items:g,activeIndex:p,overIndex:x}):C,P=_?.id,A=i.useRef({activeId:P,items:g,newIndex:se,containerId:f}),Ie=g!==A.current.items,U=t({active:_,containerId:f,isDragging:H,isSorting:W,id:s,index:C,items:g,newIndex:A.current.newIndex,previousItems:A.current.items,previousContainerId:A.current.containerId,transition:u,wasDragging:A.current.activeId!=null}),Se=oa({disabled:!U,index:C,node:R,rect:S});return i.useEffect(()=>{W&&A.current.newIndex!==se&&(A.current.newIndex=se),f!==A.current.containerId&&(A.current.containerId=f),g!==A.current.items&&(A.current.items=g)},[W,se,f,g]),i.useEffect(()=>{if(P===A.current.activeId)return;if(P&&!A.current.activeId){A.current.activeId=P;return}const me=setTimeout(()=>{A.current.activeId=P},50);return()=>clearTimeout(me)},[P]),{active:_,activeIndex:p,attributes:Q,data:j,rect:S,index:C,newIndex:se,items:g,isOver:L,isSorting:W,isDragging:H,listeners:ze,node:R,overIndex:x,over:Be,setNodeRef:we,setActivatorNodeRef:ae,setDroppableNodeRef:I,setDraggableNodeRef:ye,transform:Se??$e,transition:te()};function te(){if(Se||Ie&&A.current.newIndex===C)return ra;if(!(fe&&!Gt(Z)||!u)&&(W||U))return lt.Transition.toString({...u,property:Kr})}}function ia(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function yt(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 sa=[D.Down,D.Right,D.Up,D.Left],la=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:l}}=t;if(sa.includes(e.code)){if(e.preventDefault(),!r||!n)return;const d=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const p=o.get(f.id);if(p)switch(e.code){case D.Down:n.top<p.top&&d.push(f);break;case D.Up:n.top>p.top&&d.push(f);break;case D.Left:n.left>p.left&&d.push(f);break;case D.Right:n.left<p.left&&d.push(f);break}});const u=zn({collisionRect:n,droppableRects:o,droppableContainers:d});let g=Rr(u,"id");if(g===s?.id&&u.length>1&&(g=u[1].id),g!=null){const f=a.get(r.id),p=a.get(g),b=p?o.get(p.id):null,E=p?.node.current;if(E&&b&&f&&p){const x=St(E).some((N,S)=>l[S]!==N),w=Yr(f,p),k=ca(f,p),v=x||!w?{x:0,y:0}:{x:k?n.width-b.width:0,y:k?n.height-b.height:0},C={x:b.left,y:b.top};return v.x&&v.y?C:st(C,v)}}}};function Yr(e,t){return!yt(e)||!yt(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ca(e,t){return!yt(e)||!yt(t)||!Yr(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function dt(e,{min:t,max:r,fallback:n}){const o=Number(e);if(!Number.isFinite(o))return n;const a=Math.floor(o);return a<t?t:a>r?r:a}function da(e,t){const r=dt(t,{min:0,max:1e6,fallback:0}),n=dt(e,{min:1,max:Math.max(1,r||1),fallback:1});if(r<=1)return[1];const o=new Set([1,r,n-2,n-1,n,n+1,n+2]),a=Array.from(o).filter(d=>Number.isInteger(d)&&d>=1&&d<=r).sort((d,u)=>d-u),s=[];let l=null;for(const d of a)l!=null&&d-l>1&&s.push(null),s.push(d),l=d;return s}function ua({page:e,totalPages:t}){const r=typeof t=="number"&&Number.isFinite(t)&&t>=0,n=r?dt(t,{min:0,max:1e6,fallback:0}):null,o=dt(e,{min:1,max:r?Math.max(1,n||1):1e6,fallback:1}),a=o>1,s=r?o<n:!0;return{canPrev:a,canNext:s,safePage:o,safeTotal:n}}function fa({entries:e,me:t,meLabel:r}){const n=Array.isArray(e)?e:[],o=t&&typeof t.rank=="number"?t.rank:null;return!o||n.some(s=>!!s?.is_me)?n:[{rank:o,is_me:!0,is_pinned:!0,user_id:t?.user_id??null,display_name:r,avatar_url:t?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:t?.gpt_tokens??"0",claude_tokens:t?.claude_tokens??"0",gemini_tokens:t?.gemini_tokens??"0",cursor_tokens:t?.cursor_tokens??"0",opencode_tokens:t?.opencode_tokens??"0",openclaw_tokens:t?.openclaw_tokens??"0",hermes_tokens:t?.hermes_tokens??"0",kiro_tokens:t?.kiro_tokens??"0",copilot_tokens:t?.copilot_tokens??"0",kimi_tokens:t?.kimi_tokens??"0",other_tokens:t?.other_tokens??"0",total_tokens:t?.total_tokens??"0",estimated_cost_usd:t?.estimated_cost_usd??null},...n]}function ga(e,t){const r=Number(e),n=Number(t);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:Math.ceil(r/n)}const ha=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function ba({iconSrc:e,label:t}){return c.jsxs("span",{className:"inline-flex items-center gap-3",children:[e?c.jsx("img",{src:e,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${ha.has(e)?"dark:invert":""}`}):null,c.jsx("span",{className:"whitespace-nowrap",children:t})]})}const wt=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],Wr="sticky left-0 z-40 w-[72px] min-w-[72px] max-w-[72px] bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",Xr="sticky left-[71px] z-40 min-w-[200px] max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle";function Ft(e){return T("sticky left-0 z-30 w-[72px] min-w-[72px] max-w-[72px] px-4 py-4 whitespace-nowrap",e?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function Ut(e){return T("sticky left-[71px] z-30 hover:z-50 min-w-[200px] max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 min-w-0",e?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function de({className:e}){return c.jsx("div",{className:T("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function pa({index:e}){const t=e<3?"w-24":e<8?"w-20":"w-16",r=e<3?"w-16":"w-12",n=e<5?"w-14":"w-10";return c.jsxs("tr",{className:"group",children:[c.jsx("td",{className:T(Ft(!1),"!group-hover:bg-transparent"),children:c.jsx(de,{className:"h-4 w-6"})}),c.jsx("td",{className:T(Ut(!1),"!group-hover:bg-transparent"),children:c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx(de,{className:"h-8 w-8 min-w-8 rounded-full"}),c.jsx(de,{className:T("h-4",t)})]})}),c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(de,{className:T("h-4",r)})}),c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(de,{className:"h-4 w-12"})}),wt.map(o=>c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(de,{className:T("h-4",n)})},o.key))]})}function ma({rows:e=10}){return c.jsx("div",{className:"w-full overflow-x-auto",children:c.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[c.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:c.jsxs("tr",{children:[c.jsx("th",{className:T(Wr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(de,{className:"h-3.5 w-6"})}),c.jsx("th",{className:T(Xr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(de,{className:"h-3.5 w-12"})}),c.jsx("th",{className:"px-4 py-4",children:c.jsx(de,{className:"h-3.5 w-10"})}),c.jsx("th",{className:"px-4 py-4",children:c.jsx(de,{className:"h-3.5 w-14"})}),wt.map(t=>c.jsx("th",{className:"px-4 py-4",children:c.jsx(de,{className:"h-3.5 w-12"})},t.key))]})}),c.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:e},(t,r)=>c.jsx(pa,{index:r},r))})]})})}function xa({id:e,thClassName:t,children:r}){const{attributes:n,listeners:o,setNodeRef:a,transform:s,transition:l,isDragging:d}=aa({id:e}),u=lt.Transform.toString(s)||"";i.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${e}"]`),p="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(b=>{b.style.transform=u,b.style.transition=l||"",b.style.zIndex=d?"20":"",b.style.position=u?"relative":"",b.style.boxShadow=d?p:""}),()=>{f.forEach(b=>{b.style.transform="",b.style.transition="",b.style.zIndex="",b.style.position="",b.style.boxShadow=""})}},[e,u,l,d]);const g={transform:u,transition:l,position:u?"relative":void 0,zIndex:d?20:void 0,boxShadow:d?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return c.jsx("th",{ref:a,style:g,className:T(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...o,children:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[c.jsx("span",{"aria-hidden":"true",className:T("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",d&&"opacity-100"),children:c.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[c.jsx("circle",{cx:"2",cy:"2",r:"1"}),c.jsx("circle",{cx:"6",cy:"2",r:"1"}),c.jsx("circle",{cx:"2",cy:"7",r:"1"}),c.jsx("circle",{cx:"6",cy:"7",r:"1"}),c.jsx("circle",{cx:"2",cy:"12",r:"1"}),c.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),r]})})}const Hr="tokentracker.leaderboard.columnOrder.v1";function va(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Hr);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>typeof r=="string"):null}catch{return null}}function It(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Hr,JSON.stringify(e))}catch{}}function hr(e,t){if(!e)return t;const r=new Set(t),n=e.filter(a=>r.has(a)),o=t.filter(a=>!n.includes(a));return[...n,...o]}function ya(e){const t=i.useMemo(()=>e.join("|"),[e]),[r,n]=i.useState(()=>hr(va(),e));i.useEffect(()=>{n(s=>{const l=hr(s,e);return l.length===s.length&&l.every((u,g)=>u===s[g])?s:(It(l),l)})},[t,e]);const o=i.useCallback((s,l)=>{!s||!l||s===l||n(d=>{const u=d.indexOf(s),g=d.indexOf(l);if(u===-1||g===-1)return d;const f=d.slice(),[p]=f.splice(u,1);return f.splice(g,0,p),It(f),f})},[]),a=i.useCallback(()=>{It(e),n(e)},[e]);return{order:r,reorder:o,reset:a}}function wa(e,t){const r=Number(e),n=Number(t);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(r/n*100)))}function Gr(e){return typeof e=="string"?e.trim():""}function ka(e){const t=Gr(e);return t?t.toLowerCase()==="anonymous":!0}function Sa({me:e,totalEntries:t,meLabel:r,onJumpToMe:n,canJump:o}){const a=e&&typeof e.rank=="number"?e.rank:null;if(!a)return null;const s=Number(t)||0,l=wa(a,s),d=Gr(e?.display_name),u=!d||ka(d)?r||"You":d,g=e?.user_id||u,f=!!o&&typeof n=="function",p=f?"button":"div",b=f?{type:"button",onClick:n,"aria-label":y("leaderboard.summary.jump_to_me")}:{};return c.jsxs(p,{...b,className:T("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none shadow-[0_1px_2px_rgba(0,0,0,0.03)]",f?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] hover:shadow-[0_4px_12px_rgba(0,0,0,0.05)] dark:hover:shadow-[0_4px_20px_rgba(0,0,0,0.25)] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]"),children:[c.jsx(Lt,{size:"sm",avatarUrl:e?.avatar_url,displayName:u,seed:g}),c.jsx("span",{className:"max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:u}),c.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",a.toLocaleString()]}),l!=null&&c.jsx("span",{className:T("inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",l<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:y("leaderboard.summary.percentile",{p:String(l)})}),f?c.jsx(yn,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):c.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[c.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),c.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const Ca=i.lazy(()=>hn(()=>import("./LeaderboardProfileModal-CuALURRh.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(e=>({default:e.LeaderboardProfileModal}))),Kt=[10,20,50,100],Yt=20,Vr="tokentracker:leaderboard:pageSize";function Na(){if(typeof window>"u")return Yt;try{const e=window.localStorage.getItem(Vr),t=Number(e);if(Kt.includes(t))return t}catch{}return Yt}function br(e,t,r){const n=Number(e);if(!Number.isFinite(n)||n<=0)return"-";const o=dn(t),a=t===bn?n:n*r;return a>=1e3?`${o}${Math.round(a).toLocaleString()}`:a>=10?`${o}${Math.round(a)}`:`${o}${a.toFixed(2)}`}function pr(e,t,r){const n=t?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",o=t?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60";return r.map(a=>c.jsx("td",{"data-column-key":a.key,className:T("px-4 py-4 whitespace-nowrap text-right tabular-nums",n,o),children:Tt(e?.[a.key])},a.key))}const Ra={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 mr({rank:e,placeholder:t}){const r=Ra[e];return r?c.jsx("span",{className:T("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",r.text,r.badge),children:e}):c.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:e??t})}function xr(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t==="week"||t==="month"||t==="total"?t:null}function Da(e){if(!e)return y("shared.error.prefix",{error:y("leaderboard.error.unknown")});const t=e?.message||String(e),r=String(t||"").trim()||y("leaderboard.error.unknown");return y("shared.error.prefix",{error:r})}function qr(e){return typeof e!="string"?"":e.trim()}function Ea(e){const t=qr(e);return t?t.toLowerCase()==="anonymous":!0}function vr(e,t){const r=typeof e?.user_id=="string"?e.user_id.trim():"";return r||`${e?.rank??""}:${t}`}function yr({githubUrl:e}){return c.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[c.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:t=>t.stopPropagation(),"aria-label":y("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:c.jsx(pn,{provider:"GITHUB",size:16})}),c.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute right-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[c.jsx("span",{className:"block",children:y("leaderboard.github.tooltipAction")}),c.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[y("leaderboard.github.tooltipPrefix")," ",c.jsx(cn,{to:"/settings",onClick:t=>t.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:y("leaderboard.github.tooltipSettingsLink")}),y("leaderboard.github.tooltipSuffix")]})]})]})}function Ta({auth:e,signedIn:t,sessionSoftExpired:r}){const n=Zr(),o=Qr(),{openLoginModal:a}=en(),{signedIn:s,loading:l,user:d}=tn(),{currency:u,rate:g}=mn(),f=i.useMemo(()=>rn(),[]),p=nn(),b=t&&!r,E=i.useMemo(()=>b&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,b]),m=b?E:null,x=b&&on(m),w=y("shared.placeholder.short"),k=i.useMemo(()=>wt.map(h=>h.key),[]),{order:v,reorder:C}=ya(k),j=i.useMemo(()=>{const h=new Map;for(const M of wt)h.set(M.key,M);return h},[]),N=i.useMemo(()=>v.map(h=>j.get(h)).filter(Boolean),[v,j]),S=Ln(tr(Zt,{activationConstraint:{distance:6}}),tr(qt,{coordinateGetter:la})),R=i.useCallback(h=>{const{active:M,over:re}=h;!re||M.id===re.id||C(String(M.id),String(re.id))},[C]),[L,I]=i.useState(1),[_,Z]=i.useState(Na),[G,Q]=i.useState(null),ye=i.useCallback(h=>{typeof h=="string"&&h.trim()&&Q(h.trim())},[]),ze=i.useCallback(()=>Q(null),[]),H=i.useCallback(h=>{const M=Kt.includes(h)?h:Yt;Z(M),I(1);try{window.localStorage.setItem(Vr,String(M))}catch{}},[]),[Be,ae]=i.useState(0),[B,we]=i.useState(()=>({loading:!1,error:null,data:null})),[W,ie]=i.useState(()=>an()),[fe,ke]=i.useState(!1),O=i.useMemo(()=>{const h=new URLSearchParams(n?.search||"");return xr(h.get("period"))||"total"},[n?.search]),$e=h=>{const M=xr(h);if(!M||M===O)return;const re=new URLSearchParams(n?.search||"");re.set("period",M),I(1),o(`${n?.pathname||"/leaderboard"}?${re.toString()}`,{replace:!0})};i.useEffect(()=>{l||p||s||a()},[s,l,p,a]),i.useEffect(()=>{I(1)},[O]);const se=i.useMemo(()=>(dt(L,{min:1,max:1e6,fallback:1})-1)*_,[L,_]);i.useEffect(()=>{if(!f&&!p)return;let h=!0;return we(M=>({...M,loading:!0,error:null})),(async()=>{const M=await sn({userId:d?.id||null,period:O,limit:_,offset:se});h&&we({loading:!1,error:null,data:M})})().catch(M=>{h&&we({loading:!1,error:Da(M),data:null})}),()=>{h=!1}},[f,d?.id,se,Be,p,O,_]);const P=B.data,A=P?.total_pages??null,Ie=P?.total_entries??0,U=P?.page??L,Se=i.useMemo(()=>da(U,A),[U,A]),te=P?.from||null,me=P?.to||null,xe=P?.generated_at||null,Ce=P?.me||null,Te=y("leaderboard.me_label"),He=y("leaderboard.anon_label"),le=y("leaderboard.period.week"),Le=y("leaderboard.period.month"),Oe=y("leaderboard.period.total"),Ge=O==="month"?Le:O==="total"?Oe:le,Fe=i.useMemo(()=>{const h=Array.isArray(P?.entries)?P.entries:[];return fa({entries:h,me:Ce,meLabel:Te})},[P?.entries,Ce,Te]),Ne=i.useMemo(()=>ga(Ce?.rank,_),[Ce?.rank,_]),Rt=Ne!=null&&Ne===U,Re=i.useCallback(()=>{Ne!=null&&I(Ne)},[Ne]),De=async()=>{ke(!0);try{un(!0),ie(!0),await fn(()=>Qt(m));const h=await Qt(m);h&&await gn({accessToken:h,period:O,source:"leaderboard-enable-sync"}),ae(M=>M+1)}catch(h){console.warn("[tokentracker] sync:",h)}finally{ke(!1)}},{canPrev:Ee,canNext:Ve}=ua({page:U,totalPages:A}),ge=Array.isArray(Fe)&&Fe.length!==0;let je=null;B.loading?je=c.jsx(ma,{rows:_}):B.error?je=c.jsx("div",{className:"px-6 py-12 text-center",children:c.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:B.error})}):ge?je=c.jsx(zo,{sensors:S,collisionDetection:Pn,modifiers:[Xo],onDragEnd:R,children:c.jsx("div",{className:"w-full overflow-x-auto",children:c.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[c.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:c.jsxs("tr",{children:[c.jsx("th",{className:T(Wr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:y("leaderboard.column.rank")}),c.jsx("th",{className:T(Xr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:y("leaderboard.column.user")}),c.jsx("th",{className:"px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:y("leaderboard.column.total")}),c.jsx("th",{className:"px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:y("leaderboard.column.est_cost")}),c.jsx(Zo,{items:v,strategy:qo,children:N.map(h=>c.jsx(xa,{id:h.key,thClassName:"px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:c.jsx(ba,{iconSrc:h.icon,label:y(h.copyKey)})},h.key))})]})}),c.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Fe.map((h,M)=>{if(h?.is_ellipsis){const $=4+N.length;return c.jsx("tr",{"aria-hidden":"true",children:c.jsx("td",{colSpan:$,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${M}`)}const re=!!h?.is_me,Je=typeof h?.user_id=="string"?h.user_id:null,Ze=qr(h?.display_name),Dt=Ea(Ze)?He:Ze,ce=re?Te:Dt,Pe=!!Je,X=Pe?{role:"button",tabIndex:0,onClick:Pe?()=>ye(Je):void 0,onKeyDown:Pe?$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),ye(Je))}:void 0,"aria-label":y("leaderboard.profile_modal.row_aria",{name:ce})}:{};if(re){const $=!!h?.is_pinned;return c.jsxs("tr",{...X,className:T("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",$?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",Pe&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[c.jsx("td",{className:T(Ft(!0),"relative font-semibold text-oai-brand-600 dark:text-oai-brand-400",$&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:c.jsx(mr,{rank:h?.rank,placeholder:w})}),c.jsx("td",{className:Ut(!0),children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(Lt,{avatarUrl:h?.avatar_url,displayName:ce,seed:vr(h,ce)}),c.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:ce}),h?.github_url&&c.jsx(yr,{githubUrl:h.github_url})]})}),c.jsx("td",{className:"px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:Tt(h?.total_tokens)}),c.jsx("td",{className:"px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:br(h?.estimated_cost_usd,u,g)}),pr(h,!0,N)]},`row-${h?.rank}-${ce}${$?"-pin":""}`)}return c.jsxs("tr",{...X,className:T("group transition-colors",Pe&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[c.jsx("td",{className:T(Ft(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(mr,{rank:h?.rank,placeholder:w})}),c.jsx("td",{className:Ut(!1),children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(Lt,{avatarUrl:h?.avatar_url,displayName:ce,seed:vr(h,ce)}),c.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:ce}),h?.github_url&&c.jsx(yr,{githubUrl:h.github_url})]})}),c.jsx("td",{className:"px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:Tt(h?.total_tokens)}),c.jsx("td",{className:"px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:br(h?.estimated_cost_usd,u,g)}),pr(h,!1,N)]},`row-${h?.rank}-${ce}`)})})]})})}):je=c.jsx("div",{className:"px-6 py-12 text-center",children:c.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.empty")})});let qe=null;return typeof A=="number"?qe=Se.map((h,M)=>h==null?c.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:y("leaderboard.pagination.ellipsis")},`ellipsis-${M}`):c.jsx("button",{className:T("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",h===U?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>I(h),disabled:B.loading,children:String(h)},`page-${h}`)):qe=c.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.pagination.page_unknown",{page:String(U)})}),c.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[c.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:c.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[c.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-6 mb-8",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:y("leaderboard.title")}),c.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[O==="total"?y("leaderboard.range.total"):te&&me?y("leaderboard.range",{period:Ge,from:te,to:me}):y("leaderboard.range_loading",{period:Ge}),xe&&c.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:y("leaderboard.generated_at",{ts:xe})})]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsx(Sa,{me:Ce,totalEntries:Ie,meLabel:Te,onJumpToMe:Re,canJump:Ne!=null&&!Rt&&!B.loading}),c.jsx("div",{className:"inline-flex h-9 p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-full items-center relative",children:["week","month","total"].map(h=>{const M=O===h;return c.jsxs("button",{onClick:()=>$e(h),disabled:B.loading,className:T("px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",M?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[c.jsx("span",{className:"relative z-10",children:h==="week"?le:h==="month"?Le:Oe}),M&&c.jsx(ln.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},h)})})]})]}),!t&&c.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[c.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.signin_prompt")}),c.jsx("button",{onClick:a,className:"px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:y("leaderboard.signin_button")})]}),b&&x&&!W&&c.jsxs("div",{className:"mb-6 flex items-center justify-between text-sm",children:[c.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.sync_prompt")}),c.jsx("button",{onClick:De,disabled:fe,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:fe?y("leaderboard.sync_button.busy"):y("leaderboard.sync_button.idle")})]}),c.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[je,c.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-end gap-x-4 gap-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[c.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:y("leaderboard.pagination.page_size_label")}),c.jsxs("div",{className:"relative",children:[c.jsx("select",{id:"leaderboard-page-size",value:_,onChange:h=>H(Number(h.target.value)),disabled:B.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:Kt.map(h=>c.jsx("option",{value:h,children:h},h))}),c.jsx(xn,{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:2,"aria-hidden":"true"})]})]}),c.jsx("div",{className:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),c.jsx("button",{className:T("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Ee&&!B.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>I(h=>Math.max(1,h-1)),disabled:!Ee||B.loading,children:y("leaderboard.pagination.prev")}),c.jsx("div",{className:"flex flex-wrap items-center gap-1",children:qe}),c.jsx("button",{className:T("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Ve&&!B.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>I(h=>h+1),disabled:!Ve||B.loading,children:y("leaderboard.pagination.next")})]})]})]})}),c.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:c.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[c.jsx("p",{children:y("landing.v2.footer.line")}),c.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:y("landing.v2.nav.github")})]})}),c.jsx(i.Suspense,{fallback:null,children:c.jsx(Ca,{isOpen:!!G,userId:G,period:O,accessToken:m,onClose:ze})})]})}export{Ta as LeaderboardPage};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import{c as q,r as g,aO as K,C as a,B as o,aP as Q,ah as V,aQ as aa,S as d,aG as ea,L as ra,n as ta,X as sa,G as R,F as ia}from"./main-ucQlYWcW.js";import{u as oa}from"./useCurrency-BCgpAcqK.js";import{L as B}from"./LeaderboardAvatar-eipAcwXo.js";import{P as C}from"./ProviderIcon-L6z81yHi.js";import{A as na}from"./ActivityHeatmap-ByU2hUad.js";import{A as $}from"./arrow-up-right-DVWbxoR_.js";import{D as la,d as da,e as ca,f as ma,g as xa,h as ga}from"./DialogTitle-BL4bLqSk.js";import"./info-CxuBFHAT.js";const pa=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],ha=q("heart",pa),M="tokentracker_likes";function F(e){if(!e)return!1;try{const r=localStorage.getItem(M);return r?!!JSON.parse(r)?.[e]:!1}catch{return!1}}function A(e,r){if(e)try{const t=localStorage.getItem(M),s=t?JSON.parse(t):{};r?s[e]=!0:delete s[e],localStorage.setItem(M,JSON.stringify(s))}catch{}}function U({userId:e}){const[r,t]=g.useState(!1),[s,i]=g.useState(0),[c,m]=g.useState(!1),[l,p]=g.useState(!1),[u,y]=g.useState(!1),[k,L]=g.useState([]),[j,b]=g.useState(!1),v=g.useRef(0);g.useEffect(()=>{let n=!1;return e?(m(!1),t(F(e)),K({userId:e}).then(x=>{n||(i(Number(x?.count)||0),m(!0))}).catch(()=>{n||(i(0),m(!0))}),()=>{n=!0}):(m(!1),()=>{n=!0})},[e]);const N=()=>{y(!0),setTimeout(()=>y(!1),450),b(!0),setTimeout(()=>b(!1),500);const n=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],x=["circle","heart"],f=[];for(let h=0;h<12;h++){const _=(h*30+Math.random()*20-10)*(Math.PI/180),w=45+Math.random()*45,I=Math.cos(_)*w,O=Math.sin(_)*w-(10+Math.random()*15),W=Math.random()*360-180,J=6+Math.random()*8,X=n[Math.floor(Math.random()*n.length)],Y=x[Math.floor(Math.random()*x.length)],Z=++v.current;f.push({id:Z,tx:I,ty:O,rot:W,size:J,color:X,shape:Y})}L(h=>[...h,...f]),setTimeout(()=>{L(h=>h.filter(_=>!f.find(w=>w.id===_.id)))},850)},D=async n=>{p(!0);try{const x=await Q({userId:e,delta:n}),f=Number(x?.count);Number.isFinite(f)&&i(f)}catch{t(x=>!x),i(x=>Math.max(0,x-n)),A(e,!F(e))}finally{p(!1)}},G=n=>{n.stopPropagation(),!(!e||!c||l)&&(r?(t(!1),i(x=>Math.max(0,x-1)),A(e,!1),D(-1)):(t(!0),i(x=>x+1),A(e,!0),N(),D(1)))};return a.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:`
|
|
2
|
-
@keyframes tt-like-pop {
|
|
3
|
-
0% { transform: scale(1); }
|
|
4
|
-
25% { transform: scale(0.75); }
|
|
5
|
-
50% { transform: scale(1.35); }
|
|
6
|
-
75% { transform: scale(0.9); }
|
|
7
|
-
100% { transform: scale(1); }
|
|
8
|
-
}
|
|
9
|
-
@keyframes tt-particle-fly {
|
|
10
|
-
0% {
|
|
11
|
-
transform: translate(0, 0) scale(1) rotate(0deg);
|
|
12
|
-
opacity: 1;
|
|
13
|
-
}
|
|
14
|
-
70% {
|
|
15
|
-
opacity: 0.8;
|
|
16
|
-
}
|
|
17
|
-
100% {
|
|
18
|
-
transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot));
|
|
19
|
-
opacity: 0;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
@keyframes tt-num-scroll {
|
|
23
|
-
0% { transform: translateY(8px); opacity: 0; }
|
|
24
|
-
100% { transform: translateY(0); opacity: 1; }
|
|
25
|
-
}
|
|
26
|
-
.tt-animate-pop {
|
|
27
|
-
animation: tt-like-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
|
|
28
|
-
}
|
|
29
|
-
.tt-particle {
|
|
30
|
-
position: absolute;
|
|
31
|
-
top: 50%;
|
|
32
|
-
left: 50%;
|
|
33
|
-
margin-top: -6px;
|
|
34
|
-
margin-left: -6px;
|
|
35
|
-
pointer-events: none;
|
|
36
|
-
z-index: 50;
|
|
37
|
-
}
|
|
38
|
-
.tt-num-anim {
|
|
39
|
-
animation: tt-num-scroll 0.25s ease-out forwards;
|
|
40
|
-
}
|
|
41
|
-
`}}),k.map(n=>a.jsx("span",{className:"tt-particle",style:{"--tx":`${n.tx}px`,"--ty":`${n.ty}px`,"--rot":`${n.rot}deg`,width:`${n.size}px`,height:`${n.size}px`,backgroundColor:n.shape==="circle"?n.color:"transparent",borderRadius:n.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:n.shape==="heart"&&a.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:n.color,className:"w-full h-full",children:a.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},n.id)),a.jsxs("button",{type:"button",onClick:G,disabled:!c||l,"aria-label":r?o("leaderboard.profile.like.aria_unlike"):o("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${r?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[a.jsx("span",{className:u?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:a.jsx(ha,{size:14,className:`transition-all duration-300 ${r?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),a.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${r?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${j?"tt-num-anim":""}`,children:c?s:"·"})]})]})}function fa(e,r,t){const s=Number(e);return!Number.isFinite(s)||s<0?"—":s>0&&s<.01?`<${r==="USD"?"$":""}0.01`:ia(s,{decimals:2,currency:r,rate:t})}function T(e,r,t){const s=Number(e);if(!Number.isFinite(s)||s<0)return"—";if(s<1e3)return fa(s,r,t);const i=r==="USD"?s:s*(t||1);return`${r==="USD"?"$":""}${R(i,{decimals:1})}`}function z(e){const r=Number(e);return!Number.isFinite(r)||r<=0?"0":R(r,{decimals:1})}function ba(e){const r=Array.isArray(e)?e:[];if(r.length===0)return null;const t=r.map(i=>({day:i.date,total_tokens:i.total_tokens,models:i.models||null})),s=r[r.length-1]?.date;return ta({dailyRows:t,weeks:52,to:s})}const ua=`
|
|
42
|
-
@keyframes tt-shimmer {
|
|
43
|
-
100% { transform: translateX(100%); }
|
|
44
|
-
}
|
|
45
|
-
.tt-shimmer-bar {
|
|
46
|
-
position: relative;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
}
|
|
49
|
-
.tt-shimmer-bar::after {
|
|
50
|
-
position: absolute;
|
|
51
|
-
top: 0; right: 0; bottom: 0; left: 0;
|
|
52
|
-
transform: translateX(-100%);
|
|
53
|
-
background-image: linear-gradient(
|
|
54
|
-
90deg,
|
|
55
|
-
rgba(0, 0, 0, 0) 0%,
|
|
56
|
-
rgba(0, 0, 0, 0.02) 20%,
|
|
57
|
-
rgba(0, 0, 0, 0.06) 60%,
|
|
58
|
-
rgba(0, 0, 0, 0) 100%
|
|
59
|
-
);
|
|
60
|
-
animation: tt-shimmer 1.6s infinite;
|
|
61
|
-
content: '';
|
|
62
|
-
}
|
|
63
|
-
.dark .tt-shimmer-bar::after {
|
|
64
|
-
background-image: linear-gradient(
|
|
65
|
-
90deg,
|
|
66
|
-
rgba(255, 255, 255, 0) 0%,
|
|
67
|
-
rgba(255, 255, 255, 0.02) 20%,
|
|
68
|
-
rgba(255, 255, 255, 0.06) 60%,
|
|
69
|
-
rgba(255, 255, 255, 0) 100%
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
`;function ya({variant:e="modal"}){const r="rounded bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar",t=e==="page";return a.jsxs("div",{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:ua}}),t?a.jsxs("div",{className:"flex items-start gap-5 px-6 sm:px-8 pt-8 pb-7 animate-fade-in",children:[a.jsx("div",{className:"h-[68px] w-[68px] rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0 flex items-start justify-between gap-4 pt-0.5",children:[a.jsxs("div",{className:"min-w-0 space-y-2.5",children:[a.jsx("div",{className:d(r,"h-7 w-48")}),a.jsx("div",{className:d(r,"h-3.5 w-32")})]}),a.jsxs("div",{className:"shrink-0 space-y-1.5 flex flex-col items-end",children:[a.jsx("div",{className:d(r,"h-2.5 w-8")}),a.jsx("div",{className:d(r,"h-7 w-12")})]})]})]}):a.jsxs("div",{className:"flex items-start gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60 animate-fade-in",children:[a.jsx("div",{className:"h-14 w-14 rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2 pt-1",children:[a.jsx("div",{className:d(r,"h-4 w-40")}),a.jsx("div",{className:d(r,"h-3 w-56")})]}),a.jsx("div",{className:d(r,"h-4 w-4 shrink-0 mt-1")})]}),a.jsxs("div",{className:d("space-y-6",t?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"px-6 py-5"),children:[a.jsx("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:Array.from({length:4}).map((s,i)=>a.jsxs("div",{children:[a.jsx("div",{className:d(r,"h-6 w-20")}),a.jsx("div",{className:d(r,"mt-2 h-3 w-14")})]},i))}),a.jsx("div",{className:"space-y-3 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:Array.from({length:3}).map((s,i)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:d(r,"h-3 w-24")}),a.jsx("div",{className:d(r,"h-3 w-44")})]},i))}),a.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[a.jsx("div",{className:d(r,"h-3 w-44 mb-4")}),a.jsx("div",{className:"grid grid-cols-[repeat(52,1fr)] gap-[2px]",children:Array.from({length:364}).map((s,i)=>a.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},i))})]}),a.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[a.jsx("div",{className:d(r,"h-3 w-28 mb-3")}),a.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((s,i)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:d(r,"h-4 w-4")}),a.jsx("div",{className:d(r,"h-3 w-16")}),a.jsx("div",{className:d(r,"h-[3px] flex-1")}),a.jsx("div",{className:d(r,"h-3 w-12")})]},i))})]})]})]})}function E(e){if(!e)return null;const r=String(e).match(/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})/i);return r?r[1]:null}function H({children:e}){return a.jsx("h3",{className:"text-[11px] uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400 mb-3",children:e})}function S({value:e,label:r}){return a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl font-black tabular-nums tracking-tight leading-none text-oai-black dark:text-white",style:{fontFamily:'"DIN Alternate-Bold", "DIN Alternate", "DIN Condensed-Bold", "Impact", -apple-system, sans-serif',fontWeight:900},children:e}),a.jsx("div",{className:"mt-1.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r})]})}function P({label:e,children:r}){return a.jsxs("div",{className:"flex items-baseline gap-3 text-sm",children:[a.jsx("dt",{className:"shrink-0 w-28 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",children:e}),a.jsx("dd",{className:"min-w-0 flex-1 text-oai-gray-900 dark:text-oai-gray-100 tabular-nums truncate flex items-baseline gap-2 flex-wrap",children:r})]})}function ka({user:e,onClose:r}){const t=E(e?.github_url);return a.jsxs("div",{className:"flex items-center gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60",children:[a.jsx(B,{avatarUrl:e?.avatar_url,displayName:e?.display_name||"",seed:e?.user_id||e?.display_name,size:"lg",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:e?.display_name||"—"}),e?.rank?a.jsx("span",{className:d("shrink-0 inline-flex items-center px-2 py-0.5 rounded text-xs font-bold font-mono uppercase tracking-wider border shadow-sm",e.rank===1&&"bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400 dark:bg-amber-400/10",e.rank===2&&"bg-slate-500/10 text-slate-600 border-slate-500/20 dark:text-slate-400 dark:bg-slate-400/10",e.rank===3&&"bg-orange-500/10 text-orange-700 border-orange-500/20 dark:text-orange-400 dark:bg-orange-400/10",e.rank>3&&"bg-oai-gray-100 dark:bg-oai-gray-900/60 text-oai-gray-500 dark:text-oai-gray-400 border-oai-gray-200/60 dark:border-oai-gray-800"),children:o("leaderboard.profile_modal.rank",{rank:e.rank})}):null]}),t&&a.jsxs("a",{href:e.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-[12px] text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200 transition-colors",children:[a.jsx(C,{provider:"GITHUB",size:11}),a.jsxs("span",{children:["@",t]})]})]}),e?.user_id&&a.jsx("div",{className:"shrink-0 flex items-center justify-center",children:a.jsx(U,{userId:e.user_id})}),r&&a.jsx("button",{type:"button",onClick:r,className:"shrink-0 -mr-1 -mt-1 flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors group","aria-label":o("leaderboard.profile_modal.close"),children:a.jsx(sa,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function ja({user:e}){const r=E(e?.github_url),t=Number(e?.rank)||0,s=t===1?"text-amber-500 dark:text-amber-400":t===2?"text-slate-500 dark:text-slate-300":t===3?"text-orange-600 dark:text-orange-400":"text-oai-gray-400 dark:text-oai-gray-500";return a.jsxs("div",{className:"flex items-center gap-5 px-6 sm:px-8 pt-8 pb-7",children:[a.jsx(B,{avatarUrl:e?.avatar_url,displayName:e?.display_name||"",seed:e?.user_id||e?.display_name,size:"xl",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),a.jsxs("div",{className:"min-w-0 flex-1 flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[a.jsx("h1",{className:"truncate text-2xl sm:text-[28px] font-semibold tracking-tight leading-tight text-oai-black dark:text-white",children:e?.display_name||"—"}),e?.user_id&&a.jsx(U,{userId:e.user_id})]}),r?a.jsxs("a",{href:e.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white transition-colors",children:[a.jsx(C,{provider:"GITHUB",size:13}),a.jsxs("span",{children:["@",r]})]}):null]}),t?a.jsxs("div",{className:"shrink-0 text-right leading-none",children:[a.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-oai-gray-400 dark:text-oai-gray-500",children:o("leaderboard.profile.hero.rank_label")}),a.jsx("div",{className:d("mt-1.5 text-3xl font-black tabular-nums tracking-tight",s),children:o("leaderboard.profile_modal.rank",{rank:t})})]}):null]})]})}function va({data:e}){const r=Array.isArray(e)?e:[];return r.length===0?a.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:o("leaderboard.profile_modal.providers.none")}):a.jsx("ul",{className:"space-y-2",children:r.map(t=>{const s=Math.max(0,Math.min(1,Number(t?.percent)||0));return a.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[a.jsx("span",{className:"shrink-0 inline-flex items-center justify-center w-4 h-4",children:a.jsx(C,{provider:String(t.source).toUpperCase(),size:14})}),a.jsx("span",{className:"shrink-0 capitalize w-16 text-oai-gray-700 dark:text-oai-gray-300",children:t.source}),a.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:a.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(s*100).toFixed(1)}%`}})}),a.jsx("span",{className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:z(t.total_tokens)}),a.jsxs("span",{className:"shrink-0 w-10 text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[(s*100).toFixed(0),"%"]})]},t.source)})})}function Na({data:e,currency:r,rate:t,onClose:s,variant:i="modal"}){const{user:c,totals:m,streak:l,best_day:p,models:u,by_provider:y,heatmap:k,period:L}=e,j=i==="page",b=g.useMemo(()=>ba(k),[k]),v=u?.favorite?.model_name,N=Number(u?.count)||0;return a.jsxs(a.Fragment,{children:[j?a.jsx(ja,{user:c}):a.jsx(ka,{user:c,onClose:s}),a.jsxs("div",{className:d("space-y-6",j?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"flex-1 min-h-0 overflow-y-auto oai-scrollbar px-6 py-5"),children:[a.jsxs("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:[a.jsx(S,{value:z(m?.total_tokens),label:o("leaderboard.profile_modal.stat.total_tokens")}),a.jsx(S,{value:T(m?.estimated_cost_usd,r,t),label:o("leaderboard.profile_modal.stat.total_cost")}),a.jsx(S,{value:String(m?.active_days??0),label:o("leaderboard.profile_modal.stat.active_days")}),a.jsx(S,{value:T(m?.avg_per_day_usd,r,t),label:o("leaderboard.profile_modal.stat.avg_per_day")})]}),a.jsxs("dl",{className:"space-y-2 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[a.jsxs(P,{label:o("leaderboard.profile_modal.streak.current"),children:[a.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:o("leaderboard.profile_modal.streak.days",{count:l?.current_days??0})}),a.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",l?.longest_days??0,")"]})]}),a.jsx(P,{label:o("leaderboard.profile_modal.best_day.title"),children:p?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:z(p.total_tokens)}),a.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",p.date]})]}):a.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:o("leaderboard.profile_modal.best_day.none")})}),a.jsx(P,{label:o("leaderboard.profile_modal.models.favorite"),children:v?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30 truncate max-w-[200px] inline-block align-bottom",children:v}),N>1&&a.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:o("leaderboard.profile_modal.models.count",{count:N})})]}):a.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:o("leaderboard.profile_modal.models.none")})})]}),b&&a.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[a.jsx(H,{children:o("leaderboard.profile_modal.heatmap.title")}),a.jsx("div",{className:"min-w-0",children:a.jsx(na,{heatmap:b,hideLegend:!0,embedded:!0})})]}),a.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[a.jsx(H,{children:o("leaderboard.profile_modal.providers.title")}),a.jsx(va,{data:y})]}),s&&c?.user_id&&a.jsx("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-4",children:ea()?a.jsxs("a",{href:`https://www.tokentracker.cc/u/${c.user_id}`,target:"_blank",rel:"noopener noreferrer",onClick:s,className:"inline-flex items-center gap-1 text-xs text-oai-gray-500 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:text-oai-gray-100 transition-colors",children:[a.jsx("span",{children:o("leaderboard.profile_modal.view_full")}),a.jsx($,{size:12,strokeWidth:2,"aria-hidden":!0})]}):a.jsxs(ra,{to:`/u/${c.user_id}`,onClick:s,className:"inline-flex items-center gap-1 text-xs text-oai-gray-500 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:text-oai-gray-100 transition-colors",children:[a.jsx("span",{children:o("leaderboard.profile_modal.view_full")}),a.jsx($,{size:12,strokeWidth:2,"aria-hidden":!0})]})})]})]})}function _a({userId:e,period:r,accessToken:t,enabled:s=!0}){const[i,c]=g.useState({loading:!1,error:null,data:null});return g.useEffect(()=>{if(!s||!e)return;let m=!0;return c({loading:!0,error:null,data:null}),(async()=>{try{const l=t?await V(t):null;if(!m)return;const p=await aa({accessToken:l,userId:e,period:r||"week"});if(!m)return;c({loading:!1,error:null,data:p})}catch(l){if(!m)return;l?.status===404?c({loading:!1,error:null,data:null}):c({loading:!1,error:l?.message||String(l),data:null})}})(),()=>{m=!1}},[s,e,r,t]),i}function Da({isOpen:e,onClose:r,userId:t,period:s,accessToken:i}){const{currency:c,rate:m}=oa(),l=_a({userId:t,period:s,accessToken:i,enabled:e});return a.jsx(la,{open:e,onOpenChange:p=>{p||r?.()},children:a.jsxs(da,{children:[a.jsx(ca,{className:"cost-modal-backdrop"}),a.jsx(ma,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:a.jsxs(xa,{className:d("cost-modal-popup","relative w-full max-w-[540px] max-h-[calc(100vh-2rem)] flex flex-col","rounded-2xl bg-white dark:bg-oai-gray-950","shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)]","ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden","dark:border-t dark:border-white/[0.08]"),children:[a.jsx(ga,{render:a.jsx("h2",{className:"sr-only"}),children:l.data?.user?.display_name||o("leaderboard.profile_modal.loading")}),l.loading&&a.jsx(ya,{}),!l.loading&&l.error&&a.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:a.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:o("leaderboard.profile_modal.error")})}),!l.loading&&!l.error&&!l.data&&a.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:a.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:o("leaderboard.profile_modal.empty")})}),!l.loading&&!l.error&&l.data&&a.jsx(Na,{data:l.data,currency:c,rate:m,onClose:r})]})})]})})}export{Da as LeaderboardProfileModal,Na as ProfileContent,ya as ProfileSkeleton,_a as useLeaderboardProfileData};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,C as e,Q as j,T as w,U as N,L as k,aj as L,B as s,a8 as I}from"./main-ucQlYWcW.js";import{u as T}from"./useCurrency-BCgpAcqK.js";import{H as C}from"./HeaderGithubStar-DMVEHsGB.js";import{useLeaderboardProfileData as M,ProfileSkeleton as _,ProfileContent as E}from"./LeaderboardProfileModal-CuALURRh.js";import"./LeaderboardAvatar-eipAcwXo.js";import"./ProviderIcon-L6z81yHi.js";import"./ActivityHeatmap-ByU2hUad.js";import"./info-CxuBFHAT.js";import"./arrow-up-right-DVWbxoR_.js";import"./DialogTitle-BL4bLqSk.js";const l=18;function y(){return e.jsxs("svg",{"aria-hidden":!0,width:l,height:l,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 v(){return e.jsx("svg",{"aria-hidden":!0,width:l,height:l,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 S(){return e.jsxs("svg",{"aria-hidden":!0,width:l,height:l,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 P=[{value:"light",label:"Light",Icon:y},{value:"dark",label:"Dark",Icon:v},{value:"system",label:"System",Icon:S}];function B(a){return a==="dark"?v:y}function O({theme:a,resolvedTheme:h,onSetTheme:g,className:m="",direction:u="down",align:p="right"}){const[o,x]=d.useState(!1),c=d.useRef(null),n=d.useCallback(()=>x(!1),[]);d.useEffect(()=>{if(!o)return;const r=i=>{c.current&&!c.current.contains(i.target)&&n()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[o,n]),d.useEffect(()=>{if(!o)return;const r=i=>{i.key==="Escape"&&n()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[o,n]);const b=B(h);return e.jsxs("div",{ref:c,className:`relative ${m}`,children:[e.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":o,onClick:()=>x(r=>!r),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(b,{})}),o&&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 ${u==="up"?"bottom-full mb-1":"top-full mt-1"} ${p==="left"?"left-0":"right-0"}`,children:P.map(({value:r,label:i,Icon:f})=>{const t=a===r;return e.jsxs("button",{type:"button",onClick:()=>{g(r),n()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${t?"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(f,{}),e.jsx("span",{children:i})]},r)})})]})}function Q({auth:a,signedIn:h,sessionSoftExpired:g,userId:m}){const{currency:u,rate:p}=T(),{theme:o,resolvedTheme:x,setTheme:c}=j(),{openLoginModal:n}=w(),{signedIn:b,loading:r}=N(),i=h&&!g,f=d.useMemo(()=>i&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,i]),t=M({userId:m,period:"total",accessToken:f});return e.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 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 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:e.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(k,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",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 scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:e.jsx(C,{})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsxs(k,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-lg border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[e.jsx(L,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),e.jsx("span",{children:s("leaderboard.profile.nav.back")})]}),r?e.jsx("div",{className:"h-8 w-16 animate-pulse rounded-lg bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):b?e.jsx(I,{}):e.jsx("button",{type:"button",onClick:n,className:"inline-flex h-8 min-w-[76px] items-center justify-center rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-all duration-200 active:scale-[0.98] select-none text-xs font-bold shadow-sm",children:s("header.auth.sign_in_aria")})]})]})}),e.jsx("main",{className:"flex-1 pt-4 pb-10 sm:pt-6 sm:pb-16",children:e.jsx("div",{className:"mx-auto max-w-2xl px-4 sm:px-6",children:e.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[t.loading&&e.jsx(_,{variant:"page"}),!t.loading&&t.error&&e.jsx("div",{className:"px-6 py-16 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:s("leaderboard.profile_modal.error")})}),!t.loading&&!t.error&&!t.data&&e.jsx("div",{className:"px-6 py-16 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.profile_modal.empty")})}),!t.loading&&!t.error&&t.data&&e.jsx(E,{data:t.data,currency:u,rate:p,variant:"page"})]})})}),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-2xl 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:s("landing.v2.footer.line")}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(O,{theme:o,resolvedTheme:x,onSetTheme:c,direction:"up",align:"right"}),e.jsx(k,{to:"/leaderboard",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:s("leaderboard.profile.nav.back")})]})]})})]})}export{Q as LeaderboardProfilePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as v,r as l,b as Q,f as J,ap as L,C as t,D as O,S as y,B as s,U as X,ae as ee,aq as te,af as ne,ag as ae,ah as P,ar as ie,as as se,T as oe,R as re,P as le,Q as ce,Y as ue,at as de,au as ge,av as _,aw as he,ax as pe,ay as me,az as be,H as fe,aA as xe,a9 as ye}from"./main-ucQlYWcW.js";import{L as ve,a as G,u as ke}from"./use-limits-display-prefs-B6zAQQ9V.js";import{S as k,T as j,a as b,b as I,u as D}from"./use-native-settings-C0ZhPtTY.js";import{C as je}from"./check-CQ-rAjt3.js";import{u as Ne}from"./useCurrency-BCgpAcqK.js";import{C as Se}from"./chevron-down-DtOT9b1q.js";import{I as we}from"./info-CxuBFHAT.js";import{D as Ce}from"./download-CMXwYo7E.js";import"./Card-Ca3xp-bE.js";const Le=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ge=v("activity",Le);const Ie=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ee=v("copy",Ie);const Ae=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Oe=v("grip-vertical",Ae);const Pe=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],E=v("languages",Pe);const _e=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],De=v("log-out",_e);const Te=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ue=v("pencil",Te),Me=e=>!e.isLayoutDirty&&e.willUpdate(!1);function A(){const e=new Set,n=new WeakMap,i=()=>e.forEach(Me);return{add:a=>{e.add(a),n.set(a,a.addEventListener("willUpdate",i))},remove:a=>{e.delete(a);const o=n.get(a);o&&(o(),n.delete(a)),i()},dirty:i}}const Re=l.createContext(null);function Fe(){const e=l.useRef(!1);return Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function He(){const e=Fe(),[n,i]=l.useState(0),a=l.useCallback(()=>{e.current&&i(n+1)},[n]);return[l.useCallback(()=>J.postRender(a),[a]),n]}const T=e=>e===!0,$e=e=>T(e===!0)||e==="id",Be=({children:e,id:n,inherit:i=!0})=>{const a=l.useContext(L),o=l.useContext(Re),[r,c]=He(),u=l.useRef(null),g=a.id||o;u.current===null&&($e(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:T(i)&&a.group||A()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return t.jsx(L.Provider,{value:h,children:e})},ze=new Set(["cursor","kiro","copilot","kimi"]);function Ve({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:y("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:y("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Ze({prefs:e}){const{order:n,visibility:i,toggle:a,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},m=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},x=d=>{d.preventDefault(),c(null),g(null)};return t.jsx(Be,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const p=i[d]!==!1,N=r===d;return t.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:f,onDrop:x,className:y("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[t.jsx(Oe,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),t.jsx("img",{src:ve[d],alt:"",width:18,height:18,className:y("h-[18px] w-[18px] shrink-0 pointer-events-none",ze.has(d)&&"dark:invert"),draggable:!1}),t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:G[d]}),t.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:t.jsx(Ve,{checked:p,onChange:()=>a(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${G[d]}`})})]},d)})})})}function We(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},a=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof a=="string"&&a.trim()?a.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function Ke(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function Ye(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),a=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||a?.[1];return o?`https://github.com/${o}`:null}function w(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function qe(e,n,i){const[a,o]=l.useState(()=>ee()),r=n&&i&&te(),c=l.useCallback(async()=>{const u=!a;if(ne(u),o(u),!!u)try{await ae(()=>e())}catch(g){w("cloud sync",g)}},[a,e]);return{cloudSyncOn:a,handleCloudSyncToggle:c,showLocalCloudSync:r}}function Qe(e){const[n,i]=l.useState(!1),[a,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[f,x]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[F,C]=l.useState(""),[H,$]=l.useState(""),[B,z]=l.useState(!1),[V,Z]=l.useState(null),W=l.useMemo(()=>We(e),[e]),K=l.useMemo(()=>Ke(e),[e]),Y=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:i,setShowGithubOn:S}),[]);return{anonymousOn:a,customDisplayName:h,displayName:W,editingGithub:B,editingName:f,email:K,githubError:V,githubInput:H,githubUrl:F,loadSetters:q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:z,setEditingName:x,setGithubError:Z,setGithubInput:$,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:S,showGithubOn:N,userId:Y}}function Je(e,n,i){l.useEffect(()=>{if(!n)return;let a=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await P({getAccessToken:e});if(!a||!o)return;const r=await ie({accessToken:o});if(!a)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{a&&i.setProfileLoading(!1)}})(),()=>{a=!1}},[e,n,i])}function Xe(e,n){return l.useCallback(async(i,{label:a,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const c=await P({getAccessToken:e});if(!c)return!1;const u=await se({accessToken:c,...i});return r?.(u),!0}catch(c){return o?o(c):w(a||"mutate profile",c),!1}finally{n.setProfileSaving(!1)}},[e,n])}function et(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function tt(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function nt(e,n){const i=l.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function at(e,n){const i=l.useCallback(async()=>{const o=e.nameInput.trim().slice(0,50);o&&await n({display_name:o},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(o),e.setEditingName(!1)}})},[n,e]),a=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:a}}function it(e,n){const i=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),a=l.useCallback(async()=>{const r=Ye(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:a,handleShowGithubToggle:i,startEditingGithub:o}}function st(){const e=X(),n=Qe(e.user),i=qe(e.getAccessToken,e.enabled,e.signedIn);Je(e.getAccessToken,e.signedIn,n.loadSetters);const a=Xe(e.getAccessToken,n),o=nt(n,a),r=at(n,a),c=it(n,a);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:et(n,{...o,...r}),github:tt(n,c),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function U({disabled:e,onCancel:n,onSave:i,saveLabel:a=s("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:a}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function ot({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:a,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),t.jsx(U,{disabled:a||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:a?s("settings.account.saving"):void 0})]})}function rt({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:a,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),t.jsx(U,{disabled:a,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:a?s("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function M({disabled:e=!1,label:n,onClick:i,title:a}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:a,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ue,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function R({actions:e,editing:n,editor:i,hint:a,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a})]}),n?null:e]})})}function lt({name:e}){const n=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(M,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function ct({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:a,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:f,startEditingName:x}=e,d=n?s("settings.account.displayNameAnonymousHint"):i||a;return t.jsx(R,{label:s("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(ot,{nameInput:u,setEditingName:m,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:t.jsx(lt,{name:e})})}function ut({github:e}){const{editingGithub:n,githubError:i,githubInput:a,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f,showGithubOn:x,startEditingGithub:d}=e;return t.jsx(R,{label:s("settings.account.githubUrl"),editing:n,hint:o||s("settings.account.githubUrlHint"),editor:t.jsx(rt,{githubError:i,githubInput:a,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(M,{label:s("settings.account.edit"),onClick:d}),t.jsx(j,{checked:x,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function dt(){const{openLoginModal:e}=oe();return t.jsx(k,{title:s("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function gt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(ct,{name:e}),t.jsx(ut,{github:n})]})}function ht(){const e=st();return e.enabled?e.signedIn?t.jsxs(k,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(mt,{onSignOut:e.signOut}),children:[t.jsx(pt,{userId:e.userId}),t.jsx(bt,{settings:e}),t.jsx(ft,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(xt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(dt,{}):null}function pt({userId:e}){const[n,i]=re.useState(!1);if(!e)return null;const a=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":s("settings.account.copyUserId"),children:[n?t.jsx(je,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?s("settings.account.copied"):s("settings.account.copy")]})]})}function mt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(De,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function bt({settings:e}){return e.showLocalCloudSync?t.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function ft({checked:e,disabled:n,onChange:i}){return t.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:s("settings.account.publicProfile")})})}function xt({visible:e,name:n,github:i}){return t.jsx(le,{initial:!1,children:e?t.jsx(O.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(gt,{name:n,github:i})},"public-profile-fields"):null})}function yt(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:de},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:ge},{value:"system",label:s("settings.appearance.theme.system"),Icon:_}]}function vt(){return[{value:he,label:s("settings.appearance.language.system"),Icon:_},{value:pe,label:s("settings.appearance.language.english"),Icon:E},{value:me,label:s("settings.appearance.language.chinese"),Icon:E}]}function kt(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function jt(e,n){const i=s(`settings.appearance.currency.rate_source.${e}`),a=kt(n),o=a?s("settings.appearance.currency.rate_updated",{when:a}):s("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Nt({currency:e,setCurrency:n}){const i=be();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.currency.label"),className:y("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-3 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500","dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.code,children:s(a.labelKey)},a.code))}),t.jsx(Se,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function St({currency:e,rate:n,rateSource:i,rateFetchedAt:a}){if(e===fe)return t.jsx(t.Fragment,{children:s("settings.appearance.currency.hint")});const o=jt(i,a);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx(we,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function wt(){const{theme:e,setTheme:n}=ce(),{locale:i,setLocale:a}=ue(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ne();return t.jsxs(k,{title:s("settings.section.appearance"),children:[t.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:t.jsx(I,{options:yt(),value:e,onChange:n})}),t.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:t.jsx(I,{options:vt(),value:i,onChange:a})}),t.jsx(b,{label:s("settings.appearance.currency.label"),hint:t.jsx(St,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:t.jsx(Nt,{currency:o,setCurrency:g})})]})}function Ct(){const{available:e,settings:n,setSetting:i,runAction:a}=D();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,c=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(k,{title:s("settings.section.menubar"),children:[r?t.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,t.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>a("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(xe,{className:y("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),t.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:t.jsxs("button",{type:"button",onClick:()=>a("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ce,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Lt(){const{available:e,settings:n,runAction:i}=D(),a=e&&n?.version;return t.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[a?t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["TokenTrackerBar v",n.version]}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,t.jsxs("a",{href:ye,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function Ut(){const e=ke();return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(wt,{}),t.jsx(Ct,{}),t.jsx(ht,{}),t.jsx(k,{title:s("settings.section.limits"),children:t.jsx(Ze,{prefs:e})})]}),t.jsx(Lt,{})]})})})}export{Ut as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c}from"./main-ucQlYWcW.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
|