tokentracker-cli 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{ActivityHeatmap-CiilYEqW.js → ActivityHeatmap-BfxK9hvH.js} +1 -1
- package/dashboard/dist/assets/{Card-BkDHn179.js → Card-Sg0FPI4e.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-BwTkSsim.js → DashboardPage-IdI75EjJ.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-DX8aCjtt.js → DevicePage-BuyHqTu3.js} +1 -1
- package/dashboard/dist/assets/{DialogTitle-DH5VFL8l.js → DialogTitle-B0st_3V5.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CcubhRKW.js → FadeIn-bxDP-K40.js} +1 -1
- package/dashboard/dist/assets/HeaderGithubStar-BEHD7rie.js +1 -0
- package/dashboard/dist/assets/{IpCheckPage-BcHkEcE7.js → IpCheckPage-C57xLKui.js} +4 -4
- package/dashboard/dist/assets/{LandingPage-Bnqs_k3p.js → LandingPage-COsYhPBM.js} +31 -31
- package/dashboard/dist/assets/LeaderboardAvatar-96tM6DY0.js +1 -0
- package/dashboard/dist/assets/LeaderboardPage-BuRxhyKL.js +6 -0
- package/dashboard/dist/assets/LeaderboardProfileModal-BHCcrJjo.js +32 -0
- package/dashboard/dist/assets/LeaderboardProfilePage-SFrFYBLF.js +1 -0
- package/dashboard/dist/assets/LimitsPage-CvN3W5RK.js +2 -0
- package/dashboard/dist/assets/LocalOnlyNotice-B7WiSJ6k.js +1 -0
- package/dashboard/dist/assets/{LoginPage-1M5RskQE.js → LoginPage-31Oiu8B_.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-BzS6tVnf.js → PopoverPopup-JofwunzX.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-C8nYnvzP.js → ProviderIcon-JDw0Drn4.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-DjoUqFA-.js → SettingsPage-C7FP78_q.js} +1 -1
- package/dashboard/dist/assets/SkillsPage-Df5UWPX0.js +1 -0
- package/dashboard/dist/assets/WidgetsPage-BCV3A8Pz.js +1 -0
- package/dashboard/dist/assets/{WrappedPage-BxuVlF3C.js → WrappedPage-DhojFfsH.js} +1 -1
- package/dashboard/dist/assets/arrow-up-right-BWxw7oTY.js +1 -0
- package/dashboard/dist/assets/check-B6GHhpMZ.js +1 -0
- package/dashboard/dist/assets/{chevron-down-BS2aEE_V.js → chevron-down-CES2R9rt.js} +1 -1
- package/dashboard/dist/assets/{download-DtsgF1HV.js → download-XTaZ-oYR.js} +1 -1
- package/dashboard/dist/assets/{info-TG4KyASc.js → info-B920DcmX.js} +1 -1
- package/dashboard/dist/assets/main-DwtQoM3t.css +1 -0
- package/dashboard/dist/assets/{main-CR7sCH5H.js → main-RGma-IbC.js} +25 -19
- package/dashboard/dist/assets/{use-limits-display-prefs-DgRoQmhK.js → use-limits-display-prefs-Ddyh6mLl.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-BVWj6xAN.js → use-native-settings-BPHa51-L.js} +1 -1
- package/dashboard/dist/assets/{use-reduced-motion-BsyM6Mgz.js → use-reduced-motion-BTcFjxkz.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-KGue9hvK.js → use-usage-limits-Bbxgv8dw.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-BLJima5w.js → useCurrency-CE5nH0RE.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-DV6K7KSV.js +0 -6
- package/dashboard/dist/assets/LeaderboardProfileModal-CnbpLjG_.js +0 -1
- package/dashboard/dist/assets/LimitsPage-DO53157-.js +0 -2
- package/dashboard/dist/assets/SkillsPage-CvOf-_li.js +0 -1
- package/dashboard/dist/assets/WidgetsPage-Cc5PRPDd.js +0 -1
- package/dashboard/dist/assets/check-r6BrjxcR.js +0 -1
- package/dashboard/dist/assets/main-aCzF4R9D.css +0 -1
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-CnbpLjG_.js","assets/main-CR7sCH5H.js","assets/main-aCzF4R9D.css","assets/useCurrency-BLJima5w.js","assets/ProviderIcon-C8nYnvzP.js","assets/ActivityHeatmap-CiilYEqW.js","assets/info-TG4KyASc.js","assets/DialogTitle-DH5VFL8l.js","assets/chevron-down-BS2aEE_V.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as Zr,r as s,R as H,aa as rt,C as c,S as I,B as y,ab as Qr,ac as en,T as tn,U as rn,ad as nn,h as on,j as an,ae as sn,W as ln,a6 as Tt,D as cn,L as dn,E as un,af as fn,ag as gn,ah as Qt,ai as hn,_ as bn,H as pn}from"./main-CR7sCH5H.js";import{P as mn}from"./ProviderIcon-C8nYnvzP.js";import{u as xn}from"./useCurrency-BLJima5w.js";import{C as vn}from"./chevron-down-BS2aEE_V.js";const yn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],wn=Zr("arrow-right",yn);function kn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return s.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const 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 kr(e){return e instanceof J(e).SVGElement}function We(e){return e?Ye(e)?e.document:Wt(e)?Xt(e)?e:ut(e)||kr(e)?e.ownerDocument:document:document:document}const pe=kt?s.useLayoutEffect:s.useEffect;function Ht(e){const t=s.useRef(e);return pe(()=>{t.current=e}),s.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function Sn(){const e=s.useRef(null),t=s.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=s.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function it(e,t){t===void 0&&(t=[e]);const r=s.useRef(e);return pe(()=>{r.current!==e&&(r.current=e)},t),r}function ft(e,t){const r=s.useRef();return s.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function mt(e){const t=Ht(e),r=s.useRef(null),n=s.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function Lt(e){const t=s.useRef();return s.useEffect(()=>{t.current=e},[e]),t.current}let Et={};function gt(e,t){return s.useMemo(()=>{if(t)return t;const r=Et[e]==null?0:Et[e]+1;return Et[e]=r,e+"-"+r},[e,t])}function Sr(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,i)=>{const l=Object.entries(i);for(const[d,u]of l){const g=a[d];g!=null&&(a[d]=g+e*u)}return a},{...t})}}const Ke=Sr(1),st=Sr(-1);function Cn(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 Nn(e){if(!e)return!1;const{TouchEvent:t}=J(e.target);return t&&e instanceof t}function Ot(e){if(Nn(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 Cn(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 Rn(e){return e.matches(er)?e:e.querySelector(er)}const Dn={display:"none"};function jn(e){let{id:t,value:r}=e;return H.createElement("div",{id:t,style:Dn},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 H.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function _n(){const[e,t]=s.useState("");return{announce:s.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Cr=s.createContext(null);function An(e){const t=s.useContext(Cr);s.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Mn(){const[e]=s.useState(()=>new Set),t=s.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[s.useCallback(n=>{let{type:o,event:a}=n;e.forEach(i=>{var l;return(l=i[o])==null?void 0:l.call(i,a)})},[e]),t]}const In={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
|
-
`},Tn={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 Ln(e){let{announcements:t=Tn,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=In}=e;const{announce:a,announcement:i}=_n(),l=gt("DndLiveRegion"),[d,u]=s.useState(!1);if(s.useEffect(()=>{u(!0)},[]),An(s.useMemo(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:b}=f;t.onDragMove&&a(t.onDragMove({active:p,over:b}))},onDragOver(f){let{active:p,over:b}=f;a(t.onDragOver({active:p,over:b}))},onDragEnd(f){let{active:p,over:b}=f;a(t.onDragEnd({active:p,over:b}))},onDragCancel(f){let{active:p,over:b}=f;a(t.onDragCancel({active:p,over:b}))}}),[a,t])),!d)return null;const g=H.createElement(H.Fragment,null,H.createElement(jn,{id:n,value:o.draggable}),H.createElement(En,{id:l,announcement:i}));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 s.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function On(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return s.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const ue=Object.freeze({x:0,y:0});function Nr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rr(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function Pn(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 Dr(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 zn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=nr(t,t.left,t.top),a=[];for(const i of n){const{id:l}=i,d=r.get(l);if(d){const u=Nr(nr(d),o);a.push({id:l,data:{droppableContainer:i,value:u}})}}return a.sort(Rr)},Bn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=rr(t),a=[];for(const i of n){const{id:l}=i,d=r.get(l);if(d){const u=rr(d),g=o.reduce((p,b,j)=>p+Nr(u[j],b),0),f=Number((g/4).toFixed(4));a.push({id:l,data:{droppableContainer:i,value:f}})}}return a.sort(Rr)};function $n(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),i=o-n,l=a-r;if(n<o&&r<a){const d=t.width*t.height,u=e.width*e.height,g=i*l,f=g/(d+u-g);return Number(f.toFixed(4))}return 0}const Fn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:i}=a,l=r.get(i);if(l){const d=$n(l,t);d>0&&o.push({id:i,data:{droppableContainer:a,value:d}})}}return o.sort(Pn)};function Un(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function jr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ue}function Kn(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((i,l)=>({...i,top:i.top+e*l.y,bottom:i.bottom+e*l.y,left:i.left+e*l.x,right:i.right+e*l.x}),{...r})}}const Yn=Kn(1);function Wn(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 Xn(e,t,r){const n=Wn(t);if(!n)return e;const{scaleX:o,scaleY:a,x:i,y:l}=n,d=e.left-i-(1-o)*parseFloat(r),u=e.top-l-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),g=o?e.width/o:e.width,f=a?e.height/a:e.height;return{width:g,height:f,top:u,right:d+g,bottom:u+f,left:d}}const Hn={ignoreTransform:!1};function Xe(e,t){t===void 0&&(t=Hn);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=J(e).getComputedStyle(e);u&&(r=Xn(r,u,g))}const{top:n,left:o,width:a,height:i,bottom:l,right:d}=r;return{top:n,left:o,width:a,height:i,bottom:l,right:d}}function or(e){return Xe(e,{ignoreTransform:!0})}function Gn(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Vn(e,t){return t===void 0&&(t=J(e).getComputedStyle(e)),t.position==="fixed"}function qn(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)||kr(o)||r.includes(o))return r;const a=J(e).getComputedStyle(o);return o!==e&&qn(o,a)&&r.push(o),Vn(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 _r(e){return Ye(e)?e.scrollX:e.scrollLeft}function Ar(e){return Ye(e)?e.scrollY:e.scrollTop}function Pt(e){return{x:_r(e),y:Ar(e)}}var F;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(F||(F={}));function Mr(e){return!kt||!e?!1:e===document.scrollingElement}function Ir(e){const t={x:0,y:0},r=Mr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,i=e.scrollTop>=n.y,l=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:i,isRight:l,maxScroll:n,minScroll:t}}const Jn={x:.2,y:.2};function Zn(e,t,r,n,o){let{top:a,left:i,right:l,bottom:d}=r;n===void 0&&(n=10),o===void 0&&(o=Jn);const{isTop:u,isBottom:g,isLeft:f,isRight:p}=Ir(e),b={x:0,y:0},j={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,j.y=n*Math.abs((t.top+m.height-a)/m.height)):!g&&d>=t.bottom-m.height&&(b.y=F.Forward,j.y=n*Math.abs((t.bottom-m.height-d)/m.height)),!p&&l>=t.right-m.width?(b.x=F.Forward,j.x=n*Math.abs((t.right-m.width-l)/m.width)):!f&&i<=t.left+m.width&&(b.x=F.Backward,j.x=n*Math.abs((t.left+m.width-i)/m.width)),{direction:b,speed:j}}function Qn(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}const{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Tr(e){return e.reduce((t,r)=>Ke(t,Pt(r)),ue)}function eo(e){return e.reduce((t,r)=>t+_r(r),0)}function to(e){return e.reduce((t,r)=>t+Ar(r),0)}function ro(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 no=[["x",["left","right"],eo],["y",["top","bottom"],to]];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=Tr(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,i,l]of no)for(const d of i)Object.defineProperty(this,d,{get:()=>{const u=l(n),g=o[a]-u;return this.rect[d]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class 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 oo(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 ao(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 Lr={start:[D.Space,D.Enter],cancel:[D.Esc],end:[D.Space,D.Enter,D.Tab]},io=(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&&ro(n),r(ue)}handleKeyDown(t){if(Gt(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=Lr,coordinateGetter:i=io,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=i(t,{active:r,context:n.current,currentCoordinates:g});if(f){const p=st(f,g),b={x:0,y:0},{scrollableAncestors:j}=n.current;for(const m of j){const x=t.code,{isTop:w,isRight:k,isLeft:v,isBottom:C,maxScroll:E,minScroll:N}=Ir(m),S=Qn(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,T=x===D.Down&&!C||x===D.Up&&!w;if(L&&R.x!==f.x){const _=m.scrollLeft+p.x,Z=x===D.Right&&_<=E.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-E.x:m.scrollLeft-N.x,b.x&&m.scrollBy({left:-b.x,behavior:l});break}else if(T&&R.y!==f.y){const _=m.scrollTop+p.y,Z=x===D.Down&&_<=E.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-E.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=Lr,onActivation:o}=t,{active:a}=r;const{code:i}=e.nativeEvent;if(n.start.includes(i)){const l=a.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function 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=oo(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:a}=t,{target:i}=a;this.props=t,this.events=r,this.document=We(i),this.documentListeners=new nt(this.document),this.listeners=new nt(n),this.windowListeners=new nt(J(i)),this.initialCoordinates=(o=Ot(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,ao,{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:i,options:{activationConstraint:l}}=a;if(!o)return;const d=(r=Ot(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(),i(d)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===D.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const so={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,so,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 lo={move:{name:"mousemove"},end:{name:"mouseup"}};var zt;(function(e){e[e.RightClick=2]="RightClick"})(zt||(zt={}));class co extends Jt{constructor(t){super(t,lo,We(t.event.target))}}co.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===zt.RightClick?!1:(n?.({event:r}),!0)}}];const Mt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class uo 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(){}}}uo.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 fo(e){let{acceleration:t,activator:r=ot.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:i=5,order:l=vt.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:p}=e;const b=ho({delta:f,disabled:!a}),[j,m]=Sn(),x=s.useRef({x:0,y:0}),w=s.useRef({x:0,y:0}),k=s.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=s.useRef(null),C=s.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)},[]),E=s.useMemo(()=>l===vt.TreeOrder?[...u].reverse():u,[l,u]);s.useEffect(()=>{if(!a||!u.length||!k){m();return}for(const N of E){if(n?.(N)===!1)continue;const S=u.indexOf(N),R=g[S];if(!R)continue;const{direction:L,speed:T}=Zn(N,R,k,t,p);for(const _ of["x","y"])b[_][L[_]]||(T[_]=0,L[_]=0);if(T.x>0||T.y>0){m(),v.current=N,j(C,i),x.current=T,w.current=L;return}}x.current={x:0,y:0},w.current={x:0,y:0},m()},[t,C,n,m,a,i,JSON.stringify(k),JSON.stringify(b),j,u,E,g,JSON.stringify(p)])}const go={x:{[F.Backward]:!1,[F.Forward]:!1},y:{[F.Backward]:!1,[F.Forward]:!1}};function ho(e){let{delta:t,disabled:r}=e;const n=Lt(t);return ft(o=>{if(r||!n||!o)return go;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 bo(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 po(e,t){return s.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,n)}));return[...r,...a]},[]),[e,t])}var ct;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ct||(ct={}));var Bt;(function(e){e.Optimized="optimized"})(Bt||(Bt={}));const lr=new Map;function mo(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,i]=s.useState(null),{frequency:l,measure:d,strategy:u}=o,g=s.useRef(e),f=x(),p=it(f),b=s.useCallback(function(w){w===void 0&&(w=[]),!p.current&&i(k=>k===null?w:k.concat(w.filter(v=>!k.includes(v))))},[p]),j=s.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,E=C?new Vt(d(C),C):null;v.rect.current=E,E&&k.set(v.id,E)}return k}return w},[e,a,r,f,d]);return s.useEffect(()=>{g.current=e},[e]),s.useEffect(()=>{f||b()},[r,f]),s.useEffect(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),s.useEffect(()=>{f||typeof l!="number"||j.current!==null||(j.current=setTimeout(()=>{b(),j.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 Or(e,t){return ft(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function xo(e,t){return Or(e,t)}function vo(e){let{callback:t,disabled:r}=e;const n=Ht(t),o=s.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function Ct(e){let{callback:t,disabled:r}=e;const n=Ht(t),o=s.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return s.useEffect(()=>()=>o?.disconnect(),[o]),o}function yo(e){return new Vt(Xe(e),e)}function cr(e,t,r){t===void 0&&(t=yo);const[n,o]=s.useState(null);function a(){o(d=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=d??r)!=null?u:null}const g=t(e);return JSON.stringify(d)===JSON.stringify(g)?d:g})}const i=vo({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),i?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),i?.disconnect())},[e]),n}function wo(e){const t=Or(e);return jr(e,t)}const dr=[];function ko(e){const t=s.useRef(e),r=ft(n=>e?n&&n!==dr&&e&&t.current&&e.parentNode===t.current.parentNode?n:St(e):dr,[e]);return s.useEffect(()=>{t.current=e},[e]),r}function So(e){const[t,r]=s.useState(null),n=s.useRef(e),o=s.useCallback(a=>{const i=_t(a.target);i&&r(l=>l?(l.set(i,Pt(i)),new Map(l)):null)},[]);return s.useEffect(()=>{const a=n.current;if(e!==a){i(a);const l=e.map(d=>{const u=_t(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Pt(u)]):null}).filter(d=>d!=null);r(l.length?new Map(l):null),n.current=e}return()=>{i(e),i(a)};function i(l){l.forEach(d=>{const u=_t(d);u?.removeEventListener("scroll",o)})}},[o,e]),s.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,i)=>Ke(a,i),ue):Tr(e):ue,[e,t])}function ur(e,t){t===void 0&&(t=[]);const r=s.useRef(null);return s.useEffect(()=>{r.current=null},t),s.useEffect(()=>{const n=e!==ue;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?st(e,r.current):ue}function Co(e){s.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 No(e,t){return s.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=i=>{a(i,t)},r},{}),[e,t])}function Pr(e){return s.useMemo(()=>e?Gn(e):null,[e])}const fr=[];function Ro(e,t){t===void 0&&(t=Xe);const[r]=e,n=Pr(r?J(r):null),[o,a]=s.useState(fr);function i(){a(()=>e.length?e.map(d=>Mr(d)?n:new Vt(t(d),d)):fr)}const l=Ct({callback:i});return pe(()=>{l?.disconnect(),i(),e.forEach(d=>l?.observe(d))},[e]),o}function Do(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ut(t)?t:e}function jo(e){let{measure:t}=e;const[r,n]=s.useState(null),o=s.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}),i=s.useCallback(u=>{const g=Do(u);a?.disconnect(),g&&a?.observe(g),n(g?t(g):null)},[t,a]),[l,d]=mt(i);return s.useMemo(()=>({nodeRef:l,rect:r,setRef:d}),[r,l,d])}const Eo=[{sensor:Zt,options:{}},{sensor:qt,options:{}}],_o={current:{}},pt={draggable:{measure:or},droppable:{measure:or,strategy:ct.WhileDragging,frequency:Bt.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 Ao={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},Mo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:xt,draggableNodes:new Map,over:null,measureDroppableContainers:xt},Nt=s.createContext(Mo),zr=s.createContext(Ao);function Io(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new at}}}function To(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 i=new at(e.droppable.containers);return i.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:i}}}case z.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new at(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Lo(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=s.useContext(Nt),a=Lt(n),i=Lt(r?.id);return s.useEffect(()=>{if(!t&&!n&&a&&i!=null){if(!Gt(a)||document.activeElement===a.target)return;const l=o.get(i);if(!l)return;const{activatorNode:d,node:u}=l;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[d.current,u.current]){if(!g)continue;const f=Rn(g);if(f){f.focus();break}}})}},[n,t,o,i,a]),null}function Oo(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function Po(e){return s.useMemo(()=>({draggable:{...pt.draggable,...e?.draggable},droppable:{...pt.droppable,...e?.droppable},dragOverlay:{...pt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function zo(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=s.useRef(!1),{x:i,y:l}=typeof o=="boolean"?{x:o,y:o}:o;pe(()=>{if(!i&&!l||!t){a.current=!1;return}if(a.current||!n)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const g=r(u),f=jr(g,n);if(i||(f.x=0),l||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=Er(u);p&&p.scrollBy({top:f.y,left:f.x})}},[t,i,l,n,r])}const Br=s.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 Bo=s.memo(function(t){var r,n,o,a;let{id:i,accessibility:l,autoScroll:d=!0,children:u,sensors:g=Eo,collisionDetection:f=Fn,measuring:p,modifiers:b,...j}=t;const m=s.useReducer(To,void 0,Io),[x,w]=m,[k,v]=Mn(),[C,E]=s.useState(Me.Uninitialized),N=C===Me.Initialized,{draggable:{active:S,nodes:R,translate:L},droppable:{containers:T}}=x,_=S!=null?R.get(S):null,Z=s.useRef({initial:null,translated:null}),V=s.useMemo(()=>{var K;return S!=null?{id:S,data:(K=_?.data)!=null?K:_o,rect:Z}:null},[S,_]),Q=s.useRef(null),[ye,ze]=s.useState(null),[G,Be]=s.useState(null),ae=it(j,Object.values(j)),B=gt("DndDescribedBy",i),we=s.useMemo(()=>T.getEnabled(),[T]),W=Po(p),{droppableRects:ie,measureDroppableContainers:fe,measuringScheduled:ke}=mo(we,{dragging:N,dependencies:[L.x,L.y],config:W.droppable}),O=bo(R,S),$e=s.useMemo(()=>G?Ot(G):null,[G]),se=Pe(),P=xo(O,W.draggable.measure);zo({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=s.useRef({activatorEvent:null,active:null,activeNode:O,collisionRect:null,collisions:null,droppableRects:ie,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Se=T.getNodeFor((r=U.current.over)==null?void 0:r.id),te=jo({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=wo(Ce?null:A),He=Pr(me?J(me):null),le=ko(N?Se??O:null),Le=Ro(le),Oe=Oo(b,{transform:{x:L.x-Te.x,y:L.y-Te.y,scaleX:1,scaleY:1},activatorEvent:G,active:V,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=So(le),Ne=ur(Fe),Rt=ur(Fe,[A]),Re=Ke(Oe,Ne),De=xe?Yn(xe,Oe):null,je=V&&De?f({active:V,collisionRect:De,droppableRects:ie,droppableContainers:we,pointerCoordinates:Ge}):null,Ve=Dr(je,"id"),[ge,Ee]=s.useState(null),qe=Ce?Oe:Ke(Oe,Rt),h=Un(qe,(a=ge?.rect)!=null?a:null,A),M=s.useRef(null),re=s.useCallback((K,q)=>{let{sensor:X,options:$}=q;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),E(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}),E(Me.Uninitialized),Ee(null),ze(null),Be(null),M.current=null;const tt=Y===z.DragEnd?"onDragEnd":"onDragCancel";if(Ae){const jt=ae.current[tt];jt?.(Ae),k({type:tt,event:Ae})}})}}},[R]),Je=s.useCallback((K,q)=>(X,$)=>{const ne=X.nativeEvent,ee=R.get($);if(Q.current!==null||!ee||ne.dndKit||ne.defaultPrevented)return;const he={active:ee};K(X,q.options,he)===!0&&(ne.dndKit={capturedBy:q.sensor},Q.current=$,re(X,q))},[R,re]),Ze=po(g,Je);Co(g),pe(()=>{A&&C===Me.Initializing&&E(Me.Initialized)},[A,C]),s.useEffect(()=>{const{onDragMove:K}=ae.current,{active:q,activatorEvent:X,collisions:$,over:ne}=U.current;if(!q||!X)return;const ee={active:q,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]),s.useEffect(()=>{const{active:K,activatorEvent:q,collisions:X,droppableContainers:$,scrollAdjustedTranslate:ne}=U.current;if(!K||Q.current==null||!q||!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:q,collisions:X,delta:{x:ne.x,y:ne.y},over:Ue};rt.unstable_batchedUpdates(()=>{Ee(Ue),ee?.(Y),k({type:"onDragOver",event:Y})})},[Ve]),pe(()=>{U.current={activatorEvent:G,active:V,activeNode:O,collisionRect:De,collisions:je,droppableRects:ie,draggableNodes:R,draggingNode:me,draggingNodeRect:xe,droppableContainers:T,over:ge,scrollableAncestors:le,scrollAdjustedTranslate:Re},Z.current={initial:xe,translated:De}},[V,O,je,De,R,me,xe,ie,T,ge,le,Re]),fo({...se,delta:L,draggingRect:De,pointerCoordinates:Ge,scrollableAncestors:le,scrollableAncestorRects:Le});const Dt=s.useMemo(()=>({active:V,activeNode:O,activeNodeRect:A,activatorEvent:G,collisions:je,containerNodeRect:Ie,dragOverlay:te,draggableNodes:R,droppableContainers:T,droppableRects:ie,over:ge,measureDroppableContainers:fe,scrollableAncestors:le,scrollableAncestorRects:Le,measuringConfiguration:W,measuringScheduled:ke,windowRect:He}),[V,O,A,G,je,Ie,te,R,T,ie,ge,fe,le,Le,W,ke,He]),ce=s.useMemo(()=>({activatorEvent:G,activators:Ze,active:V,activeNodeRect:A,ariaDescribedById:{draggable:B},dispatch:w,draggableNodes:R,over:ge,measureDroppableContainers:fe}),[G,Ze,V,A,w,B,R,ge,fe]);return H.createElement(Cr.Provider,{value:v},H.createElement(Nt.Provider,{value:ce},H.createElement(zr.Provider,{value:Dt},H.createElement(Br.Provider,{value:h},u)),H.createElement(Lo,{disabled:l?.restoreFocus===!1})),H.createElement(Ln,{...l,hiddenTextDescribedById:B}));function Pe(){const K=ye?.autoScrollEnabled===!1,q=typeof d=="object"?d.enabled===!1:d===!1,X=N&&!K&&!q;return typeof d=="object"?{...d,enabled:X}:{enabled:X}}}),$o=s.createContext(null),gr="button",Fo="Draggable";function Uo(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=gt(Fo),{activators:i,activatorEvent:l,active:d,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:p}=s.useContext(Nt),{role:b=gr,roleDescription:j="draggable",tabIndex:m=0}=o??{},x=d?.id===t,w=s.useContext(x?Br:$o),[k,v]=mt(),[C,E]=mt(),N=No(i,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=s.useMemo(()=>({role:b,tabIndex:m,"aria-disabled":n,"aria-pressed":x&&b===gr?!0:void 0,"aria-roledescription":j,"aria-describedby":g.draggable}),[n,b,m,x,j,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:E,transform:w}}function Ko(){return s.useContext(zr)}const Yo="Droppable",Wo={timeout:25};function Xo(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=gt(Yo),{active:i,dispatch:l,over:d,measureDroppableContainers:u}=s.useContext(Nt),g=s.useRef({disabled:r}),f=s.useRef(!1),p=s.useRef(null),b=s.useRef(null),{disabled:j,updateMeasurementsFor:m,timeout:x}={...Wo,...o},w=it(m??n),k=s.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:j||!i}),C=s.useCallback((R,L)=>{v&&(L&&(v.unobserve(L),f.current=!1),R&&v.observe(R))},[v]),[E,N]=mt(C),S=it(t);return s.useEffect(()=>{!v||!E.current||(v.disconnect(),f.current=!1,v.observe(E.current))},[E,v]),s.useEffect(()=>(l({type:z.RegisterDroppable,element:{id:n,key:a,disabled:r,node:E,rect:p,data:S}}),()=>l({type:z.UnregisterDroppable,key:a,id:n})),[n]),s.useEffect(()=>{r!==g.current.disabled&&(l({type:z.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,l]),{active:i,rect:p,isOver:d?.id===n,node:E,over:d,setNodeRef:N}}const Ho=e=>{let{transform:t}=e;return{...t,y:0}};function $r(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Go(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 Vo(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 qo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const bt={scaleX:1,scaleY:1},Jo=e=>{var t;let{rects:r,activeNodeRect:n,activeIndex:o,overIndex:a,index:i}=e;const l=(t=r[o])!=null?t:n;if(!l)return null;const d=Zo(r,i,o);if(i===o){const u=r[a];return u?{x:o<a?u.left+u.width-(l.left+l.width):u.left-l.left,y:0,...bt}:null}return i>o&&i<=a?{x:-l.width-d,y:0,...bt}:i<o&&i>=a?{x:l.width+d,y:0,...bt}:{x:0,y:0,...bt}};function Zo(e,t,r){const n=e[t],o=e[t-1],a=e[t+1];return!n||!o&&!a?0:r<t?o?n.left-(o.left+o.width):a.left-(n.left+n.width):a?a.left-(n.left+n.width):n.left-(o.left+o.width)}const Fr=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=$r(t,n,r),i=t[o],l=a[o];return!l||!i?null:{x:l.left-i.left,y:l.top-i.top,scaleX:l.width/i.width,scaleY:l.height/i.height}},Ur="Sortable",Kr=H.createContext({activeIndex:-1,containerId:Ur,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Fr,disabled:{draggable:!1,droppable:!1}});function Qo(e){let{children:t,id:r,items:n,strategy:o=Fr,disabled:a=!1}=e;const{active:i,dragOverlay:l,droppableRects:d,over:u,measureDroppableContainers:g}=Ko(),f=gt(Ur,r),p=l.rect!==null,b=s.useMemo(()=>n.map(N=>typeof N=="object"&&"id"in N?N.id:N),[n]),j=i!=null,m=i?b.indexOf(i.id):-1,x=u?b.indexOf(u.id):-1,w=s.useRef(b),k=!Vo(b,w.current),v=x!==-1&&m===-1||k,C=qo(a);pe(()=>{k&&j&&g(b)},[k,b,j,g]),s.useEffect(()=>{w.current=b},[b]);const E=s.useMemo(()=>({activeIndex:m,containerId:f,disabled:C,disableTransforms:v,items:b,overIndex:x,useDragOverlay:p,sortedRects:Go(b,d),strategy:o}),[m,f,C.draggable,C.droppable,v,b,x,d,p,o]);return H.createElement(Kr.Provider,{value:E},t)}const ea=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return $r(r,n,o).indexOf(t)},ta=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:i,previousItems:l,previousContainerId:d,transition:u}=e;return!u||!n||l!==a&&o===i?!1:r?!0:i!==o&&t===d},ra={duration:200,easing:"ease"},Yr="transform",na=lt.Transition.toString({property:Yr,duration:0,easing:"linear"}),oa={roleDescription:"sortable"};function aa(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,i]=s.useState(null),l=s.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)&&i(g)}}r!==l.current&&(l.current=r)},[t,r,n,o]),s.useEffect(()=>{a&&i(null)},[a]),a}function ia(e){let{animateLayoutChanges:t=ta,attributes:r,disabled:n,data:o,getNewIndex:a=ea,id:i,strategy:l,resizeObserverConfig:d,transition:u=ra}=e;const{items:g,containerId:f,activeIndex:p,disabled:b,disableTransforms:j,sortedRects:m,overIndex:x,useDragOverlay:w,strategy:k}=s.useContext(Kr),v=sa(n,b),C=g.indexOf(i),E=s.useMemo(()=>({sortable:{containerId:f,index:C,items:g},...o}),[f,o,C,g]),N=s.useMemo(()=>g.slice(g.indexOf(i)),[g,i]),{rect:S,node:R,isOver:L,setNodeRef:T}=Xo({id:i,data:E,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...d}}),{active:_,activatorEvent:Z,activeNodeRect:V,attributes:Q,setNodeRef:ye,listeners:ze,isDragging:G,over:Be,setActivatorNodeRef:ae,transform:B}=Uo({id:i,data:E,attributes:{...oa,...r},disabled:v.draggable}),we=kn(T,ye),W=!!_,ie=W&&!j&&ht(p)&&ht(x),fe=!w&&G,ke=fe&&ie?B:null,$e=ie?ke??(l??k)({rects:m,activeNodeRect:V,activeIndex:p,overIndex:x,index:C}):null,se=ht(p)&&ht(x)?a({id:i,items:g,activeIndex:p,overIndex:x}):C,P=_?.id,A=s.useRef({activeId:P,items:g,newIndex:se,containerId:f}),Ie=g!==A.current.items,U=t({active:_,containerId:f,isDragging:G,isSorting:W,id:i,index:C,items:g,newIndex:A.current.newIndex,previousItems:A.current.items,previousContainerId:A.current.containerId,transition:u,wasDragging:A.current.activeId!=null}),Se=aa({disabled:!U,index:C,node:R,rect:S});return s.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]),s.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:E,rect:S,index:C,newIndex:se,items:g,isOver:L,isSorting:W,isDragging:G,listeners:ze,node:R,overIndex:x,over:Be,setNodeRef:we,setActivatorNodeRef:ae,setDroppableNodeRef:T,setDraggableNodeRef:ye,transform:Se??$e,transition:te()};function te(){if(Se||Ie&&A.current.newIndex===C)return na;if(!(fe&&!Gt(Z)||!u)&&(W||U))return lt.Transition.toString({...u,property:Yr})}}function sa(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 la=[D.Down,D.Right,D.Up,D.Left],ca=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:i,scrollableAncestors:l}}=t;if(la.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=Bn({collisionRect:n,droppableRects:o,droppableContainers:d});let g=Dr(u,"id");if(g===i?.id&&u.length>1&&(g=u[1].id),g!=null){const f=a.get(r.id),p=a.get(g),b=p?o.get(p.id):null,j=p?.node.current;if(j&&b&&f&&p){const x=St(j).some((N,S)=>l[S]!==N),w=Wr(f,p),k=da(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 Wr(e,t){return!yt(e)||!yt(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function da(e,t){return!yt(e)||!yt(t)||!Wr(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 ua(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),i=[];let l=null;for(const d of a)l!=null&&d-l>1&&i.push(null),i.push(d),l=d;return i}function fa({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,i=r?o<n:!0;return{canPrev:a,canNext:i,safePage:o,safeTotal:n}}function ga({entries:e,me:t,meLabel:r}){const n=Array.isArray(e)?e:[],o=t&&typeof t.rank=="number"?t.rank:null;return!o||n.some(i=>!!i?.is_me)?n:[{rank:o,is_me:!0,is_pinned:!0,user_id:t?.user_id??null,display_name:r,avatar_url:t?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:t?.gpt_tokens??"0",claude_tokens:t?.claude_tokens??"0",gemini_tokens:t?.gemini_tokens??"0",cursor_tokens:t?.cursor_tokens??"0",opencode_tokens:t?.opencode_tokens??"0",openclaw_tokens:t?.openclaw_tokens??"0",hermes_tokens:t?.hermes_tokens??"0",kiro_tokens:t?.kiro_tokens??"0",copilot_tokens:t?.copilot_tokens??"0",kimi_tokens:t?.kimi_tokens??"0",other_tokens:t?.other_tokens??"0",total_tokens:t?.total_tokens??"0",estimated_cost_usd:t?.estimated_cost_usd??null},...n]}function ha(e,t){const r=Number(e),n=Number(t);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:Math.ceil(r/n)}function ba(e){let t=0;const r=String(e??"");for(let n=0;n<r.length;n+=1)t=Math.imul(31,t)+r.charCodeAt(n)|0;return Math.abs(t)%360}function pa(e){const t=String(e??"").trim();if(!t)return"?";const r=t.split(/\s+/).filter(Boolean);if(r.length>=2){const n=r[0][0]||"",o=r[1][0]||"";return`${n}${o}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const hr={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base"};function $t({avatarUrl:e,displayName:t,seed:r,size:n="md",className:o}){const a=hr[n]||hr.md,i=ba(r??t??""),l=typeof e=="string"?e.trim():"",[d,u]=H.useState(!1);return H.useEffect(()=>{u(!1)},[l]),l&&!d?c.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",onError:()=>u(!0),className:I("rounded-full object-cover ring-1 ring-white/10",a,o)}):c.jsx("div",{className:I("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",a,o),style:{backgroundColor:`hsl(${i} 42% 34%)`},"aria-hidden":!0,children:pa(t)})}const ma=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function xa({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 ${ma.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}],Xr="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",Hr="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 I("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 I("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:I("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function va({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:I(Ft(!1),"!group-hover:bg-transparent"),children:c.jsx(de,{className:"h-4 w-6"})}),c.jsx("td",{className:I(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:I("h-4",t)})]})}),c.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:c.jsx(de,{className:I("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:I("h-4",n)})},o.key))]})}function ya({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:I(Xr,"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:I(Hr,"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(va,{index:r},r))})]})})}function wa({id:e,thClassName:t,children:r}){const{attributes:n,listeners:o,setNodeRef:a,transform:i,transition:l,isDragging:d}=ia({id:e}),u=lt.Transform.toString(i)||"";s.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${e}"]`),p="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(b=>{b.style.transform=u,b.style.transition=l||"",b.style.zIndex=d?"20":"",b.style.position=u?"relative":"",b.style.boxShadow=d?p:""}),()=>{f.forEach(b=>{b.style.transform="",b.style.transition="",b.style.zIndex="",b.style.position="",b.style.boxShadow=""})}},[e,u,l,d]);const g={transform:u,transition:l,position:u?"relative":void 0,zIndex:d?20:void 0,boxShadow:d?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return c.jsx("th",{ref:a,style:g,className:I(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:I("-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 Gr="tokentracker.leaderboard.columnOrder.v1";function ka(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Gr);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(Gr,JSON.stringify(e))}catch{}}function br(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 Sa(e){const t=s.useMemo(()=>e.join("|"),[e]),[r,n]=s.useState(()=>br(ka(),e));s.useEffect(()=>{n(i=>{const l=br(i,e);return l.length===i.length&&l.every((u,g)=>u===i[g])?i:(It(l),l)})},[t,e]);const o=s.useCallback((i,l)=>{!i||!l||i===l||n(d=>{const u=d.indexOf(i),g=d.indexOf(l);if(u===-1||g===-1)return d;const f=d.slice(),[p]=f.splice(u,1);return f.splice(g,0,p),It(f),f})},[]),a=s.useCallback(()=>{It(e),n(e)},[e]);return{order:r,reorder:o,reset:a}}function Ca(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 Vr(e){return typeof e=="string"?e.trim():""}function Na(e){const t=Vr(e);return t?t.toLowerCase()==="anonymous":!0}function Ra({me:e,totalEntries:t,meLabel:r,onJumpToMe:n,canJump:o}){const a=e&&typeof e.rank=="number"?e.rank:null;if(!a)return null;const i=Number(t)||0,l=Ca(a,i),d=Vr(e?.display_name),u=!d||Na(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:I("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none shadow-[0_1px_2px_rgba(0,0,0,0.03)]",f?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] hover:shadow-[0_4px_12px_rgba(0,0,0,0.05)] dark:hover:shadow-[0_4px_20px_rgba(0,0,0,0.25)] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]"),children:[c.jsx($t,{size:"sm",avatarUrl:e?.avatar_url,displayName:u,seed:g}),c.jsx("span",{className:"max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:u}),c.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",a.toLocaleString()]}),l!=null&&c.jsx("span",{className:I("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(wn,{"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 Da=s.lazy(()=>bn(()=>import("./LeaderboardProfileModal-CnbpLjG_.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(e=>({default:e.LeaderboardProfileModal}))),Kt=[10,20,50,100],Yt=20,qr="tokentracker:leaderboard:pageSize";function ja(){if(typeof window>"u")return Yt;try{const e=window.localStorage.getItem(qr),t=Number(e);if(Kt.includes(t))return t}catch{}return Yt}function pr(e,t,r){const n=Number(e);if(!Number.isFinite(n)||n<=0)return"-";const o=un(t),a=t===pn?n:n*r;return a>=1e3?`${o}${Math.round(a).toLocaleString()}`:a>=10?`${o}${Math.round(a)}`:`${o}${a.toFixed(2)}`}function mr(e,t,r){const n=t?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",o=t?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60";return r.map(a=>c.jsx("td",{"data-column-key":a.key,className:I("px-4 py-4 whitespace-nowrap text-right tabular-nums",n,o),children:Tt(e?.[a.key])},a.key))}const Ea={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function xr({rank:e,placeholder:t}){const r=Ea[e];return r?c.jsx("span",{className:I("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",r.text,r.badge),children:e}):c.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:e??t})}function vr(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t==="week"||t==="month"||t==="total"?t:null}function _a(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 Jr(e){return typeof e!="string"?"":e.trim()}function Aa(e){const t=Jr(e);return t?t.toLowerCase()==="anonymous":!0}function yr(e,t){const r=typeof e?.user_id=="string"?e.user_id.trim():"";return r||`${e?.rank??""}:${t}`}function wr({githubUrl:e}){return c.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[c.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:t=>t.stopPropagation(),"aria-label":y("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:c.jsx(mn,{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(dn,{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 Ma({auth:e,signedIn:t,sessionSoftExpired:r}){const n=Qr(),o=en(),{openLoginModal:a}=tn(),{signedIn:i,loading:l,user:d}=rn(),{currency:u,rate:g}=xn(),f=s.useMemo(()=>nn(),[]),p=on(),b=t&&!r,j=s.useMemo(()=>b&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,b]),m=b?j:null,x=b&&an(m),w=y("shared.placeholder.short"),k=s.useMemo(()=>wt.map(h=>h.key),[]),{order:v,reorder:C}=Sa(k),E=s.useMemo(()=>{const h=new Map;for(const M of wt)h.set(M.key,M);return h},[]),N=s.useMemo(()=>v.map(h=>E.get(h)).filter(Boolean),[v,E]),S=On(tr(Zt,{activationConstraint:{distance:6}}),tr(qt,{coordinateGetter:ca})),R=s.useCallback(h=>{const{active:M,over:re}=h;!re||M.id===re.id||C(String(M.id),String(re.id))},[C]),[L,T]=s.useState(1),[_,Z]=s.useState(ja),[V,Q]=s.useState(null),ye=s.useCallback(h=>{typeof h=="string"&&h.trim()&&Q(h.trim())},[]),ze=s.useCallback(()=>Q(null),[]),G=s.useCallback(h=>{const M=Kt.includes(h)?h:Yt;Z(M),T(1);try{window.localStorage.setItem(qr,String(M))}catch{}},[]),[Be,ae]=s.useState(0),[B,we]=s.useState(()=>({loading:!1,error:null,data:null})),[W,ie]=s.useState(()=>sn()),[fe,ke]=s.useState(!1),O=s.useMemo(()=>{const h=new URLSearchParams(n?.search||"");return vr(h.get("period"))||"total"},[n?.search]),$e=h=>{const M=vr(h);if(!M||M===O)return;const re=new URLSearchParams(n?.search||"");re.set("period",M),T(1),o(`${n?.pathname||"/leaderboard"}?${re.toString()}`,{replace:!0})};s.useEffect(()=>{l||p||i||a()},[i,l,p,a]),s.useEffect(()=>{T(1)},[O]);const se=s.useMemo(()=>(dt(L,{min:1,max:1e6,fallback:1})-1)*_,[L,_]);s.useEffect(()=>{if(!f&&!p)return;let h=!0;return we(M=>({...M,loading:!0,error:null})),(async()=>{const M=await ln({userId:d?.id||null,period:O,limit:_,offset:se});h&&we({loading:!1,error:null,data:M})})().catch(M=>{h&&we({loading:!1,error:_a(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=s.useMemo(()=>ua(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=s.useMemo(()=>{const h=Array.isArray(P?.entries)?P.entries:[];return ga({entries:h,me:Ce,meLabel:Te})},[P?.entries,Ce,Te]),Ne=s.useMemo(()=>ha(Ce?.rank,_),[Ce?.rank,_]),Rt=Ne!=null&&Ne===U,Re=s.useCallback(()=>{Ne!=null&&T(Ne)},[Ne]),De=async()=>{ke(!0);try{fn(!0),ie(!0),await gn(()=>Qt(m));const h=await Qt(m);h&&await hn({accessToken:h,period:O,source:"leaderboard-enable-sync"}),ae(M=>M+1)}catch(h){console.warn("[tokentracker] sync:",h)}finally{ke(!1)}},{canPrev:je,canNext:Ve}=fa({page:U,totalPages:A}),ge=Array.isArray(Fe)&&Fe.length!==0;let Ee=null;B.loading?Ee=c.jsx(ya,{rows:_}):B.error?Ee=c.jsx("div",{className:"px-6 py-12 text-center",children:c.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:B.error})}):ge?Ee=c.jsx(Bo,{sensors:S,collisionDetection:zn,modifiers:[Ho],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:I(Xr,"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:I(Hr,"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(Qo,{items:v,strategy:Jo,children:N.map(h=>c.jsx(wa,{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(xa,{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=Jr(h?.display_name),Dt=Aa(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:I("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:I(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(xr,{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($t,{avatarUrl:h?.avatar_url,displayName:ce,seed:yr(h,ce)}),c.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:ce}),h?.github_url&&c.jsx(wr,{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:pr(h?.estimated_cost_usd,u,g)}),mr(h,!0,N)]},`row-${h?.rank}-${ce}${$?"-pin":""}`)}return c.jsxs("tr",{...X,className:I("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:I(Ft(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:c.jsx(xr,{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($t,{avatarUrl:h?.avatar_url,displayName:ce,seed:yr(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(wr,{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:pr(h?.estimated_cost_usd,u,g)}),mr(h,!1,N)]},`row-${h?.rank}-${ce}`)})})]})})}):Ee=c.jsx("div",{className:"px-6 py-12 text-center",children:c.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.empty")})});let 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:I("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:()=>T(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(Ra,{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:I("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(cn.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:[Ee,c.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-end gap-x-4 gap-y-2",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[c.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:y("leaderboard.pagination.page_size_label")}),c.jsxs("div",{className:"relative",children:[c.jsx("select",{id:"leaderboard-page-size",value:_,onChange:h=>G(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(vn,{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:I("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",je&&!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:()=>T(h=>Math.max(1,h-1)),disabled:!je||B.loading,children:y("leaderboard.pagination.prev")}),c.jsx("div",{className:"flex flex-wrap items-center gap-1",children:qe}),c.jsx("button",{className:I("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:()=>T(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(s.Suspense,{fallback:null,children:c.jsx(Da,{isOpen:!!V,userId:V,period:O,accessToken:m,onClose:ze})})]})}const Pa=Object.freeze(Object.defineProperty({__proto__:null,LeaderboardPage:Ma},Symbol.toStringTag,{value:"Module"}));export{$t as L,Pa as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as u,ah as A,aM as D,C as a,B as i,S as o,n as S,X as F,G as _,F as C}from"./main-CR7sCH5H.js";import{u as P}from"./useCurrency-BLJima5w.js";import{L as z}from"./LeaderboardPage-DV6K7KSV.js";import{P as w}from"./ProviderIcon-C8nYnvzP.js";import{A as L}from"./ActivityHeatmap-CiilYEqW.js";import{D as M,d as U,e as H,f as $,g as R,h as B}from"./DialogTitle-DH5VFL8l.js";import"./chevron-down-BS2aEE_V.js";import"./info-TG4KyASc.js";function E(e,r,s){const t=Number(e);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:C(t,{decimals:2,currency:r,rate:s})}function N(e,r,s){const t=Number(e);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return E(t,r,s);const d=r==="USD"?t:t*(s||1);return`${r==="USD"?"$":""}${_(d,{decimals:1})}`}function b(e){const r=Number(e);return!Number.isFinite(r)||r<=0?"0":_(r,{decimals:1})}function G(e){const r=Array.isArray(e)?e:[];if(r.length===0)return null;const s=r.map(d=>({day:d.date,total_tokens:d.total_tokens,models:d.models||null})),t=r[r.length-1]?.date;return S({dailyRows:s,weeks:52,to:t})}function T(){const e="rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/60";return a.jsxs("div",{className:"animate-pulse",children:[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",children:[a.jsx("div",{className:"h-14 w-14 rounded-full bg-oai-gray-200/70 dark:bg-oai-gray-800/60 shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-2 pt-1",children:[a.jsx("div",{className:o(e,"h-4 w-40")}),a.jsx("div",{className:o(e,"h-3 w-56")})]}),a.jsx("div",{className:o(e,"h-4 w-4 shrink-0 mt-1")})]}),a.jsxs("div",{className:"px-6 py-5 space-y-6",children:[a.jsx("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:Array.from({length:4}).map((r,s)=>a.jsxs("div",{children:[a.jsx("div",{className:o(e,"h-6 w-20")}),a.jsx("div",{className:o(e,"mt-2 h-3 w-14")})]},s))}),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((r,s)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:o(e,"h-3 w-24")}),a.jsx("div",{className:o(e,"h-3 w-44")})]},s))}),a.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[a.jsx("div",{className:o(e,"h-3 w-44 mb-4")}),a.jsx("div",{className:"grid grid-cols-[repeat(52,1fr)] gap-[2px]",children:Array.from({length:364}).map((r,s)=>a.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/60 dark:bg-oai-gray-800/50"},s))})]}),a.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[a.jsx("div",{className:o(e,"h-3 w-28 mb-3")}),a.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((r,s)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:o(e,"h-4 w-4")}),a.jsx("div",{className:o(e,"h-3 w-16")}),a.jsx("div",{className:o(e,"h-[3px] flex-1")}),a.jsx("div",{className:o(e,"h-3 w-12")})]},s))})]})]})]})}function W(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 k({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 p({value:e,label:r}){return a.jsxs("div",{children:[a.jsx("div",{className:"text-2xl font-semibold tabular-nums tracking-tight leading-none text-oai-black dark:text-white",children:e}),a.jsx("div",{className:"mt-1.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r})]})}function h({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",children:r})]})}function Z({user:e,onClose:r}){const s=W(e?.github_url);return 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",children:[a.jsx(z,{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:"shrink-0 text-xs font-medium tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:i("leaderboard.profile_modal.rank",{rank:e.rank})}):null]}),s&&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(w,{provider:"GITHUB",size:11}),a.jsxs("span",{children:["@",s]})]})]}),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","aria-label":i("leaderboard.profile_modal.close"),children:a.jsx(F,{size:16,strokeWidth:2,"aria-hidden":!0})})]})}function q({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:i("leaderboard.profile_modal.providers.none")}):a.jsx("ul",{className:"space-y-2",children:r.map(s=>{const t=Math.max(0,Math.min(1,Number(s?.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(w,{provider:String(s.source).toUpperCase(),size:14})}),a.jsx("span",{className:"shrink-0 capitalize w-16 text-oai-gray-700 dark:text-oai-gray-300",children:s.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:`${(t*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:b(s.total_tokens)}),a.jsxs("span",{className:"shrink-0 w-10 text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[(t*100).toFixed(0),"%"]})]},s.source)})})}function V({data:e,currency:r,rate:s,onClose:t}){const{user:d,totals:m,streak:g,best_day:l,models:x,by_provider:n,heatmap:c,period:y}=e,f=u.useMemo(()=>G(c),[c]),j=x?.favorite?.model_name,v=Number(x?.count)||0;return a.jsxs(a.Fragment,{children:[a.jsx(Z,{user:d,onClose:t}),a.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto oai-scrollbar px-6 py-5 space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:[a.jsx(p,{value:b(m?.total_tokens),label:i("leaderboard.profile_modal.stat.total_tokens")}),a.jsx(p,{value:N(m?.estimated_cost_usd,r,s),label:i("leaderboard.profile_modal.stat.total_cost")}),a.jsx(p,{value:String(m?.active_days??0),label:i("leaderboard.profile_modal.stat.active_days")}),a.jsx(p,{value:N(m?.avg_per_day_usd,r,s),label:i("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(h,{label:i("leaderboard.profile_modal.streak.current"),children:[a.jsx("span",{children:i("leaderboard.profile_modal.streak.days",{count:g?.current_days??0})}),a.jsxs("span",{className:"ml-2 text-oai-gray-500 dark:text-oai-gray-400",children:["(max ",g?.longest_days??0,")"]})]}),a.jsx(h,{label:i("leaderboard.profile_modal.best_day.title"),children:l?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:l.date}),a.jsx("span",{className:"ml-2 text-oai-gray-500 dark:text-oai-gray-400",children:b(l.total_tokens)})]}):a.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:i("leaderboard.profile_modal.best_day.none")})}),a.jsx(h,{label:i("leaderboard.profile_modal.models.favorite"),children:j?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"truncate",children:j}),v>1&&a.jsx("span",{className:"ml-2 text-oai-gray-500 dark:text-oai-gray-400",children:i("leaderboard.profile_modal.models.count",{count:v})})]}):a.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:i("leaderboard.profile_modal.models.none")})})]}),f&&a.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[a.jsx(k,{children:i("leaderboard.profile_modal.heatmap.title")}),a.jsx("div",{className:"overflow-x-auto oai-scrollbar -mx-1 px-1",children:a.jsx(L,{heatmap:f,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(k,{children:i("leaderboard.profile_modal.providers.title")}),a.jsx(q,{data:n})]})]})]})}function ea({isOpen:e,onClose:r,userId:s,period:t,accessToken:d}){const{currency:m,rate:g}=P(),[l,x]=u.useState({loading:!1,error:null,data:null});return u.useEffect(()=>{if(!e||!s)return;let n=!0;return x({loading:!0,error:null,data:null}),(async()=>{try{const c=d?await A(d):null;if(!n)return;const y=await D({accessToken:c,userId:s,period:t||"week"});if(!n)return;x({loading:!1,error:null,data:y})}catch(c){if(!n)return;c?.status===404?x({loading:!1,error:null,data:null}):x({loading:!1,error:c?.message||String(c),data:null})}})(),()=>{n=!1}},[e,s,t,d]),a.jsx(M,{open:e,onOpenChange:n=>{n||r?.()},children:a.jsxs(U,{children:[a.jsx(H,{className:"cost-modal-backdrop"}),a.jsx($,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:a.jsxs(R,{className:o("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"),children:[a.jsx(B,{render:a.jsx("h2",{className:"sr-only"}),children:l.data?.user?.display_name||i("leaderboard.profile_modal.loading")}),l.loading&&a.jsx(T,{}),!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:i("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:i("leaderboard.profile_modal.empty")})}),!l.loading&&!l.error&&l.data&&a.jsx(V,{data:l.data,currency:m,rate:g,onClose:r})]})})]})})}export{ea as LeaderboardProfileModal};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{C as r,S as g,B as n,r as j,L as v,aj as k}from"./main-CR7sCH5H.js";import{u as N}from"./use-usage-limits-KGue9hvK.js";import{u as L}from"./use-limits-display-prefs-DgRoQmhK.js";import{C as h}from"./Card-BkDHn179.js";import{F as E}from"./FadeIn-CcubhRKW.js";import"./use-reduced-motion-BsyM6Mgz.js";const P=[3,2,3,3,2,2,3];function m({className:s}){return r.jsx("div",{className:g("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",s)})}function C(){return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(m,{className:"h-3 w-12 shrink-0"}),r.jsx(m,{className:"flex-1 h-1.5 rounded-full min-w-0"}),r.jsx(m,{className:"h-3 w-[30px] shrink-0"}),r.jsx(m,{className:"h-3 w-6 shrink-0"})]})}function O({bars:s,index:e}){const i=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(m,{className:"h-[14px] w-[14px] rounded shrink-0"}),r.jsx(m,{className:g("h-4",i)})]}),Array.from({length:s},(l,a)=>r.jsx(C,{},a))]})}function T(){return r.jsx(h,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(m,{className:"h-3.5 w-28"}),P.map((s,e)=>r.jsx(O,{bars:s,index:e},e))]})})}function t(s){if(!s)return null;const e=typeof s=="number"?s*1e3:Date.parse(s);if(!Number.isFinite(e))return null;const i=e-Date.now();if(i<=0)return n("shared.time.now");const l=Math.floor(i/6e4);if(l<60)return`${l}m`;const a=Math.floor(l/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function R(s){return s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500"}function o({label:s,pct:e,reset:i}){const l=Math.max(0,Math.min(100,Number(e)||0)),a=Math.round(l),u=l>0&&a===0?Math.max(l,.35):l,x=l>0&&a===0?"<1":String(a);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:s}),r.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:r.jsx("div",{className:`${R(a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:l>0?"3px":0}})}),r.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-[30px] text-right shrink-0",children:[x,"%"]}),i?r.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i}):null]})}function d({name:s,icon:e,children:i}){const a=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[e?r.jsx("img",{src:e,alt:"",className:a}):null,r.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:s})]}),i]})}const S=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],I={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:s,tone:e="neutral"}){const i=e==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return r.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:s})}function A(s,e){const i=I[s];if(!i)return null;if(!e?.configured)return r.jsx(d,{name:i.name,icon:i.icon,children:r.jsx(c,{children:n("limits.status.not_connected")})},s);if(e.error)return r.jsx(d,{name:i.name,icon:i.icon,children:r.jsx(c,{tone:"error",children:n("shared.error.prefix",{error:e.error})})},s);switch(s){case"claude":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.five_hour?r.jsx(o,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?r.jsx(o,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?r.jsx(o,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?r.jsx(c,{children:n("limits.status.no_data")}):null]},"claude");case"codex":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"codex");case"cursor":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:n("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"cursor");case"gemini":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"gemini");case"kimi":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:n("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,e.parallel_limit?r.jsx(c,{children:n("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"kimi");case"kiro":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"kiro");case"antigravity":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"antigravity");case"copilot":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:r.jsx(D,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function D({defaultDir:s}){const[e,i]=j.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${s||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
2
|
-
`),u=async()=>{try{await navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return r.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[r.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n("limits.copilot.otelHint.title")}),r.jsx("div",{className:"mt-0.5 leading-snug",children:n("limits.copilot.otelHint.body")}),r.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:a}),r.jsx("button",{type:"button",onClick:u,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?n("limits.copilot.otelHint.copied"):n("limits.copilot.otelHint.copy")})]})}function M({claude:s,codex:e,cursor:i,gemini:l,kimi:a,kiro:u,antigravity:x,copilot:b,order:w,visibility:_}){const f={claude:s,codex:e,cursor:i,gemini:l,kimi:a,kiro:u,antigravity:x,copilot:b},y=(Array.isArray(w)&&w.length>0?w:S).filter(p=>!_||_[p]!==!1).map(p=>A(p,f[p])).filter(Boolean);return r.jsx(E,{delay:.15,children:r.jsx(h,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:n("limits.panel.title")}),y.length>0?y:r.jsx(c,{children:n("limits.status.all_hidden")})]})})})}function V(){const{data:s,error:e,isLoading:i}=N({initialRefresh:!0}),l=L();return r.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:r.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:r.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[r.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.limits")}),r.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("limits.page.subtitle")})]}),r.jsx(v,{to:"/settings","aria-label":n("limits.page.openSettings"),title:n("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:r.jsx(k,{className:"h-4 w-4","aria-hidden":!0})})]}),i?r.jsx(T,{}):r.jsxs(r.Fragment,{children:[e?r.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:n("shared.error.prefix",{error:e})}):null,r.jsx(M,{claude:s?.claude,codex:s?.codex,cursor:s?.cursor,gemini:s?.gemini,kimi:s?.kimi,kiro:s?.kiro,antigravity:s?.antigravity,copilot:s?.copilot,order:l.order,visibility:l.visibility})]})]})})})}export{V as LimitsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as St,r as n,C as r,aa as yr,I as Le,S as Ue,X as Nt,B as S,P as Qr,D as rr,aB as Zr,ay as en,R as tn}from"./main-CR7sCH5H.js";import{C as rn}from"./Card-BkDHn179.js";import{A as Wt,s as Me,i as lt,j as Be,k as ze,l as br,m as $e,n as nn,o as an,p as ee,q as sn,r as Ne,t as on,v as nr,w as ln,x as st,c as Ee,y as At,z as ar,B as cn,C as wr,E as dn,F as un,G as Ge,H as Ft,I as Xe,N as Ve,J as yt,K as bt,L as fn,M as fe,O as qt,P as gn,Q as $t,R as B,S as Rt,T as mn,U as hn,V as Gt,W as Yt,X as kr,Y as vr,Z as Ct,_ as pn,$ as xn,a as De,a0 as yn,a1 as Ht,a2 as bn,a3 as wn,a4 as kn,a5 as vn,a6 as jn,a7 as Sn,a8 as Nn,a9 as jr,aa as Rn,ab as sr,ac as Cn,ad as In,ae as Mn,af as Xt,ag as En,ah as _t,u as Tn,D as Pn,d as On,e as An,f as _n,g as Vn,h as Ln}from"./DialogTitle-DH5VFL8l.js";import{I as Dn}from"./info-TG4KyASc.js";import{P as tt}from"./ProviderIcon-C8nYnvzP.js";import{C as Ye}from"./check-r6BrjxcR.js";import{f as or,e as Fn,g as $n,u as Jt,h as Hn,i as Un,j as Bn,L as Ke,P as zn,a as Kn,b as Wn,c as qn,d as Gn,C as Yn}from"./PopoverPopup-BzS6tVnf.js";import{u as Xn}from"./use-reduced-motion-BsyM6Mgz.js";import{C as Sr}from"./chevron-down-BS2aEE_V.js";import{D as Jn}from"./download-DtsgF1HV.js";const Qn=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Ut=St("external-link",Qn);const Zn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Nr=St("plus",Zn);const ea=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ir=St("search",ea);const ta=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Rr=St("trash-2",ta);function ra(e){const t=n.useRef(!0);t.current&&(t.current=!1,e())}function Bt({controlled:e,default:t,name:a,state:s="value"}){const{current:u}=n.useRef(e!==void 0),[o,c]=n.useState(t),l=u?e:o,p=n.useCallback(y=>{u||c(y)},[]);return[l,p]}function gt(e,t,a){return Math.floor(e/t)!==a}function ot(e,t){return t<0||t>=e.current.length}function Vt(e,t){return Ie(e,{disabledIndices:t})}function lr(e,t){return Ie(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Ie(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:s,amount:u=1}={}){let o=t;do o+=a?-u:u;while(o>=0&&o<=e.current.length-1&&it(e,o,s));return o}function na(e,{event:t,orientation:a,loopFocus:s,rtl:u,cols:o,disabledIndices:c,minIndex:l,maxIndex:p,prevIndex:y,stopEvent:f=!1}){let m=y;const h=[],T={};let x=!1;{let d=null,E=-1;e.current.forEach((b,j)=>{if(b==null)return;const A=b.closest('[role="row"]');A&&(x=!0),(A!==d||E===-1)&&(d=A,E+=1,h[E]=[]),h[E].push(j),T[j]=E})}const k=x&&h.length>0&&h.some(d=>d.length!==o);function M(d){if(!k||y===-1)return;const E=T[y];if(E==null)return;const b=h[E].indexOf(y);let j=d==="up"?E-1:E+1;s&&(j<0?j=h.length-1:j>=h.length&&(j=0));const A=new Set;for(;j>=0&&j<h.length&&!A.has(j);){A.add(j);const V=h[j];if(V.length===0){j=d==="up"?j-1:j+1;continue}const Q=Math.min(b,V.length-1);for(let _=Q;_>=0;_-=1){const te=V[_];if(!it(e,te,c))return te}j=d==="up"?j-1:j+1,s&&(j<0?j=h.length-1:j>=h.length&&(j=0))}}if(t.key===Wt){const d=M("up");if(d!==void 0)f&&Me(t),m=d;else{if(f&&Me(t),y===-1)m=p;else if(m=Ie(e,{startingIndex:m,amount:o,decrement:!0,disabledIndices:c}),s&&(y-o<l||m<0)){const E=y%o,b=p%o,j=p-(b-E);b===E?m=p:m=b>E?j:j-o}ot(e,m)&&(m=y)}}if(t.key===lt){const d=M("down");d!==void 0?(f&&Me(t),m=d):(f&&Me(t),y===-1?m=l:(m=Ie(e,{startingIndex:y,amount:o,disabledIndices:c}),s&&y+o>p&&(m=Ie(e,{startingIndex:y%o-o,amount:o,disabledIndices:c}))),ot(e,m)&&(m=y))}if(a==="both"){const d=or(y/o);t.key===(u?Be:ze)&&(f&&Me(t),y%o!==o-1?(m=Ie(e,{startingIndex:y,disabledIndices:c}),s&>(m,o,d)&&(m=Ie(e,{startingIndex:y-y%o-1,disabledIndices:c}))):s&&(m=Ie(e,{startingIndex:y-y%o-1,disabledIndices:c})),gt(m,o,d)&&(m=y)),t.key===(u?ze:Be)&&(f&&Me(t),y%o!==0?(m=Ie(e,{startingIndex:y,decrement:!0,disabledIndices:c}),s&>(m,o,d)&&(m=Ie(e,{startingIndex:y+(o-y%o),decrement:!0,disabledIndices:c}))):s&&(m=Ie(e,{startingIndex:y+(o-y%o),decrement:!0,disabledIndices:c})),gt(m,o,d)&&(m=y));const E=or(p/o)===d;ot(e,m)&&(s&&E?m=t.key===(u?ze:Be)?p:Ie(e,{startingIndex:y-y%o-1,disabledIndices:c}):m=y)}return m}function aa(e,t,a){const s=[];let u=0;return e.forEach(({width:o,height:c},l)=>{let p=!1;for(a&&(u=0);!p;){const y=[];for(let f=0;f<o;f+=1)for(let m=0;m<c;m+=1)y.push(u+f+m*t);u%t+o<=t&&y.every(f=>s[f]==null)?(y.forEach(f=>{s[f]=l}),p=!0):u+=1}}),[...s]}function sa(e,t,a,s,u){if(e===-1)return-1;const o=a.indexOf(e),c=t[e];switch(u){case"tl":return o;case"tr":return c?o+c.width-1:o;case"bl":return c?o+(c.height-1)*s:o;case"br":return a.lastIndexOf(e);default:return-1}}function oa(e,t){return t.flatMap((a,s)=>e.includes(a)?[s]:[])}function it(e,t,a){if(typeof a=="function")return a(t);if(a)return a.includes(t);const s=e.current[t];return s?s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true":!1}const ia="Escape";function It(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function mt(e,t){return It(t,e===Wt||e===lt,e===Be||e===ze)}function Lt(e,t,a){return It(t,e===lt,a?e===Be:e===ze)||e==="Enter"||e===" "||e===""}function la(e,t,a){return It(t,a?e===Be:e===ze,e===lt)}function ca(e,t,a,s){const u=a?e===ze:e===Be,o=e===Wt;return t==="both"||t==="horizontal"&&s&&s>1?e===ia:It(t,u,o)}function da(e,t){const a="rootStore"in e?e.rootStore:e,s=a.useState("open"),u=a.useState("floatingElement"),o=a.useState("domReferenceElement"),c=a.context.dataRef,{listRef:l,activeIndex:p,onNavigate:y=()=>{},enabled:f=!0,selectedIndex:m=null,allowEscape:h=!1,loopFocus:T=!1,nested:x=!1,rtl:k=!1,virtual:M=!1,focusItemOnOpen:d="auto",focusItemOnHover:E=!0,openOnArrowKeyDown:b=!0,disabledIndices:j=void 0,orientation:A="vertical",parentOrientation:V,cols:Q=1,scrollItemIntoView:_=!0,itemSizes:te,dense:ye=!1,id:X,resetOnPointerLeave:Z=!0,externalTree:K}=t,ge=br(u),W=$e(ge),D=nn(),ae=an(K);ee(()=>{c.current.orientation=A},[c,A]);const R=sn(o),H=n.useRef(d),C=n.useRef(m??-1),v=n.useRef(null),de=n.useRef(!0),P=Ne(g=>{y(C.current===-1?null:C.current,g)}),oe=n.useRef(P),J=n.useRef(!!u),I=n.useRef(s),U=n.useRef(!1),be=n.useRef(!1),ke=$e(j),F=$e(s),xe=$e(_),re=$e(m),we=$e(Z),me=Ne(()=>{function g(i){M?ae?.events.emit("virtualfocus",i):on(i,{sync:U.current,preventScroll:!0})}const L=l.current[C.current],N=be.current;L&&g(L),(U.current?i=>i():requestAnimationFrame)(()=>{const i=l.current[C.current]||L;if(!i)return;L||g(i);const w=xe.current;w&&q&&(N||!de.current)&&i.scrollIntoView?.(typeof w=="boolean"?{block:"nearest",inline:"nearest"}:w)})});ee(()=>{f&&(s&&u?(C.current=m??-1,H.current&&m!=null&&(be.current=!0,P())):J.current&&(C.current=-1,oe.current()))},[f,s,u,m,P]),ee(()=>{if(f){if(!s){U.current=!1;return}if(u)if(p==null){if(U.current=!1,re.current!=null)return;if(J.current&&(C.current=-1,me()),(!I.current||!J.current)&&H.current&&(v.current!=null||H.current===!0&&v.current==null)){let g=0;const L=()=>{l.current[0]==null?(g<2&&(g?requestAnimationFrame:queueMicrotask)(L),g+=1):(C.current=v.current==null||Lt(v.current,A,k)||x?Vt(l):lr(l),v.current=null,P())};L()}}else ot(l,p)||(C.current=p,me(),be.current=!1)}},[f,s,u,p,re,x,l,A,k,P,me,ke]),ee(()=>{if(!f||u||!ae||M||!J.current)return;const g=ae.nodesRef.current,L=g.find(i=>i.id===D)?.context?.elements.floating,N=nr(ln(u)),G=g.some(i=>i.context&&st(i.context.elements.floating,N));L&&!G&&de.current&&L.focus({preventScroll:!0})},[f,u,ae,D,M]),ee(()=>{oe.current=P,I.current=s,J.current=!!u}),ee(()=>{s||(v.current=null,H.current=d)},[s,d]);const ue=p!=null,q=n.useMemo(()=>{function g(N){if(!F.current)return;const G=l.current.indexOf(N.currentTarget);G!==-1&&C.current!==G&&(C.current=G,P(N))}return{onFocus(N){U.current=!0,g(N)},onClick:({currentTarget:N})=>N.focus({preventScroll:!0}),onMouseMove(N){U.current=!0,be.current=!1,E&&g(N)},onPointerLeave(N){if(!F.current||!de.current||N.pointerType==="touch")return;U.current=!0;const G=N.relatedTarget;!E||l.current.includes(G)||we.current&&(C.current=-1,P(N),M||W.current?.focus({preventScroll:!0}))}}},[F,W,E,l,P,we,M]),ne=n.useCallback(()=>V??ae?.nodesRef.current.find(g=>g.id===D)?.context?.dataRef?.current.orientation,[D,ae,V]),ve=Ne(g=>{if(de.current=!1,U.current=!0,g.which===229||!F.current&&g.currentTarget===W.current)return;if(x&&ca(g.key,A,k,Q)){mt(g.key,ne())||Me(g),a.setOpen(!1,Ee(At,g.nativeEvent)),ar(o)&&(M?ae?.events.emit("virtualfocus",o):o.focus());return}const L=C.current,N=Vt(l,j),G=lr(l,j);if(R||(g.key==="Home"&&(Me(g),C.current=N,P(g)),g.key==="End"&&(Me(g),C.current=G,P(g))),Q>1){const i=te||Array.from({length:l.current.length},()=>({width:1,height:1})),w=aa(i,Q,ye),O=w.findIndex(ce=>ce!=null&&!it(l,ce,j)),Y=w.reduce((ce,pe,Re)=>pe!=null&&!it(l,pe,j)?Re:ce,-1),le=w[na({current:w.map(ce=>ce!=null?l.current[ce]:null)},{event:g,orientation:A,loopFocus:T,rtl:k,cols:Q,disabledIndices:oa([...(typeof j!="function"?j:null)||l.current.map((ce,pe)=>it(l,pe,j)?pe:void 0),void 0],w),minIndex:O,maxIndex:Y,prevIndex:sa(C.current>G?N:C.current,i,w,Q,g.key===lt?"bl":g.key===(k?Be:ze)?"tr":"tl"),stopEvent:!0})];if(le!=null&&(C.current=le,P(g)),A==="both")return}if(mt(g.key,A)){if(Me(g),s&&!M&&nr(g.currentTarget.ownerDocument)===g.currentTarget){C.current=Lt(g.key,A,k)?N:G,P(g);return}Lt(g.key,A,k)?T?L>=G?h&&L!==l.current.length?C.current=-1:(U.current=!1,C.current=N):C.current=Ie(l,{startingIndex:L,disabledIndices:j}):C.current=Math.min(G,Ie(l,{startingIndex:L,disabledIndices:j})):T?L<=N?h&&L!==-1?C.current=l.current.length:(U.current=!1,C.current=G):C.current=Ie(l,{startingIndex:L,decrement:!0,disabledIndices:j}):C.current=Math.max(N,Ie(l,{startingIndex:L,decrement:!0,disabledIndices:j})),ot(l,C.current)&&(C.current=-1),P(g)}}),se=n.useMemo(()=>M&&s&&ue&&{"aria-activedescendant":`${X}-${p}`},[M,s,ue,X,p]),ie=n.useMemo(()=>({"aria-orientation":A==="both"?void 0:A,...R?{}:se,onKeyDown(g){if(g.key==="Tab"&&g.shiftKey&&s&&!M){const L=cn(g.nativeEvent);if(L&&!st(W.current,L))return;Me(g),a.setOpen(!1,Ee(wr,g.nativeEvent)),ar(o)&&o.focus();return}ve(g)},onPointerMove(){de.current=!0}}),[se,ve,W,A,R,a,s,M,o]),Ce=n.useMemo(()=>{function g(N){d==="auto"&&dn(N.nativeEvent)&&(H.current=!M)}function L(N){H.current=d,d==="auto"&&un(N.nativeEvent)&&(H.current=!0)}return{onKeyDown(N){const G=a.select("open");de.current=!1;const i=N.key.startsWith("Arrow"),w=la(N.key,ne(),k),O=mt(N.key,A),Y=(x?w:O)||N.key==="Enter"||N.key.trim()==="";if(M&&G)return ve(N);if(!(!G&&!b&&i)){if(Y){const le=mt(N.key,ne());v.current=x&&le?null:N.key}if(x){w&&(Me(N),G?(C.current=Vt(l,ke.current),P(N)):a.setOpen(!0,Ee(At,N.nativeEvent,N.currentTarget)));return}O&&(re.current!=null&&(C.current=re.current),Me(N),!G&&b?a.setOpen(!0,Ee(At,N.nativeEvent,N.currentTarget)):ve(N),G&&P(N))}},onFocus(N){a.select("open")&&!M&&(C.current=-1,P(N))},onPointerDown:L,onPointerEnter:L,onMouseDown:g,onClick:g}},[ve,ke,d,l,x,P,a,b,A,ne,k,re,M]),he=n.useMemo(()=>({...se,...Ce}),[se,Ce]);return n.useMemo(()=>f?{reference:he,floating:ie,item:q,trigger:Ce}:{},[f,he,ie,Ce,q])}function ua(e,t){const a="rootStore"in e?e.rootStore:e,s=a.useState("open"),u=a.context.dataRef,{listRef:o,activeIndex:c,onMatch:l,onTypingChange:p,enabled:y=!0,findMatch:f=null,resetMs:m=750,ignoreKeys:h=Ft,selectedIndex:T=null}=t,x=Ge(),k=n.useRef(""),M=n.useRef(T??c??-1),d=n.useRef(null);ee(()=>{s&&(x.clear(),d.current=null,k.current="")},[s,x]),ee(()=>{s&&k.current===""&&(M.current=T??c??-1)},[s,T,c]);const E=Ne(V=>{V?u.current.typing||(u.current.typing=V,p?.(V)):u.current.typing&&(u.current.typing=V,p?.(V))}),b=Ne(V=>{function Q(Z,K,ge){const W=f?f(K,ge):K.find(D=>D?.toLocaleLowerCase().indexOf(ge.toLocaleLowerCase())===0);return W?Z.indexOf(W):-1}const _=o.current;if(k.current.length>0&&k.current[0]!==" "&&(Q(_,_,k.current)===-1?E(!1):V.key===" "&&Me(V)),_==null||h.includes(V.key)||V.key.length!==1||V.ctrlKey||V.metaKey||V.altKey)return;s&&V.key!==" "&&(Me(V),E(!0)),_.every(Z=>Z?Z[0]?.toLocaleLowerCase()!==Z[1]?.toLocaleLowerCase():!0)&&k.current===V.key&&(k.current="",M.current=d.current),k.current+=V.key,x.start(m,()=>{k.current="",M.current=d.current,E(!1)});const ye=M.current,X=Q(_,[..._.slice((ye||0)+1),..._.slice(0,(ye||0)+1)],k.current);X!==-1?(l?.(X),d.current=X):V.key!==" "&&(k.current="",E(!1))}),j=n.useMemo(()=>({onKeyDown:b}),[b]),A=n.useMemo(()=>({onKeyDown:b,onKeyUp(V){V.key===" "&&E(!1)}}),[b,E]);return n.useMemo(()=>y?{reference:j,floating:A}:{},[y,j,A])}const Cr=n.createContext(null),Ir=n.createContext(null);function We(){const e=n.useContext(Cr);if(e===null)throw new Error(Xe(60));return e}function Mr(){const e=n.useContext(Ir);if(e===null)throw new Error(Xe(61));return e}let cr=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const fa={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Qt={valid(e){return e===null?null:e?{[cr.valid]:""}:{[cr.invalid]:""}}},ga=n.createContext({invalid:void 0,name:void 0,validityData:{state:fa,errors:[],error:"",value:"",initialValue:null},setValidityData:Ve,disabled:void 0,touched:!1,setTouched:Ve,dirty:!1,setDirty:Ve,filled:!1,setFilled:Ve,focused:!1,setFocused:Ve,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=yt)=>e,getInputValidationProps:(e=yt)=>e,inputRef:{current:null},commit:async()=>{}}});function Mt(e=!0){const t=n.useContext(ga);if(t.setValidityData===Ve&&!e)throw new Error(Xe(28));return t}const ma=n.createContext({controlId:void 0,setControlId:Ve,labelId:void 0,setLabelId:Ve,messageIds:[],setMessageIds:Ve,getDescriptionProps:e=>e});function Zt(){return n.useContext(ma)}function Er(e={}){const{id:t,implicit:a=!1,controlRef:s}=e,{controlId:u,setControlId:o}=Zt(),c=bt(t);return ee(()=>{if(!(!a&&!t||o===Ve)){if(a){const l=s?.current;fn(l)&&l.closest("label")!=null?o(t??null):o(u??c)}else t&&o(t);return()=>{t&&o(void 0)}}},[t,s,u,o,a,c]),u??c}const ha=(e,t)=>Object.is(e,t);function rt(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function Dt(e,t,a){return!e||e.length===0?!1:e.some(s=>s===void 0?!1:rt(s,t,a))}function zt(e,t,a){return!e||e.length===0?-1:e.findIndex(s=>s===void 0?!1:rt(s,t,a))}function pa(e,t,a){return e.filter(s=>!rt(s,t,a))}function Kt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function xa(e){if(!Array.isArray(e))return e!=null&&!("null"in e);if(Tr(e)){for(const t of e)for(const a of t.items)if(a&&a.value==null&&a.label!=null)return!0;return!1}for(const t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function ya(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Kt(e)}function et(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Kt(e.value):Kt(e)}function Pr(e,t,a){function s(){return ya(e,a)}if(a&&e!=null)return a(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??s();if(Array.isArray(t)){const u=Tr(t)?t.flatMap(o=>o.items):t;if(e==null||typeof e!="object"){const o=u.find(c=>c.value===e);return o&&o.label!=null?o.label:s()}if("value"in e){const o=u.find(c=>c&&c.value===e.value);if(o&&o.label!=null)return o.label}}return s()}function ba(e,t,a){return e.reduce((s,u,o)=>(o>0&&s.push(", "),s.push(r.jsx(n.Fragment,{children:Pr(u,t,a)},o)),s),[])}const $={id:fe(e=>e.id),modal:fe(e=>e.modal),multiple:fe(e=>e.multiple),items:fe(e=>e.items),itemToStringLabel:fe(e=>e.itemToStringLabel),itemToStringValue:fe(e=>e.itemToStringValue),isItemEqualToValue:fe(e=>e.isItemEqualToValue),value:fe(e=>e.value),hasSelectedValue:fe(e=>{const{value:t,multiple:a,itemToStringValue:s}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:et(t,s)!==""}),hasNullItemLabel:fe((e,t)=>t?xa(e.items):!1),open:fe(e=>e.open),mounted:fe(e=>e.mounted),forceMount:fe(e=>e.forceMount),transitionStatus:fe(e=>e.transitionStatus),openMethod:fe(e=>e.openMethod),activeIndex:fe(e=>e.activeIndex),selectedIndex:fe(e=>e.selectedIndex),isActive:fe((e,t)=>e.activeIndex===t),isSelected:fe((e,t,a)=>{const s=e.isItemEqualToValue,u=e.value;return e.multiple?Array.isArray(u)&&u.some(o=>rt(o,a,s)):e.selectedIndex===t&&e.selectedIndex!==null?!0:rt(u,a,s)}),isSelectedByFocus:fe((e,t)=>e.selectedIndex===t),popupProps:fe(e=>e.popupProps),triggerProps:fe(e=>e.triggerProps),triggerElement:fe(e=>e.triggerElement),positionerElement:fe(e=>e.positionerElement),listElement:fe(e=>e.listElement),scrollUpArrowVisible:fe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:fe(e=>e.scrollDownArrowVisible),hasScrollArrows:fe(e=>e.hasScrollArrows)},wa=n.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ve,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function er(){return n.useContext(wa)}function ka(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Or(e){const{enabled:t=!0,value:a,id:s,name:u,controlRef:o,commit:c}=e,{formRef:l}=er(),{invalid:p,markedDirtyRef:y,validityData:f,setValidityData:m}=Mt(),h=Ne(e.getValue);ee(()=>{if(!t)return;let T=a;T===void 0&&(T=h()),f.initialValue===null&&T!==null&&m(x=>({...x,initialValue:T}))},[t,m,a,f.initialValue,h]),ee(()=>{!t||!s||l.current.fields.set(s,{getValue:h,name:u,controlRef:o,validityData:ka(f,p),validate(T=!0){let x=a;x===void 0&&(x=h()),y.current=!0,T?yr.flushSync(()=>c(x)):c(x)}})},[c,o,t,l,h,s,p,y,u,f,a]),ee(()=>{const T=l.current.fields;return()=>{s&&T.delete(s)}},[l,s])}function Ar(e,t){const a=n.useRef(e),s=Ne(t);ee(()=>{a.current!==e&&s(a.current)},[e,s]),ee(()=>{a.current=e},[e])}function _r(e){const{id:t,value:a,defaultValue:s=null,onValueChange:u,open:o,defaultOpen:c=!1,onOpenChange:l,name:p,disabled:y=!1,readOnly:f=!1,required:m=!1,modal:h=!0,actionsRef:T,inputRef:x,onOpenChangeComplete:k,items:M,multiple:d=!1,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:j=ha,highlightItemOnHover:A=!0,children:V}=e,{clearErrors:Q}=er(),{setDirty:_,setTouched:te,setFocused:ye,shouldValidateOnChange:X,validityData:Z,setFilled:K,name:ge,disabled:W,validation:D,validationMode:ae}=Mt(),R=Er({id:t}),H=W||y,C=ge??p,[v,de]=Bt({controlled:a,default:d?s??Ft:s,name:"Select",state:"value"}),[P,oe]=Bt({controlled:o,default:c,name:"Select",state:"open"}),J=n.useRef([]),I=n.useRef([]),U=n.useRef(null),be=n.useRef(null),ke=n.useRef(0),F=n.useRef(null),xe=n.useRef([]),re=n.useRef(!1),we=n.useRef(!1),me=n.useRef(null),ue=n.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),q=n.useRef(!1),{mounted:ne,setMounted:ve,transitionStatus:se}=qt(P),{openMethod:ie,triggerProps:Ce,reset:he}=gn(P),g=$t(()=>new pn({id:R,modal:h,multiple:d,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:j,value:v,open:P,mounted:ne,transitionStatus:se,items:M,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,L=B(g,$.activeIndex),N=B(g,$.selectedIndex),G=B(g,$.triggerElement),i=B(g,$.positionerElement),w=n.useMemo(()=>d&&Array.isArray(v)&&v.length===0?"":et(v,b),[d,v,b]),O=n.useMemo(()=>d&&Array.isArray(v)?v.map(z=>et(z,b)):et(v,b),[d,v,b]),Y=$e(g.state.triggerElement);Or({id:R,commit:D.commit,value:v,controlRef:Y,name:C,getValue:()=>O});const le=n.useRef(v);ee(()=>{v!==le.current&&g.set("forceMount",!0)},[g,v]),ee(()=>{K(d?Array.isArray(v)&&v.length>0:v!=null)},[d,v,K]),ee(function(){if(P)return;const je=xe.current;if(d){const _e=Array.isArray(v)?v:[];if(_e.length===0){g.set("selectedIndex",null);return}const Te=_e[_e.length-1],ft=zt(je,Te,j);g.set("selectedIndex",ft===-1?null:ft);return}const Ae=zt(je,v,j);g.set("selectedIndex",Ae===-1?null:Ae)},[d,P,v,xe,j,g]),Ar(v,()=>{Q(C),_(v!==Z.initialValue),X()?D.commit(v):D.commit(v,!0)});const ce=Ne((z,je)=>{if(l?.(z,je),!je.isCanceled&&(oe(z),!z&&(je.reason===wr||je.reason===xn)&&(te(!0),ye(!1),ae==="onBlur"&&D.commit(v)),!z&&g.state.activeIndex!==null)){const Ae=J.current[g.state.activeIndex];queueMicrotask(()=>{Ae?.setAttribute("tabindex","-1")})}}),pe=Ne(()=>{ve(!1),g.set("activeIndex",null),he(),k?.(!1)});Rt({enabled:!T,open:P,ref:U,onComplete(){P||pe()}}),n.useImperativeHandle(T,()=>({unmount:pe}),[pe]);const Re=Ne((z,je)=>{u?.(z,je),!je.isCanceled&&de(z)}),Se=Ne(()=>{const z=g.state.listElement||U.current;if(!z)return;const je=z.scrollTop,Ae=z.scrollTop+z.clientHeight,_e=je>1,Te=Ae<z.scrollHeight-1;g.state.scrollUpArrowVisible!==_e&&g.set("scrollUpArrowVisible",_e),g.state.scrollDownArrowVisible!==Te&&g.set("scrollDownArrowVisible",Te)}),Oe=Fn({open:P,onOpenChange:ce,elements:{reference:G,floating:i}}),Je=$n(Oe,{enabled:!f&&!H,event:"mousedown"}),nt=mn(Oe,{bubbles:!1}),Fe=da(Oe,{enabled:!f&&!H,listRef:J,activeIndex:L,selectedIndex:N,disabledIndices:Ft,onNavigate(z){z===null&&!P||g.set("activeIndex",z)},focusItemOnHover:!1}),Tt=ua(Oe,{enabled:!f&&!H&&(P||!d),listRef:I,activeIndex:L,selectedIndex:N,onMatch(z){P?g.set("activeIndex",z):Re(xe.current[z],Ee("none"))},onTypingChange(z){re.current=z}}),{getReferenceProps:Qe,getFloatingProps:Ze,getItemProps:ct}=hn([Je,nt,Fe,Tt]),at=n.useMemo(()=>Gt(Qe(),Ce,R?{id:R}:yt),[Qe,Ce,R]);ra(()=>{g.update({popupProps:Ze(),triggerProps:at})}),ee(()=>{g.update({id:R,modal:h,multiple:d,value:v,open:P,mounted:ne,transitionStatus:se,popupProps:Ze(),triggerProps:at,items:M,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:j,openMethod:ie})},[g,R,h,d,v,P,ne,se,Ze,at,M,E,b,j,ie]);const dt=n.useMemo(()=>({store:g,name:C,required:m,disabled:H,readOnly:f,multiple:d,itemToStringLabel:E,itemToStringValue:b,highlightItemOnHover:A,setValue:Re,setOpen:ce,listRef:J,popupRef:U,scrollHandlerRef:be,handleScrollArrowVisibility:Se,scrollArrowsMountedCountRef:ke,getItemProps:ct,events:Oe.context.events,valueRef:F,valuesRef:xe,labelsRef:I,typingRef:re,selectionRef:ue,selectedItemTextRef:me,validation:D,onOpenChangeComplete:k,keyboardActiveRef:we,alignItemWithTriggerActiveRef:q,initialValueRef:le}),[g,C,m,H,f,d,E,b,A,Re,ce,ct,Oe.context.events,D,k,Se]),ut=Yt(x,D.inputRef),Pt=d&&Array.isArray(v)&&v.length>0,Ot=n.useMemo(()=>!d||!Array.isArray(v)||!C?null:v.map(z=>{const je=et(z,b);return r.jsx("input",{type:"hidden",name:C,value:je},je)}),[d,v,C,b]);return r.jsx(Cr.Provider,{value:dt,children:r.jsxs(Ir.Provider,{value:Oe,children:[V,r.jsx("input",{...D.getInputValidationProps({onFocus(){g.state.triggerElement?.focus({focusVisible:!0})},onChange(z){if(z.nativeEvent.defaultPrevented)return;const je=z.target.value,Ae=Ee(Ct,z.nativeEvent);function _e(){if(d)return;const Te=xe.current.find(ft=>et(ft,b).toLowerCase()===je.toLowerCase());Te!=null&&(_(Te!==Z.initialValue),Re(Te,Ae),X()&&D.commit(Te))}g.set("forceMount",!0),queueMicrotask(_e)}}),name:d?void 0:C,value:w,disabled:H,required:m&&!Pt,readOnly:f,ref:ut,style:C?kr:vr,tabIndex:-1,"aria-hidden":!0}),Ot]})})}function va(e){const t=e.getBoundingClientRect(),a=window.getComputedStyle(e,"::before"),s=window.getComputedStyle(e,"::after");if(!(a.content!=="none"||s.content!=="none"))return t;const o=parseFloat(a.width)||0,c=parseFloat(a.height)||0,l=parseFloat(s.width)||0,p=parseFloat(s.height)||0,y=Math.max(t.width,o,l),f=Math.max(t.height,c,p),m=y-t.width,h=f-t.height;return{left:t.left-m/2,right:t.right+m/2,top:t.top-h/2,bottom:t.bottom+h/2}}const ht=2,ja=400,dr=200,Sa={...yn,...Qt,value:()=>null},Vr=n.forwardRef(function(t,a){const{render:s,className:u,id:o,disabled:c=!1,nativeButton:l=!0,...p}=t,{setTouched:y,setFocused:f,validationMode:m,state:h,disabled:T}=Mt(),{labelId:x}=Zt(),{store:k,setOpen:M,selectionRef:d,validation:E,readOnly:b,required:j,alignItemWithTriggerActiveRef:A,disabled:V,keyboardActiveRef:Q}=We(),_=T||V||c,te=B(k,$.open),ye=B(k,$.value),X=B(k,$.triggerProps),Z=B(k,$.positionerElement),K=B(k,$.listElement),ge=B(k,$.id),W=B(k,$.hasSelectedValue),D=!W&&te,ae=B(k,$.hasNullItemLabel,D),R=o??ge;Er({id:R});const H=$e(Z),C=n.useRef(null),{getButtonProps:v,buttonRef:de}=Jt({disabled:_,native:l}),P=Ne(re=>{k.set("triggerElement",re)}),oe=Yt(a,C,de,P),J=Ge(),I=Ge(),U=Ge(),be=Ge();n.useEffect(()=>{if(te)return!(W||ae)?U.start(ja,()=>{d.current.allowUnselectedMouseUp=!0,d.current.allowSelectedMouseUp=!0}):be.start(dr,()=>{d.current.allowUnselectedMouseUp=!0,U.start(dr,()=>{d.current.allowSelectedMouseUp=!0})}),()=>{U.clear(),be.clear()};d.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},I.clear()},[te,W,ae,d,I,U,be]);const ke=n.useMemo(()=>K?.id??br(Z)?.id,[K,Z]),F=Gt(X,{id:R,role:"combobox","aria-expanded":te?"true":"false","aria-haspopup":"listbox","aria-controls":te?ke:void 0,"aria-labelledby":x,"aria-readonly":b||void 0,"aria-required":j||void 0,tabIndex:_?-1:0,ref:oe,onFocus(re){f(!0),te&&A.current&&M(!1,Ee(Ct,re.nativeEvent)),J.start(0,()=>{k.set("forceMount",!0)})},onBlur(re){st(Z,re.relatedTarget)||(y(!0),f(!1),m==="onBlur"&&E.commit(ye))},onPointerMove(){Q.current=!1},onKeyDown(){Q.current=!0},onMouseDown(re){if(te)return;const we=Ht(re.currentTarget);function me(ue){if(!C.current)return;const q=ue.target;if(st(C.current,q)||st(H.current,q)||q===C.current)return;const ne=va(C.current);ue.clientX>=ne.left-ht&&ue.clientX<=ne.right+ht&&ue.clientY>=ne.top-ht&&ue.clientY<=ne.bottom+ht||M(!1,Ee(bn,ue))}I.start(0,()=>{we.addEventListener("mouseup",me,{once:!0})})}},E.getValidationProps,p,v);F.role="combobox";const xe=n.useMemo(()=>({...h,open:te,disabled:_,value:ye,readOnly:b,placeholder:!W}),[h,te,_,ye,b,W]);return De("button",t,{ref:[a,C],state:xe,stateAttributesMapping:Sa,props:F})}),Na={value:()=>null},Lr=n.forwardRef(function(t,a){const{className:s,render:u,children:o,placeholder:c,...l}=t,{store:p,valueRef:y}=We(),f=B(p,$.value),m=B(p,$.items),h=B(p,$.itemToStringLabel),T=B(p,$.hasSelectedValue),x=!T&&c!=null&&o==null,k=B(p,$.hasNullItemLabel,x),M=n.useMemo(()=>({value:f,placeholder:!T}),[f,T]);let d=null;return typeof o=="function"?d=o(f):o!=null?d=o:!T&&c!=null&&!k?d=c:Array.isArray(f)?d=ba(f,m,h):d=Pr(f,m,h),De("span",t,{state:M,ref:[a,y],props:[{children:d},l],stateAttributesMapping:Na})}),Dr=n.forwardRef(function(t,a){const{className:s,render:u,...o}=t,{store:c}=We(),l=B(c,$.open),p=n.useMemo(()=>({open:l}),[l]);return De("span",t,{state:p,ref:a,props:[{"aria-hidden":!0,children:"▼"},o],stateAttributesMapping:wn})}),Ra=n.createContext(void 0),Fr=n.forwardRef(function(t,a){const{store:s}=We(),u=B(s,$.mounted),o=B(s,$.forceMount);return u||o?r.jsx(Ra.Provider,{value:!0,children:r.jsx(kn,{ref:a,...t})}):null}),$r=n.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Ca(){return n.useContext($r)}function Ia(e){const{children:t,elementsRef:a,labelsRef:s,onMapChange:u}=e,o=Ne(u),c=n.useRef(0),l=$t(Ea).current,p=$t(Ma).current,[y,f]=n.useState(0),m=n.useRef(y),h=Ne((d,E)=>{p.set(d,E??null),m.current+=1,f(m.current)}),T=Ne(d=>{p.delete(d),m.current+=1,f(m.current)}),x=n.useMemo(()=>{const d=new Map;return Array.from(p.keys()).filter(b=>b.isConnected).sort(Ta).forEach((b,j)=>{const A=p.get(b)??{};d.set(b,{...A,index:j})}),d},[p,y]);ee(()=>{if(typeof MutationObserver!="function"||x.size===0)return;const d=new MutationObserver(E=>{const b=new Set,j=A=>b.has(A)?b.delete(A):b.add(A);E.forEach(A=>{A.removedNodes.forEach(j),A.addedNodes.forEach(j)}),b.size===0&&(m.current+=1,f(m.current))});return x.forEach((E,b)=>{b.parentElement&&d.observe(b.parentElement,{childList:!0})}),()=>{d.disconnect()}},[x]),ee(()=>{m.current===y&&(a.current.length!==x.size&&(a.current.length=x.size),s&&s.current.length!==x.size&&(s.current.length=x.size),c.current=x.size),o(x)},[o,x,a,s,y]),ee(()=>()=>{a.current=[]},[a]),ee(()=>()=>{s&&(s.current=[])},[s]);const k=Ne(d=>(l.add(d),()=>{l.delete(d)}));ee(()=>{l.forEach(d=>d(x))},[l,x]);const M=n.useMemo(()=>({register:h,unregister:T,subscribeMapChange:k,elementsRef:a,labelsRef:s,nextIndexRef:c}),[h,T,k,a,s,c]);return r.jsx($r.Provider,{value:M,children:t})}function Ma(){return new Map}function Ea(){return new Set}function Ta(e,t){const a=e.compareDocumentPosition(t);return a&Node.DOCUMENT_POSITION_FOLLOWING||a&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:a&Node.DOCUMENT_POSITION_PRECEDING||a&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Hr=n.createContext(void 0);function Pa(){const e=n.useContext(Hr);if(!e)throw new Error(Xe(59));return e}function wt(e,t){e&&Object.assign(e.style,t)}const Oa={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Aa={position:"fixed"},Ur=n.forwardRef(function(t,a){const{anchor:s,positionMethod:u="absolute",className:o,render:c,side:l="bottom",align:p="center",sideOffset:y=0,alignOffset:f=0,collisionBoundary:m="clipping-ancestors",collisionPadding:h,arrowPadding:T=5,sticky:x=!1,disableAnchorTracking:k,alignItemWithTrigger:M=!0,collisionAvoidance:d=vn,...E}=t,{store:b,listRef:j,labelsRef:A,alignItemWithTriggerActiveRef:V,selectedItemTextRef:Q,valuesRef:_,initialValueRef:te,popupRef:ye,setValue:X}=We(),Z=Mr(),K=B(b,$.open),ge=B(b,$.mounted),W=B(b,$.modal),D=B(b,$.value),ae=B(b,$.openMethod),R=B(b,$.positionerElement),H=B(b,$.triggerElement),C=B(b,$.isItemEqualToValue),v=n.useRef(null),de=n.useRef(null),[P,oe]=n.useState(M),J=ge&&P&&ae!=="touch";!ge&&P!==M&&oe(M),ee(()=>{ge||($.scrollUpArrowVisible(b.state)&&b.set("scrollUpArrowVisible",!1),$.scrollDownArrowVisible(b.state)&&b.set("scrollDownArrowVisible",!1))},[b,ge]),n.useImperativeHandle(V,()=>J),jn((J||W)&&K&&ae!=="touch",H);const I=Hn({anchor:s,floatingRootContext:Z,positionMethod:u,mounted:ge,side:l,sideOffset:y,align:p,alignOffset:f,arrowPadding:T,collisionBoundary:m,collisionPadding:h,sticky:x,disableAnchorTracking:k??J,collisionAvoidance:d,keepMounted:!0}),U=J?"none":I.side,be=J?Aa:I.positionerStyles,ke=n.useMemo(()=>{const q={};return K||(q.pointerEvents="none"),{role:"presentation",hidden:!ge,style:{...be,...q}}},[K,ge,be]),F=n.useMemo(()=>({open:K,side:U,align:I.align,anchorHidden:I.anchorHidden}),[K,U,I.align,I.anchorHidden]),xe=Ne(q=>{b.set("positionerElement",q)}),re=De("div",t,{ref:[a,xe],state:F,stateAttributesMapping:jr,props:[ke,E]}),we=n.useRef(0),me=Ne(q=>{if(q.size===0&&we.current===0||_.current.length===0)return;const ne=we.current;if(we.current=q.size,q.size===ne)return;const ve=Ee(Ct);if(ne!==0&&!b.state.multiple&&D!==null&&zt(_.current,D,C)===-1){const ie=te.current,he=ie!=null&&Dt(_.current,ie,C)?ie:null;X(he,ve),he===null&&(b.set("selectedIndex",null),Q.current=null)}if(ne!==0&&b.state.multiple&&Array.isArray(D)){const se=D.filter(ie=>Dt(_.current,ie,C));(se.length!==D.length||se.some(ie=>!Dt(D,ie,C)))&&(X(se,ve),se.length===0&&(b.set("selectedIndex",null),Q.current=null))}if(K&&J){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const se={height:""};wt(R,se),wt(ye.current,se)}}),ue=n.useMemo(()=>({...I,side:U,alignItemWithTriggerActive:J,setControlledAlignItemWithTrigger:oe,scrollUpArrowRef:v,scrollDownArrowRef:de}),[I,U,J,oe]);return r.jsx(Ia,{elementsRef:j,labelsRef:A,onMapChange:me,children:r.jsxs(Hr.Provider,{value:ue,children:[ge&&W&&r.jsx(Sn,{inert:Nn(!K),cutout:H}),re]})})});function Br(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const pt="base-ui-disable-scrollbar",ur={className:pt,getElement(e){return r.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}};function _a(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}const Va=n.createContext(void 0),La={disableStyleElements:!1};function Da(){return n.useContext(Va)??La}const Fa={...jr,...Xt},zr=n.forwardRef(function(t,a){const{render:s,className:u,...o}=t,{store:c,popupRef:l,onOpenChangeComplete:p,setOpen:y,valueRef:f,selectedItemTextRef:m,keyboardActiveRef:h,multiple:T,handleScrollArrowVisibility:x,scrollHandlerRef:k,highlightItemOnHover:M}=We(),{side:d,align:E,alignItemWithTriggerActive:b,setControlledAlignItemWithTrigger:j,scrollDownArrowRef:A,scrollUpArrowRef:V}=Pa(),Q=Un()!=null,_=Mr(),{nonce:te,disableStyleElements:ye}=Da(),X=Ge(),Z=B(c,$.id),K=B(c,$.open),ge=B(c,$.mounted),W=B(c,$.popupProps),D=B(c,$.transitionStatus),ae=B(c,$.triggerElement),R=B(c,$.positionerElement),H=B(c,$.listElement),C=n.useRef(0),v=n.useRef(!1),de=n.useRef(0),P=n.useRef(!1),oe=n.useRef({}),J=Rn(),I=Ne(F=>{if(!R||!l.current||!P.current)return;if(v.current||!b){x();return}const xe=R.style.top==="0px",re=R.style.bottom==="0px",we=R.getBoundingClientRect().height,me=Ht(R),ue=getComputedStyle(R),q=parseFloat(ue.marginTop),ne=parseFloat(ue.marginBottom),ve=fr(getComputedStyle(l.current)),se=me.documentElement.clientHeight-q-ne,ie=F.scrollTop,Ce=F.scrollHeight,he=F.clientHeight,g=Ce-he;let L=0,N=null,G=!1;if(xe){const i=g-ie,w=we+i,O=Math.min(w,se);L=O,O!==se?N=g:G=!0}else if(re){const i=ie-0,w=we+i,O=Math.min(w,se),Y=w-se;L=O,O!==se?N=0:(G=!0,ie<g&&(N=ie-(i-Y)))}L!==0&&(R.style.height=`${L}px`),N!=null&&(F.scrollTop=N),(G||L>=ve)&&(v.current=!0),x()});n.useImperativeHandle(k,()=>I,[I]),Rt({open:K,ref:l,onComplete(){K&&p?.(!0)}});const U=n.useMemo(()=>({open:K,transitionStatus:D,side:d,align:E}),[K,D,d,E]);ee(()=>{!R||!l.current||Object.keys(oe.current).length||(oe.current={top:R.style.top||"0",left:R.style.left||"0",right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[l,R]),ee(()=>{K||b||(P.current=!1,v.current=!1,C.current=0,de.current=0,wt(R,oe.current))},[K,b,R,l]),ee(()=>{const F=l.current;if(!(!K||!ae||!R||!F||c.state.transitionStatus==="ending")){if(!b){P.current=!0,J.request(x),F.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const xe=Ha(F);F.style.removeProperty("--transform-origin");try{const re=getComputedStyle(R),we=getComputedStyle(F),me=Ht(ae),ue=sr(R),q=ae.getBoundingClientRect(),ne=R.getBoundingClientRect(),ve=q.left,se=q.height,ie=H||F,Ce=ie.scrollHeight,he=parseFloat(we.borderBottomWidth),g=parseFloat(re.marginTop)||10,L=parseFloat(re.marginBottom)||10,N=parseFloat(re.minHeight)||100,G=fr(we),i=5,w=5,O=20,Y=me.documentElement.clientHeight-g-L,le=me.documentElement.clientWidth,ce=Y-q.bottom+se,pe=m.current,Re=f.current;let Se,Oe=0,Je=0;if(pe&&Re){const z=Re.getBoundingClientRect();Se=pe.getBoundingClientRect();const je=z.left-ve,Ae=Se.left-ne.left,_e=z.top-q.top+z.height/2,Te=Se.top-ne.top+Se.height/2;Oe=je-Ae,Je=Te-_e}const nt=ce+Je+L+he;let Fe=Math.min(Y,nt);const Tt=Y-g-L,Qe=nt-Fe,Ze=Math.max(i,ve+Oe),ct=le-w,at=Math.max(0,Ze+ne.width-ct);R.style.left=`${Ze-at}px`,R.style.height=`${Fe}px`,R.style.maxHeight="auto",R.style.marginTop=`${g}px`,R.style.marginBottom=`${L}px`,F.style.height="100%";const dt=ie.scrollHeight-ie.clientHeight,ut=Qe>=dt;ut&&(Fe=Math.min(Y,ne.height)-(Qe-dt));const Pt=q.top<O||q.bottom>Y-O||Fe<Math.min(Ce,N),Ot=(ue.visualViewport?.scale??1)!==1&&Cn;if(Pt||Ot){P.current=!0,wt(R,oe.current),yr.flushSync(()=>j(!1));return}if(ut){const z=Math.max(0,Y-nt);R.style.top=ne.height>=Tt?"0":`${z}px`,R.style.height=`${Fe}px`,ie.scrollTop=ie.scrollHeight-ie.clientHeight,C.current=Math.max(N,Fe)}else R.style.bottom="0",C.current=Math.max(N,Fe),ie.scrollTop=Qe;if(Se){const z=ne.top,je=ne.height,Ae=Se.top+Se.height/2,_e=je>0?(Ae-z)/je*100:50,Te=_a(_e,0,100);F.style.setProperty("--transform-origin",`50% ${Te}%`)}(C.current===Y||Fe>=G)&&(v.current=!0),x(),setTimeout(()=>{P.current=!0})}finally{xe()}})}},[c,K,R,ae,f,m,l,x,b,j,J,A,V,H]),n.useEffect(()=>{if(!b||!R||!K)return;const F=sr(R);function xe(re){y(!1,Ee(Mn,re))}return F.addEventListener("resize",xe),()=>{F.removeEventListener("resize",xe)}},[y,b,R,K]);const be={...H?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":T||void 0,id:`${Z}-list`},onKeyDown(F){h.current=!0,Q&&En.has(F.key)&&F.stopPropagation()},onMouseMove(){h.current=!1},onPointerLeave(F){if(!M||Br(F)||F.pointerType==="touch")return;const xe=F.currentTarget;X.start(0,()=>{c.set("activeIndex",null),xe.focus({preventScroll:!0})})},onScroll(F){H||k.current?.(F.currentTarget)},...b&&{style:H?{height:"100%"}:Oa}},ke=De("div",t,{ref:[a,l],state:U,stateAttributesMapping:Fa,props:[W,be,Bn(D),{className:!H&&b?ur.className:void 0},o]});return r.jsxs(n.Fragment,{children:[!ye&&ur.getElement(te),r.jsx(In,{context:_,modal:!1,disabled:!ge,restoreFocus:!0,children:ke})]})});function fr(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const gr={transform:"none",scale:"1",translate:"0 0"};function $a(e,t,a){a?e.setProperty(t,a):e.removeProperty(t)}function Ha(e){const{style:t}=e,a={},s=Object.keys(gr);for(const u of s)a[u]=t.getPropertyValue(u),t.setProperty(u,gr[u]);return()=>{for(const u of s)$a(t,u,a[u])}}let Kr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Ua(e={}){const{label:t,metadata:a,textRef:s,indexGuessBehavior:u,index:o}=e,{register:c,unregister:l,subscribeMapChange:p,elementsRef:y,labelsRef:f,nextIndexRef:m}=Ca(),h=n.useRef(-1),[T,x]=n.useState(o??(u===Kr.GuessFromOrder?()=>{if(h.current===-1){const d=m.current;m.current+=1,h.current=d}return h.current}:-1)),k=n.useRef(null),M=n.useCallback(d=>{if(k.current=d,T!==-1&&d!==null&&(y.current[T]=d,f)){const E=t!==void 0;f.current[T]=E?t:s?.current?.textContent??d.textContent}},[T,y,f,t,s]);return ee(()=>{if(o!=null)return;const d=k.current;if(d)return c(d,a),()=>{l(d)}},[o,c,l,a]),ee(()=>{if(o==null)return p(d=>{const E=k.current?d.get(k.current)?.index:null;E!=null&&x(E)})},[o,p,x]),n.useMemo(()=>({ref:M,index:T}),[T,M])}const Wr=n.createContext(void 0);function tr(){const e=n.useContext(Wr);if(!e)throw new Error(Xe(57));return e}const kt=n.memo(n.forwardRef(function(t,a){const{render:s,className:u,value:o=null,label:c,disabled:l=!1,nativeButton:p=!1,...y}=t,f=n.useRef(null),m=Ua({label:c,textRef:f,indexGuessBehavior:Kr.GuessFromOrder}),{store:h,getItemProps:T,setOpen:x,setValue:k,selectionRef:M,typingRef:d,valuesRef:E,keyboardActiveRef:b,multiple:j,highlightItemOnHover:A}=We(),V=Ge(),Q=B(h,$.isActive,m.index),_=B(h,$.isSelected,m.index,o),te=B(h,$.isSelectedByFocus,m.index),ye=B(h,$.isItemEqualToValue),X=m.index,Z=X!==-1,K=n.useRef(null),ge=$e(X);ee(()=>{if(!Z)return;const I=E.current;return I[X]=o,()=>{delete I[X]}},[Z,X,o,E]),ee(()=>{if(!Z)return;const I=h.state.value;let U=I;j&&Array.isArray(I)&&I.length>0&&(U=I[I.length-1]),U!==void 0&&rt(U,o,ye)&&h.set("selectedIndex",X)},[Z,X,j,ye,h,o]);const W=n.useMemo(()=>({disabled:l,selected:_,highlighted:Q}),[l,_,Q]),D=T({active:Q,selected:_});D.onFocus=void 0,D.id=void 0;const ae=n.useRef(null),R=n.useRef("mouse"),H=n.useRef(!1),{getButtonProps:C,buttonRef:v}=Jt({disabled:l,focusableWhenDisabled:!0,native:p});function de(I){const U=h.state.value;if(j){const be=Array.isArray(U)?U:[],ke=_?pa(be,o,ye):[...be,o];k(ke,Ee(_t,I))}else k(o,Ee(_t,I)),x(!1,Ee(_t,I))}const P={role:"option","aria-selected":_,tabIndex:Q?0:-1,onFocus(){h.set("activeIndex",X)},onMouseEnter(){!b.current&&h.state.selectedIndex===null&&h.set("activeIndex",X)},onMouseMove(){A&&h.set("activeIndex",X)},onMouseLeave(I){!A||b.current||Br(I)||V.start(0,()=>{h.state.activeIndex===X&&h.set("activeIndex",null)})},onTouchStart(){M.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(I){ae.current=I.key,h.set("activeIndex",X)},onClick(I){H.current=!1,!(I.type==="keydown"&&ae.current===null)&&(l||ae.current===" "&&d.current||R.current!=="touch"&&!Q||(ae.current=null,de(I.nativeEvent)))},onPointerEnter(I){R.current=I.pointerType},onPointerDown(I){R.current=I.pointerType,H.current=!0},onMouseUp(I){if(l)return;if(H.current){H.current=!1;return}const U=!M.current.allowSelectedMouseUp&&_,be=!M.current.allowUnselectedMouseUp&&!_;U||be||R.current!=="touch"&&!Q||de(I.nativeEvent)}},oe=De("div",t,{ref:[v,a,m.ref,K],state:W,props:[D,P,y,C]}),J=n.useMemo(()=>({selected:_,indexRef:ge,textRef:f,selectedByFocus:te,hasRegistered:Z}),[_,ge,f,te,Z]);return r.jsx(Wr.Provider,{value:J,children:oe})})),vt=n.forwardRef(function(t,a){const s=t.keepMounted??!1,{selected:u}=tr();return s||u?r.jsx(Ba,{...t,ref:a}):null}),Ba=n.memo(n.forwardRef((e,t)=>{const{render:a,className:s,keepMounted:u,...o}=e,{selected:c}=tr(),l=n.useRef(null),{transitionStatus:p,setMounted:y}=qt(c),f=n.useMemo(()=>({selected:c,transitionStatus:p}),[c,p]),m=De("span",e,{ref:[t,l],state:f,props:[{"aria-hidden":!0,children:"✔️"},o],stateAttributesMapping:Xt});return Rt({open:c,ref:l,onComplete(){c||y(!1)}}),m})),jt=n.memo(n.forwardRef(function(t,a){const{indexRef:s,textRef:u,selectedByFocus:o,hasRegistered:c}=tr(),{selectedItemTextRef:l}=We(),{className:p,render:y,...f}=t,m=n.useCallback(T=>{if(!T||!c)return;const x=l.current===null||!l.current.isConnected;(o||x&&s.current===0)&&(l.current=T)},[l,s,o,c]);return De("div",t,{ref:[m,a,u],props:f})})),za=n.forwardRef(function(t,a){const{render:s,className:u,id:o,...c}=t,{store:l}=Tn(),p=bt(o);return l.useSyncedValueWithCleanup("descriptionElementId",p),De("p",t,{ref:a,props:[{id:p},c]})});function Ka({open:e,title:t,description:a,confirmLabel:s,cancelLabel:u,destructive:o=!1,busy:c=!1,onConfirm:l,onCancel:p}){return r.jsx(Pn,{open:e,onOpenChange:y=>{!y&&!c&&p?.()},children:r.jsxs(On,{children:[r.jsx(An,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),r.jsx(_n,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:r.jsxs(Vn,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[r.jsx(Ln,{className:"text-base font-semibold text-oai-black dark:text-white",children:t}),a?r.jsx(za,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a}):null,r.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[r.jsx(Le,{type:"button",variant:"secondary",size:"sm",disabled:c,onClick:()=>p?.(),children:u}),r.jsx(Le,{type:"button",size:"sm",disabled:c,onClick:()=>l?.(),className:Ue(o&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:s})]})]})})]})})}function qr({id:e,value:t,onChange:a,placeholder:s,disabled:u=!1,type:o="text",label:c,error:l,className:p="",...y}){const f=n.useId(),m=e||f,h=l?`${m}-error`:void 0,M=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${u?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${l?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${p}`;return r.jsxs("div",{className:"w-full",children:[c&&r.jsx("label",{htmlFor:m,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:c}),r.jsx("input",{id:m,type:o,value:t,onChange:a,placeholder:s,disabled:u,"aria-invalid":l?!0:void 0,"aria-describedby":h,className:M,...y}),l&&r.jsx("p",{id:h,className:"mt-1.5 text-sm text-oai-error",children:l})]})}const Wa="tt:hint:dismissed:";function Gr(e){return Wa+e}function qa(e){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Gr(e))==="1"}catch{return!1}}function Ga({id:e,children:t,className:a,ariaLabel:s}){const[u,o]=n.useState(()=>qa(e)),c=n.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(Gr(e),"1")}catch{}o(!0)},[e]);return u?null:r.jsxs("div",{role:"note","aria-label":s||S("hint.dismissible_aria"),className:Ue("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",a),children:[r.jsx("button",{type:"button",onClick:c,"aria-label":S("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:r.jsx(Nt,{className:"h-4 w-4","aria-hidden":"true"})}),r.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[r.jsx(Dn,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),r.jsx("div",{className:"min-w-0 flex-1",children:t})]})]})}let mr=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.indeterminate="data-indeterminate",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});function Yr(e){return n.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[mr.checked]:""}:{[mr.unchecked]:""}},...Qt}),[e.indeterminate])}const Ya=n.createContext({disabled:!1});function Xa(){return n.useContext(Ya)}const Ja=n.createContext(void 0);function Qa(e=!0){const t=n.useContext(Ja);if(t===void 0&&!e)throw new Error(Xe(3));return t}const Xr=n.createContext(void 0);function Za(){const e=n.useContext(Xr);if(e===void 0)throw new Error(Xe(14));return e}const es="data-parent",ts=n.forwardRef(function(t,a){const{checked:s,className:u,defaultChecked:o=!1,disabled:c=!1,id:l,indeterminate:p=!1,inputRef:y,name:f,onCheckedChange:m,parent:h=!1,readOnly:T=!1,render:x,required:k=!1,uncheckedValue:M,value:d,nativeButton:E=!1,...b}=t,{clearErrors:j}=er(),{disabled:A,name:V,setDirty:Q,setFilled:_,setFocused:te,setTouched:ye,state:X,validationMode:Z,validityData:K,shouldValidateOnChange:ge,validation:W}=Mt(),D=Xa(),{labelId:ae,controlId:R,setControlId:H,getDescriptionProps:C}=Zt(),v=Qa(),de=v?.parent,P=de&&v.allValues,oe=A||D.disabled||v?.disabled||c,J=V??f,I=d??J,U=bt(),be=bt();let ke=R;P?ke=h?be:`${de.id}-${I}`:l&&(ke=l);let F={};P&&(h?F=v.parent.getParentProps():I&&(F=v.parent.getChildProps(I)));const xe=Ne(m),{checked:re=s,indeterminate:we=p,onCheckedChange:me,...ue}=F,q=v?.value,ne=v?.setValue,ve=v?.defaultValue,se=n.useRef(null),{getButtonProps:ie,buttonRef:Ce}=Jt({disabled:oe,native:E}),he=v?.validation??W,[g,L]=Bt({controlled:I&&q&&!h?q.includes(I):re,default:I&&ve&&!h?ve.includes(I):o,name:"Checkbox",state:"checked"});ee(()=>{if(H!==Ve)return H(ke),()=>{H(void 0)}},[ke,v,H,h]),Or({enabled:!v,id:U,commit:he.commit,value:g,controlRef:se,name:J,getValue:()=>g});const N=n.useRef(null),G=Yt(y,N,he.inputRef);ee(()=>{N.current&&(N.current.indeterminate=we,g&&_(!0))},[g,we,_]),Ar(g,()=>{v&&!h||(j(J),_(g),Q(g!==K.initialValue),ge()?he.commit(g):he.commit(g,!0))});const i=Gt({checked:g,disabled:oe,name:h?void 0:J,id:E?void 0:ke??void 0,required:k,ref:G,style:J?kr:vr,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(pe){if(pe.nativeEvent.defaultPrevented)return;const Re=pe.target.checked,Se=Ee(Ct,pe.nativeEvent);if(me?.(Re,Se),xe(Re,Se),!Se.isCanceled&&(L(Re),I&&q&&ne&&!h)){const Oe=Re?[...q,I]:q.filter(Je=>Je!==I);ne(Oe,Se)}},onFocus(){se.current?.focus()}},d!==void 0?{value:(v?g&&d:d)||""}:yt,C,v?he.getValidationProps:he.getInputValidationProps),w=P?!!re:g,O=P&&we||p;n.useEffect(()=>{de&&I&&de.disabledStatesRef.current.set(I,oe)},[de,oe,I]);const Y=n.useMemo(()=>({...X,checked:w,disabled:oe,readOnly:T,required:k,indeterminate:O}),[X,w,oe,T,k,O]),le=Yr(Y),ce=De("span",t,{state:Y,ref:[Ce,se,a,v?.registerControlRef],props:[{id:E?ke??void 0:U,role:"checkbox","aria-checked":we?"mixed":g,"aria-readonly":T||void 0,"aria-required":k||void 0,"aria-labelledby":ae,[es]:h?"":void 0,onFocus(){te(!0)},onBlur(){const pe=N.current;pe&&(ye(!0),te(!1),Z==="onBlur"&&he.commit(v?q:pe.checked))},onClick(pe){T||oe||(pe.preventDefault(),N.current?.click())}},C,he.getValidationProps,b,ue,ie],stateAttributesMapping:le});return r.jsxs(Xr.Provider,{value:Y,children:[ce,!g&&!v&&J&&!h&&M!==void 0&&r.jsx("input",{type:"hidden",name:J,value:M}),r.jsx("input",{...i})]})}),rs=n.forwardRef(function(t,a){const{render:s,className:u,keepMounted:o=!1,...c}=t,l=Za(),p=l.checked||l.indeterminate,{transitionStatus:y,setMounted:f}=qt(p),m=n.useRef(null),h=n.useMemo(()=>({...l,transitionStatus:y}),[l,y]);Rt({open:p,ref:m,onComplete(){p||f(!1)}});const T=Yr(l),x=n.useMemo(()=>({...T,...Xt,...Qt}),[T]),k=o||p,M=De("span",t,{enabled:k,ref:[a,m],state:h,stateAttributesMapping:x,props:c});return k?M:null});function ns(e,t){return`target:${e}:${t}`}function as(e){return`remove:${e.id||e.directory}`}function ss({skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o}){return r.jsx(Qr,{children:e?r.jsx(os,{skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o},e.id||e.directory):null})}function os({skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o}){const c=Xn(),l=n.useRef(null);n.useEffect(()=>{const x=M=>{M.key==="Escape"&&(M.stopPropagation(),s?.())},k=M=>{const d=M.target;d instanceof Element&&(l.current?.contains(d)||d.closest('[data-skill-row="1"]')||s?.())};return document.addEventListener("keydown",x),document.addEventListener("mousedown",k),()=>{document.removeEventListener("keydown",x),document.removeEventListener("mousedown",k)}},[s]);const p=e.name||e.directory,y=!!(e.repoOwner&&e.repoName),f=y?`https://github.com/${e.repoOwner}/${e.repoName}`:null,m=new Set(e.targets||[]),h=a===as(e),T=c?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return r.jsxs(r.Fragment,{children:[r.jsx(rr.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:c?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:c?0:.15},onClick:s,"aria-hidden":!0}),r.jsxs(rr.aside,{ref:l,role:"complementary","aria-label":p,initial:c?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:c?{opacity:0}:{opacity:0,x:24,scale:.98},transition:T,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[r.jsxs("header",{className:"flex items-start gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:p,children:p}),y?r.jsxs("a",{href:f,target:"_blank",rel:"noreferrer noopener",className:"mt-1 inline-flex max-w-full items-center gap-1 truncate text-xs text-oai-gray-500 transition-colors hover:text-oai-black hover:underline dark:text-oai-gray-400 dark:hover:text-white",title:f,children:[r.jsxs("span",{className:"truncate",children:[e.repoOwner,"/",e.repoName]}),r.jsx(Ut,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):r.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:e.directory,children:e.directory})]}),r.jsx("button",{type:"button",onClick:s,"aria-label":S("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:r.jsx(Nt,{className:"h-4 w-4","aria-hidden":!0})})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[e.description?r.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:e.description}):null,r.jsxs("section",{className:e.description?"mt-6":"",children:[r.jsx("h3",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.detail.sync_section_title")}),r.jsx("div",{className:"overflow-hidden rounded-xl bg-white/40 ring-1 ring-white/50 dark:bg-white/[0.02] dark:ring-white/10",children:(t||[]).map((x,k)=>{const M=m.has(x.id),d=a===ns(e.id,x.id),E=k===(t||[]).length-1,b=`skill-detail-sync-${e.id||e.directory}-${x.id}`;return r.jsxs("label",{htmlFor:b,className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 text-sm text-oai-black transition-colors hover:bg-white/40 dark:text-white dark:hover:bg-white/[0.04]"+(E?"":" border-b border-white/40 dark:border-white/[0.06]"),children:[r.jsx(ts,{id:b,checked:M,disabled:d,onCheckedChange:j=>u?.(e,x.id,!!j),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:r.jsx(rs,{className:"flex items-center justify-center text-white dark:text-oai-black",children:r.jsx(Ye,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),r.jsx(tt,{provider:x.id,size:16}),r.jsx("span",{className:"flex-1",children:x.label}),d?r.jsx(Ke,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},x.id)})})]})]}),r.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[r.jsxs("button",{type:"button",onClick:()=>o?.(e),disabled:h,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[h?r.jsx(Ke,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":!0}),S("skills.detail.remove_button")]}),r.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.detail.remove_confirm_hint")})]})]})]})}const Jr="tokentracker-skills";async function Et(e){const t=new URL(`/functions/${Jr}`,window.location.origin);if(e)for(const[u,o]of Object.entries(e))o!=null&&o!==""&&t.searchParams.set(u,String(o));const a=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),s=await a.json().catch(()=>null);if(!a.ok)throw new Error(s?.error||`Request failed with HTTP ${a.status}`);return s}async function qe(e){const t=await Zr(),a=await fetch(`/functions/${Jr}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...t},cache:"no-store",body:JSON.stringify(e)}),s=await a.json().catch(()=>null);if(!a.ok||s?.ok===!1)throw new Error(s?.error||`Request failed with HTTP ${a.status}`);return s}function is(){return Et({mode:"installed"})}function ls(e={}){return Et({mode:"discover",...e.force?{force:1}:{}})}function cs(e,t=0,a=20){return Et({mode:"search",q:e,offset:t,limit:a})}function ds(){return Et({mode:"repos"})}function us(e,t){return qe({action:"install",skill:e,targets:t})}function fs(e){return qe({action:"uninstall",id:e})}function gs(e){return qe({action:"restore",id:e})}function ms(e,t){return qe({action:"set_targets",id:e,targets:t})}function hs(e,t){return qe({action:"import_local",directory:e,targets:t})}function ps(e,t){return qe({action:"delete_local",directory:e,targets:t||[]})}function xs(e){return qe({action:"add_repo",repo:e})}function ys(e,t){return qe({action:"remove_repo",owner:e,name:t})}const hr=["claude","codex"],bs={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},He="all",Pe="skillssh";function xt(e){return`${e.repoOwner||"local"}/${e.repoName||"local"}:${e.directory}`}function pr(e){return`install:${xt(e)}`}function xr(e){return`remove:${e.id||e.directory}`}function ws(e,t){return`target:${e}:${t}`}function ks({target:e}){return r.jsxs("span",{className:"inline-flex h-6 items-center gap-1.5 rounded-full bg-oai-gray-100 px-2 text-[11px] font-medium text-oai-gray-700 ring-1 ring-oai-gray-200/70 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:ring-oai-gray-700/70",children:[r.jsx("span",{className:Ue("flex h-3.5 w-3.5 items-center justify-center",bs[e.id]),"aria-hidden":!0,children:r.jsx(tt,{provider:e.id,size:14})}),e.label]})}function vs({skill:e,targets:t}){const a=new Set(e.targets||[]),s=t.filter(o=>a.has(o.id));if(!s.length)return r.jsx("span",{className:"text-xs italic text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.target.synced_none")});const u=s.map(o=>o.label).join(", ");return r.jsx("div",{className:"flex flex-wrap gap-1","aria-label":S("skills.target.synced_summary",{targets:u}),children:s.map(o=>r.jsx(ks,{target:o},o.id))})}function js({skill:e,targets:t,selected:a,onSelect:s}){const u=e.repoOwner&&e.repoName?`${e.repoOwner}/${e.repoName}`:null,o=u?`${e.directory} · ${u}`:e.directory,c=l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),s?.(e))};return r.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":a,"aria-label":S("skills.row.open_details",{name:e.name||e.directory}),onClick:()=>s?.(e),onKeyDown:c,className:Ue("flex cursor-pointer flex-col gap-3 rounded-md px-3 py-3 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 lg:flex-row lg:items-center lg:gap-4",a?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[r.jsxs("div",{className:"min-w-0 flex-1",title:o,children:[r.jsx("h2",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:e.name||e.directory}),e.description?r.jsx("p",{className:"mt-0.5 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e.description}):null]}),r.jsx("div",{className:"flex items-center gap-2 lg:gap-3",children:r.jsx(vs,{skill:e,targets:t})}),r.jsx(Yn,{className:Ue("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",a&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]})}function Ss({agentFilter:e,agentOptions:t,onAgentFilter:a,filteredCount:s,totalCount:u,anyFilter:o,onClearFilters:c}){return r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[r.jsxs(_r,{value:e,onValueChange:a,children:[r.jsxs(Vr,{"aria-label":S("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[r.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[S("skills.filter.agent_label"),":"]}),r.jsx(Lr,{children:l=>l==="all"?S("skills.filter.agent_all"):t.find(p=>p.id===l)?.label||l}),r.jsx(Dr,{className:"text-oai-gray-400",children:r.jsx(Sr,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),r.jsx(Fr,{children:r.jsx(Ur,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:r.jsxs(zr,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[r.jsxs(kt,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[r.jsx(jt,{children:S("skills.filter.agent_all")}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),t.map(l=>r.jsxs(kt,{value:l.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tt,{provider:l.id,size:14}),r.jsx(jt,{children:l.label})]}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},l.id))]})})})]}),r.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.filter.result_count",{filtered:s,total:u})}),o?r.jsxs("button",{type:"button",onClick:c,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[r.jsx(Nt,{className:"h-3 w-3","aria-hidden":!0}),S("skills.filter.clear")]}):null]})}function Ns({items:e,totalCount:t,targets:a,agentOptions:s,agentFilter:u,onAgentFilter:o,anyFilter:c,onClearFilters:l,selectedId:p,onSelect:y}){return r.jsxs("div",{children:[r.jsx(Ss,{agentFilter:u,agentOptions:s,onAgentFilter:o,filteredCount:e.length,totalCount:t,anyFilter:c,onClearFilters:l}),e.length===0?r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[r.jsx("p",{children:S("skills.empty.no_match")}),r.jsx(Le,{type:"button",variant:"secondary",size:"sm",onClick:l,children:S("skills.filter.clear")})]}):r.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(f=>r.jsx(js,{skill:f,targets:a,selected:p===(f.id||f.directory),onSelect:y},f.id||f.key))})]})}const Rs={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Cs=tn.memo(function({skill:t,installed:a,installing:s,allTargets:u,defaultTargets:o,onInstall:c}){const[l,p]=n.useState(()=>(o||[]).filter(x=>u.some(k=>k.id===x))),y=x=>{p(k=>k.includes(x)?k.filter(M=>M!==x):[...k,x])},f=t.repoOwner&&t.repoName?`${t.repoOwner}/${t.repoName}`:null,m=f?`https://github.com/${t.repoOwner}/${t.repoName}`:null,h=t.installs!=null?S("skills.card.installs",{count:Number(t.installs||0).toLocaleString()}):null,T=l.length?l.map(x=>u.find(k=>k.id===x)?.label||x).join(", "):S("skills.action.choose_targets");return r.jsxs(rn,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[t.readmeUrl?r.jsxs("a",{href:t.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:t.readmeUrl,children:[r.jsx("span",{className:"truncate",children:t.name||t.directory}),r.jsx(Ut,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):r.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:t.name||t.directory}),f||h?r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[m?r.jsxs("a",{href:m,target:"_blank",rel:"noopener noreferrer",onClick:x=>x.stopPropagation(),className:"inline-flex items-center gap-1 truncate rounded text-oai-gray-500 hover:text-oai-black hover:underline focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",title:m,children:[r.jsx("span",{className:"truncate",children:f}),r.jsx(Ut,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,f&&h?r.jsx("span",{"aria-hidden":!0,children:"·"}):null,h?r.jsx("span",{className:"truncate",children:h}):null]}):null]}),a?r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-md bg-oai-black/[0.06] px-2 py-1 text-xs font-medium text-oai-gray-700 ring-1 ring-oai-black/10 dark:bg-white/[0.08] dark:text-oai-gray-200 dark:ring-white/10",children:[r.jsx(Ye,{className:"h-3 w-3","aria-hidden":!0}),S("skills.card.installed")]}):null]}),t.description?r.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t.description}):null,r.jsx("div",{className:"mt-auto pt-5",children:a?r.jsxs("div",{className:"inline-flex h-9 w-full items-center justify-center gap-1.5 rounded-md bg-oai-black/[0.04] text-sm font-medium text-oai-gray-700 ring-1 ring-inset ring-oai-black/[0.08] dark:bg-white/[0.05] dark:text-oai-gray-200 dark:ring-white/[0.08]",children:[r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0}),S("skills.card.installed")]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[r.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.card.targets_prefix")}),r.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:l.length?T:S("skills.target.none")}),r.jsxs(zn,{children:[r.jsx(Kn,{disabled:s,"aria-label":S("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:S("skills.card.targets_change")}),r.jsx(Wn,{children:r.jsx(qn,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:r.jsxs(Gn,{className:"min-w-[220px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[r.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.target.menu_label")}),u.map(x=>{const k=l.includes(x.id);return r.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[r.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:k,onChange:()=>y(x.id)}),r.jsx(tt,{provider:x.id,size:16}),r.jsx("span",{className:"flex-1 text-left",children:x.label})]},x.id)})]})})})]})]}),r.jsxs(Le,{type:"button",size:"sm",onClick:()=>c(t,l),disabled:s||l.length===0,className:"w-full",children:[s?r.jsx(Ke,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Jn,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),S("skills.action.install")]})]})})]})});function Is({repos:e,repoInput:t,onRepoInput:a,busyKey:s,onAdd:u,onRemove:o}){return r.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[r.jsx(qr,{value:t,onChange:c=>a(c.target.value),placeholder:S("skills.repo.placeholder"),className:"min-w-0 flex-1"}),r.jsxs(Le,{type:"button",variant:"secondary",size:"md",onClick:u,disabled:s==="repo:add",className:"shrink-0 whitespace-nowrap",children:[s==="repo:add"?r.jsx(Ke,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(Nr,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),S("skills.repo.add")]})]}),e.length?r.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(c=>{const l=s===`repo:${c.owner}/${c.name}`;return r.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[c.owner,"/",c.name]}),r.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:c.branch})]}),r.jsxs(Le,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:()=>o(c),className:"shrink-0",children:[l?r.jsx(Ke,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":!0}),r.jsx("span",{className:"sr-only",children:S("skills.repo.remove")})]})]},`${c.owner}/${c.name}`)})}):null]})}function Ms(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function Hs(){const[e,t]=n.useState(Ms),[a,s]=n.useState({skills:[],targets:[]}),[u,o]=n.useState([]),[c,l]=n.useState([]),[p,y]=n.useState([]),[f,m]=n.useState(He),[h,T]=n.useState(""),[x,k]=n.useState(""),[M,d]=n.useState(""),[E,b]=n.useState(!1),[j,A]=n.useState("all"),[V,Q]=n.useState(null),[_,te]=n.useState(""),[ye,X]=n.useState(!0),[Z,K]=n.useState(!1),[ge,W]=n.useState(""),[D,ae]=n.useState(null),[R,H]=n.useState(null),C=n.useMemo(()=>{const i=new Set;for(const w of a.skills||[]){i.add(xt(w).toLowerCase()),w.repoOwner&&w.repoName&&i.add(`${w.repoOwner}/${w.repoName}:${w.sourceDirectory||w.directory}`.toLowerCase());const O=String(w.directory||"").split(/[\\/]/).pop().toLowerCase();O&&i.add(`dir:${O}`)}return i},[a.skills]),v=n.useCallback(async()=>{const i=await is();s({skills:i.skills||[],targets:i.targets||[]})},[]),de=n.useCallback(async()=>{const i=await ds();y(i.repos||[])},[]),P=n.useCallback(async({force:i=!1}={})=>{K(!0);try{const w=await ls({force:i});o(w.skills||[])}finally{K(!1)}},[]),oe=n.useCallback(async()=>{X(!0),W("");try{await Promise.all([v(),de()])}catch(i){W(i?.message||S("skills.error.generic"))}finally{X(!1)}},[v,de]),J=n.useCallback(async()=>{await oe(),e==="browse"&&f!==Pe&&P({force:!0}).catch(i=>W(i?.message||S("skills.error.generic")))},[P,oe,f,e]);n.useEffect(()=>{oe()},[oe]),n.useEffect(()=>{e==="browse"&&f!==Pe&&u.length===0&&P().catch(i=>W(i?.message||S("skills.error.generic")))},[u.length,P,f,e]),n.useEffect(()=>{if(!R)return;const i=setTimeout(()=>H(w=>w?.key===R.key?null:w),R.ttlMs||5e3);return()=>clearTimeout(i)},[R]),n.useEffect(()=>{const i=setTimeout(()=>k(h),200);return()=>clearTimeout(i)},[h]),n.useEffect(()=>{if(typeof window>"u")return;const i=new URLSearchParams(window.location.search),w=i.get("tab");if(e==="my"){if(!w)return;i.delete("tab")}else{if(w===e)return;i.set("tab",e)}const O=i.toString(),Y=`${window.location.pathname}${O?`?${O}`:""}${window.location.hash}`;window.history.replaceState({},"",Y)},[e]);const I=async(i,w)=>{te(i),W("");try{await w(),await v()}catch(O){W(O?.message||S("skills.error.generic"))}finally{te("")}},U=(i,w)=>{const O=(w&&w.length?w:hr).filter(Y=>(a.targets||[]).some(le=>le.id===Y));I(pr(i),async()=>{await us(i,O);const Y=O.map(le=>(a.targets||[]).find(ce=>ce.id===le)?.label||le).join(", ");H({key:`${Date.now()}:install:${xt(i)}`,message:S("skills.toast.installed",{name:i.name||i.directory,targets:Y||S("skills.target.none")}),ttlMs:4e3})})},be=i=>{ae(i)},ke=()=>{const i=D;i&&(ae(null),I(xr(i),async()=>{let w=null;i.managed?w=await fs(i.id):await ps(i.directory,i.targets||[]);const O=!!(w?.trashed&&i.managed&&i.id);H({key:`${Date.now()}:${i.id||i.directory}`,message:S("skills.toast.removed",{name:i.name||i.directory}),undo:O?async()=>{try{await gs(i.id),await v(),H(null)}catch(Y){W(Y?.message||S("skills.error.generic"))}}:null,ttlMs:5e3})}))},F=(i,w,O)=>I(ws(i.id,w),async()=>{const Y=new Set(i.targets||[]);O?Y.add(w):Y.delete(w),i.managed?await ms(i.id,Array.from(Y)):await hs(i.directory,Array.from(Y))}),xe=async()=>{const i=h.trim();if(!(i.length<2)){te("search"),W("");try{const w=await cs(i);l(w.skills||[])}catch(w){W(w?.message||S("skills.error.generic"))}finally{te("")}}},re=async()=>{const i=M.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[w,O]=i.split("/");if(!w||!O){W(S("skills.repo.invalid"));return}await I("repo:add",async()=>{await xs({owner:w,name:O,branch:"main",enabled:!0}),d(""),await de(),await P()})},we=async i=>{await I(`repo:${i.owner}/${i.name}`,async()=>{await ys(i.owner,i.name),await de(),await P()})},me=a.targets||[],ue=a.skills||[],q=n.useMemo(()=>j==="all"?ue:ue.filter(i=>(i.targets||[]).includes(j)),[ue,j]),ne=j!=="all",ve=n.useMemo(()=>V&&ue.find(i=>(i.id||i.directory)===V)||null,[ue,V]),se=n.useCallback(()=>{A("all")},[]),ie=n.useCallback(i=>{Q(w=>{const O=i?.id||i?.directory||null;return w===O?null:O})},[]),Ce=n.useCallback(()=>Q(null),[]);n.useEffect(()=>{e!=="my"&&V&&Q(null)},[e,V]),n.useEffect(()=>{V&&!ve&&Q(null)},[ve,V]);const he=n.useMemo(()=>{const i=f===Pe?c:u,w=f===Pe||f===He?i:i.filter(le=>`${le.repoOwner}/${le.repoName}`===f),O=x.trim().toLowerCase();return(f===Pe||!O?w:w.filter(le=>(le.name||"").toLowerCase().includes(O)||(le.directory||"").toLowerCase().includes(O)||(le.description||"").toLowerCase().includes(O))).map(le=>{const ce=xt(le).toLowerCase(),pe=String(le.directory||"").split(/[\\/]/).pop().toLowerCase(),Re=pe?`dir:${pe}`:"";return{...le,installed:C.has(ce)||Re&&C.has(Re)}})},[x,u,C,c,f]),g=r.jsx("div",{className:"flex h-64 items-center justify-center",children:r.jsx(Ke,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),L=r.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[r.jsx(Ke,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),r.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.browse.loading_hint")})]}),N=(i,w=null)=>r.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[r.jsx("p",{children:S(i)}),w]});let G;if(ye)G=g;else if(e==="my")G=ue.length?r.jsx(Ns,{items:q,totalCount:ue.length,targets:me,agentOptions:me,agentFilter:j,onAgentFilter:A,anyFilter:ne,onClearFilters:se,selectedId:V,onSelect:ie}):r.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[me.length>0?r.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[r.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:r.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...me,...me].map((i,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(tt,{provider:i.id,size:30})},`b-${w}`))})}),r.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:r.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...me,...me].map((i,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(tt,{provider:i.id,size:30})},`c-${w}`))})}),r.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),r.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.empty.my")}),r.jsx(Le,{type:"button",size:"sm",onClick:()=>t("browse"),children:S("skills.empty.my_cta")})]});else{const i=f===Pe,w=p.length===0&&!i,O=!i&&(x.trim()!==""||f!==He),Y=()=>{T(""),m(He)},le=!w&&!Z&&(he.length>0||O)?r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[r.jsx("span",{children:S("skills.filter.result_count_browse",{count:he.length})}),O?r.jsxs("button",{type:"button",onClick:Y,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[r.jsx(Nt,{className:"h-3 w-3","aria-hidden":!0}),S("skills.filter.clear")]}):null]}):null;let ce;w?ce=r.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:r.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:S("skills.browse.empty_sources")})}):Z&&!i?ce=L:i&&h.trim().length<2?ce=r.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:S("skills.browse.hint_skillssh")}):he.length?ce=r.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:he.map(Se=>r.jsx("div",{style:Rs,children:r.jsx(Cs,{skill:Se,installed:!!Se.installed,installing:_===pr(Se),allTargets:me,defaultTargets:hr,onInstall:U})},Se.id||Se.key))}):O?ce=N("skills.empty.no_match",r.jsx(Le,{type:"button",variant:"secondary",size:"sm",onClick:Y,children:S("skills.filter.clear")})):i?ce=N("skills.empty.search"):ce=N("skills.empty.browse");const pe=w||E?r.jsx("div",{className:"mb-5",children:r.jsx(Is,{repos:p,repoInput:M,onRepoInput:d,busyKey:_,onAdd:re,onRemove:we})}):null,Re=!E&&!i&&p.length<=1&&he.length>0?r.jsx(Ga,{id:"skills-browse-intro",className:"mt-6",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{children:S("skills.browse.add_repo_hint")}),r.jsx("button",{type:"button",onClick:()=>b(!0),className:"rounded font-medium text-oai-gray-700 underline decoration-dotted underline-offset-2 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-200 dark:hover:text-white",children:S("skills.browse.manage_sources")})]})}):null;G=r.jsxs(r.Fragment,{children:[pe,le,ce,Re]})}return r.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[r.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:r.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[r.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[r.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:S("skills.page.title")}),r.jsxs(Le,{type:"button",variant:"secondary",size:"sm",onClick:J,disabled:ye||Z,children:[r.jsx(en,{className:Ue("mr-1.5 h-3.5 w-3.5",(ye||Z)&&"animate-spin"),"aria-hidden":!0}),S("skills.action.refresh")]})]}),r.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",S("skills.tab.my")],["browse",S("skills.tab.browse")]].map(([i,w])=>r.jsx("button",{type:"button","aria-pressed":e===i,onClick:()=>t(i),className:Ue("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",e===i?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:w},i))}),ge?r.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:ge}):null,e==="browse"?r.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[r.jsx("div",{role:"tablist","aria-label":S("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",S("skills.mode.repo")],["skillssh",S("skills.mode.skillssh")]].map(([i,w])=>{const O=i==="skillssh"==(f===Pe);return r.jsx("button",{type:"button",role:"tab","aria-selected":O,onClick:()=>{i==="skillssh"?m(Pe):f===Pe&&m(He)},className:Ue("rounded px-3 py-1 text-sm font-medium transition-colors",O?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:w},i)})}),f!==Pe?r.jsxs(_r,{value:f,onValueChange:m,children:[r.jsxs(Vr,{"aria-label":S("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[r.jsx(Lr,{children:i=>i===He?S("skills.source.all"):i}),r.jsx(Dr,{className:"text-oai-gray-400",children:r.jsx(Sr,{className:"h-4 w-4","aria-hidden":!0})})]}),r.jsx(Fr,{children:r.jsx(Ur,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:r.jsxs(zr,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[r.jsxs(kt,{value:He,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[r.jsx(jt,{children:S("skills.source.all")}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),p.map(i=>{const w=`${i.owner}/${i.name}`;return r.jsxs(kt,{value:w,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[r.jsx(jt,{children:w}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},w)})]})})})]}):null,r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ir,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),r.jsx(qr,{type:"search",value:h,onChange:i=>T(i.target.value),onKeyDown:i=>{i.key==="Enter"&&f===Pe&&xe()},"aria-label":S("skills.action.search_aria"),placeholder:f===Pe?S("skills.browse.placeholder_skillssh"):f===He?S("skills.browse.placeholder_all"):S("skills.browse.placeholder_repo",{repo:f}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),f===Pe?r.jsxs(Le,{type:"button",onClick:xe,disabled:h.trim().length<2||_==="search",className:"focus:!ring-oai-gray-400/30",children:[_==="search"?r.jsx(Ke,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(ir,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),S("skills.action.search")]}):r.jsxs(Le,{type:"button",variant:"secondary",size:"sm",onClick:()=>b(i=>!i),"aria-expanded":E,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[r.jsx(Nr,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),S("skills.browse.manage_sources"),r.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:p.length})]})]}):null,G,r.jsx(ss,{skill:ve,targets:me,busyKey:_,onClose:Ce,onToggleTarget:F,onRemove:be})]})}),r.jsx(Ka,{open:!!D,title:S("skills.confirm.remove_title",{name:D?.name||D?.directory||""}),description:D?D.managed?S("skills.confirm.remove_managed"):S("skills.confirm.remove_local"):"",confirmLabel:S("skills.action.remove"),cancelLabel:S("shared.action.cancel"),destructive:!0,busy:_===xr(D||{}),onCancel:()=>ae(null),onConfirm:ke}),r.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"pointer-events-none fixed inset-x-0 bottom-6 z-[90] flex justify-center px-4",children:R?r.jsxs("div",{className:"pointer-events-auto flex max-w-md items-center gap-3 rounded-full bg-oai-black px-4 py-2 text-sm text-white shadow-lg dark:bg-white dark:text-oai-black",children:[r.jsx("span",{children:R.message}),R.undo?r.jsx("button",{type:"button",onClick:R.undo,className:"rounded-full px-2 py-0.5 text-xs font-semibold uppercase tracking-wide hover:bg-white/10 dark:hover:bg-oai-black/10",children:S("shared.action.undo")}):null]}):null})]})}export{Hs as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as T,C as e,B as o,aC as P,at as I,r as u,aD as B,R as D,S as p}from"./main-CR7sCH5H.js";import{u as E,T as K}from"./use-native-settings-BVWj6xAN.js";import{F as v,S as $,a as z}from"./FadeIn-CcubhRKW.js";import{D as G}from"./download-DtsgF1HV.js";import{C as R}from"./chevron-down-BS2aEE_V.js";import"./Card-BkDHn179.js";import"./use-reduced-motion-BsyM6Mgz.js";const H=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],O=T("arrow-up-right",H),U=["todayTokens","todayCost"],F=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaude",label:"Antigravity Claude Limit",shortLabel:"Ag Cl",category:"limits"},{id:"antigravityGPro",label:"Antigravity Gemini Pro Limit",shortLabel:"Ag GPro",category:"limits"},{id:"antigravityFlash",label:"Antigravity Flash Limit",shortLabel:"Ag Fl",category:"limits"}];function N(t,i=F,s=2){const a=new Set(i.map(n=>n.id)),l=new Set,r=Array.isArray(t)?t.filter(n=>!a.has(n)||l.has(n)?!1:(l.add(n),!0)):[];return(r.length>0?r:U).slice(0,Math.max(1,Number(s)||2))}const X=264,Y=124,h="ui-rounded, -apple-system, system-ui",L=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],V={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Z(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function y({size:t="sm",children:i}){const s=t==="lg",a=s?560:264,l=s?32:22;return e.jsx("div",{className:p("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",s?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:a,aspectRatio:`${X} / ${Y}`,borderRadius:l},children:i})})}function q({size:t="sm"}){const i="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",s=`${i} L264,124 L0,124 Z`,a=`sparkArea-${t}`;return e.jsx(y,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:h,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:h,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:"$673.61"}),e.jsx("path",{d:s,fill:`url(#${a})`,stroke:"none"}),e.jsx("path",{d:i,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const C=(()=>{const s=[];for(let a=0;a<26;a++)for(let l=0;l<7;l++){const r=Math.sin((a+1)*12.9898+(l+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(r-Math.floor(r))*100);s.push({w:a,d:l,v:c})}return s})();function S(t,i){return t<18?i?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function J(){return e.jsx(y,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:S(r.v,!0)},`d-${r.w}-${r.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:S(r.v,!1)},`l-${r.w}-${r.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:h,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function Q(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],i=22,s=28,a=14,l=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const n=s+c*i,g=L[c%L.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:h,children:r.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:h,children:[r.pct,"%"]}),e.jsx("rect",{x:a,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:n+4,width:Math.max(l*(r.pct/100),4),height:"2.8",rx:"1.4",fill:g})]},r.name)})})})}function ee(){const t=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],i=22,s=28,a=14,l=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const n=s+c*i,g=V[r.source],b=Z(r.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:r.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:h,children:[r.pct,"%"]}),e.jsx("rect",{x:a,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:n+4,width:Math.max(l*(r.pct/100),4),height:"2.8",rx:"1.4",fill:b})]},r.label)})})})}function te(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ae(t,i){switch(t){case"todayTokens":return o("menubar.metric.today_tokens");case"todayCost":return o("menubar.metric.today_cost");case"last7dTokens":return o("menubar.metric.last_7d_tokens");case"totalTokens":return o("menubar.metric.total_tokens");case"totalCost":return o("menubar.metric.total_cost");case"claude5h":return o("menubar.metric.claude_5h");case"claude7d":return o("menubar.metric.claude_7d");case"codex5h":return o("menubar.metric.codex_5h");case"codex7d":return o("menubar.metric.codex_7d");default:return i}}function ie(t,i){const s=new Set(i.map(l=>l.id)),a=t.filter(l=>s.has(l));for(const l of i){if(a.length>=2)break;a.includes(l.id)||a.push(l.id)}return a.slice(0,2)}function re({slotConfigs:t,showStats:i}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),i?t.map(({slot:s,item:a},l)=>e.jsxs(D.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:p("flex min-w-[52px] flex-col items-center justify-center py-1.5",l===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:a?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:a?.shortLabel||"Metric"})]})]},s)):null]})})}function se({slot:t,value:i,options:s,disabled:a,onChange:l}){const r=t===0?o("menubar.slot.primary"):o("menubar.slot.secondary");return e.jsxs("label",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:r}),e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:i,disabled:a,"aria-label":r,onChange:c=>l(t,c.target.value),className:p("w-full appearance-none rounded-lg border border-oai-gray-200 bg-white px-3 py-2 pr-9 text-sm font-medium text-oai-black transition-colors hover:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700",a&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800"),children:s.map(c=>e.jsx("option",{value:c.id,children:c.displayLabel},c.id))}),e.jsx(R,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":"true"})]})]})}function A({label:t,hint:i,checked:s,disabled:a,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(K,{checked:s,disabled:a,onChange:l,ariaLabel:t})]})}function le(){const{available:t,settings:i,setSetting:s}=E(),a=u.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:F).map(m=>({...m,displayLabel:ae(m.id,m.label),previewValue:te(m)})),[i?.menuBarAvailableItems]),l=Number(i?.menuBarMaxItems)||2,r=u.useMemo(()=>N(i?.menuBarItems,a,l),[a,l,i?.menuBarItems]),c=u.useMemo(()=>ie(r,a),[a,r]),n=i?.showStats!==!1,g=d=>{s("menuBarItems",N(d,a,l))},b=(d,m)=>{const x=[...c];x[d===0?1:0]!==m&&(x[d]=m,g(x))},k=[0,1].map(d=>{const m=c[d]||a[d]?.id||"",j=c[d===0?1:0],_=a.filter(f=>f.id===m||f.id!==j),W=a.find(f=>f.id===m);return{slot:d,currentValue:m,options:_,item:W}}),w=i?.animatedIcon!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(re,{slotConfigs:k,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:k.map(({slot:d,currentValue:m,options:x})=>e.jsx(se,{slot:d,value:m,options:x,disabled:!t||!n,onChange:b},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(A,{label:o("settings.menubar.showStats"),hint:t?o("settings.menubar.showStatsHint"):o("menubar.native_only"),checked:n,disabled:!t,onChange:()=>s("showStats",!n)}),e.jsx(A,{label:o("settings.menubar.animatedIcon"),hint:o("settings.menubar.animatedIconHint"),checked:w,disabled:!t,onChange:()=>s("animatedIcon",!w)})]})]})}function oe(){const[t,i]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(B()){i("native");return}const s=(navigator.userAgent||"").toLowerCase(),a=/mac/.test(s)&&!/iphone|ipad/.test(s);i(a?"mac-web":"other")},[]),t}function ne(){const t=oe();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>P("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[o("widgets.cta.open_gallery"),e.jsx(O,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(G,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(I,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.macos_only")]})}const ce=[{id:"summary",Preview:q,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:J,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:Q,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:ee,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function de({Preview:t,nameKey:i,descKey:s}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:o(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:o(s)})]})]})}function M({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:o(t)})}function be(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(v,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:o("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(ne,{})})]})}),e.jsx(v,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":o("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(M,{titleKey:"widgets.menubar.section.title"}),e.jsx(le,{})]})}),e.jsxs("section",{"aria-label":o("widgets.gallery.section.title"),children:[e.jsx(M,{titleKey:"widgets.gallery.section.title"}),e.jsx($,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:ce.map(({id:t,Preview:i,nameKey:s,descKey:a})=>e.jsx(z,{children:e.jsx(de,{Preview:i,nameKey:s,descKey:a})},t))})})]})]})})})}export{be as WidgetsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c}from"./main-CR7sCH5H.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
|