🚀 Socket Launch Week Day 4:Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection.Learn more
Sign In

tokentracker-cli

Package Overview
Dependencies
Maintainers
1
Versions
231
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tokentracker-cli - npm Package Compare versions

Comparing version
0.53.2
to
0.53.3
+42
dashboard/dist/assets/ActivityHeatmap-CZasqY2H.js
import{c as ue,r as i,j as e,G as n,T as We,n as Fe,I as Ie,X as He,ar as Ge,J as Oe}from"./main-DADupgLA.js";import{u as qe}from"./useCurrency-CIJjQNSk.js";import{I as Ze}from"./info-Cje0RF1w.js";const Ke=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Ve=ue("maximize-2",Ke);const Je=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Qe=ue("pause",Je);const et=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],tt=ue("play",et);const at=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],rt=ue("rotate-ccw",at);const ot=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],nt=ue("terminal",ot),Q={emerald:{light:["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],dark:["#2d333b","#065f46","#059669","#10b981","#34d399"],gridColor:{light:"rgba(16, 185, 129, 0.12)",dark:"rgba(52, 211, 153, 0.08)"}},ocean:{light:["#f1f5f9","#93c5fd","#60a5fa","#3b82f6","#1d4ed8"],dark:["#1e293b","#1e3a8a","#2563eb","#3b82f6","#60a5fa"],gridColor:{light:"rgba(59, 130, 246, 0.12)",dark:"rgba(96, 165, 250, 0.08)"}},neon:{light:["#faf5ff","#ebd5ff","#c084fc","#a855f7","#7e22ce"],dark:["#2e1065","#581c87","#8b5cf6","#a855f7","#c084fc"],gridColor:{light:"rgba(168, 85, 247, 0.12)",dark:"rgba(192, 132, 252, 0.08)"}},amber:{light:["#fffbeb","#fde68a","#f59e0b","#d97706","#b45309"],dark:["#451a03","#78350f","#b45309","#d97706","#f59e0b"],gridColor:{light:"rgba(245, 158, 11, 0.12)",dark:"rgba(245, 158, 11, 0.08)"}}};function st(l,x){const p=/^#([0-9a-f]{6})$/i.exec(l);if(!p)return l;const c=parseInt(p[1],16),z=c>>16&255,P=c>>8&255,$=c&255,S=E=>Math.max(0,Math.min(255,Math.round(E*x)));return`rgb(${S(z)}, ${S(P)}, ${S($)})`}function O(l,x,p,c,z){const P=Math.cos(c),$=Math.sin(c),S=l*P-x*$,E=l*$+x*P,L=p,_=Math.cos(z),m=Math.sin(z),N=S,ee=E*_-L*m,te=E*m+L*_;return{x:N,y:ee,z:te}}function lt(l,x,p,c,z){return O(l,x,p,c,z)}function Se(l,x){const p=Number(x).toLocaleString();if(l>=4){const c=Math.floor(Math.random()*3)+1;return n(`heatmap.3d.voxel.joke.${c}`,{value:p})}else return l===3?n("heatmap.3d.voxel.level3",{value:p}):l===2?n("heatmap.3d.voxel.level2",{value:p}):l===1?n("heatmap.3d.voxel.level1",{value:p}):n("heatmap.3d.voxel.level0")}function _e({weeks:l,palette:x="auto",isDark:p=!1,interactive:c=!1,autoRotateInit:z=!1,onResetViewRef:P=null}){const $=Q[x]||(x==="auto"?Q.emerald:null),S=$?p?$.dark:$.light:Array.isArray(x)?x:p?Q.emerald.dark:Q.emerald.light,E=$?p?$.gridColor.dark:$.gridColor.light:p?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",L=-.2,_=.88,[m,N]=i.useState({yaw:L,pitch:_}),[ee,te]=i.useState(z),[he,A]=i.useState(1),j=c?13:10.5,pe=i.useMemo(()=>{const t=[],r=l.length;if(r===0||!c)return[];for(let s=0;s<=7;s++){const o=(s-3.5)*j,d=O(-r/2*j,o,0,m.yaw,m.pitch),h=O(r/2*j,o,0,m.yaw,m.pitch);t.push({d:`M${d.x},${d.y} L${h.x},${h.y}`,key:`horiz-${s}`})}for(let s=0;s<=r;s+=4){const o=(s-r/2)*j,d=O(o,-3.5*j,0,m.yaw,m.pitch),h=O(o,3.5*j,0,m.yaw,m.pitch);t.push({d:`M${d.x},${d.y} L${h.x},${h.y}`,key:`vert-${s}`})}if(r%4!==0){const s=(r-r/2)*j,o=O(s,-3.5*j,0,m.yaw,m.pitch),d=O(s,3.5*j,0,m.yaw,m.pitch);t.push({d:`M${o.x},${o.y} L${d.x},${d.y}`,key:"vert-last"})}return t},[l.length,m,j,c]);i.useEffect(()=>{P&&(P.current={reset:()=>{N({yaw:L,pitch:_}),te(!1),A(1),ye()},toggleAutoRotate:t=>{te(t)}})},[P]);const q=i.useRef(null),F=i.useRef(null),W=i.useRef(!1),ie=i.useRef({x:0,y:0}),Z=i.useRef({yaw:L,pitch:_}),Y=i.useRef({x:0,y:0}),oe=i.useRef({x:0,y:0,time:0}),ne=i.useRef(null),[fe,ge]=i.useState(0),K=i.useRef(null),se=i.useRef(!0);i.useEffect(()=>(se.current=!0,()=>{se.current=!1}),[]);const ye=()=>{K.current&&cancelAnimationFrame(K.current),ge(0);const t=performance.now(),r=1200,s=o=>{if(!se.current)return;const d=o-t,h=Math.min(1,d/r),k=1-Math.pow(1-h,3);ge(k),h<1?K.current=requestAnimationFrame(s):K.current=null};K.current=requestAnimationFrame(s)};i.useEffect(()=>(ye(),()=>{K.current&&cancelAnimationFrame(K.current)}),[c]),i.useEffect(()=>{if(!ee||W.current||typeof window>"u"||typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let r;const s=()=>{if(typeof document<"u"&&document.visibilityState==="hidden"){r=requestAnimationFrame(s);return}N(o=>({yaw:o.yaw+.002,pitch:o.pitch})),r=requestAnimationFrame(s)};return r=requestAnimationFrame(s),()=>cancelAnimationFrame(r)},[ee]);const ce=(t,r)=>{c&&(W.current=!0,ie.current={x:t,y:r},Z.current={yaw:m.yaw,pitch:m.pitch},Y.current={x:0,y:0},oe.current={x:t,y:r,time:performance.now()},ne.current&&cancelAnimationFrame(ne.current))},U=(t,r)=>{if(!W.current)return;const s=t-ie.current.x,o=r-ie.current.y,d=performance.now(),h=d-oe.current.time;h>0&&(Y.current={x:(t-oe.current.x)/h,y:(r-oe.current.y)/h}),oe.current={x:t,y:r,time:d};const k=.005,f=Z.current.yaw-s*k,g=Math.PI/2.3,D=Math.max(-g,Math.min(g,Z.current.pitch-o*k));N({yaw:f,pitch:D})},be=()=>{if(!W.current)return;W.current=!1;let t=-Y.current.x*12,r=-Y.current.y*12;const s=.95,o=()=>{W.current||(t*=s,r*=s,!(Math.abs(t)<.01&&Math.abs(r)<.01)&&(N(d=>{const h=d.yaw+t*.005,k=Math.PI/2.3,f=Math.max(-k,Math.min(k,d.pitch+r*.005));return{yaw:h,pitch:f}}),ne.current=requestAnimationFrame(o)))};ne.current=requestAnimationFrame(o)},[b,de]=i.useState(null),[V,xe]=i.useState({x:0,y:0,shiftX:0}),y=i.useRef(null);i.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]),i.useEffect(()=>{if(!c||!F.current)return;const t=s=>{s.preventDefault();const o=-s.deltaY*.0025;A(d=>{const h=d+o;return Math.max(.5,Math.min(3,h))})},r=F.current;return r.addEventListener("wheel",t,{passive:!1}),()=>{r.removeEventListener("wheel",t)}},[c]);const C=i.useMemo(()=>{const t=[];return l.forEach((r,s)=>{(Array.isArray(r)?r:[]).forEach((o,d)=>{o&&t.push({key:o.day||`${s}-${d}`,col:s,row:d,level:o.level||0,value:o.value||0,day:o.day,models:o.models||null})})}),t},[l]),ve=j-(c?1.8:1.5),ke=c?38:28,J=t=>Math.max(1.8,Number(t)/4*ke),ae=i.useMemo(()=>{if(C.length===0)return[];const t=l.length;return C.map(r=>{const s=J(r.level),o=Math.sqrt(Math.pow(r.col-t/2,2)+Math.pow(r.row-3.5,2)),d=Math.sqrt(Math.pow(t/2,2)+Math.pow(3.5,2)),h=o/d*.4,k=Math.min(1,Math.max(0,(fe-h)*(1/.6))),f=s*k,g=(r.col-t/2)*j,D=(r.row-3.5)*j,w=ve/2,I=[{x:g-w,y:D-w,z:0},{x:g+w,y:D-w,z:0},{x:g+w,y:D+w,z:0},{x:g-w,y:D+w,z:0},{x:g-w,y:D-w,z:f},{x:g+w,y:D-w,z:f},{x:g+w,y:D+w,z:f},{x:g-w,y:D+w,z:f}].map(B=>O(B.x,B.y,B.z,m.yaw,m.pitch)),me=O(g,D,f/2,m.yaw,m.pitch),Le=[{name:"top",indices:[4,5,6,7],scale:1,normal:[0,0,1]},{name:"bottom",indices:[3,2,1,0],scale:.4,normal:[0,0,-1]},{name:"left",indices:[3,0,4,7],scale:.55,normal:[-1,0,0]},{name:"right",indices:[1,2,6,5],scale:.75,normal:[1,0,0]},{name:"front",indices:[0,1,5,4],scale:.85,normal:[0,-1,0]},{name:"back",indices:[2,3,7,6],scale:.65,normal:[0,1,0]}],Re=S[Math.min(4,Math.max(0,Number(r.level)||0))],Ne=[],Ae=.35,De=-.4,Pe=.83;return Le.forEach(B=>{const we=lt(B.normal[0],B.normal[1],B.normal[2],m.yaw,m.pitch);if(we.z>.001){const Ce=I[B.indices[0]],ze=I[B.indices[1]],Me=I[B.indices[2]],Te=I[B.indices[3]],Ye=`M${Ce.x},${Ce.y} L${ze.x},${ze.y} L${Me.x},${Me.y} L${Te.x},${Te.y} Z`,Ue=we.x*Ae+we.y*De+we.z*Pe,Xe=p?.18:0,Be=B.scale*(.82+.28*Math.max(0,Ue))+Xe;Ne.push({name:B.name,d:Ye,fill:st(Re,Be)})}}),{...r,centerProj:me,renderedFaces:Ne}})},[C,m,S,l.length,fe,j,ve,ke]),le=i.useMemo(()=>[...ae].sort((t,r)=>t.centerProj.z-r.centerProj.z),[ae]),M=i.useMemo(()=>{if(le.length===0)return{minX:-100,minY:-100,maxX:100,maxY:100};let t=1/0,r=1/0,s=-1/0,o=-1/0;return le.forEach(d=>{const h=j*2,k=d.centerProj.x,f=d.centerProj.y;k-h<t&&(t=k-h),k+h>s&&(s=k+h),f-h<r&&(r=f-h),f+h>o&&(o=f+h)}),{minX:t,minY:r,maxX:s,maxY:o}},[le,j]),R=12,a=M.maxX-M.minX+R*2,u=M.maxY-M.minY+R*2,T=a/he,v=u/he,X=M.minX-R+(a-T)/2,H=M.minY-R+(u-v)/2,G=`${X} ${H} ${T} ${v}`;return C.length===0?e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:n("heatmap.empty")}):e.jsxs("div",{ref:F,className:`relative select-none outline-none ${c?"cursor-grab active:cursor-grabbing w-full h-full flex items-center justify-center":"w-full overflow-hidden flex justify-center"}`,onMouseDown:t=>{if(!c)return;ce(t.clientX,t.clientY);const r=o=>U(o.clientX,o.clientY),s=()=>{be(),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",s)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",s)},onTouchStart:t=>{!c||t.touches.length===0||ce(t.touches[0].clientX,t.touches[0].clientY)},onTouchMove:t=>{!c||t.touches.length===0||U(t.touches[0].clientX,t.touches[0].clientY)},onTouchEnd:()=>{c&&be()},children:[e.jsxs("svg",{ref:q,viewBox:G,width:c?"95%":"100%",height:c?"95%":"auto",role:"img","aria-label":n("heatmap.iso.aria")||"3D interactive activity heatmap",style:{display:"block",width:"100%",height:"auto",maxWidth:c?"none":`${a}px`,maxHeight:c?"78vh":"none"},className:"transition-transform duration-300 ease-out",children:[c&&pe.map(t=>e.jsx("path",{d:t.d,fill:"none",stroke:E,strokeWidth:.25,strokeDasharray:"1.5 2.5",strokeLinecap:"round"},t.key)),le.map(t=>{const r=b&&b.key===t.key;return e.jsxs("g",{onMouseEnter:s=>{if(y.current&&(clearTimeout(y.current),y.current=null),de(t),c&&q.current){const o=O((t.col-l.length/2)*j,(t.row-3.5)*j,J(t.level),m.yaw,m.pitch);let d=0,h=0;const k=q.current;if(F.current&&typeof k.createSVGPoint=="function"&&typeof k.getScreenCTM=="function")try{const w=k.createSVGPoint();w.x=o.x,w.y=o.y;const re=k.getScreenCTM();if(re){const I=w.matrixTransform(re),me=F.current.getBoundingClientRect();d=I.x-me.left,h=I.y-me.top}}catch{const re=k.getBoundingClientRect(),I=M.maxX-M.minX+R*2,me=M.maxY-M.minY+R*2;d=(o.x-(M.minX-R))/I*re.width,h=(o.y-(M.minY-R))/me*re.height}else{const w=k.getBoundingClientRect(),re=M.maxX-M.minX+R*2,I=M.maxY-M.minY+R*2;d=(o.x-(M.minX-R))/re*w.width,h=(o.y-(M.minY-R))/I*w.height}const f=140;let g=0;const D=F.current?F.current.getBoundingClientRect().width:k.getBoundingClientRect().width;d<f?g=f-d:d>D-f&&(g=D-f-d),xe({x:d,y:h,shiftX:g})}},onMouseLeave:()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{de(null)},150)},className:"transition-all duration-200",style:{filter:r?"brightness(1.15) drop-shadow(0 4px 6px rgba(0,0,0,0.15))":"none",cursor:c?"pointer":"default"},children:[!c&&t.day&&e.jsx("title",{children:`${t.day}: ${Number(t.value).toLocaleString()} tokens`}),t.renderedFaces.map((s,o)=>e.jsx("path",{d:s.d,fill:s.fill,stroke:s.fill,strokeWidth:.25,strokeLinejoin:"round"},o))]},t.key)})]}),c&&b&&e.jsxs("div",{onMouseEnter:()=>{y.current&&(clearTimeout(y.current),y.current=null)},onMouseLeave:()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{de(null)},150)},className:"absolute z-[9999] w-0 h-0 transition-all duration-100 ease-out",style:{left:`${V.x}px`,top:`${V.y}px`},children:[e.jsxs("div",{className:"absolute left-0 bottom-[10px] backdrop-blur-md bg-white/90 dark:bg-oai-gray-900/90 border border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-xl rounded-xl p-3.5 max-w-[280px] min-w-[200px] flex flex-col gap-2 animate-in fade-in zoom-in-95 duration-100",style:{transform:`translateX(calc(-50% + ${V.shiftX}px))`},children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-oai-gray-100 dark:border-oai-gray-800/80 pb-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-oai-gray-500 dark:text-oai-gray-400",children:b.day}),(()=>{const t=b.level===0?p?"#9ca3af":"#6b7280":S[b.level];return e.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:t+"22",color:t,border:`1px solid ${t}44`},children:["Level ",b.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:Number(b.value).toLocaleString()}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),b.models&&Object.keys(b.models).length>0?e.jsxs("div",{className:"mt-1.5 border-t border-oai-gray-100 dark:border-oai-gray-800/60 pt-2 flex flex-col gap-1.5",children:[e.jsx("div",{className:"text-[10px] font-semibold text-oai-gray-400 dark:text-oai-gray-500 uppercase tracking-wider",children:"Model Breakdown"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-[150px] overflow-y-auto pr-1.5 scrollbar-thin",children:Object.entries(b.models).map(([t,r])=>({name:t,val:Number(r)})).sort((t,r)=>r.val-t.val).map(({name:t,val:r})=>{const s=Number(b.value)||1,o=Math.round(r/s*100);return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] gap-3",children:[e.jsx("span",{className:"font-medium text-oai-gray-750 dark:text-oai-gray-200 truncate max-w-[120px]",title:t,children:t}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:r.toLocaleString()}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[o,"%"]})]})]}),e.jsx("div",{className:"w-full h-1 bg-oai-gray-100 dark:bg-oai-gray-800/85 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${o}%`,backgroundColor:S[4],boxShadow:`0 0 4px ${S[4]}55`}})})]},t)})})]}):e.jsx("p",{className:"text-[11px] text-oai-gray-600 dark:text-oai-gray-300 leading-relaxed font-normal mt-1 border-t border-dashed border-oai-gray-100 dark:border-oai-gray-800/60 pt-1.5",children:Se(b.level,b.value)})]})]}),e.jsx("div",{className:"absolute bottom-[6px] left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 border-r border-b border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-sm",style:{marginBottom:"1px"}})]})]})}const it=12,ct=3,dt=26,mt=["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],xt=["#30363d","#065f46","#059669","#10b981","#34d399"];function $e(l){const x=Number(l);return Number.isFinite(x)?x<1e3?x.toLocaleString():Oe(x,{decimals:2}):"0"}function ut(l){if(typeof l!="string")return null;const x=/^(\d{4})-(\d{2})-(\d{2})$/.exec(l.trim());if(!x)return null;const p=new Date(Date.UTC(Number(x[1]),Number(x[2])-1,Number(x[3])));return Number.isFinite(p.getTime())?p:null}function Ee(l,x){return new Date(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()+x))}function ht(l,x){return Math.floor((Date.UTC(x.getUTCFullYear(),x.getUTCMonth(),x.getUTCDate())-Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()))/864e5)}function pt(l,x){const p=x==="mon"?1:0,c=l.getUTCDay();return Ee(l,-((c-p+7)%7))}function ft(l,x,p,c){if(!l)return[];const z=ut(x)||new Date,P=[];for(let _=11;_>=0;_-=1)P.push(new Date(Date.UTC(z.getUTCFullYear(),z.getUTCMonth()-_,1)));const $=pt(z,p),S=Ee($,-(l-1)*7),E=[],L=new Set;for(const _ of P){const m=Math.floor(ht(S,_)/7);m<0||m>=l||L.has(m)||(L.add(m),E.push({label:c[_.getUTCMonth()],index:m}))}return E}function vt({heatmap:l,timeZoneLabel:x,timeZoneShortLabel:p,hideLegend:c=!1,embedded:z=!1}){const{resolvedTheme:P}=We(),{currency:$,rate:S}=qe(),E=P==="dark",L=E?xt:mt,_=i.useRef(null),m=i.useRef(null),[N,ee]=i.useState(null),[te,he]=i.useState({x:0,y:0,shiftX:0}),A=i.useRef(null);i.useEffect(()=>()=>{A.current&&clearTimeout(A.current)},[]);const[j,pe]=i.useState(!1),[q,F]=i.useState(!1),[W,ie]=i.useState(!1),Z=i.useRef(null),[Y,oe]=i.useState("emerald"),ne=[n("heatmap.month.jan"),n("heatmap.month.feb"),n("heatmap.month.mar"),n("heatmap.month.apr"),n("heatmap.month.may"),n("heatmap.month.jun"),n("heatmap.month.jul"),n("heatmap.month.aug"),n("heatmap.month.sep"),n("heatmap.month.oct"),n("heatmap.month.nov"),n("heatmap.month.dec")],fe=(a,u)=>{if(!u||!u.day)return;A.current&&(clearTimeout(A.current),A.current=null),ee(u);const T=a.currentTarget.getBoundingClientRect(),v=typeof window<"u"?window.innerWidth:1024,X=T.left+T.width/2,H=T.top,G=140;let t=0;X<G?t=G-X:X>v-G&&(t=v-G-X),he({x:X,y:H,shiftX:t})},ge=()=>{A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{ee(null)},150)},K=()=>{F(!1),pe(!0)},se=()=>{F(!0)},ye=a=>{a.target===a.currentTarget&&q&&(pe(!1),F(!1))};i.useEffect(()=>{if(!j||q)return;const a=u=>{u.key==="Escape"&&se()};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[j,q]);const ce=i.useMemo(()=>({emerald:{accentText:"text-emerald-500 dark:text-emerald-400",accentBg:"bg-emerald-500/10 dark:bg-emerald-400/10",accentBorder:"border-emerald-500/20 dark:border-emerald-400/15",hoverBorder:"hover:border-emerald-500/30 dark:hover:border-emerald-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(16,185,129,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(52,211,153,0.25)]",rawColor:"#10b981"},ocean:{accentText:"text-blue-500 dark:text-blue-400",accentBg:"bg-blue-500/10 dark:bg-blue-400/10",accentBorder:"border-blue-500/20 dark:border-blue-400/15",hoverBorder:"hover:border-blue-500/30 dark:hover:border-blue-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(59,130,246,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(96,165,250,0.25)]",rawColor:"#3b82f6"},neon:{accentText:"text-purple-500 dark:text-purple-400",accentBg:"bg-purple-500/10 dark:bg-purple-400/10",accentBorder:"border-purple-500/20 dark:border-purple-400/15",hoverBorder:"hover:border-purple-500/30 dark:hover:border-purple-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(168,85,247,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(192,132,252,0.25)]",rawColor:"#a855f7"},amber:{accentText:"text-amber-500 dark:text-amber-400",accentBg:"bg-amber-500/10 dark:bg-amber-400/10",accentBorder:"border-amber-500/20 dark:border-amber-400/15",hoverBorder:"hover:border-amber-500/30 dark:hover:border-amber-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(245,158,11,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(245,158,11,0.25)]",rawColor:"#f59e0b"}}),[]),U=ce[Y]||ce.emerald,be=Q[Y]?E?Q[Y].dark:Q[Y].light:E?Q.emerald.dark:Q.emerald.light,[b,de]=i.useState(()=>{if(z)return"2d";try{return window.localStorage?.getItem("tt:heatmap-view")==="3d"?"3d":"2d"}catch{return"2d"}});i.useEffect(()=>{if(!z)try{window.localStorage?.setItem("tt:heatmap-view",b)}catch{}},[b,z]),i.useEffect(()=>{if(b!=="2d")return;const a=_.current;a&&(a.scrollLeft=a.scrollWidth)},[l?.weeks,b]),i.useEffect(()=>{const a=_.current;if(!a)return;const u=()=>{A.current&&(clearTimeout(A.current),A.current=null),ee(null)};return a.addEventListener("scroll",u),()=>a.removeEventListener("scroll",u)},[]);const V=l?.week_starts_on==="mon"?"mon":"sun",xe=i.useMemo(()=>{const a=Array.isArray(l?.weeks)?l.weeks:[];if(!a.length)return{weeks:[]};const u=[];for(const T of a)for(const v of Array.isArray(T)?T:[])v?.day&&u.push({day:v.day,total_tokens:v.total_tokens??v.value??0,billable_total_tokens:v.billable_total_tokens??v.value??v.total_tokens??0,models:v.models??null});return Fe({dailyRows:u,weeks:Math.max(52,a.length),to:l?.to,weekStartsOn:V})},[l?.to,l?.weeks,V]),y=xe?.weeks||[],C=i.useMemo(()=>{let a=0,u=0,T={day:"无数据",value:0},v=0,X=0;const H=[];y.forEach(f=>{(Array.isArray(f)?f:[]).forEach(g=>{g&&g.day&&H.push(g)})}),H.sort((f,g)=>f.day.localeCompare(g.day)),H.forEach(f=>{const g=Number(f.value)||0;a+=g,g>0?(u++,v++,v>X&&(X=v)):v=0,g>T.value&&(T={day:f.day,value:g})});const G=H.length||365,t=(u/G*100).toFixed(1);let r="heatmap.3d.modal.ai.eval.default",s="heatmap.3d.modal.ai.title.default";a>=15e6?(s="heatmap.3d.modal.ai.title.peak",r="heatmap.3d.modal.ai.eval.peak"):a>=5e6?(s="heatmap.3d.modal.ai.title.heavy",r="heatmap.3d.modal.ai.eval.heavy"):a>=1e6?(s="heatmap.3d.modal.ai.title.core",r="heatmap.3d.modal.ai.eval.core"):a>=2e4&&(s="heatmap.3d.modal.ai.title.steady",r="heatmap.3d.modal.ai.eval.steady");const o=l?.total_cost_usd,d=Number(o),k=o!=null&&(typeof o!="string"||o.trim()!=="")&&Number.isFinite(d)?d:a/15e5;return{totalTokens:a,activeDays:u,activeRate:t,maxSingleDay:T,maxStreak:X,aiEvaluationTitleKey:s,aiEvaluationKey:r,totalCostUsd:k}},[y,l?.total_cost_usd]),je=i.useMemo(()=>Ie(C.totalCostUsd,{currency:$,rate:S}),[C.totalCostUsd,$,S]),ve=V==="mon"?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(a=>n(`heatmap.day.${a.toLowerCase()}`)):["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(a=>n(`heatmap.day.${a.toLowerCase()}`)),ke=i.useMemo(()=>ft(y.length,xe?.to,V,ne),[xe?.to,y.length,V,ne]);if(!y.length)return e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:n("heatmap.empty")});const J=z?10:it,ae=z?2:ct,le=z?22:dt,M=le+y.length*J+Math.max(0,y.length-1)*ae,R=`${le}px repeat(${y.length}, ${J}px)`;return e.jsxs("div",{ref:m,className:z?"relative":"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[!z&&e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:n("heatmap.title")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{role:"tablist","aria-label":"Heatmap view",className:"flex rounded-md border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 text-[10px]",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":b==="2d",onClick:()=>de("2d"),className:b==="2d"?"px-2 py-0.5 rounded bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-oai-white font-medium":"px-2 py-0.5 rounded text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200",children:n("heatmap.view.2d")}),e.jsx("button",{type:"button",role:"tab","aria-selected":b==="3d",onClick:()=>de("3d"),className:b==="3d"?"px-2 py-0.5 rounded bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-oai-white font-medium":"px-2 py-0.5 rounded text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200",children:n("heatmap.view.3d")})]}),e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-450",children:p||n("heatmap.legend.utc")})]})]}),b==="3d"&&e.jsxs("div",{onClick:K,className:"cursor-pointer group relative overflow-hidden rounded-lg hover:border-oai-gray-350 dark:hover:border-oai-gray-700 border border-transparent transition-all",title:n("heatmap.3d.hover_tip"),children:[e.jsx(_e,{weeks:y,isDark:E,palette:Y}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-oai-gray-900/5 to-transparent pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity flex items-end justify-center pb-2",children:e.jsxs("span",{className:"text-[10px] bg-white/95 dark:bg-oai-gray-900/95 shadow border border-oai-gray-200/60 dark:border-oai-gray-800/80 px-2.5 py-1 rounded-full font-medium text-oai-gray-500 dark:text-oai-gray-400 flex items-center gap-1 transform translate-y-2 group-hover:translate-y-0 transition-transform duration-200",children:[e.jsx(Ve,{size:9}),n("heatmap.3d.hover_tip")]})})]}),b==="2d"&&e.jsx("div",{ref:_,className:"overflow-x-auto overflow-y-hidden heatmap-scroll-thin",children:e.jsxs("div",{style:{minWidth:M},children:[e.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:R,columnGap:ae},children:[e.jsx("span",{}),ke.map(a=>e.jsx("span",{style:{gridColumnStart:a.index+2},className:"whitespace-nowrap",children:a.label},`${a.label}-${a.index}`))]}),e.jsxs("div",{className:"grid",style:{gridTemplateColumns:R,columnGap:ae},children:[e.jsx("div",{className:"grid text-[10px] text-oai-gray-400 dark:text-oai-gray-400 sticky left-0 bg-white dark:bg-oai-gray-900 pr-2",style:{gridTemplateRows:`repeat(7, ${J}px)`,rowGap:ae},children:ve.map(a=>e.jsx("span",{className:"leading-none",children:a},a))}),e.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${J}px)`,gap:ae},children:y.map((a,u)=>(Array.isArray(a)?a:[]).map((T,v)=>{if(!T)return null;const X=T.day||`e-${u}-${v}`,H=Number(T.level)||0,G=L[H]||L[0];return e.jsx("span",{onMouseEnter:t=>fe(t,T),onMouseLeave:ge,className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10 cursor-pointer",style:{width:J,height:J,background:G}},X)}))})]})]})}),!c&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mt-3",children:[e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:n("heatmap.legend.less")}),e.jsx("div",{className:"flex gap-0.5",children:L.map((a,u)=>e.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:a}},u))}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:n("heatmap.legend.more")})]}),j&&e.jsx("div",{onAnimationEnd:ye,onClick:a=>{a.target===a.currentTarget&&se()},className:`fixed inset-0 z-50 flex items-center justify-center p-3 md:p-6 backdrop-blur-md bg-black/15 dark:bg-black/40 ${q?"animate-tt-fade-out":"animate-tt-fade-in"}`,children:e.jsxs("div",{className:`relative w-full max-w-6xl h-[88vh] backdrop-blur-2xl bg-white/90 dark:bg-oai-gray-900/90 border border-oai-gray-200/50 dark:border-white/10 shadow-2xl rounded-2xl flex flex-col md:flex-row overflow-hidden ${q?"animate-tt-modal-exit":"animate-tt-modal"}`,children:[e.jsx("button",{type:"button",onClick:se,className:"absolute top-4 right-4 z-50 p-2 rounded-full border border-oai-gray-200/60 dark:border-oai-gray-800/60 bg-white/50 dark:bg-oai-gray-900/50 text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:rotate-90 hover:scale-105 active:scale-95 transition-all duration-300",children:e.jsx(He,{size:16})}),e.jsxs("div",{className:"w-full md:w-[340px] border-b md:border-b-0 md:border-r border-zinc-200/50 dark:border-zinc-800/40 p-5 md:p-6 flex flex-col gap-6 overflow-y-auto backdrop-blur-md bg-zinc-50/50 dark:bg-zinc-950/50",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:U.rawColor}}),e.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5",style:{backgroundColor:U.rawColor}})]}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500",children:"3D Insight"})]}),e.jsx("h4",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight leading-none mt-2 select-none",children:n("heatmap.3d.modal.title")}),e.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-400 dark:text-zinc-500 mt-2 font-normal select-none",children:n("heatmap.3d.modal.desc")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-5 gap-y-5 border-y border-zinc-200/50 dark:border-zinc-800/50 py-5 select-none",children:[e.jsxs("div",{className:"flex flex-col gap-1 relative group cursor-help",children:[e.jsx("div",{className:"absolute left-0 bottom-full mb-2 pointer-events-none opacity-0 translate-y-1 group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-200 z-50",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-950 text-zinc-900 dark:text-zinc-50 text-[10px] font-semibold font-mono rounded-lg px-2.5 py-1.5 shadow-xl border border-zinc-200 dark:border-zinc-800/80 whitespace-nowrap flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-zinc-400 dark:text-zinc-500",children:n("heatmap.3d.modal.stats.precision_total_tokens")}),e.jsxs("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:[C.totalTokens.toLocaleString()," Tokens"]})]})}),e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.total_tokens")}),e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:$e(C.totalTokens)}),e.jsx("div",{className:"opacity-30 group-hover:opacity-60 transition-opacity",children:e.jsx("svg",{width:"24",height:"10",viewBox:"0 0 24 10",fill:"none",children:e.jsx("path",{d:"M1 9C3 7 5 7 7 4C9 1 11 0 13 2C15 4 17 0 23 0",stroke:U.rawColor,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.estimated_cost")}),e.jsx("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:je})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.active_rate_days")}),e.jsxs("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[C.activeRate,"% ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",C.activeDays,"D)"]})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.max_streak")}),e.jsxs("span",{className:"text-xl font-black text-amber-500 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[C.maxStreak," ",e.jsx("span",{className:"text-[10px] font-bold text-amber-500/80 font-mono",children:n("heatmap.3d.modal.stats.days_suffix")})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 col-span-2 relative group cursor-help",children:[e.jsx("div",{className:"absolute left-0 bottom-full mb-2 pointer-events-none opacity-0 translate-y-1 group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-200 z-50",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-950 text-zinc-900 dark:text-zinc-50 text-[10px] font-semibold font-mono rounded-lg px-2.5 py-1.5 shadow-xl border border-zinc-200 dark:border-zinc-800/80 whitespace-nowrap flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-zinc-400 dark:text-zinc-500",children:n("heatmap.3d.modal.stats.precision_peak_value")}),e.jsxs("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:[C.maxSingleDay.value>0?C.maxSingleDay.value.toLocaleString():n("heatmap.3d.modal.stats.no_data")," Tokens"]}),e.jsx("span",{className:"text-[8px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:C.maxSingleDay.day!=="无数据"?C.maxSingleDay.day:n("heatmap.3d.modal.stats.no_data")})]})}),e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.peak_day")}),e.jsxs("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[C.maxSingleDay.value>0?$e(C.maxSingleDay.value):n("heatmap.3d.modal.stats.no_data")," ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",C.maxSingleDay.day!=="无数据"?C.maxSingleDay.day:n("heatmap.3d.modal.stats.no_data"),")"]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2.5 py-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[e.jsx(nt,{size:11,style:{color:U.rawColor}}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono",style:{color:U.rawColor},children:n(C.aiEvaluationTitleKey)})]}),e.jsxs("div",{className:"pl-3.5 border-l-2 relative transition-all duration-300 group",style:{borderColor:U.rawColor},children:[e.jsx("div",{className:"absolute inset-y-0 left-0 w-[3px] blur-[2px] opacity-15 pointer-events-none rounded-full",style:{backgroundColor:U.rawColor}}),e.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-600 dark:text-zinc-400 font-normal",children:n(C.aiEvaluationKey)})]})]}),e.jsx("div",{className:"mt-auto border-t border-zinc-200/50 dark:border-zinc-800/50 pt-4 select-none",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.legend.title")}),e.jsx("span",{className:"text-[10px] font-medium text-zinc-500 dark:text-zinc-400",children:n(`heatmap.3d.modal.palette.${Y}`)})]}),e.jsx("div",{className:"flex gap-1",children:be.map((a,u)=>e.jsx("div",{className:"flex-1 h-1 rounded-[2px]",style:{backgroundColor:a},title:`Level ${u}`},u))})]})})]}),e.jsxs("div",{className:"flex-1 h-full relative flex items-center justify-center overflow-hidden p-4",children:[e.jsx("div",{className:"absolute top-1/4 left-1/3 w-96 h-96 rounded-full blur-[130px] pointer-events-none -translate-x-1/2 -translate-y-1/2 transition-all duration-500",style:{backgroundColor:U.rawColor+"15"}}),e.jsx("div",{className:"absolute bottom-1/4 right-1/3 w-80 h-80 rounded-full blur-[120px] pointer-events-none translate-x-1/2 translate-y-1/2 bg-purple-500/[0.04] dark:bg-purple-500/[0.08]"}),e.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 flex items-center gap-3 p-1.5 backdrop-blur-md bg-white/70 dark:bg-oai-gray-900/75 border border-oai-gray-200/60 dark:border-oai-gray-800/80 rounded-full shadow-lg z-30 select-none",children:[e.jsx("div",{className:"flex items-center gap-1.5 px-2",children:Object.keys(ce).map(a=>{const u=Y===a;return e.jsx("button",{type:"button",onClick:()=>oe(a),title:n(`heatmap.3d.modal.palette.${a}`),className:`w-3.5 h-3.5 rounded-full transition-all duration-200 relative hover:scale-125 ${a==="emerald"?"bg-[#10b981]":a==="ocean"?"bg-[#3b82f6]":a==="neon"?"bg-[#a855f7]":"bg-[#f59e0b]"}`,children:u&&e.jsx("span",{className:"absolute inset-0 rounded-full ring-2 ring-offset-1 ring-offset-white dark:ring-offset-oai-gray-900 ring-oai-gray-900 dark:ring-white scale-110"})},a)})}),e.jsx("div",{className:"w-[1px] h-4 bg-oai-gray-200 dark:bg-oai-gray-800"}),e.jsxs("div",{className:"flex items-center gap-1 pr-1",children:[e.jsx("button",{type:"button",onClick:()=>{const a=!W;ie(a),Z.current&&Z.current.toggleAutoRotate(a)},title:W?n("heatmap.3d.modal.control.pause"):n("heatmap.3d.modal.control.play"),className:`p-1.5 rounded-full transition-all duration-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 ${W?U.accentText:"text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250"}`,children:W?e.jsx(Qe,{size:12}):e.jsx(tt,{size:12})}),e.jsx("button",{type:"button",onClick:()=>{ie(!1),Z.current&&Z.current.reset()},title:n("heatmap.3d.modal.control.reset"),className:"p-1.5 rounded-full text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-all duration-200",children:e.jsx(rt,{size:12})})]})]}),e.jsx(_e,{weeks:y,isDark:E,interactive:!0,palette:Y,autoRotateInit:W,onResetViewRef:Z}),e.jsxs("div",{className:"absolute bottom-4 right-4 flex items-center gap-1.5 text-[9px] font-bold text-oai-gray-400 bg-white/80 dark:bg-oai-gray-900/80 border border-oai-gray-200/50 dark:border-oai-gray-800/80 rounded-md px-2.5 py-1.5 select-none pointer-events-none backdrop-blur-md shadow-sm",children:[e.jsx(Ze,{size:10,className:U.accentText}),e.jsx("span",{children:n("heatmap.3d.modal.footer.tip")})]})]})]})}),N&&!j&&typeof document<"u"&&Ge.createPortal(e.jsxs("div",{className:"fixed z-[9999] w-0 h-0 transition-all duration-100 ease-out pointer-events-none",style:{left:`${te.x}px`,top:`${te.y}px`},children:[e.jsxs("div",{className:"absolute left-0 bottom-[10px] backdrop-blur-md bg-white/95 dark:bg-oai-gray-900/95 border border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-xl rounded-xl p-3.5 max-w-[280px] min-w-[200px] flex flex-col gap-2 animate-in fade-in zoom-in-95 duration-100",style:{transform:`translateX(calc(-50% + ${te.shiftX}px))`},children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-oai-gray-100 dark:border-oai-gray-800/80 pb-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-oai-gray-500 dark:text-oai-gray-400",children:N.day}),(()=>{const a=N.level===0?E?"#9ca3af":"#6b7280":L[N.level];return e.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:a+"22",color:a,border:`1px solid ${a}44`},children:["Level ",N.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:Number(N.total_tokens??N.value).toLocaleString()}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),N.models&&Object.keys(N.models).length>0?e.jsxs("div",{className:"mt-1.5 border-t border-oai-gray-100 dark:border-oai-gray-800/60 pt-2 flex flex-col gap-1.5",children:[e.jsx("div",{className:"text-[10px] font-semibold text-oai-gray-400 dark:text-oai-gray-500 uppercase tracking-wider",children:"Model Breakdown"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-[150px] overflow-y-auto pr-1.5 oai-scrollbar",children:Object.entries(N.models).map(([a,u])=>({name:a,val:Number(u)})).sort((a,u)=>u.val-a.val).map(({name:a,val:u})=>{const T=Number(N.total_tokens??N.value)||1,v=Math.round(u/T*100);return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] gap-3",children:[e.jsx("span",{className:"font-medium text-oai-gray-750 dark:text-oai-gray-200 truncate max-w-[120px]",title:a,children:a}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:u.toLocaleString()}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[v,"%"]})]})]}),e.jsx("div",{className:"w-full h-1 bg-oai-gray-100 dark:bg-oai-gray-800/85 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${v}%`,backgroundColor:L[4],boxShadow:`0 0 4px ${L[4]}55`}})})]},a)})})]}):e.jsx("p",{className:"text-[11px] text-oai-gray-600 dark:text-oai-gray-300 leading-relaxed font-normal mt-1 border-t border-dashed border-oai-gray-100 dark:border-oai-gray-800/60 pt-1.5",children:Se(N.level,N.total_tokens??N.value)})]})]}),e.jsx("div",{className:"absolute bottom-[6px] left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 border-r border-b border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-sm",style:{marginBottom:"1px"}})]}),document.body),e.jsx("style",{children:`
@keyframes tt-fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes tt-fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
@keyframes tt-modal-entrance {
from {
opacity: 0;
transform: scale(0.96) translateY(10px);
}
to {
opacity: 1;
transform: scale(1) translateY(0);
}
}
@keyframes tt-modal-exit {
from {
opacity: 1;
transform: scale(1) translateY(0);
}
to {
opacity: 0;
transform: scale(0.96) translateY(10px);
}
}
.animate-tt-fade-in {
animation: tt-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-tt-fade-out {
animation: tt-fade-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-tt-modal {
animation: tt-modal-entrance 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}
.animate-tt-modal-exit {
animation: tt-modal-exit 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
`})]})}export{vt as A,Ve as M,nt as T};
import{ah as I,ai as j,aj as w,ak as M,al as h,am as N,r as u,an as V,ao as G,ap as H,aq as g,j as p,R as F,m as v,S as C,U as D}from"./main-DADupgLA.js";function P(...e){const t=!Array.isArray(e[0]),n=t?0:-1,o=e[0+n],r=e[1+n],i=e[2+n],a=e[3+n],s=I(r,i,a);return t?s(o):s}function K(e,t,n={}){const o=e.get();let r=null,i=o,a;const s=typeof o=="string"?o.replace(/[\d.-]/g,""):void 0,c=()=>{r&&(r.stop(),r=null),e.animation=void 0},d=()=>{const l=b(e.get()),m=b(i);if(l===m){c();return}const y=r?r.getGeneratorVelocity():e.getVelocity();c(),r=new M({keyframes:[l,m],velocity:y,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:a})},f=()=>{d(),e.animation=r??void 0,e.events.animationStart?.notify(),r?.then(()=>{e.animation=void 0,e.events.animationComplete?.notify()})};if(e.attach((l,m)=>{i=l,a=y=>m(x(y,s)),j.postRender(f)},c),w(t)){let l=n.skipInitialAnimation===!0;const m=t.on("change",A=>{l?(l=!1,e.jump(x(A,s),!1)):e.set(x(A,s))}),y=e.on("destroy",m);return()=>{m(),y()}}return c}function x(e,t){return t?e+t:e}function b(e){return typeof e=="number"?e:parseFloat(e)}function k(e){const t=h(()=>N(e)),{isStatic:n}=u.useContext(V);if(n){const[,o]=u.useState(e);u.useEffect(()=>t.on("change",o),[])}return t}function E(e,t){const n=k(t()),o=()=>n.set(t());return o(),G(()=>{const r=()=>j.preRender(o,!1,!0),i=e.map(a=>a.on("change",r));return()=>{i.forEach(a=>a()),H(o)}}),n}function T(e){g.current=[],e();const t=E(g.current,e);return g.current=void 0,t}function L(e,t,n,o){if(typeof e=="function")return T(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!="function")return U(e,t,n,o);const a=typeof t=="function"?t:P(t,n,o),s=Array.isArray(e)?S(e,a):S([e],([d])=>a(d)),c=Array.isArray(e)?void 0:e.accelerate;return c&&!c.isTransformed&&typeof t!="function"&&Array.isArray(n)&&o?.clamp!==!1&&(s.accelerate={...c,times:t,keyframes:n,isTransformed:!0}),s}function S(e,t){const n=h(()=>[]);return E(e,()=>{n.length=0;const o=e.length;for(let r=0;r<o;r++)n[r]=e[r].get();return t(n)})}function U(e,t,n,o){const r=h(()=>Object.keys(n)),i=h(()=>({}));for(const a of r)i[a]=L(e,t,n[a],o);return i}function z(e,t={}){const{isStatic:n}=u.useContext(V),o=()=>w(e)?e.get():e;if(n)return L(o);const r=k(o());return u.useInsertionEffect(()=>K(r,e,t),[r,JSON.stringify(t)]),r}function O(e,t={}){return z(e,{type:"spring",...t})}function J(e){const t=[...e];for(let n=t.length-1;n>0;n--){const o=Math.floor(Math.random()*(n+1));[t[n],t[o]]=[t[o],t[n]]}return t}function $(e,t){const n=J(e),o=Array.from({length:t},()=>[]);n.forEach((i,a)=>{o[a%t].push(i)});const r=Math.max(...o.map(i=>i.length));return o.forEach(i=>{for(;i.length<r;)i.push(n[Math.floor(Math.random()*n.length)])}),o}const q=F.memo(function({logos:t,index:n,currentTime:o,onHoverChange:r}){const[i,a]=u.useState(!1),s=4e3,c=n*400,d=(o+c)%(s*t.length),f=Math.floor(d/s),l=t[f],m=y=>{a(y),r(y)};return p.jsxs("div",{className:"relative flex flex-col items-center",onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[p.jsx(v.div,{className:"relative h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 overflow-hidden",initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{delay:n*.1,duration:.5,ease:"easeOut"},children:p.jsx(C,{mode:"wait",children:p.jsx(v.div,{className:"absolute inset-0 flex items-center justify-center",initial:{y:"18%",opacity:0,filter:"blur(4px)"},animate:{y:"0%",opacity:1,filter:"blur(0px)",transition:{type:"tween",ease:[.22,1,.36,1],duration:.9}},exit:{y:"-18%",opacity:0,filter:"blur(4px)",transition:{type:"tween",ease:[.4,0,1,1],duration:.55}},children:p.jsx(D,{provider:l.provider,size:24,className:"object-contain"})},`${l.id}-${f}`)})}),p.jsx(C,{children:i&&p.jsx(v.span,{className:"pointer-events-none absolute -bottom-7 z-10 whitespace-nowrap rounded bg-oai-gray-800 px-2 py-0.5 text-xs font-medium text-oai-gray-100 shadow-lg ring-1 ring-oai-gray-700",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:l.name})})]})});function _({logos:e,columnCount:t=2}){const[n,o]=u.useState([]),[r,i]=u.useState(0),[a,s]=u.useState(!1);u.useEffect(()=>{o($(e,t))},[e,t]),u.useEffect(()=>{if(a)return;const d=setInterval(()=>i(f=>f+100),100);return()=>clearInterval(d)},[a]);const c=u.useCallback(d=>{s(d)},[]);return p.jsx("div",{className:"flex gap-2.5 sm:gap-4 text-oai-gray-200",children:n.map((d,f)=>p.jsx(q,{logos:d,index:f,currentTime:r,onHoverChange:c},f))})}const Q=[{id:1,name:"Claude Code",provider:"claude"},{id:2,name:"Codex",provider:"codex"},{id:3,name:"Cursor",provider:"cursor"},{id:4,name:"Gemini",provider:"gemini"},{id:5,name:"OpenCode",provider:"opencode"},{id:6,name:"OpenClaw",provider:"openclaw"},{id:7,name:"Antigravity",provider:"antigravity"},{id:8,name:"Kiro",provider:"kiro"},{id:9,name:"Hermes",provider:"hermes"},{id:10,name:"GitHub Copilot",provider:"copilot"},{id:11,name:"Kimi",provider:"kimi"},{id:12,name:"oh-my-pi",provider:"omp"},{id:13,name:"Pi",provider:"pi"},{id:14,name:"CodeBuddy",provider:"codebuddy"},{id:15,name:"Grok",provider:"grok"},{id:16,name:"Kilo",provider:"kilo-cli"},{id:17,name:"Craft",provider:"craft"},{id:18,name:"Droid",provider:"droid"},{id:19,name:"GitHub",provider:"github"}];export{Q as A,_ as L,O as a,L as b,k as u};
import{c as o}from"./main-DADupgLA.js";const t=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],a=o("arrow-up-right",t);export{a as A};
import{j as r}from"./main-DADupgLA.js";function t({children:i,title:a,subtitle:o,className:s="",bodyClassName:d=""}){return r.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 transition-colors duration-200 ${s}`,children:[(a||o)&&r.jsxs("div",{className:"px-5 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 transition-colors duration-200",children:[a&&r.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide transition-colors duration-200",children:a}),o&&r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-1 transition-colors duration-200",children:o})]}),r.jsx("div",{className:`p-5 ${d}`,children:i})]})}export{t as C};

Sorry, the diff of this file is too big to display

import{Y as p,r as c,j as e,aK as b}from"./main-DADupgLA.js";const f={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_VERSION:"0.53.3",VITE_INSFORGE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC0xMjM0LTU2NzgtOTBhYi1jZGVmMTIzNDU2NzgiLCJlbWFpbCI6ImFub25AaW5zZm9yZ2UuY29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODExNDU5NDd9.T0auta_IrVIh0uXW1bob5QSnzvsnJmN28r5XkSGEuQY",VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function x(){return b(),`${(f&&"https://srctyff5.us-east.insforge.app"||"https://srctyff5.us-east.insforge.app").replace(/\/$/,"")}/functions/tokentracker-device-flow-grant`}function l(a){return(a||"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9-]/g,"")}function k(){const a=p(),[m,u]=c.useState(""),[t,r]=c.useState({kind:"idle",message:""});c.useEffect(()=>{try{const i=new URLSearchParams(window.location.search).get("user_code");i&&u(l(i))}catch{}},[]);async function g(d){if(d?.preventDefault?.(),!a?.signedIn){r({kind:"error",message:"Please sign in first."});return}const i=l(m);if(!/^[A-HJKMNP-Z2-9]{4}-[A-HJKMNP-Z2-9]{4}$/.test(i)){r({kind:"error",message:"Invalid code format. Expected XXXX-XXXX."});return}r({kind:"working",message:"Approving…"});try{const n=await a.getAccessToken?.();if(!n){r({kind:"error",message:"No access token — please sign in again."});return}const s=await fetch(x(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({user_code:i})}),o=await s.json().catch(()=>({}));s.ok?r({kind:"success",message:o.status==="already_approved"?`Already approved earlier${o.client_info?" ("+o.client_info+")":""}.`:`Approved${o.client_info?" for "+o.client_info:""}. You can close this tab — your CLI will pick it up within a few seconds.`}):s.status===404?r({kind:"error",message:"Code not found. Double-check what your CLI printed."}):s.status===410?r({kind:"error",message:"Code expired. Re-run `tracker device-login` and try again."}):s.status===401?r({kind:"error",message:"Session expired. Sign out, sign in, and try again."}):r({kind:"error",message:o?.error||`Server error (HTTP ${s.status}).`})}catch(n){r({kind:"error",message:`Network error: ${n?.message||n}`})}}return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-oai-gray-950 px-6 py-12",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-8",children:[e.jsx("h1",{className:"text-2xl font-semibold text-oai-gray-900 dark:text-white mb-2",children:"Approve your CLI"}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mb-6",children:"Type the code your CLI showed you. We'll link it to your account so token usage from that machine flows into your leaderboard profile."}),a?.signedIn?null:e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 dark:bg-amber-900/20 dark:border-amber-800 p-4 mb-4",children:e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"Sign in first, then return to this page."})}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400 mb-1",children:"CLI code"}),e.jsx("input",{type:"text",value:m,onChange:d=>u(l(d.target.value)),placeholder:"XXXX-XXXX",spellCheck:!1,autoCapitalize:"characters",maxLength:9,className:"w-full font-mono text-xl tracking-widest text-center rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-white dark:bg-oai-gray-900 text-oai-gray-900 dark:text-white px-4 py-3 focus:outline-none focus:ring-inset focus:ring-2 focus:ring-emerald-600"})]}),e.jsx("button",{type:"submit",disabled:t.kind==="working"||!a?.signedIn,className:"w-full rounded-md bg-emerald-600 hover:bg-emerald-500 disabled:bg-oai-gray-300 disabled:cursor-not-allowed text-white font-medium py-3 transition-colors",children:t.kind==="working"?"Approving…":"Approve"})]}),t.kind==="success"&&e.jsx("div",{className:"mt-4 rounded-md border border-emerald-200 bg-emerald-50 dark:bg-emerald-900/20 dark:border-emerald-800 p-4",children:e.jsx("p",{className:"text-sm text-emerald-700 dark:text-emerald-300",children:t.message})}),t.kind==="error"&&e.jsx("div",{className:"mt-4 rounded-md border border-red-200 bg-red-50 dark:bg-red-900/20 dark:border-red-800 p-4",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:t.message})})]})})}export{k as default};
import{bQ as s,b9 as T,r as i,b4 as W,a as k,bf as K,be as ee,j as I,bY as te,b$ as ne,b as oe,bR as se,bG as re,bJ as ae,b8 as ie,bL as le}from"./main-DADupgLA.js";import{x as z,P as G,w as L,A as x,l as H,v as ue,r as de,I as pe,h as ce,i as ge,j as fe,k as me,z as Se,m as Ce,s as Pe,e as Oe,f as Re,u as xe}from"./useScrollLock-DO1uWkvz.js";function Ee(){return new z({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new G,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function he(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Ee(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:T,inactiveTriggerProps:T,popupProps:T}}function Ie(e,t,o=!1){return new z({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:o,onOpenChange:void 0})}const w=s(e=>e.triggerIdProp??e.activeTriggerId),Y=s(e=>e.openProp??e.open),$=s(e=>(e.popupElement?.id??e.floatingId)||void 0);function Q(e,t){return t!==void 0&&Y(e)&&w(e)===t}function ve(e,t){return Q(e,t)?!0:t!==void 0&&Y(e)&&w(e)==null&&e.triggerCount===1}const ye={open:Y,mounted:s(e=>e.mounted),transitionStatus:s(e=>e.transitionStatus),floatingRootContext:s(e=>e.floatingRootContext),triggerCount:s(e=>e.triggerCount),preventUnmountingOnClose:s(e=>e.preventUnmountingOnClose),payload:s(e=>e.payload),activeTriggerId:w,activeTriggerElement:s(e=>e.mounted?e.activeTriggerElement:null),popupId:$,isTriggerActive:s((e,t)=>t!==void 0&&w(e)===t),isOpenedByTrigger:s((e,t)=>Q(e,t)),isMountedByTrigger:s((e,t)=>t!==void 0&&w(e)===t&&e.mounted),triggerProps:s((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:s((e,t)=>ve(e,t)?$(e):void 0),popupProps:s(e=>e.popupProps),popupElement:s(e=>e.popupElement),positionerElement:s(e=>e.positionerElement)},q=i.createContext(!1),X=i.createContext(void 0);function b(e){const t=i.useContext(X);if(e===!1&&t===void 0)throw new Error(W(27));return t}const be={...L,...K},Ye=i.forwardRef(function(t,o){const{render:r,className:a,style:l,forceRender:u=!1,...d}=t,{store:p}=b(),n=p.useState("open"),C=p.useState("nested"),m=p.useState("mounted"),S=p.useState("transitionStatus");return k("div",t,{state:{open:n,transitionStatus:S},ref:[p.context.backdropRef,o],stateAttributesMapping:be,props:[{role:"presentation",hidden:!m,style:{userSelect:"none",WebkitUserSelect:"none"}},d],enabled:u||!C})});let Te=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),we=(function(e){return e[e.open=x.open]="open",e[e.closed=x.closed]="closed",e[e.startingStyle=x.startingStyle]="startingStyle",e[e.endingStyle=x.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Z=i.createContext(void 0);function V(){const e=i.useContext(Z);if(e===void 0)throw new Error(W(26));return e}const De={...L,...K,nestedDialogOpen(e){return e?{[we.nestedDialogOpen]:""}:null}},_e=i.forwardRef(function(t,o){const{render:r,className:a,style:l,finalFocus:u,initialFocus:d,...p}=t,{store:n}=b(),C=n.useState("descriptionElementId"),m=n.useState("disablePointerDismissal"),S=n.useState("floatingRootContext"),O=n.useState("popupProps"),f=n.useState("modal"),R=n.useState("mounted"),E=n.useState("nested"),h=n.useState("nestedOpenDialogCount"),g=n.useState("open"),v=n.useState("openMethod"),P=n.useState("titleElementId"),c=n.useState("transitionStatus"),M=n.useState("role"),N=S.useState("floatingId"),F=p.id??N;V(),ee({open:g,ref:n.context.popupRef,onComplete(){g&&n.context.onOpenChangeComplete?.(!0)}});function B(D){return D==="touch"?n.context.popupRef.current:!0}const j=d===void 0?B:d,U=h>0,y=n.useStateSetter("popupElement"),A=k("div",t,{state:{open:g,nested:E,transitionStatus:c,nestedDialogOpen:U},props:[O,{id:F,"aria-labelledby":P??void 0,"aria-describedby":C??void 0,role:M,...H,hidden:!R,onKeyDown(D){ue.has(D.key)&&D.stopPropagation()},style:{[Te.nestedDialogs]:h}},p],ref:[o,n.context.popupRef,y],stateAttributesMapping:De});return I.jsx(de,{context:S,openInteractionType:v,disabled:!R,closeOnFocusOut:!m,initialFocus:j,returnFocus:u,modal:f!==!1,restoreFocus:"popup",children:A})}),$e=i.forwardRef(function(t,o){const{keepMounted:r=!1,...a}=t,{store:l}=b(),u=l.useState("mounted"),d=l.useState("modal"),p=l.useState("open");return u||r?I.jsx(Z.Provider,{value:r,children:I.jsxs(te,{ref:o,...a,children:[u&&d===!0&&I.jsx(pe,{ref:l.context.internalBackdropRef,inert:ne(!p)}),t.children]})}):null});function ke(e){const{store:t,parentContext:o,actionsRef:r,isDrawer:a}=e,l=t.useState("open");ce(t,l),ge(t);const{forceUnmount:u}=fe(l,t),d=i.useCallback(()=>{t.setOpen(!1,oe(se))},[t]);return i.useImperativeHandle(r,()=>({unmount:u,close:d}),[u,d]),{parentContext:o,isDrawer:a}}function Me({store:e,dialogRoot:t}){const{parentContext:o,isDrawer:r}=t,a=e.useState("open"),l=e.useState("disablePointerDismissal"),u=e.useState("modal"),d=e.useState("popupElement"),p=e.useState("floatingRootContext"),[n,C]=i.useState(0),[m,S]=i.useState(0),O=n===0,f=me(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0||"touches"in g&&g.touches.length!==1)return!1;const v=re(g);if(O&&!l){const P=v;return u&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===P||e.context.backdropRef.current===P||ae(P,d)&&!P?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:O});Se(a&&u===!0,d),e.useContextCallback("onNestedDialogOpen",(g,v)=>{C(g),S(v)}),e.useContextCallback("onNestedDialogClose",()=>{C(0),S(0)}),i.useEffect(()=>(o?.onNestedDialogOpen&&a&&o.onNestedDialogOpen(n+1,m+(r?1:0)),o?.onNestedDialogClose&&!a&&o.onNestedDialogClose(),()=>{o?.onNestedDialogClose&&a&&o.onNestedDialogClose()}),[r,a,n,m,o]);const R=f.reference??T,E=f.trigger??T,h=i.useMemo(()=>ie(H,f.floating),[f.floating]);return Ce(e,{activeTriggerProps:R,inactiveTriggerProps:E,popupProps:h,nestedOpenDialogCount:n,nestedOpenDrawerCount:m}),null}const Ne={...ye,modal:s(e=>e.modal),nested:s(e=>e.nested),nestedOpenDialogCount:s(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:s(e=>e.nestedOpenDrawerCount),disablePointerDismissal:s(e=>e.disablePointerDismissal),openMethod:s(e=>e.openMethod),descriptionElementId:s(e=>e.descriptionElementId),titleElementId:s(e=>e.titleElementId),viewportElement:s(e=>e.viewportElement),role:s(e=>e.role)};class _ extends le{constructor(t,o,r=!1){const a=new G,l=Fe(t);l.floatingRootContext=Ie(a,o,r),super(l,{popupRef:i.createRef(),backdropRef:i.createRef(),internalBackdropRef:i.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:a,onOpenChange:void 0,onOpenChangeComplete:void 0},Ne)}setOpen=(t,o)=>{if(o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,o);const r={open:t};Pe(r,t,o.trigger),this.update(r)};static useStore(t,o){return Oe(t,(a,l)=>new _(o,a,l),!0).store}}function Fe(e={}){return{...he(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function Be(e,t="dialog"){const{children:o,open:r,defaultOpen:a=!1,onOpenChange:l,onOpenChangeComplete:u,disablePointerDismissal:d=!1,modal:p=!0,actionsRef:n,handle:C,triggerId:m,defaultTriggerId:S=null}=e,O=t==="drawer",f=t==="alert-dialog",R=f?!0:p,E=f||d,h=f?"alertdialog":"dialog",g=b(!0),P={modal:R,disablePointerDismissal:E,nested:!!g,role:h},c=_.useStore(C?.store,{open:a,openProp:r,activeTriggerId:S,triggerIdProp:m,...P});Re(()=>{const y=r===void 0&&c.state.open===!1&&a===!0?{open:!0,activeTriggerId:S}:null;f?c.update(y?{...P,...y}:P):y&&c.update(y)}),c.useControlledProp("openProp",r),c.useControlledProp("triggerIdProp",m),c.useSyncedValues(P),c.useContextCallback("onOpenChange",l),c.useContextCallback("onOpenChangeComplete",u);const M=c.useState("open"),N=c.useState("mounted"),F=c.useState("payload"),B=ke({store:c,actionsRef:n,parentContext:g?.store.context,isDrawer:O}),j=M||N,U=i.useMemo(()=>({store:c}),[c]);return I.jsx(q.Provider,{value:!1,children:I.jsxs(X.Provider,{value:U,children:[j&&I.jsx(Me,{store:c,dialogRoot:B}),typeof o=="function"?o({payload:F}):o]})})}function Je(e){const t=i.useContext(q)?"drawer":"dialog";return Be(e,t)}let J=(function(e){return e[e.open=x.open]="open",e[e.closed=x.closed]="closed",e[e.startingStyle=x.startingStyle]="startingStyle",e[e.endingStyle=x.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const je={...L,...K,nested(e){return e?{[J.nested]:""}:null},nestedDialogOpen(e){return e?{[J.nestedDialogOpen]:""}:null}},We=i.forwardRef(function(t,o){const{render:r,className:a,style:l,children:u,...d}=t,p=V(),{store:n}=b(),C=n.useState("open"),m=n.useState("nested"),S=n.useState("transitionStatus"),O=n.useState("nestedOpenDialogCount"),f=n.useState("mounted"),R=n.useStateSetter("viewportElement"),E=O>0;return k("div",t,{enabled:p||f,state:{open:C,nested:m,transitionStatus:S,nestedDialogOpen:E},ref:[o,R],stateAttributesMapping:je,props:[{role:"presentation",hidden:!f,style:{pointerEvents:C?void 0:"none"},children:u},d]})}),ze=i.forwardRef(function(t,o){const{render:r,className:a,style:l,id:u,...d}=t,{store:p}=b(),n=xe(u);return p.useSyncedValueWithCleanup("titleElementId",n),k("h2",t,{ref:o,props:[{id:n},d]})});export{Je as D,$e as a,Ye as b,We as c,_e as d,ze as e,Ie as f,he as g,ye as p,b as u};
import{c as o}from"./main-DADupgLA.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],e=o("download",a);export{e as D};
import{e as d,j as n,m as a}from"./main-DADupgLA.js";function v({children:i,delay:t=0,duration:o=.35,y:e=12,className:s="",once:r=!0}){return d()?n.jsx("div",{className:s,children:i}):n.jsx(a.div,{initial:{opacity:0,y:e},animate:{opacity:1,y:0},transition:{duration:o,delay:t,ease:[.16,1,.3,1]},className:s,children:i})}function x({children:i,staggerDelay:t=.1,initialDelay:o=0,className:e=""}){return d()?n.jsx("div",{className:e,children:i}):n.jsx(a.div,{initial:"hidden",animate:"visible",variants:{hidden:{},visible:{transition:{staggerChildren:t,delayChildren:o}}},className:e,children:i})}function h({children:i,className:t="",y:o=12}){return d()?n.jsx("div",{className:t,children:i}):n.jsx(a.div,{variants:{hidden:{opacity:0,y:o},visible:{opacity:1,y:0,transition:{duration:.35,ease:[.16,1,.3,1]}}},className:t,children:i})}export{v as F,x as S,h as a};
import{r as s,aF as c,j as t}from"./main-DADupgLA.js";function u({repo:r="mm7894215/TokenTracker"}){const[a,o]=s.useState(null);return s.useEffect(()=>{if(typeof window>"u")return;const n=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,i=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));c({prefersReducedMotion:n,screenshotCapture:i})&&fetch(`https://api.github.com/repos/${r}`).then(e=>e.json()).then(e=>{e&&typeof e.stargazers_count=="number"&&o(e.stargazers_count)}).catch(()=>{})},[r]),t.jsxs("a",{href:`https://github.com/${r}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-2 px-3 py-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 transition-colors no-underline",children:[t.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"shrink-0 fill-oai-gray-700 dark:fill-oai-gray-300",children:t.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),t.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap",children:"Star"}),a!==null&&t.jsx("span",{className:"text-xs font-semibold text-oai-gray-900 dark:text-oai-white tabular-nums whitespace-nowrap",children:a})]})}export{u as H};
import{c}from"./main-DADupgLA.js";const o=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],t=c("info",o);export{t as I};
import{r as ge,G as t,j as n}from"./main-DADupgLA.js";const Ge=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),j=Ge?"/proxy/ipcheck":"https://ip.net.coffee",fe="claude_ip_history",Se=6,Ue=["CN","HK","MO","RU","KP","IR","SY","CU","BY","VE"],ze={CN:"Asia/Shanghai",TW:"Asia/Taipei",HK:"Asia/Hong_Kong",MO:"Asia/Macau",JP:"Asia/Tokyo",KR:"Asia/Seoul",SG:"Asia/Singapore",MY:"Asia/Kuala_Lumpur",TH:"Asia/Bangkok",VN:"Asia/Ho_Chi_Minh",ID:"Asia/Jakarta",PH:"Asia/Manila",IN:"Asia/Kolkata",PK:"Asia/Karachi",BD:"Asia/Dhaka",IR:"Asia/Tehran",IL:"Asia/Jerusalem",AE:"Asia/Dubai",SA:"Asia/Riyadh",TR:"Europe/Istanbul",RU:"Europe/Moscow",UA:"Europe/Kyiv",GB:"Europe/London",IE:"Europe/Dublin",FR:"Europe/Paris",DE:"Europe/Berlin",IT:"Europe/Rome",ES:"Europe/Madrid",PT:"Europe/Lisbon",NL:"Europe/Amsterdam",BE:"Europe/Brussels",CH:"Europe/Zurich",AT:"Europe/Vienna",SE:"Europe/Stockholm",NO:"Europe/Oslo",DK:"Europe/Copenhagen",FI:"Europe/Helsinki",PL:"Europe/Warsaw",CZ:"Europe/Prague",GR:"Europe/Athens",RO:"Europe/Bucharest",US:"America/Los_Angeles",CA:"America/Toronto",MX:"America/Mexico_City",BR:"America/Sao_Paulo",AR:"America/Argentina/Buenos_Aires",CL:"America/Santiago",AU:"Australia/Sydney",NZ:"Pacific/Auckland",ZA:"Africa/Johannesburg",EG:"Africa/Cairo",NG:"Africa/Lagos",KE:"Africa/Nairobi"},We={CN:["zh"],TW:["zh"],HK:["zh","en"],MO:["zh","en"],JP:["ja"],KR:["ko"],TH:["th"],VN:["vi"],SG:["en","zh","ms","ta"],MY:["ms","en","zh","ta"],ID:["id","en"],PH:["en","tl","fil"],IN:["en","hi"],PK:["ur","en"],BD:["bn","en"],LK:["si","ta","en"],NP:["ne","en"],US:["en"],GB:["en"],IE:["en","ga"],AU:["en"],NZ:["en","mi"],CA:["en","fr"],DE:["de"],AT:["de"],CH:["de","fr","it","rm"],BE:["nl","fr","de"],FR:["fr"],IT:["it"],ES:["es","ca","gl","eu"],PT:["pt"],NL:["nl","fy"],LU:["lb","fr","de"],SE:["sv"],NO:["no","nb","nn"],DK:["da"],FI:["fi","sv"],IS:["is","en"],PL:["pl"],CZ:["cs"],SK:["sk"],HU:["hu"],RO:["ro"],BG:["bg"],GR:["el"],RU:["ru"],UA:["uk","ru"],BY:["be","ru"],TR:["tr"],IL:["he","ar","en"],SA:["ar"],AE:["ar","en"],EG:["ar"],IR:["fa"],IQ:["ar","ku"],ZA:["en","af","zu","xh"],KE:["en","sw"],NG:["en"],ET:["am","en"],BR:["pt"],AR:["es"],MX:["es"],CL:["es"],CO:["es"],PE:["es"],VE:["es"]},Be={jp:"Japan",tw:"Taiwan",hk:"Hong Kong",sg:"Singapore",us:"United States",de:"Germany",kr:"South Korea",fr:"France",nl:"Netherlands",gb:"United Kingdom",au:"Australia",ca:"Canada",br:"Brazil",in:"India"};function Z(p){return!!p&&p.includes(":")}function Ke(p){return!Z(p)||p.length<=20?p:p.substring(0,18)+"..."}function w(p){return p==null?"":String(p).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function B(p){if(!p||!/^[a-zA-Z]{2}$/.test(p))return"";const b=p.toLowerCase();return`<img src="${b==="cn"?`${j}/favicons/cn.png`:b==="tw"?`${j}/favicons/flags/tw.png`:`${j}/favicons/flags/${b}.png`}" alt="${b}" class="inline-block h-4 w-auto align-[-2px]" onerror="this.onerror=null;this.style.display='none'">`}function Fe(p){if(!p)return"";const b=String(p).trim();if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(b)){const S=b.split(".");return S[0]+"."+S[1]+".*.*"}if(b.includes("…")){const S=b.lastIndexOf("…");return b.substring(0,S+1)+"*"}if(b.includes(":")){const S=b.split(":");if(S.length>=2)return S[0]+":"+S[1]+":*"}return b}function Ve(p){if(!p)return null;try{const S=new Intl.DateTimeFormat("en-US",{timeZone:p,timeZoneName:"longOffset"}).formatToParts(new Date).find(q=>q.type==="timeZoneName");if(!S)return null;if(S.value==="GMT"||S.value==="UTC")return 0;const M=S.value.match(/GMT([+-])(\d{1,2}):?(\d{0,2})/);return M?(M[1]==="+"?1:-1)*(parseInt(M[2],10)*60+parseInt(M[3]||"0",10)):null}catch{return null}}function Ye(p){if(p==null)return"";const b=p>=0?"+":"-",S=Math.abs(p),M=Math.floor(S/60),D=S%60;return"UTC"+b+M+(D?":"+String(D).padStart(2,"0"):"")}const Te={safe:"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",warn:"bg-amber-50 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300",danger:"bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",info:"bg-blue-50 text-blue-700 dark:bg-blue-500/15 dark:text-blue-300",neutral:"bg-oai-gray-100 text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-400"};function Je(){const p=ge.useRef(null),[b,S]=ge.useState(!1);ge.useEffect(()=>{const _=p.current;if(!_)return;const C=a=>_.querySelector(`#${a}`);let se=!1;const e={unknown:t("ipcheck.common.unknown"),failed:t("ipcheck.ip.failed"),regionAccessible:t("ipcheck.trust.region.accessible"),regionWarnTitle:a=>t("ipcheck.trust.region_warn.title",{region:a}),regionWarnBody:t("ipcheck.trust.region_warn.body"),regionRestrictedText:t("ipcheck.trust.text.restricted"),noData:t("ipcheck.trust.no_data"),noIp:t("ipcheck.trust.no_ip"),noScore:t("ipcheck.trust.no_score"),score:{pristine:t("ipcheck.trust.label.pristine"),clean:t("ipcheck.trust.label.clean"),good:t("ipcheck.trust.label.good"),neutral:t("ipcheck.trust.label.neutral"),suspicious:t("ipcheck.trust.label.suspicious"),unreachable:t("ipcheck.trust.label.unreachable")},scoreText:{excellent:t("ipcheck.trust.text.excellent"),great:t("ipcheck.trust.text.great"),minor:t("ipcheck.trust.text.minor"),moderate:t("ipcheck.trust.text.moderate"),severe:t("ipcheck.trust.text.severe")},propsRegion:t("ipcheck.props.region"),propsCity:t("ipcheck.props.city"),propsType:t("ipcheck.props.type"),propsAsn:t("ipcheck.props.asn"),propsOrg:t("ipcheck.props.org"),propsResidential:t("ipcheck.props.residential"),propsDatacenter:t("ipcheck.props.datacenter"),secVpn:t("ipcheck.security.vpn"),secProxy:t("ipcheck.security.proxy"),secTor:t("ipcheck.security.tor"),secCrawler:t("ipcheck.security.crawler"),secAbuser:t("ipcheck.security.abuser"),secProxyFlag:t("ipcheck.security.proxy_flag"),secCrawlerYes:t("ipcheck.security.crawler_yes"),secCrawlerNo:t("ipcheck.security.crawler_no"),secAbuserYes:t("ipcheck.security.abuser_yes"),secAbuserNo:t("ipcheck.security.abuser_no"),secClean:t("ipcheck.security.clean"),availSvc:t("ipcheck.avail.svc_row"),availLat:{normal:t("ipcheck.avail.latency.normal"),good:t("ipcheck.avail.latency.good"),slow:t("ipcheck.avail.latency.slow"),unreachable:t("ipcheck.avail.latency.unreachable")},availSvcStatus:{none:t("ipcheck.avail.svc.none"),minor:t("ipcheck.avail.svc.minor"),major:t("ipcheck.avail.svc.major"),critical:t("ipcheck.avail.svc.critical"),maintenance:t("ipcheck.avail.svc.maintenance"),other:t("ipcheck.avail.svc.other")},dnsStatus:t("ipcheck.dns.status"),dnsOutlet:t("ipcheck.dns.outlet"),dnsOutletIp:t("ipcheck.dns.outlet_ip"),dnsIsp:t("ipcheck.dns.isp"),dnsLeaked:t("ipcheck.dns.leaked"),dnsNoLeak:t("ipcheck.dns.no_leak"),dnsEncrypted:t("ipcheck.dns.encrypted"),dnsCnTag:t("ipcheck.dns.cn_tag"),udpStatus:t("ipcheck.udp.status"),udpOutlet:t("ipcheck.udp.outlet"),udpOutletIp:t("ipcheck.udp.outlet_ip"),udpOrigin:t("ipcheck.udp.origin"),udpDisabled:t("ipcheck.udp.disabled"),udpNoLeak:t("ipcheck.udp.no_leak"),udpLeaked:t("ipcheck.udp.leaked"),udpAnomaly:t("ipcheck.udp.anomaly"),devTz:t("ipcheck.device.tz"),devLang:t("ipcheck.device.lang"),devOs:t("ipcheck.device.os"),devTouch:t("ipcheck.device.touch"),devNet:t("ipcheck.device.net"),devDnt:t("ipcheck.device.dnt"),devWebglRender:t("ipcheck.device.webgl_render"),devCanvasFp:t("ipcheck.device.canvas_fp"),devWebglFp:t("ipcheck.device.webgl_fp"),devMatch:t("ipcheck.device.match"),devMismatch:t("ipcheck.device.mismatch"),devLocal:t("ipcheck.device.local"),devEstSuffix:t("ipcheck.device.estimate_suffix"),devDiffEqual:t("ipcheck.device.diff_equal"),devDiffAhead:a=>t("ipcheck.device.diff_ahead",{h:a}),devDiffBehind:a=>t("ipcheck.device.diff_behind",{h:a}),devLangExpected:t("ipcheck.device.lang_expected"),devTouchYes:t("ipcheck.device.touch_yes"),devTouchNo:t("ipcheck.device.touch_no"),devDntOn:t("ipcheck.device.dnt_on"),devDntOff:t("ipcheck.device.dnt_off"),devDntUnset:t("ipcheck.device.dnt_unset"),devNetUnsupported:t("ipcheck.device.net_unsupported"),devUnsupported:t("ipcheck.device.unsupported"),histEmpty:t("ipcheck.history.empty"),histCurrent:t("ipcheck.history.current"),histLoading:t("ipcheck.ip.loading")};function f(a,i="neutral"){return`<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${Te[i]||Te.neutral}">${a}</span>`}function J(a,i,r){return a===!0?f(i,"danger"):a===!1?f(r,"safe"):f(e.unknown,"neutral")}function he(a){if(!a)return`<span class="text-oai-gray-400 dark:text-oai-gray-500">${w(e.failed)}</span>`;const i=w(a);return Z(a)?`<span class="ip-mask-target truncate" title="${i}">${w(Ke(a))}</span>`:`<span class="ip-mask-target">${i}</span>`}function K(a){return a?`<span class="ip-link">${he(a)}</span>`:`<span class="text-oai-gray-400 dark:text-oai-gray-500">${w(e.failed)}</span>`}function d(a,i,r=!1){let u=i;return i===void 0?r?u=`<div class="inline-flex items-center gap-1.5 text-xs text-oai-gray-400">
<svg class="animate-spin-subtle h-3.5 w-3.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
</div>`:u='<span class="block h-3 w-20 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></span>':u=`<div class="animate-scale-up-fade">${i}</div>`,`<div class="flex items-center justify-between py-2.5 gap-3">
<span class="text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0">${a}</span>
<span class="text-sm font-medium text-oai-black dark:text-white text-right min-w-0">${u}</span>
</div>`}function re(a){return a.map(i=>d(i,void 0)).join("")}function oe(){return'<div class="h-7 w-44 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></div>'}function ce(){return'<div class="h-3 w-52 mt-2 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></div>'}function _e(a){return a>=95?{text:e.score.pristine,variant:"safe"}:a>=80?{text:e.score.clean,variant:"safe"}:a>=50?{text:e.score.good,variant:"info"}:a>=25?{text:e.score.neutral,variant:"warn"}:{text:e.score.suspicious,variant:"danger"}}const m={ip:null,ippure:null,ipapis:null,claudeGeo:null,claudeRisk:null,cfGeo:"",scoreAnimId:null,lastScore:0};function xe(){const a=(m.claudeRisk?.countryCode||"").toUpperCase();return!a||!Ue.includes(a)?null:t(`ipcheck.region.${a}`)}function le(){const a=C("ipv6Warn");a&&a.classList.remove("hidden")}function te(a,i){const r=C(a);r&&(r.textContent=i||"",r.classList.remove("animate-pulse","bg-oai-gray-200","dark:bg-oai-gray-800","w-52","h-3","mt-2","rounded"))}const Le={gaugeScore:'<span class="block h-8 w-16 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></span>',ipAddrCN:oe(),ipGeoCN:ce(),ipAddr:oe(),ipGeo:ce(),ipAddrClaude:oe(),ipGeoClaude:ce(),propsContent:re([e.propsRegion,e.propsCity,e.propsType,e.propsAsn,e.propsOrg]),securityContent:re([e.secVpn,e.secProxy,e.secTor,e.secCrawler,e.secAbuser]),claudeAvailContent:d("claude.ai",void 0,!0)+d("anthropic.com",void 0,!0),dnsLeakContent:d(e.dnsStatus,void 0,!0)+d(e.dnsOutletIp,void 0,!0),udpLeakContent:d(e.udpStatus,void 0,!0)+d(e.udpOutletIp,void 0,!0),deviceContent:re([e.devTz,e.devLang,e.devOs,e.devTouch,e.devNet,e.devDnt,e.devWebglRender,e.devCanvasFp]),ipHistoryContent:`<span class="text-sm text-oai-gray-400 dark:text-oai-gray-500">${e.histLoading}</span>`};Object.entries(Le).forEach(([a,i])=>{const r=C(a);r&&(r.innerHTML=i)});let ye=!1;function Ne(a){if(!a)return;a.dataset.realText||(a.dataset.realText=(a.textContent||"").trim());const i=a.dataset.realText,r=ye?Fe(i):i;a.textContent!==r&&(a.textContent=r)}function ke(){_.querySelectorAll(".ip-link, .ip-mask-target").forEach(Ne)}const ve=new MutationObserver(()=>requestAnimationFrame(ke));["ipHeroCN","ipHero","ipHeroClaude","ipHistoryContent","dnsLeakContent","udpLeakContent"].forEach(a=>{const i=C(a);i&&ve.observe(i,{childList:!0,subtree:!0})}),_.__setMaskOn=a=>{ye=!!a,ke()};async function $e(){try{const r=(await(await fetch("https://1.1.1.1/cdn-cgi/trace",{signal:AbortSignal.timeout(5e3)})).text()).match(/ip=([^\n]+)/);r&&(m.ip=r[1].trim())}catch{}}async function je(){try{const i=await(await fetch("https://claude.ai/cdn-cgi/trace",{cache:"no-store",signal:AbortSignal.timeout(8e3)})).text(),r=Object.fromEntries(i.trim().split(`
`).map(u=>u.split("=")));return{ip:r.ip||null,loc:r.loc?.toLowerCase()||null}}catch{return null}}async function Me(){try{const r=(await(await fetch("https://2026.ip138.com/",{signal:AbortSignal.timeout(5e3)})).text()).match(/(\d+\.\d+\.\d+\.\d+)/);if(r)return{ip:r[1]}}catch{}try{const r=(await(await fetch("https://my.ip.cn/",{signal:AbortSignal.timeout(5e3)})).text()).match(/(\d+\.\d+\.\d+\.\d+)/);if(r)return{ip:r[1]}}catch{}return null}async function Ee(a,i,r,u){const g=C(a),o=C(i);if(!(!g||!o)){if(!r){g.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`,o.textContent="";return}Z(r)&&le(),g.innerHTML=`${B(u)+" "}${K(r)}`;try{const l=await fetch(`${j}/api/geoip/${r}`,{signal:AbortSignal.timeout(5e3)});if(l.ok){const h=await l.json(),s=[h.country,h.region,h.city,h.isp].filter(Boolean).join(" · "),x=h.country_code||u||"";g.innerHTML=`${B(x)} ${K(r)}`,te(i,s)}}catch{}}}function Ie(){const a=m.ippure,i=m.claudeRisk,r=m.claudeGeo,u=m.ipapis,g=i?.asn||a?.asn||"",o=i?.asOrganization||a?.asOrganization||u?.company?.name||"",l=xe(),h=!!(i&&i.ip);let s,x=null;h?l?(s=0,x=e.regionRestrictedText):s=typeof i.trust_score=="number"?i.trust_score:null:s=null;const v=C("gaugePointer"),c=C("gaugeScore"),P=C("gaugeText");if(s===null)c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums text-oai-gray-400 dark:text-oai-gray-500">—</span> ${f(e.noData,"neutral")}`,v.style.left="0%",v.style.opacity="0.3",v.style.borderColor="",v.style.boxShadow="",P.textContent=h?e.noScore:e.noIp;else{const A=l?{text:e.score.unreachable,variant:"danger"}:_e(s),L=s>=50?"text-emerald-500":s>=25?"text-amber-500":"text-red-500",X=s>=50?"#10b981":s>=25?"#f59e0b":"#ef4444";if(m.lastScore!==s){m.scoreAnimId&&cancelAnimationFrame(m.scoreAnimId);const Q=m.lastScore||0;m.lastScore=s;const de=performance.now(),ee=800,ne=ue=>{const N=ue-de,k=Math.min(N/ee,1),$=k*(2-k),I=Math.round(Q+(s-Q)*$),Y=I>=50?"text-emerald-500":I>=25?"text-amber-500":"text-red-500";c&&(c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums ${Y}">${I}</span> ${f(A.text,A.variant)}`),k<1?m.scoreAnimId=requestAnimationFrame(ne):m.scoreAnimId=null};m.scoreAnimId=requestAnimationFrame(ne)}else c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums ${L}">${s}</span> ${f(A.text,A.variant)}`;requestAnimationFrame(()=>{requestAnimationFrame(()=>{v&&(v.style.left=Math.min(s,100)+"%",v.style.opacity="1",v.style.borderColor=X,v.style.boxShadow=`0 0 10px ${X}80, 0 2px 6px rgba(0,0,0,0.15)`)})}),P.textContent=x||(s>=95?e.scoreText.excellent:s>=80?e.scoreText.great:s>=50?e.scoreText.minor:s>=25?e.scoreText.moderate:e.scoreText.severe)}const y=C("statusDotClaude");if(y){let A,L;s===null?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-oai-gray-300 dark:bg-oai-gray-600 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"):l||s<25?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-red-500"):s<50?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-amber-500"):(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-emerald-500"),y.innerHTML=`<span class="${A}"></span><span class="${L}"></span>`}const H=C("regionWarn");H&&(l?(H.innerHTML=`<span class="font-medium">⚠️ ${e.regionWarnTitle(l)}</span><br><span class="text-[13px] font-normal mt-1 block opacity-90">${e.regionWarnBody}</span>`,H.classList.remove("hidden")):H.classList.add("hidden"));const G=C("claudeRegionSupportRow"),F=C("claudeRegionSupport");if(G&&F)if(l)G.classList.add("hidden");else{const A=!!(i&&i.ip),L=!!(i&&i.countryCode);F.innerHTML=!A||!L?f(e.unknown,"neutral"):f(e.regionAccessible,"safe"),G.classList.remove("hidden")}const U=i?.isResidential??(u?!u.is_datacenter:null),O=u?.company?.type||"",z=r?.country||i?.country||"",W=r?.city||i?.city||"";let T;if(U===!0?T=f(e.propsResidential,"safe"):U===!1?T=f(e.propsDatacenter,"warn"):T=f(e.unknown,"neutral"),O){const L={hosting:"Hosting",isp:"ISP",business:"Business",education:"Education"}[O]||w(O);T+=` <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${L}</span>`}C("propsContent").innerHTML=d(e.propsRegion,z?w(z):f(e.unknown,"neutral"))+d(e.propsCity,W?w(W):f(e.unknown,"neutral"))+d(e.propsType,T)+d(e.propsAsn,g?`<span class="font-mono tabular-nums">AS${w(g)}</span>`:f(e.unknown,"neutral"))+d(e.propsOrg,o?w(o):f(e.unknown,"neutral"));const E=u||{};C("securityContent").innerHTML=d(e.secVpn,J(E.is_vpn,e.secVpn,e.secClean))+d(e.secProxy,J(E.is_proxy,e.secProxyFlag,e.secClean))+d(e.secTor,J(E.is_tor,e.secTor,e.secClean))+d(e.secCrawler,J(E.is_crawler,e.secCrawlerYes,e.secCrawlerNo))+d(e.secAbuser,J(E.is_abuser,e.secAbuserYes,e.secAbuserNo))}async function Re(){const a=C("dnsLeakContent");if(!a)return;a.innerHTML=d(e.dnsStatus,void 0,!0)+d(e.dnsOutletIp,void 0,!0);const i=Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2);for(let s=1;s<=2;s++)await new Promise(x=>{const v=new Image,c=setTimeout(x,2e3);v.onload=v.onerror=()=>{clearTimeout(c),x()},v.src=`http://${i}-${s}.d.ip.net.coffee/pixel.gif?_=${Date.now()}`});await new Promise(s=>setTimeout(s,1500));let r=[];for(let s=0;s<2;s++){try{const x=await fetch(`${j}/api/dns/result/${i}`,{signal:AbortSignal.timeout(3e3)});if(x.ok&&(r=(await x.json()).dns_servers||[],r.length>0))break}catch{}s===0&&await new Promise(x=>setTimeout(x,1500))}if(r.length===0){a.innerHTML=d(e.dnsStatus,f(e.dnsEncrypted,"safe"));return}const u=(m.claudeRisk?.country||"").toLowerCase(),g=u.includes("china")||u.includes("中国");let o=null,l=!1;for(const s of r){let x=null;try{const y=await fetch(`${j}/api/geoip/${s}`,{signal:AbortSignal.timeout(3e3)});y.ok&&(x=await y.json())}catch{}const v=x?.country_code||"",c=x?.isp||"";if(v==="cn"&&!g){o={ip:s,cc:v,isp:c,leaked:!0},l=!0;break}o||(o={ip:s,cc:v,isp:c,leaked:!1})}let h=d(e.dnsStatus,l?f(e.dnsLeaked,"warn"):f(e.dnsNoLeak,"safe"));if(o){const s=`${B(o.cc)} <span class="ip-mask-target ${o.leaked?"text-amber-600 dark:text-amber-400 font-medium":""}">${w(o.ip)}</span>${o.leaked?" "+f(e.dnsCnTag,"warn"):""}`;h+=d(e.dnsOutlet,s),o.isp&&(h+=d(e.dnsIsp,`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal truncate inline-block max-w-[12rem] align-bottom">${w(o.isp)}</span>`))}a.innerHTML=h}async function He(){const a=C("udpLeakContent");if(!a)return;a.innerHTML=d(e.udpStatus,void 0,!0)+d(e.udpOutletIp,void 0,!0);const i=new Set;try{const y=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.cloudflare.com:3478"}]});y.createDataChannel("");const H=await y.createOffer();await y.setLocalDescription(H),await new Promise(G=>{const F=setTimeout(()=>{y.close(),G()},5e3);y.onicecandidate=U=>{if(!U.candidate){clearTimeout(F),y.close(),G();return}const O=U.candidate.candidate.match(/([0-9]{1,3}\.){3}[0-9]{1,3}/);if(O){const W=O[0];!W.startsWith("0.")&&!W.startsWith("127.")&&W!=="0.0.0.0"&&i.add(W)}const z=U.candidate.candidate.match(/([a-f0-9]{1,4}:){2,7}[a-f0-9]{1,4}/i);z&&i.add(z[0])}})}catch{}const r=m.claudeRisk?.ip||"",u=[...i],g=u.filter(y=>!Z(y)&&!y.startsWith("192.168.")&&!y.startsWith("10.")&&!y.startsWith("172.")&&!y.startsWith("198.18.")&&!y.startsWith("198.19.")&&!y.startsWith("100.64.")&&!y.startsWith("127.")&&!y.startsWith("0."));if(g.length===0&&u.length===0){a.innerHTML=d(e.udpStatus,f(e.udpDisabled,"safe"));return}if(g.length===0){a.innerHTML=d(e.udpStatus,f(e.udpNoLeak,"safe"));return}let o=g.find(y=>y===r)||g[0];const l=new Set(g).size>1,h=o===r,s=l&&!h;let x=d(e.udpStatus,s?f(e.udpLeaked,"warn"):f(e.udpNoLeak,"safe")),v="",c="";try{const y=await fetch(`${j}/api/geoip/${o}`,{signal:AbortSignal.timeout(5e3)});if(y.ok){const H=await y.json();v=H.country_code||"",c=H.country||""}}catch{}const P=`${B(v)} <span class="${s?"text-amber-600 dark:text-amber-400 font-medium":""}">${he(o)}</span>${h?"":s?" "+f(e.udpAnomaly,"warn"):""}`;x+=d(e.udpOutlet,P),c&&(x+=d(e.udpOrigin,`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${w(c)}</span>`)),a.innerHTML=x}async function be(){const a=C("claudeAvailContent");if(!a)return;a.innerHTML=d("claude.ai",void 0,!0)+d("anthropic.com",void 0,!0);const i=[{name:"claude.ai",url:"https://claude.ai/cdn-cgi/trace"},{name:"anthropic.com",url:"https://www.anthropic.com/favicon.ico"}],r=await Promise.allSettled(i.map(async o=>{const l=performance.now();try{return await fetch(o.url,{mode:"no-cors",signal:AbortSignal.timeout(6e3)}),{name:o.name,ms:Math.round(performance.now()-l),ok:!0}}catch{return{name:o.name,ms:-1,ok:!1}}})),u=xe();let g="";r.forEach(o=>{const l=o.value;if(u)g+=d(l.name,f(e.availLat.unreachable,"danger"));else if(l.ok){const h=l.ms<250?"safe":l.ms<500?"info":"warn",s=l.ms<250?e.availLat.normal:l.ms<500?e.availLat.good:e.availLat.slow;g+=d(l.name,`${f(s,h)} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${l.ms}ms</span>`)}else g+=d(l.name,f(e.availLat.unreachable,"danger"))});try{const o=await fetch(`${j}/claude/status.json`,{signal:AbortSignal.timeout(3e3)});if(o.ok){const h=(await o.json()).overall_indicator||"none",s=e.availSvcStatus[h]||e.availSvcStatus.other,x={none:"safe",minor:"warn",major:"danger",critical:"danger",maintenance:"warn"};g+=d(e.availSvc,f(s,x[h]||"warn"))}}catch{}a.innerHTML=g}_.__detectClaudeAvail=be;function Oe(){const a=Intl.DateTimeFormat().resolvedOptions().timeZone||e.unknown,i=-(new Date().getTimezoneOffset()/60),r="UTC"+(i>=0?"+":"")+i,u=m.claudeRisk,g=(u?.countryCode||"").toUpperCase(),o=u?.timezone||ze[g]||"",l=!!u?.timezone,h=Ve(o),s=-new Date().getTimezoneOffset();let x=null;o&&h!=null&&(x=Math.abs(h-s)<=60);let v;const c=w(a),P=w(o);if(x===!0)v=`${f(e.devMatch,"safe")} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${c} (${r})</span>`;else if(x===!1){const N=Ye(h),k=Math.round((h-s)/60),$=k===0?e.devDiffEqual:k>0?e.devDiffAhead(k):e.devDiffBehind(-k),I=l?P:`${P} ${e.devEstSuffix}`;v=`${f(e.devMismatch,"warn")}<br><span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${e.devLocal} ${c} (${r})<br>Claude ${I} (${N}) · ${$}</span>`}else v=`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${c} (${r})</span>`;const y=navigator.languages||[navigator.language],H=y.join(", ")||e.unknown,G=(y[0]||"").split("-")[0].toLowerCase(),F=We[g]||[],U=G&&F.length?F.includes(G):null;let O;const z=w(H),W=w(F.join(" / "));U===!0?O=`${f(e.devMatch,"safe")} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${z}</span>`:U===!1?O=`${f(e.devMismatch,"warn")}<br><span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${e.devLocal} ${z}<br>${e.devLangExpected} ${W}</span>`:O=`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${z}</span>`;const T=navigator.userAgent;let E=e.unknown,A=e.unknown;T.includes("Windows")?E="Windows":T.includes("Mac OS")?E="macOS":T.includes("iPhone")||T.includes("iPad")?E="iOS":T.includes("Android")?E="Android":T.includes("Linux")&&(E="Linux"),T.includes("Edg/")?A="Edge "+(T.match(/Edg\/([\d.]+)/)||[])[1]:T.includes("Chrome/")?A="Chrome "+(T.match(/Chrome\/([\d.]+)/)||[])[1]:T.includes("Firefox/")?A="Firefox "+(T.match(/Firefox\/([\d.]+)/)||[])[1]:T.includes("Safari/")&&!T.includes("Chrome")&&(A="Safari "+(T.match(/Version\/([\d.]+)/)||[])[1]);let L=e.devUnsupported;try{const N=document.createElement("canvas"),k=N.getContext("webgl")||N.getContext("experimental-webgl");if(k){const $=k.getExtension("WEBGL_debug_renderer_info");$&&(L=k.getParameter($.UNMASKED_RENDERER_WEBGL))}}catch{}let X=e.devUnsupported;try{const N=document.createElement("canvas"),k=N.getContext("webgl")||N.getContext("experimental-webgl");if(k){const $=k.getExtension("WEBGL_debug_renderer_info"),I=$?k.getParameter($.UNMASKED_VENDOR_WEBGL):"",Y=$?k.getParameter($.UNMASKED_RENDERER_WEBGL):"",Ce=I+"~"+Y+"~"+k.getParameter(k.VERSION)+"~"+k.getParameter(k.SHADING_LANGUAGE_VERSION);let ie=0;for(let pe=0;pe<Ce.length;pe++)ie=(ie<<5)-ie+Ce.charCodeAt(pe)|0;X=(ie>>>0).toString(16).toUpperCase()}}catch{}let Q=e.devUnsupported;try{const N=document.createElement("canvas");N.width=200,N.height=50;const k=N.getContext("2d");k.textBaseline="top",k.font="14px Arial",k.fillStyle="#f60",k.fillRect(50,0,100,50),k.fillStyle="#069",k.fillText("net.coffee",2,15),k.fillStyle="rgba(102,204,0,0.7)",k.fillText("canvas fp",4,30);const $=N.toDataURL();let I=0;for(let Y=0;Y<$.length;Y++)I=(I<<5)-I+$.charCodeAt(Y)|0;Q=(I>>>0).toString(16).toUpperCase()}catch{}const de=navigator.maxTouchPoints>0,ee=navigator.connection||navigator.mozConnection||navigator.webkitConnection,ne=ee?ee.effectiveType||ee.type||e.unknown:e.devNetUnsupported,ue=navigator.doNotTrack==="1"?e.devDntOn:navigator.doNotTrack==="0"?e.devDntOff:e.devDntUnset;C("deviceContent").innerHTML=d(e.devTz,v)+d(e.devLang,O)+d(e.devOs,`${w(E)} <span class="text-oai-gray-400 dark:text-oai-gray-500">/</span> ${w(A)}`)+d(e.devTouch,de?f(e.devTouchYes,"info"):f(e.devTouchNo,"neutral"))+d(e.devNet,`<span class="font-mono uppercase">${w(ne)}</span>`)+d(e.devDnt,w(ue))+d(e.devWebglRender,`<span class="text-xs font-normal text-oai-gray-600 dark:text-oai-gray-400 break-all">${w(L)}</span>`)+d(e.devCanvasFp,`<span class="font-mono text-oai-gray-700 dark:text-oai-gray-300">${w(Q)}</span>`)+d(e.devWebglFp,`<span class="font-mono text-oai-gray-700 dark:text-oai-gray-300">${w(X)}</span>`)}function we(){try{return JSON.parse(localStorage.getItem(fe))||[]}catch{return[]}}function Pe(){const a=m.claudeRisk?.ip||"",i=(m.claudeRisk?.countryCode||"").toLowerCase(),r=m.claudeRisk?.city||"";if(!a){ae();return}const u=we(),g=new Date,o={ip:a,cc:i,geo:r,time:g.toISOString()};if(u.length>0){const l=u[0],h=(g-new Date(l.time))/(1e3*60*60);if(l.ip===a&&h<24){ae();return}}u.unshift(o),u.length>Se&&(u.length=Se),localStorage.setItem(fe,JSON.stringify(u)),ae()}function ae(){const a=C("ipHistoryContent");if(!a)return;const i=we();if(i.length===0){a.innerHTML=`<span class="text-sm text-oai-gray-500 dark:text-oai-gray-400">${e.histEmpty}</span>`;return}a.innerHTML=`<ul class="divide-y divide-oai-gray-100 dark:divide-oai-gray-800">${i.map((r,u)=>{const g=new Date(r.time),o=`${g.getMonth()+1}-${g.getDate()} ${String(g.getHours()).padStart(2,"0")}:${String(g.getMinutes()).padStart(2,"0")}`,l=u===0;return`<li class="flex items-center justify-between py-3 gap-4">
<div class="flex items-center gap-2 min-w-0">
<span class="text-sm ${l?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400"}">${o}</span>
${l?`<span class="inline-flex items-center rounded-full bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300 px-1.5 py-0.5 text-[10px] font-medium">${w(e.histCurrent)}</span>`:""}
</div>
<div class="flex items-center gap-2 text-sm font-medium text-oai-black dark:text-white min-w-0">
${B(r.cc)}
${K(r.ip)}
${r.geo?`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal truncate">${w(r.geo)}</span>`:""}
</div>
</li>`}).join("")}</ul>`}_.__clearIPHistory=()=>{localStorage.removeItem(fe),ae()};async function De(){const[,a,i]=await Promise.allSettled([$e(),Me(),je()]);if(se)return;const r=a.status==="fulfilled"?a.value:null,u=i.status==="fulfilled"?i.value:null,g=[];g.push(Ee("ipAddrCN","ipGeoCN",r?.ip,"cn")),g.push((async()=>{const o=C("ipAddr"),l=C("ipGeo");if(!m.ip){o&&(o.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`),l&&(l.textContent="");return}Z(m.ip)&&le(),o&&(o.innerHTML=K(m.ip));try{const h=await fetch(`${j}/api/geoip/${m.ip}`,{signal:AbortSignal.timeout(5e3)});if(h.ok){const s=await h.json(),x=(s.country_code||"").toLowerCase();m.ippure={ip:m.ip,country:s.country,countryCode:(s.country_code||"").toUpperCase(),region:s.region,city:s.city},m.cfGeo=[s.country,s.region,s.city,s.isp].filter(Boolean).join(" · "),o&&(o.innerHTML=`${B(x)} ${K(m.ip)}`),te("ipGeo",m.cfGeo)}}catch{}})()),g.push((async()=>{const o=u?.ip,l=C("ipAddrClaude"),h=C("ipGeoClaude");if(!o){l&&(l.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`),h&&(h.textContent="");return}Z(o)&&le(),l&&(l.innerHTML=`${B(u.loc||"")} ${K(o)}`);const[s,x]=await Promise.allSettled([fetch(`${j}/api/iprisk/${o}`,{signal:AbortSignal.timeout(1e4)}),fetch(`${j}/api/geoip/${o}`,{signal:AbortSignal.timeout(5e3)})]);let v=!1;if(x.status==="fulfilled"&&x.value.ok)try{const c=await x.value.json();if(c.country){m.claudeGeo={country:c.country,region:c.region,city:c.city,isp:c.isp,country_code:c.country_code};const P=[c.country,c.region,c.city,c.isp].filter(Boolean).join(" · ");l&&(l.innerHTML=`${B(c.country_code||u.loc||"")} ${K(o)}`),te("ipGeoClaude",P),v=!0}}catch{}if(!v&&u.loc&&(l&&(l.innerHTML=`${B(u.loc)} ${K(o)}`),te("ipGeoClaude",Be[u.loc]||u.loc.toUpperCase())),s.status==="fulfilled"&&s.value.ok){const c=await s.value.json();m.ipapis={is_datacenter:c.is_datacenter,is_vpn:c.is_vpn,is_proxy:c.is_proxy,is_tor:c.is_tor,is_crawler:c.is_crawler,is_abuser:c.is_abuser,is_mobile:c.is_mobile,company:{type:c.company_type,name:c.company_name},abuser_score:c.abuser_score,datacenter_name:c.datacenter_name},m.claudeRisk={ip:o,asn:c.asn,asOrganization:c.asOrganization,country:c.country,countryCode:c.countryCode,region:c.region,city:c.city,isResidential:c.isResidential,isBroadcast:c.isBroadcast,trust_score:c.trust_score,timezone:c.timezone}}})()),await Promise.allSettled(g),!se&&(Ie(),Promise.allSettled([Re(),He(),be()]),Oe(),Pe())}return De(),()=>{se=!0,ve.disconnect(),m.scoreAnimId&&cancelAnimationFrame(m.scoreAnimId),delete _.__setMaskOn,delete _.__clearIPHistory,delete _.__detectClaudeAvail}},[]);const M=_=>{S(_),p.current?.__setMaskOn?.(_)},D=()=>p.current?.__clearIPHistory?.(),q=()=>p.current?.__detectClaudeAvail?.(),R={__html:""};return n.jsx("div",{ref:p,className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:n.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:n.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[n.jsxs("div",{className:"flex items-start justify-between gap-4 mb-8",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:t("ipcheck.page.title")}),n.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base max-w-3xl text-pretty",children:t("ipcheck.page.subtitle")})]}),n.jsxs("label",{className:"shrink-0 inline-flex items-center gap-2.5 cursor-pointer select-none group",children:[n.jsx("div",{className:"text-oai-gray-400 group-hover:text-oai-gray-600 dark:text-oai-gray-500 dark:group-hover:text-oai-gray-300 transition-colors duration-200",children:b?n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4.5 w-4.5 animate-scale-up-fade",children:[n.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),n.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),n.jsx("path",{d:"M6.61 6.61A13.52 13.52 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),n.jsx("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]}):n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4.5 w-4.5 animate-scale-up-fade",children:[n.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),n.jsx("span",{className:"text-xs font-medium text-oai-gray-500 group-hover:text-oai-gray-700 dark:text-oai-gray-400 dark:group-hover:text-oai-gray-200 transition-colors duration-200",children:t("ipcheck.mask.toggle")}),n.jsxs("span",{className:"relative inline-block w-9 h-5",children:[n.jsx("input",{type:"checkbox",checked:b,onChange:_=>M(_.target.checked),className:"peer sr-only"}),n.jsx("span",{className:"absolute inset-0 rounded-full bg-oai-gray-200 dark:bg-oai-gray-800 peer-checked:bg-oai-brand-500 transition-colors duration-200"}),n.jsx("span",{className:"absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white shadow-sm transition-transform duration-200 peer-checked:translate-x-4"})]})]})]}),n.jsx("div",{id:"ipv6Warn",className:"hidden mb-4 rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-500/30 dark:bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200",children:t("ipcheck.ipv6.warn")}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[n.jsx(me,{id:"CN",label:t("ipcheck.ip.cn"),icon:null,className:"animate-fade-in-up stagger-1"}),n.jsx(me,{id:"",label:t("ipcheck.ip.cloudflare"),icon:n.jsx("img",{src:`${j}/favicons/cloudflare.webp`,alt:"",className:"h-4 w-4"}),className:"animate-fade-in-up stagger-2"}),n.jsx(me,{id:"Claude",label:t("ipcheck.ip.claude"),icon:n.jsx("img",{src:`${j}/favicons/claude.webp`,alt:"",className:"h-4 w-4"}),statusDot:!0,className:"animate-fade-in-up stagger-3"})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[n.jsx(V,{title:t("ipcheck.trust.title"),subtitle:t("ipcheck.trust.subtitle"),className:"animate-fade-in-up stagger-4",children:n.jsxs("div",{className:"px-1 py-2",children:[n.jsx("div",{className:"flex items-baseline justify-between mb-2 gap-3",children:n.jsx("div",{id:"gaugeScore",className:"flex items-baseline gap-2 min-h-[2.5rem]",dangerouslySetInnerHTML:R})}),n.jsx("div",{id:"gaugeText",className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mb-4 min-h-[1rem]"}),n.jsxs("div",{children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"h-1.5 rounded-full",style:{background:"linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%)"}}),n.jsx("span",{id:"gaugePointer",className:"absolute top-1/2 -translate-y-1/2 h-3.5 w-3.5 rounded-full bg-white dark:bg-oai-gray-900 border-2 border-oai-gray-300 dark:border-oai-gray-700 shadow-[0_2px_6px_rgba(0,0,0,0.15)] dark:shadow-[0_2px_6px_rgba(0,0,0,0.4)] -translate-x-1/2 transition-[left,border-color] duration-700 ease-out",style:{left:"0%"}})]}),n.jsxs("div",{className:"mt-2 flex justify-between text-[10px] uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 font-medium",children:[n.jsx("span",{children:t("ipcheck.trust.gauge.low")}),n.jsx("span",{className:"tracking-normal",children:"25"}),n.jsx("span",{className:"tracking-normal",children:"50"}),n.jsx("span",{className:"tracking-normal",children:"75"}),n.jsx("span",{children:t("ipcheck.trust.gauge.high")})]})]}),n.jsx("div",{id:"regionWarn",className:"hidden mt-4 rounded-lg border border-red-200 bg-red-50 dark:border-red-500/30 dark:bg-red-500/10 px-3 py-2 text-xs text-red-800 dark:text-red-300"}),n.jsxs("div",{id:"claudeRegionSupportRow",className:"hidden mt-4 pt-4 border-t border-oai-gray-100 dark:border-oai-gray-800 flex items-center justify-between",children:[n.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:t("ipcheck.trust.region_support")}),n.jsx("span",{id:"claudeRegionSupport",className:"text-sm font-medium text-oai-black dark:text-white",dangerouslySetInnerHTML:R})]})]})}),n.jsx(V,{title:t("ipcheck.props.title"),className:"animate-fade-in-up stagger-4",children:n.jsx("div",{id:"propsContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.security.title"),className:"animate-fade-in-up stagger-4",children:n.jsx("div",{id:"securityContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[n.jsx(V,{title:n.jsxs("span",{className:"flex items-center gap-1.5",children:[t("ipcheck.avail.title"),n.jsx(Ze,{text:t("ipcheck.avail.tooltip")})]}),action:n.jsx(Ae,{label:t("ipcheck.avail.refresh"),onClick:q}),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"claudeAvailContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.dns.title"),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"dnsLeakContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.udp.title"),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"udpLeakContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})})]}),n.jsx(V,{title:t("ipcheck.device.title"),className:"animate-fade-in-up stagger-6",children:n.jsx("div",{id:"deviceContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.history.title"),subtitle:t("ipcheck.history.subtitle"),action:n.jsx(Ae,{label:t("ipcheck.history.clear"),onClick:D}),className:"animate-fade-in-up stagger-6",children:n.jsx("div",{id:"ipHistoryContent",dangerouslySetInnerHTML:R})})]})]})})})}function V({title:p,subtitle:b,action:S,children:M,className:D=""}){return n.jsxs("section",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 sm:p-6 transition-colors duration-200 ${D}`,children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:p}),b?n.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:b}):null]}),S]}),M]})}function Ae({label:p,onClick:b}){return n.jsx("button",{type:"button",onClick:b,className:"shrink-0 inline-flex h-7 items-center px-2.5 rounded-md text-xs font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-200 dark:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:p})}function Ze({text:p}){return n.jsxs("span",{className:"relative inline-flex items-center group",children:[n.jsx("svg",{viewBox:"0 0 16 16",className:"h-3.5 w-3.5 text-oai-gray-400 dark:text-oai-gray-500",fill:"currentColor","aria-hidden":!0,children:n.jsx("path",{d:"M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13zM7.25 6.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-1.5 0V6.75zM8 4a.85.85 0 1 1 0 1.7A.85.85 0 0 1 8 4z"})}),n.jsx("span",{className:"pointer-events-none absolute left-1/2 top-full z-10 mt-1.5 -translate-x-1/2 w-56 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-2 text-[11px] font-normal text-white opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-relaxed shadow-lg origin-top",children:p})]})}function me({id:p,label:b,icon:S,statusDot:M,className:D=""}){const q=`ipAddr${p}`,R=`ipGeo${p}`;return n.jsxs("article",{id:`ipHero${p}`,className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 sm:p-6 cursor-default transition-colors duration-200 ${D}`,children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-wider font-medium text-oai-gray-500 dark:text-oai-gray-400 mb-2",children:[S,n.jsx("span",{children:b}),M?n.jsxs("span",{id:`statusDot${p}`,className:"relative inline-flex h-2 w-2 ml-1.5","aria-hidden":!0,children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-oai-gray-300 dark:bg-oai-gray-600 opacity-75"}),n.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"})]}):null]}),n.jsx("div",{id:q,className:"text-xl sm:text-2xl font-semibold text-oai-black dark:text-white flex items-center gap-2 min-h-[2rem]",dangerouslySetInnerHTML:{__html:""}}),n.jsx("div",{id:R,className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate min-h-[1rem]"})]})}export{Je as default};

Sorry, the diff of this file is too big to display

import{R as l,j as c,V as h}from"./main-DADupgLA.js";function x(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function d(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={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",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=x(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:d(t)})}export{g as L};

Sorry, the diff of this file is too big to display

import{c as D,r as g,dp as K,j as e,G as n,dq as Q,aB as ee,dr as ae,V as c,Y as re,ds as te,aD as se,L as ie,n as oe,U as T,X as ne,J as I,I as le,ae as de}from"./main-DADupgLA.js";import{u as ce}from"./useCurrency-CIJjQNSk.js";import{L as W}from"./LeaderboardAvatar-DMaYoU7B.js";import{A as me}from"./ActivityHeatmap-CZasqY2H.js";import{A as U}from"./arrow-up-right-B_p-ZPxR.js";import{C as xe}from"./useScrollLock-DO1uWkvz.js";import{D as ge,a as pe,b as he,c as fe,d as be,e as ue}from"./DialogTitle-Btt5G5wB.js";import"./info-Cje0RF1w.js";const ye=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],ke=D("code-xml",ye);const je=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],ve=D("heart",je);const Ne=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],_e=D("link-2",Ne),C="tokentracker_likes";function F(a){if(!a)return!1;try{const r=localStorage.getItem(C);return r?!!JSON.parse(r)?.[a]:!1}catch{return!1}}function z(a,r){if(a)try{const t=localStorage.getItem(C),s=t?JSON.parse(t):{};r?s[a]=!0:delete s[a],localStorage.setItem(C,JSON.stringify(s))}catch{}}function E({userId:a}){const[r,t]=g.useState(!1),[s,i]=g.useState(0),[l,m]=g.useState(!1),[d,p]=g.useState(!1),[y,k]=g.useState(!1),[j,M]=g.useState([]),[v,b]=g.useState(!1),N=g.useRef(0);g.useEffect(()=>{let o=!1;return a?(m(!1),t(F(a)),K({userId:a}).then(x=>{o||(i(Number(x?.count)||0),m(!0))}).catch(()=>{o||(i(0),m(!0))}),()=>{o=!0}):(m(!1),()=>{o=!0})},[a]);const _=()=>{k(!0),setTimeout(()=>k(!1),450),b(!0),setTimeout(()=>b(!1),500);const o=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],x=["circle","heart"],f=[];for(let h=0;h<12;h++){const S=(h*30+Math.random()*20-10)*(Math.PI/180),A=45+Math.random()*45,O=Math.cos(S)*A,q=Math.sin(S)*A-(10+Math.random()*15),J=Math.random()*360-180,X=6+Math.random()*8,Y=o[Math.floor(Math.random()*o.length)],V=x[Math.floor(Math.random()*x.length)],Z=++N.current;f.push({id:Z,tx:O,ty:q,rot:J,size:X,color:Y,shape:V})}M(h=>[...h,...f]),setTimeout(()=>{M(h=>h.filter(S=>!f.find(A=>A.id===S.id)))},850)},u=async o=>{p(!0);try{const x=await Q({userId:a,delta:o}),f=Number(x?.count);Number.isFinite(f)&&i(f)}catch{t(x=>!x),i(x=>Math.max(0,x-o)),z(a,!F(a))}finally{p(!1)}},w=o=>{o.stopPropagation(),!(!a||!l||d)&&(r?(t(!1),i(x=>Math.max(0,x-1)),z(a,!1),u(-1)):(t(!0),i(x=>x+1),z(a,!0),_(),u(1)))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
@keyframes tt-like-pop {
0% { transform: scale(1); }
25% { transform: scale(0.75); }
50% { transform: scale(1.35); }
75% { transform: scale(0.9); }
100% { transform: scale(1); }
}
@keyframes tt-particle-fly {
0% {
transform: translate(0, 0) scale(1) rotate(0deg);
opacity: 1;
}
70% {
opacity: 0.8;
}
100% {
transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot));
opacity: 0;
}
}
@keyframes tt-num-scroll {
0% { transform: translateY(8px); opacity: 0; }
100% { transform: translateY(0); opacity: 1; }
}
.tt-animate-pop {
animation: tt-like-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.tt-particle {
position: absolute;
top: 50%;
left: 50%;
margin-top: -6px;
margin-left: -6px;
pointer-events: none;
z-index: 50;
}
.tt-num-anim {
animation: tt-num-scroll 0.25s ease-out forwards;
}
`}}),j.map(o=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${o.tx}px`,"--ty":`${o.ty}px`,"--rot":`${o.rot}deg`,width:`${o.size}px`,height:`${o.size}px`,backgroundColor:o.shape==="circle"?o.color:"transparent",borderRadius:o.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:o.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:o.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},o.id)),e.jsxs("button",{type:"button",onClick:w,disabled:!l||d,"aria-label":r?n("leaderboard.profile.like.aria_unlike"):n("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${r?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:y?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(ve,{size:14,className:`transition-all duration-300 ${r?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${r?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${v?"tt-num-anim":""}`,children:l?s:"·"})]})]})}function we(a,r,t){const s=Number(a);return!Number.isFinite(s)||s<0?"—":s>0&&s<.01?`<${r==="USD"?"$":""}0.01`:le(s,{decimals:2,currency:r,rate:t})}function H(a,r,t){const s=Number(a);if(!Number.isFinite(s)||s<0)return"—";if(s<1e3)return we(s,r,t);const i=r==="USD"?s:s*(t||1);return`${r==="USD"?"$":""}${I(i,{decimals:1})}`}function $(a){const r=Number(a);return!Number.isFinite(r)||r<=0?"0":I(r,{decimals:1})}function Se(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const t=r.map(i=>({day:i.date,total_tokens:i.total_tokens,models:i.models||null})),s=r[r.length-1]?.date;return oe({dailyRows:t,weeks:52,to:s})}const Ae=`
@keyframes tt-shimmer {
100% { transform: translateX(100%); }
}
.tt-shimmer-bar {
position: relative;
overflow: hidden;
}
.tt-shimmer-bar::after {
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
transform: translateX(-100%);
background-image: linear-gradient(
90deg,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.02) 20%,
rgba(0, 0, 0, 0.06) 60%,
rgba(0, 0, 0, 0) 100%
);
animation: tt-shimmer 1.6s infinite;
content: '';
}
.dark .tt-shimmer-bar::after {
background-image: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.02) 20%,
rgba(255, 255, 255, 0.06) 60%,
rgba(255, 255, 255, 0) 100%
);
}
`;function Le({variant:a="modal"}){const r="rounded bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar",t=a==="page";return e.jsxs("div",{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:Ae}}),t?e.jsxs("div",{className:"flex items-start gap-5 px-6 sm:px-8 pt-8 pb-7 animate-fade-in",children:[e.jsx("div",{className:"h-[68px] w-[68px] rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 flex items-start justify-between gap-4 pt-0.5",children:[e.jsxs("div",{className:"min-w-0 space-y-2.5",children:[e.jsx("div",{className:c(r,"h-7 w-48")}),e.jsx("div",{className:c(r,"h-3.5 w-32")})]}),e.jsxs("div",{className:"shrink-0 space-y-1.5 flex flex-col items-end",children:[e.jsx("div",{className:c(r,"h-2.5 w-8")}),e.jsx("div",{className:c(r,"h-7 w-12")})]})]})]}):e.jsxs("div",{className:"flex items-start gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60 animate-fade-in",children:[e.jsx("div",{className:"h-14 w-14 rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2 pt-1",children:[e.jsx("div",{className:c(r,"h-4 w-40")}),e.jsx("div",{className:c(r,"h-3 w-56")})]}),e.jsx("div",{className:c(r,"h-4 w-4 shrink-0 mt-1")})]}),e.jsxs("div",{className:c("space-y-6",t?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"px-6 py-5"),children:[e.jsx("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:Array.from({length:4}).map((s,i)=>e.jsxs("div",{children:[e.jsx("div",{className:c(r,"h-6 w-20")}),e.jsx("div",{className:c(r,"mt-2 h-3 w-14")})]},i))}),e.jsx("div",{className:"space-y-3 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:Array.from({length:3}).map((s,i)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-3 w-24")}),e.jsx("div",{className:c(r,"h-3 w-44")})]},i))}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-44 mb-4")}),e.jsx("div",{className:"grid grid-cols-[repeat(52,1fr)] gap-[2px]",children:Array.from({length:364}).map((s,i)=>e.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},i))})]}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-28 mb-3")}),e.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((s,i)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-4 w-4")}),e.jsx("div",{className:c(r,"h-3 w-16")}),e.jsx("div",{className:c(r,"h-[3px] flex-1")}),e.jsx("div",{className:c(r,"h-3 w-12")})]},i))})]})]})]})}function G(a){if(!a)return null;const r=String(a).match(/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})/i);return r?r[1]:null}function R({children:a}){return e.jsx("h3",{className:"text-[11px] uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400 mb-3",children:a})}function L({value:a,label:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-black tabular-nums tracking-tight leading-none text-oai-black dark:text-white",style:{fontFamily:'"DIN Alternate-Bold", "DIN Alternate", "DIN Condensed-Bold", "Impact", -apple-system, sans-serif',fontWeight:900},children:a}),e.jsx("div",{className:"mt-1.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r})]})}function P({label:a,children:r}){return e.jsxs("div",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"shrink-0 w-28 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"min-w-0 flex-1 text-oai-gray-900 dark:text-oai-gray-100 tabular-nums truncate flex items-baseline gap-2 flex-wrap",children:r})]})}function Me({user:a,onClose:r}){const t=G(a?.github_url);return e.jsxs("div",{className:"flex items-center gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60",children:[e.jsx(W,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"lg",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.rank?e.jsx("span",{className:c("shrink-0 inline-flex items-center px-2 py-0.5 rounded text-xs font-bold font-mono uppercase tracking-wider border shadow-sm",a.rank===1&&"bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400 dark:bg-amber-400/10",a.rank===2&&"bg-slate-500/10 text-slate-600 border-slate-500/20 dark:text-slate-400 dark:bg-slate-400/10",a.rank===3&&"bg-orange-500/10 text-orange-700 border-orange-500/20 dark:text-orange-400 dark:bg-orange-400/10",a.rank>3&&"bg-oai-gray-100 dark:bg-oai-gray-900/60 text-oai-gray-500 dark:text-oai-gray-400 border-oai-gray-200/60 dark:border-oai-gray-800"),children:n("leaderboard.profile_modal.rank",{rank:a.rank})}):null]}),t&&e.jsxs("a",{href:a.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:[e.jsx(T,{provider:"GITHUB",size:11}),e.jsxs("span",{children:["@",t]})]})]}),a?.user_id&&e.jsx("div",{className:"shrink-0 flex items-center justify-center",children:e.jsx(E,{userId:a.user_id})}),r&&e.jsx("button",{type:"button",onClick:r,className:"shrink-0 -mr-1 -mt-1 flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors group","aria-label":n("leaderboard.profile_modal.close"),children:e.jsx(ne,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function ze({user:a}){const r=G(a?.github_url),t=Number(a?.rank)||0,s=t===1?"text-amber-500 dark:text-amber-400":t===2?"text-slate-500 dark:text-slate-300":t===3?"text-orange-600 dark:text-orange-400":"text-oai-gray-400 dark:text-oai-gray-500";return e.jsxs("div",{className:"flex items-center gap-5 px-6 sm:px-8 pt-8 pb-7",children:[e.jsx(W,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"xl",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"truncate text-2xl sm:text-[28px] font-semibold tracking-tight leading-tight text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.user_id&&e.jsx(E,{userId:a.user_id})]}),r?e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(T,{provider:"GITHUB",size:13}),e.jsxs("span",{children:["@",r]})]}):null]}),t?e.jsxs("div",{className:"shrink-0 text-right leading-none",children:[e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.profile.hero.rank_label")}),e.jsx("div",{className:c("mt-1.5 text-3xl font-black tabular-nums tracking-tight",s),children:n("leaderboard.profile_modal.rank",{rank:t})})]}):null]})]})}function Pe({data:a}){const r=Array.isArray(a)?a:[];return r.length===0?e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.providers.none")}):e.jsx("ul",{className:"space-y-2",children:r.map(t=>{const s=Math.max(0,Math.min(1,Number(t?.percent)||0));return e.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center w-4 h-4",children:e.jsx(T,{provider:String(t.source).toUpperCase(),size:14})}),e.jsx("span",{className:"shrink-0 capitalize w-16 text-oai-gray-700 dark:text-oai-gray-300",children:t.source}),e.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:e.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(s*100).toFixed(1)}%`}})}),e.jsx("span",{className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:$(t.total_tokens)}),e.jsxs("span",{className:"shrink-0 w-10 text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[(s*100).toFixed(0),"%"]})]},t.source)})})}function B({icon:a,label:r,value:t}){const[s,i]=g.useState(!1),l=async()=>{await de(t)&&(i(!0),setTimeout(()=>i(!1),1600))};return e.jsxs("button",{type:"button",onClick:l,className:c("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",s?"border-emerald-500/30 text-emerald-600 dark:text-emerald-400 bg-emerald-500/[0.06]":"border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-gray-900 dark:hover:text-oai-gray-100 hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[s?e.jsx(xe,{size:13,strokeWidth:2,"aria-hidden":!0}):e.jsx(a,{size:13,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:s?n("leaderboard.profile_modal.badge.copied"):r})]})}function Ce({data:a,currency:r,rate:t,onClose:s,variant:i="modal"}){const{user:l,totals:m,streak:d,best_day:p,models:y,by_provider:k,heatmap:j,period:M}=a,v=i==="page",b=g.useMemo(()=>Se(j),[j]),N=y?.favorite?.model_name,_=Number(y?.count)||0,u=re(),w=!!(u?.user?.id&&l?.user_id&&u.user.id===l.user_id),o=l?.user_id?`https://www.tokentracker.cc/u/${l.user_id}`:null,x=l?.user_id?`[![My AI coding usage](${te()}/functions/tokentracker-embed-svg?user_id=${l.user_id}&theme=dark)](${o}?ref=readme)`:null;return e.jsxs(e.Fragment,{children:[v?e.jsx(ze,{user:l}):e.jsx(Me,{user:l,onClose:s}),e.jsxs("div",{className:c("space-y-6",v?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"flex-1 min-h-0 overflow-y-auto oai-scrollbar px-6 py-5"),children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-4",children:[e.jsx(L,{value:$(m?.total_tokens),label:n("leaderboard.profile_modal.stat.total_tokens")}),e.jsx(L,{value:H(m?.estimated_cost_usd,r,t),label:n("leaderboard.profile_modal.stat.total_cost")}),e.jsx(L,{value:String(m?.active_days??0),label:n("leaderboard.profile_modal.stat.active_days")}),e.jsx(L,{value:H(m?.avg_per_day_usd,r,t),label:n("leaderboard.profile_modal.stat.avg_per_day")})]}),e.jsxs("dl",{className:"space-y-2 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsxs(P,{label:n("leaderboard.profile_modal.streak.current"),children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:n("leaderboard.profile_modal.streak.days",{count:d?.current_days??0})}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",d?.longest_days??0,")"]})]}),e.jsx(P,{label:n("leaderboard.profile_modal.best_day.title"),children:p?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:$(p.total_tokens)}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",p.date]})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.best_day.none")})}),e.jsx(P,{label:n("leaderboard.profile_modal.models.favorite"),children:N?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30 truncate max-w-[200px] inline-block align-bottom",children:N}),_>1&&e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:n("leaderboard.profile_modal.models.count",{count:_})})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.models.none")})})]}),b&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(R,{children:n("leaderboard.profile_modal.heatmap.title")}),e.jsx("div",{className:"min-w-0",children:e.jsx(me,{heatmap:b,hideLegend:!0,embedded:!0})})]}),e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(R,{children:n("leaderboard.profile_modal.providers.title")}),e.jsx(Pe,{data:k})]}),l?.user_id&&(s||w)&&e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-3",children:[s&&(se()?e.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",onClick:s,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(U,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]}):e.jsxs(ie,{to:`/u/${l.user_id}`,onClick:s,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(U,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})),w&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{icon:_e,label:n("leaderboard.profile_modal.badge.copy_url"),value:o}),e.jsx(B,{icon:ke,label:n("leaderboard.profile_modal.badge.copy"),value:x})]})]})]})]})}function $e({userId:a,period:r,accessToken:t,enabled:s=!0}){const[i,l]=g.useState({loading:!1,error:null,data:null});return g.useEffect(()=>{if(!s||!a)return;let m=!0;return l({loading:!0,error:null,data:null}),(async()=>{try{const d=t?await ee(t):null;if(!m)return;const p=await ae({accessToken:d,userId:a,period:r||"week"});if(!m)return;l({loading:!1,error:null,data:p})}catch(d){if(!m)return;d?.status===404?l({loading:!1,error:null,data:null}):l({loading:!1,error:d?.message||String(d),data:null})}})(),()=>{m=!1}},[s,a,r,t]),i}function We({isOpen:a,onClose:r,userId:t,period:s,accessToken:i}){const{currency:l,rate:m}=ce(),d=$e({userId:t,period:s,accessToken:i,enabled:a});return e.jsx(ge,{open:a,onOpenChange:p=>{p||r?.()},children:e.jsxs(pe,{children:[e.jsx(he,{className:"cost-modal-backdrop"}),e.jsx(fe,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(be,{className:c("cost-modal-popup","relative w-full max-w-[540px] max-h-[calc(100vh-2rem)] flex flex-col","rounded-2xl bg-white dark:bg-oai-gray-950","shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)]","ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden","dark:border-t dark:border-white/[0.08]"),children:[e.jsx(ue,{render:e.jsx("h2",{className:"sr-only"}),children:d.data?.user?.display_name||n("leaderboard.profile_modal.loading")}),d.loading&&e.jsx(Le,{}),!d.loading&&d.error&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:n("leaderboard.profile_modal.error")})}),!d.loading&&!d.error&&!d.data&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.empty")})}),!d.loading&&!d.error&&d.data&&e.jsx(Ce,{data:d.data,currency:l,rate:m,onClose:r})]})})]})})}export{We as LeaderboardProfileModal,Ce as ProfileContent,Le as ProfileSkeleton,$e as useLeaderboardProfileData};
import{r as _,j as p,T as xe,W as ge,Y as ve,aD as be,L as St,aE as we,G as Y,af as ye}from"./main-DADupgLA.js";import{u as ke}from"./useCurrency-CIJjQNSk.js";import{H as Me}from"./HeaderGithubStar-BuzgYTZ5.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Te}from"./LeaderboardProfileModal-CYzcdwRb.js";import{D as Se}from"./download-zHPmUqi6.js";import"./LeaderboardAvatar-DMaYoU7B.js";import"./ActivityHeatmap-CZasqY2H.js";import"./info-Cje0RF1w.js";import"./arrow-up-right-B_p-ZPxR.js";import"./useScrollLock-DO1uWkvz.js";import"./DialogTitle-Btt5G5wB.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,Ee=16,je=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
attribute vec2 a_position;
void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
`,Ge=`
precision highp float;
uniform vec2 u_resolution;
uniform float u_time;
uniform vec3 u_color1, u_color2, u_color3, u_color4, u_color5, u_color6, u_color7;
uniform float u_alpha1, u_alpha2, u_alpha3, u_alpha4, u_alpha5, u_alpha6, u_alpha7;
uniform float u_intensity, u_scale, u_direction;
uniform float u_softness, u_distortion, u_complexity, u_shape;
uniform float u_vignette, u_vigOpacity, u_blur, u_shaderOpacity;
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec2 mod289v2(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec3 permute(vec3 x) { return mod289((x * 34.0 + 1.0) * x); }
float snoise(vec2 v) {
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
-0.577350269189626, 0.024390243902439);
vec2 i = floor(v + dot(v, C.yy));
vec2 x0 = v - i + dot(i, C.xx);
vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
vec4 x12 = x0.xyxy + C.xxzz;
x12.xy -= i1;
i = mod289v2(i);
vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));
vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);
m = m * m; m = m * m;
vec3 x_ = 2.0 * fract(p * C.www) - 1.0;
vec3 h = abs(x_) - 0.5;
vec3 ox = floor(x_ + 0.5);
vec3 a0 = x_ - ox;
m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);
vec3 g;
g.x = a0.x * x0.x + h.x * x0.y;
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
return 130.0 * dot(m, g);
}
float fbm(vec2 p, float oct) {
float val = 0.0, amp = 0.5;
int n = int(oct);
for (int i = 0; i < 7; i++) {
if (i >= n) break;
val += amp * snoise(p);
p *= 2.0;
amp *= 0.5;
}
return val;
}
float nfbm(vec2 p) { return fbm(p, 3.0 + u_complexity * 4.0); }
/* 5-stop palette used by effect 1 (Plasma) — direct port of \`palette\` from
* the canonical engine. Stops at t = 0, 0.25, 0.5, 0.75, 1.0. */
vec3 palette(float t) {
t = clamp(t, 0.0, 1.0);
t = t * t * (3.0 - 2.0 * t);
float k = 64.0;
float w1 = u_alpha1 * exp(-k * t * t);
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
float total = w1 + w2 + w3 + w4 + w5 + 0.0001;
return (u_color1 * w1 + u_color2 * w2 + u_color3 * w3 +
u_color4 * w4 + u_color5 * w5) / total;
}
/* Per-pixel alpha that re-introduces transparency when the user dials any
* palette stop's alpha below 1. Same \`paletteAlpha\` from the canonical
* engine. With every preset shipping all-1 alphas, this returns ~1 for every
* pixel — but mirroring it keeps custom-preset behaviour identical. */
float paletteAlpha(float t) {
t = clamp(t, 0.0, 1.0);
t = t * t * (3.0 - 2.0 * t);
float k = 64.0;
float w1 = u_alpha1 * exp(-k * t * t);
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
float totalW = w1 + w2 + w3 + w4 + w5 + 0.0001;
float rawW = exp(-k * t * t)
+ exp(-k * (t - 0.25) * (t - 0.25))
+ exp(-k * (t - 0.5) * (t - 0.5))
+ exp(-k * (t - 0.75) * (t - 0.75))
+ exp(-k * (t - 1.0) * (t - 1.0))
+ 0.0001;
return totalW / rawW;
}
vec2 warp(vec2 p, float t) {
float str = u_distortion * 2.0;
return vec2(
nfbm(p + vec2(t * 0.1, 0.0)),
nfbm(p + vec2(0.0, t * 0.12) + 5.0)
) * str;
}
/* Plasma: four sine bands warped by an FBM field, mapped through the
* 5-stop palette. Identical to effect 1 in the canonical engine. */
vec3 computeEffect(vec2 uv, float aspect, float t, float dist, float cpx) {
vec2 p = (uv - 0.5) * u_scale;
p.x *= aspect;
p += vec2(cos(u_direction), sin(u_direction)) * t * 0.15;
float freq = 3.0 + cpx * 8.0;
float val = 0.0;
val += sin(p.x * freq + t);
val += sin(p.y * freq + t * 1.3);
val += sin((p.x + p.y) * freq * 0.7 + t * 0.7);
val += sin(length(p) * freq * 0.8 - t * 1.5);
vec2 w = warp(p, t);
val += (w.x + w.y) * dist;
val = val * 0.2 * u_intensity + 0.5;
return palette(clamp(val, 0.0, 1.0));
}
void main() {
vec2 uv = gl_FragCoord.xy / u_resolution;
float aspect = u_resolution.x / u_resolution.y;
float t = u_time; // JS already multiplied u_time by preset.speed.
float dist = u_distortion;
float cpx = u_complexity;
/* 5-tap cross blur (center + cardinal offsets). The chromatic/silver/gold
* presets all ship with blur=1 so this path is always active. 5 taps
* instead of the canonical engine's 9 saves ~44% fragment work; the
* perceptual difference is nil because the output is already soft from
* the plasma's low spatial frequency and CSS blur on reflections. */
vec3 col;
if (u_blur < 0.01) {
col = computeEffect(uv, aspect, t, dist, cpx);
} else {
float r = u_blur * 0.02;
col = computeEffect(uv, aspect, t, dist, cpx) * 0.4;
col += computeEffect(uv + vec2( r, 0.0), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(-r, 0.0), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(0.0, r), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(0.0, -r), aspect, t, dist, cpx) * 0.15;
}
/* Gamma punch — adds the contrast pop that defines the chromatic
* highlights. From the canonical engine: \`col = pow(col, vec3(1.3))\`. */
col = pow(col, vec3(1.3));
/* Vignette — soft edge darkening so corners read as recessed. The 40-px
* scale at the bottom of the formula is hard-coded in the canonical
* engine; we keep it for visual parity. */
float edgeDist = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));
float vigPx = 40.0 / min(u_resolution.x, u_resolution.y);
float vigRange = vigPx * (1.0 + u_vignette * 3.0);
float vig = edgeDist * edgeDist / (vigRange * vigRange);
vig = smoothstep(0.0, 1.0, vig);
col *= mix(1.0, vig, u_vignette * u_vigOpacity);
/* Per-pixel alpha. With all-1 alphas the formula collapses to ~1 but the
* computation matches the canonical engine so custom presets behave the
* same. */
float colorAlpha = (u_alpha1 + u_alpha2 + u_alpha3 + u_alpha4 + u_alpha5) / 5.0;
if (colorAlpha < 0.999) {
vec3 c1d = col - u_color1, c2d = col - u_color2, c3d = col - u_color3,
c4d = col - u_color4, c5d = col - u_color5;
float prox1 = exp(-8.0 * dot(c1d, c1d));
float prox2 = exp(-8.0 * dot(c2d, c2d));
float prox3 = exp(-8.0 * dot(c3d, c3d));
float prox4 = exp(-8.0 * dot(c4d, c4d));
float prox5 = exp(-8.0 * dot(c5d, c5d));
float pTotal = prox1 + prox2 + prox3 + prox4 + prox5 + 0.0001;
colorAlpha = (prox1 * u_alpha1 + prox2 * u_alpha2 + prox3 * u_alpha3 +
prox4 * u_alpha4 + prox5 * u_alpha5) / pTotal;
}
float alpha = colorAlpha;
/* Touch the unused-at-effect-1 uniforms so GL drivers that complain about
* declared-but-unread uniforms (some Mali / Adreno builds do) keep them
* live. The contribution is provably zero. */
alpha += 0.0 * (u_softness + u_shape +
u_alpha6 + u_alpha7 +
u_color6.x + u_color7.x);
gl_FragColor = vec4(col, alpha * u_shaderOpacity);
}
`;function Rt(t,e,a){const r=t.createShader(e);if(!r)throw new Error("metal-fx: gl.createShader returned null");if(t.shaderSource(r,a),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error(`metal-fx: shader compile failed: ${o??"(no info log)"}`)}return r}function De(t,e,a){const r=t.createProgram();if(!r)throw new Error("metal-fx: gl.createProgram returned null");if(t.attachShader(r,e),t.attachShader(r,a),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS)){const o=t.getProgramInfoLog(r);throw t.deleteProgram(r),new Error(`metal-fx: program link failed: ${o??"(no info log)"}`)}return r}const Yt=140,Kt=40,Zt=1.6,Jt=1.3;let s=null,bt=null;function Ue(t){bt=t}const qe=["u_resolution","u_time","u_color1","u_color2","u_color3","u_color4","u_color5","u_color6","u_color7","u_alpha1","u_alpha2","u_alpha3","u_alpha4","u_alpha5","u_alpha6","u_alpha7","u_intensity","u_scale","u_direction","u_softness","u_distortion","u_complexity","u_shape","u_vignette","u_vigOpacity","u_blur","u_shaderOpacity"];function Ft(t){t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);const e=Rt(t,t.VERTEX_SHADER,He),a=Rt(t,t.FRAGMENT_SHADER,Ge),r=De(t,e,a);t.useProgram(r);const o=t.createBuffer();if(!o)throw new Error("metal-fx: gl.createBuffer returned null");t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),t.STATIC_DRAW);const n=t.getAttribLocation(r,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0);const i={};for(const u of qe)i[u]=t.getUniformLocation(r,u);return{program:r,buffer:o,uniforms:i}}function te(){if(s)return s;const t=Math.min(Ne,typeof window<"u"&&window.devicePixelRatio||1),e=Math.round(Le*t),a=typeof OffscreenCanvas<"u";let r,o;if(a)r=new OffscreenCanvas(e,e),o=r.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1});else{const h=document.createElement("canvas");h.width=e,h.height=e,o=h.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1,preserveDrawingBuffer:!0})??h.getContext("experimental-webgl"),r=h}if(!o)throw new Error("metal-fx: WebGL not supported");const{program:n,buffer:i,uniforms:u}=Ft(o),l=h=>{h.preventDefault(),s&&(s.contextLost=!0)},c=()=>{if(!s)return;const h=Ft(s.gl);s.program=h.program,s.buffer=h.buffer,s.uniforms=h.uniforms,s.presetDirty=!0,s.contextLost=!1,bt?.()};return r.addEventListener("webglcontextlost",l,!1),r.addEventListener("webglcontextrestored",c,!1),s={glCanvas:r,gl:o,program:n,buffer:i,uniforms:u,preset:Xt.chromatic.modes.dark,presetDirty:!0,contextLost:!1,useOffscreen:a,frameBitmap:null,startMs:performance.now(),pausedMs:0,pausedAtMs:null,rafId:0,dpr:t,instances:new Set,frameCount:0,glowQueue:[],glowIdx:0,glowSkip:0,glowPixels:new Uint8Array(e*e*4),glowPixelsW:e,glowPixelsH:e},s}function Qe(){var t;if(!s)return;const{gl:e,program:a,buffer:r,frameBitmap:o}=s;try{o?.close(),e.deleteBuffer(r),e.deleteProgram(a),(t=e.getExtension("WEBGL_lose_context"))==null||t.loseContext()}catch{}s=null}let It=0;function dt(){if(!s)return;const t=performance.now();if(t-It<Pe)return;It=t;const{gl:e,glCanvas:a}=s,r=a.width,o=a.height;(s.glowPixelsW!==r||s.glowPixelsH!==o)&&(s.glowPixelsW=r,s.glowPixelsH=o,s.glowPixels=new Uint8Array(r*o*4)),e.readPixels(0,0,r,o,e.RGBA,e.UNSIGNED_BYTE,s.glowPixels)}const K={bx:0,by:0};function kt(t,e,a){if(!s)return K.bx=0,K.by=0,K;const{glCanvas:r}=s,o=r.width,n=r.height,i=t.dpr,u=t.cssWidth*i,l=t.cssHeight*i,c=Yt*i,h=Kt*i;let f=u*(o/c)/t.shaderScale,d=l*(n/h)/t.shaderScale;f>o&&(f=o),d>n&&(d=n);const g=(o-f)/2,x=(n-d)/2,m=g+e/t.cssWidth*f,F=x+a/t.cssHeight*d;return K.bx=Math.round(m),K.by=Math.round(n-1-F),K}const G={r:0,g:0,b:0,lum:0,count:0};function ee(t,e,a,r,o,n){const i=Math.max(1,n|0),u=Math.max(0,r-i),l=Math.min(e,r+i+1),c=Math.max(0,o-i),h=Math.min(a,o+i+1);G.r=0,G.g=0,G.b=0,G.lum=0,G.count=0;for(let f=c;f<h;f++){const d=f*e;for(let g=u;g<l;g++){const x=(d+g)*4;G.r+=t[x],G.g+=t[x+1],G.b+=t[x+2],G.lum+=(.2126*t[x]+.7152*t[x+1]+.0722*t[x+2])/255,G.count++}}return G}const R={r:255,g:255,b:255};function Ot(t,e,a,r){if(!s)return 0;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count>0?n.lum/n.count:0}function Ve(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count===0?(R.r=255,R.g=255,R.b=255,R):(R.r=n.r/n.count,R.g=n.g/n.count,R.b=n.b/n.count,R)}function Xe(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),{glowPixels:n,glowPixelsW:i,glowPixelsH:u}=s,l=Math.max(1,r|0),c=Math.max(0,o.bx-l),h=Math.min(i,o.bx+l+1),f=Math.max(0,o.by-l),d=Math.min(u,o.by+l+1);let g=-1;R.r=255,R.g=255,R.b=255;for(let x=f;x<d;x++){const m=x*i;for(let F=c;F<h;F++){const b=(m+F)*4,P=n[b],E=n[b+1],L=n[b+2],C=Math.max(P,E,L),j=Math.min(P,E,L),z=(C>0?(C-j)/C:0)*(.35+.65*(C/255));z>g&&(g=z,R.r=P,R.g=E,R.b=L)}}return R}Ue(()=>{s&&s.instances.size>0&&s.pausedAtMs===null&&nt()});typeof document<"u"&&document.addEventListener("visibilitychange",()=>{!s||s.pausedAtMs!==null||s.contextLost||(document.hidden?oe():s.instances.size>0&&nt())});function Ye(t){const e=te(),a=t.hostCanvas.getContext("2d",{alpha:!0});if(!a)throw new Error("metal-fx: canvas 2D context unavailable");const r=t.scale??1,o={canvas:t.hostCanvas,ctx:a,cssWidth:t.cssWidth,cssHeight:t.cssHeight,cornerRadius:t.cornerRadius,kind:t.kind,ringCssPx:t.ringCssPx??(t.kind==="circle"?2:1)*r,shaderScale:t.shaderScale??(t.kind==="circle"?Jt:Zt)*r,opacityMul:t.opacityMul??1,visible:!0,paused:t.paused??!1,everCopied:!1,dpr:typeof window<"u"&&window.devicePixelRatio||1,scale:r,onAfterFrame:t.onAfterFrame,onFirstCopy:t.onFirstCopy};return ae(o),e.instances.add(o),e.rafId===0&&e.pausedAtMs===null&&nt(),o}function Ke(t){if(!s)return;s.instances.delete(t);const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1),s.instances.size===0&&(oe(),Qe())}function Ze(t){s&&(s.glowQueue.includes(t)||s.glowQueue.push(t))}function Je(t){if(!s)return;const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1)}function rt(t,e){let a=!1;e.cssWidth!==void 0&&e.cssWidth!==t.cssWidth&&(t.cssWidth=e.cssWidth,a=!0),e.cssHeight!==void 0&&e.cssHeight!==t.cssHeight&&(t.cssHeight=e.cssHeight,a=!0),e.cornerRadius!==void 0&&(t.cornerRadius=e.cornerRadius),e.scale!==void 0&&(t.scale=e.scale),e.kind!==void 0&&e.kind!==t.kind&&(t.kind=e.kind,e.shaderScale===void 0&&(t.shaderScale=(e.kind==="circle"?Jt:Zt)*t.scale),e.ringCssPx===void 0&&(t.ringCssPx=(e.kind==="circle"?2:1)*t.scale)),e.shaderScale!==void 0&&(t.shaderScale=e.shaderScale),e.ringCssPx!==void 0&&(t.ringCssPx=e.ringCssPx),e.opacityMul!==void 0&&(t.opacityMul=e.opacityMul),e.paused!==void 0&&e.paused!==t.paused&&(t.paused=e.paused,!e.paused&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()),a&&ae(t)}function ta(t,e){t.visible=e,e&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()}function ea(t,e){const a=te();a.preset=Xt[t].modes[e],a.presetDirty=!0}let wt=null;function aa(t){wt=t}function ae(t){t.dpr=typeof window<"u"&&window.devicePixelRatio||1;const e=Math.max(1,Math.round(t.cssWidth*t.dpr)),a=Math.max(1,Math.round(t.cssHeight*t.dpr));t.canvas.width!==e&&(t.canvas.width=e),t.canvas.height!==a&&(t.canvas.height=a)}function ra(t){const{ctx:e,dpr:a,canvas:r}=t,o=t.ringCssPx*a,n=r.width,i=r.height,u=Math.max(0,(t.cornerRadius-t.ringCssPx)*a);e.save(),e.globalCompositeOperation="destination-out",e.fillStyle="#000",e.beginPath(),e.roundRect(o,o,n-2*o,i-2*o,u),e.fill(),e.restore()}function oa(t){var e;if(!s)return;const a=s.frameBitmap??s.glCanvas,r=t.dpr,o=t.canvas.width,n=t.canvas.height;if(o<1||n<1)return;const i=s.glCanvas.width,u=s.glCanvas.height,l=Yt*r,c=Kt*r;let h=o*(i/l)/t.shaderScale,f=n*(u/c)/t.shaderScale;h>i&&(h=i),f>u&&(f=u);const d=Math.max(0,(i-h)/2),g=Math.max(0,(u-f)/2);if(t.ctx.clearRect(0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=t.opacityMul),t.ctx.drawImage(a,d,g,h,f,0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=1),ra(t),t.onFirstCopy){const x=t.onFirstCopy;t.onFirstCopy=void 0,x()}(e=t.onAfterFrame)==null||e.call(t)}function na(){if(!s)return;const{gl:t,uniforms:e,preset:a,glCanvas:r}=s;e.u_resolution&&t.uniform2f(e.u_resolution,r.width,r.height);for(let o=0;o<7;o++){const n=e[`u_color${o+1}`];if(n){const[u,l,c]=$e(a.colors[o]);t.uniform3f(n,u,l,c)}const i=e[`u_alpha${o+1}`];i&&t.uniform1f(i,a.alphas[o])}e.u_intensity&&t.uniform1f(e.u_intensity,a.intensity),e.u_scale&&t.uniform1f(e.u_scale,a.scale),e.u_direction&&t.uniform1f(e.u_direction,a.direction*Math.PI/180),e.u_softness&&t.uniform1f(e.u_softness,a.softness),e.u_distortion&&t.uniform1f(e.u_distortion,a.distortion),e.u_complexity&&t.uniform1f(e.u_complexity,a.complexity),e.u_shape&&t.uniform1f(e.u_shape,a.shape),e.u_vignette&&t.uniform1f(e.u_vignette,a.vignette),e.u_vigOpacity&&t.uniform1f(e.u_vigOpacity,a.vigOpacity),e.u_blur&&t.uniform1f(e.u_blur,a.blur),e.u_shaderOpacity&&t.uniform1f(e.u_shaderOpacity,a.shaderOpacity),s.presetDirty=!1}function ia(t){if(!s)return;const{gl:e,uniforms:a,preset:r,glCanvas:o}=s,n=(t-s.startMs-s.pausedMs)/1e3*r.speed;e.viewport(0,0,o.width,o.height),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),s.presetDirty&&na(),a.u_time&&e.uniform1f(a.u_time,n),e.drawArrays(e.TRIANGLES,0,6),s.frameCount++}let Pt=0;function re(t){var e;if(!s)return;if(s.contextLost){s.rafId=0;return}let a=!1;for(const r of s.instances)if(r.visible&&(!r.paused||!r.everCopied)){a=!0;break}if(!a){s.rafId=0;return}if(s.rafId=requestAnimationFrame(re),!(t-Pt<Ie)){Pt=t,ia(t),s.useOffscreen&&(s.glowQueue.length>0&&dt(),(e=s.frameBitmap)==null||e.close(),s.frameBitmap=s.glCanvas.transferToImageBitmap());for(const r of s.instances)r.visible&&(r.paused&&r.everCopied||(oa(r),r.everCopied=!0));if(wt&&s.glowQueue.length>0&&++s.glowSkip%Ae===0){const r=s.glowQueue;s.glowIdx>=r.length&&(s.glowIdx=0);const o=r[s.glowIdx];o.visible&&!o.paused&&wt(o,t),s.glowIdx++}}}function nt(){!s||s.rafId!==0||(s.rafId=requestAnimationFrame(re))}function oe(){s&&(s.rafId!==0&&cancelAnimationFrame(s.rafId),s.rafId=0)}const lt={linear:t=>t,smoothstep:t=>t*t*(3-2*t)};function Z(t,e,a,r=lt.linear){return{from:t,to:e,dur:a,ease:r,startMs:-1,val:t,done:!1}}function J(t,e){t.startMs=e,t.val=t.from,t.done=!1}function At(t,e){if(t.done||t.startMs<0)return t.val;const a=Math.min(1,(e-t.startMs)/t.dur);return t.val=t.from+(t.to-t.from)*t.ease(a),a>=1&&(t.done=!0),t.val}const sa=1.5,it=1/3,la=4*it,ca=2*it,da=2*it,ua=1.35*it,ha=13*it;function Mt(t,e,a){const r=Math.max(0,Math.min(a,Math.min(t,e)/2));return 2*Math.max(0,t-2*r)+2*Math.max(0,e-2*r)+2*Math.PI*r}function _t(t,e,a,r){return r==="circle"?2*Math.PI*Math.max(0,Math.min(a,Math.min(t,e)/2)):Mt(t,e,a)}function ot(t,e,a,r,o,n,i,u){const l=u||{x:0,y:0},c=Math.max(0,Math.min(r,Math.min(e,a)/2));if(i==="circle"){const b=2*Math.PI*c;if(b<=1e-4)return l.x=e*.5,l.y=a*.5,l;t=(t%b+b)%b;const P=-Math.PI/2+t/b*Math.PI*2,E=Math.max(0,c-o+n);return l.x=e*.5+E*Math.cos(P),l.y=a*.5+E*Math.sin(P),l}const h=Math.max(0,e-2*c),f=Math.max(0,a-2*c),d=Math.PI*c/2,g=2*(h+f)+4*d;t=(t%g+g)%g;const x=Math.max(0,c-o+n);let m=t;if(m<h)return l.x=c+m,l.y=o-n,l;if(m-=h,m<d){const b=-Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=e-o+n,l.y=c+m,l;if(m-=f,m<d){const b=(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<h)return l.x=e-c-m,l.y=a-o+n,l;if(m-=h,m<d){const b=Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=o-n,l.y=a-c-m,l;m-=f;const F=Math.PI+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(F),l.y=c+x*Math.sin(F),l}function Et(t,e){const a=t*2/e;let r="";for(let o=0;o<=e;o++){const n=-t+o*a;r+=(o===0?"M ":"L ")+n.toFixed(3)+" 0 "}return r}const ft={x:0,y:0},pt={x:0,y:0};function fa(t,e,a,r,o,n){return ot(t-.1,e,a,r,o,0,n,ft),ot(t+.1,e,a,r,o,0,n,pt),Math.atan2(pt.y-ft.y,pt.x-ft.x)}function jt(t,e,a){const r=Math.max(0,Math.min(1,(a-t)/(e-t)));return r*r*(3-2*r)}function pa(t){const e=_t(t.width,t.height,t.cornerRadius,t.kind),a=sa*(t.scale??1),r=[];for(let o=0;o<$t;o++){const n=o/$t*e,i=ot(n,t.width,t.height,t.cornerRadius,a,0,t.kind);r.push({x:i.x,y:i.y,arc:n})}return r}function ma(t,e){const{width:a,height:r,cornerRadius:o}=t,n=t.scale??1,i=t.kind==="circle"?2:1,u=Math.max(0,o-i),l=(-200*n).toFixed(0),c=l,h=(540*n).toFixed(0),f=(440*n).toFixed(0),d=`x="${l}" y="${c}" width="${h}" height="${f}"`,g=`${d} filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"`,x=F=>(F*n).toFixed(3),m=F=>(F*n).toFixed(3);return["<defs>",`<filter id="${e}_bXl" ${g}><feGaussianBlur stdDeviation="${m(8.4)}"/></filter>`,`<filter id="${e}_bLg" ${g}><feGaussianBlur stdDeviation="${m(4.8)}"/></filter>`,`<filter id="${e}_bMd" ${g}><feGaussianBlur stdDeviation="${m(2.1)}"/></filter>`,`<filter id="${e}_bSm" ${g}><feGaussianBlur stdDeviation="${m(.9)}"/></filter>`,`<filter id="${e}_ebO" ${g}><feGaussianBlur stdDeviation="${m(da)}"/></filter>`,`<filter id="${e}_ebC" ${g}><feGaussianBlur stdDeviation="${m(ua)}"/></filter>`,`<radialGradient id="${e}_fg" cx="0.5" cy="0.5" r="0.5"><stop offset="0" stop-color="white"/><stop offset="0.30" stop-color="white"/><stop offset="0.65" stop-color="#404040"/><stop offset="1" stop-color="black"/></radialGradient>`,`<mask id="${e}_fm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="black"/><circle id="${e}_fc" cx="0" cy="0" r="${(ha*n).toFixed(3)}" fill="url(#${e}_fg)"/></mask>`,`<mask id="${e}_rm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="#808080"/><rect x="0" y="0" width="${a}" height="${r}" rx="${o}" ry="${o}" fill="white"/><rect x="${i}" y="${i}" width="${a-i*2}" height="${r-i*2}" rx="${u}" ry="${u}" fill="black"/></mask>`,"</defs>",`<g id="${e}_h" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g id="${e}_hI" stroke="white">`,`<path id="${e}_pXl" stroke-width="${x(26.4)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.385" filter="url(#${e}_bXl)"/>`,`<path id="${e}_pLg" stroke-width="${x(15.6)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.595" filter="url(#${e}_bLg)"/>`,`<path id="${e}_pMd" stroke-width="${x(7.2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bMd)"/>`,`<path id="${e}_pSm" stroke-width="${x(3)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bSm)"/>`,"</g></g>",`<g id="${e}_e" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g mask="url(#${e}_fm)">`,`<g id="${e}_eI" stroke="white">`,`<path id="${e}_eO" stroke-width="${x(la)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.85" filter="url(#${e}_ebO)"/>`,`<path id="${e}_eC" stroke-width="${x(ca)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="1.0" filter="url(#${e}_ebC)"/>`,"</g></g></g>"].join("")}const xa=.00875,Lt=.08,Nt=.32,ga=.05,va=3e3,Wt=.85,st=.34,mt=1500,ba=15,wa=.0075,ya=120,ka=1.5,Ma=7.8,_a=9.13952,Ca=1,Ta=1/3,Sa=.8,$a=3.51,Bt=2e3,xt=400,Ra=2.625,Fa=1.008,Ia=.31,ne=140,ie=40,se=20;let Oa=0;const q={x:0,y:0};function zt(t,e){const a=`mfxg_${++Oa}`,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","metal-fx-glow-svg"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e.width} ${e.height}`),r.innerHTML=ma(e,a),t.appendChild(r);const o=b=>r.querySelector(`#${a}_${b}`),n=o("h"),i=o("hI"),u=o("e"),l=o("eI"),c=o("fc"),h=_t(e.width,e.height,e.cornerRadius,e.kind)/Mt(ne,ie,se),f=Math.max(1,Ma*h),d=Math.max(.6,_a*Ta*h),g=Et(f,Ee),x=Et(d,je),m=[o("pXl"),o("pLg"),o("pMd"),o("pSm")],F=[o("eO"),o("eC")];for(const b of m)b.setAttribute("d",g);for(const b of F)b.setAttribute("d",x);return i.style.transformOrigin="0 0",l.style.transformOrigin="0 0",i.style.willChange="transform",l.style.willChange="transform",i.style.transition="transform 100ms linear",l.style.transition="transform 100ms linear",n.style.willChange="opacity",u.style.willChange="opacity",n.style.transition="opacity 100ms linear",u.style.transition="opacity 100ms linear",c.style.willChange="transform",{svg:r,haloGroup:n,haloInner:i,extraGroup:u,extraInner:l,fadeCircle:c,width:e.width,height:e.height,cornerRadius:e.cornerRadius,kind:e.kind,scale:e.scale??1,perim:pa(e),currentIdx:0,appearedAt:0,glowOpacity:0,relocTween:null,relocNextIdx:-1,wanderS:0,wanderTargetS:0,wanderFrames:0,tintFrom:{r:255,g:255,b:255},tintTarget:{r:255,g:255,b:255},tintTween:null,tintHoldUntil:0,lastHaloStroke:"",lastExtraStroke:""}}function Pa(t,e,a,r,o="dark"){var n;const{width:i,height:u,cornerRadius:l,perim:c}=t;if(c.length===0)return;const h=2;let f=-1,d=t.currentIdx,g=0;for(let v=0;v<c.length;v++){const M=c[v],T=Ot(e,M.x,M.y,h);T>f&&(f=T,d=v),v===t.currentIdx&&(g=T)}const x=t.appearedAt>0&&a-t.appearedAt<va,m=st+(Wt-st)*jt(Lt,Nt,g),F=!x&&f-g>ga;if(!t.relocTween||t.relocTween.done)if(t.appearedAt===0)t.currentIdx=d,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0,t.relocTween=Z(0,m,mt,lt.smoothstep),J(t.relocTween,a);else if((n=t.relocTween)!=null&&n.done&&t.relocTween.to===0){t.currentIdx=t.relocNextIdx,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0;const v=c[t.currentIdx],M=Ot(e,v.x,v.y,h),T=st+(Wt-st)*jt(Lt,Nt,M);t.relocTween=Z(0,T,mt,lt.smoothstep),J(t.relocTween,a)}else F?(t.relocNextIdx=d,t.relocTween=Z(t.glowOpacity,0,mt,lt.smoothstep),J(t.relocTween,a)):t.glowOpacity+=(m-t.glowOpacity)*xa;t.relocTween&&(t.glowOpacity=At(t.relocTween,a)),t.glowOpacity=Math.max(0,Math.min(1,t.glowOpacity));const b=_t(i,u,l,t.kind)/Mt(ne,ie,se),P=ba*b;t.wanderFrames++>=ya&&(t.wanderTargetS=(Math.random()*2-1)*P,t.wanderFrames=0),t.wanderS+=(t.wanderTargetS-t.wanderS)*wa;const E=c[t.currentIdx].arc+t.wanderS,L=ka*t.scale;ot(E,i,u,l,L,0,t.kind,q);const C=q.x,j=q.y,z=fa(E,i,u,l,L,t.kind),X=`translate(${C.toFixed(3)}px,${j.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`;t.haloInner.style.transform=X;const N=Ca*b*t.scale;ot(E,i,u,l,L,N,t.kind,q),t.extraInner.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`,t.fadeCircle.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px)`;const $=o==="light",k=$?Xe(e,C,j,h):Ve(e,C,j,h);t.tintTween?t.tintTween.done&&($?(t.tintFrom={r:t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*t.tintTween.val,g:t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*t.tintTween.val,b:t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*t.tintTween.val},t.tintTarget={...k},t.tintTween=Z(0,1,xt),J(t.tintTween,a)):a>=t.tintHoldUntil&&(t.tintFrom={...t.tintTarget},t.tintTarget={...k},t.tintTween=Z(0,1,xt),J(t.tintTween,a),t.tintHoldUntil=a+Bt)):(t.tintFrom={...k},t.tintTarget={...k},t.tintTween=Z(0,1,xt),J(t.tintTween,a),t.tintHoldUntil=$?0:a+Bt),At(t.tintTween,a);const I=t.tintTween.val;let W,B,H;if($)W=Math.round(t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I),B=Math.round(t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I),H=Math.round(t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I);else{const v=t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I,M=t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I,T=t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I,O=Math.max(v,M,T)||1;W=Math.round(255*(v/O)),B=Math.round(255*(M/O)),H=Math.round(255*(T/O))}const y=`rgb(${W},${B},${H})`;if(y!==t.lastHaloStroke&&(t.lastHaloStroke=y,t.haloInner.style.stroke=y),$){const v=Re(W,B,H),[M,T,O]=Fe(v[0],Math.min(1,v[1]*Ra),Math.max(Ia,v[2]*Fa)),D=`rgb(${M},${T},${O})`;D!==t.lastExtraStroke&&(t.lastExtraStroke=D,t.extraInner.style.stroke=D)}else t.lastExtraStroke!=="#ffffff"&&(t.lastExtraStroke="#ffffff",t.extraInner.style.stroke="#ffffff");const w=Math.max(0,Math.min(1,r));t.haloGroup.style.opacity=(t.glowOpacity*Sa*w).toFixed(3),t.extraGroup.style.opacity=Math.min(1,t.glowOpacity*$a*w).toFixed(3)}const yt=12,Ht=32,Gt=1,Dt=.55,Aa=1,Ea=1,ja=.85,La=0,Na=1.3,Ut=3.6,Wa=.7,Ba=1,za=.52,Ha=1,Ga=.044,Da=235,Ua=2.535,qa=.7,Qa=.5,Va=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function Xa(t,e){const a=Math.max(t.left-e.right,e.left-t.right,0),r=Math.max(t.top-e.bottom,e.top-t.bottom,0);return Math.sqrt(a*a+r*r)}function Ya(t,e,a,r){return!(Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top)<a||Math.max(t.left-e.right,e.left-t.right,0)>r)}function Ka(t,e,a,r){return Math.min(t.right,e.right)-Math.max(t.left,e.left)<a?!1:Math.max(t.top-e.bottom,e.top-t.bottom,0)<=r}function V(t,e,a,r,o,n){const i=Math.max(0,Math.min(n,r*.5,o*.5)),u=t.roundRect;if(typeof u=="function"){u.call(t,e,a,r,o,i);return}t.moveTo(e+i,a),t.lineTo(e+r-i,a),t.quadraticCurveTo(e+r,a,e+r,a+i),t.lineTo(e+r,a+o-i),t.quadraticCurveTo(e+r,a+o,e+r-i,a+o),t.lineTo(e+i,a+o),t.quadraticCurveTo(e,a+o,e,a+o-i),t.lineTo(e,a+i),t.quadraticCurveTo(e,a,e+i,a)}function le(t,e,a,r,o){if(!o.flipX&&!o.flipY){t.drawImage(e,0,0,a,r,o.x,o.y,o.w,o.h);return}t.save(),o.flipX&&(t.translate(o.x+o.w,0),t.scale(-1,1)),o.flipY&&(t.translate(0,o.y+o.h),t.scale(1,-1)),t.drawImage(e,0,0,a,r,o.flipX?0:o.x,o.flipY?0:o.y,o.w,o.h),t.restore()}const Za=4;function Ja(t,e,a,r,o,n,i){if(r<=2*i||o<=2*i){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+i,a+i,r-2*i,o-2*i,Math.max(0,n-i)),t.clip("evenodd")}function tr(t,e,a,r,o,n,i,u,l,c,h){const f=Math.max(1,Math.round((yt+Za*3)*h));let d=Math.max(0,i),g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),Ja(t,c.x,c.y,c.w,c.h,c.r,f),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,l),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=u,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ce(t,e,a,r,o,n,i){const u=i|0;if(u<1||r<=2*u||o<=2*u){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+u,a+u,r-2*u,o-2*u,Math.max(0,n-u)),t.clip("evenodd")}function er(t,e,a,r,o,n,i,u,l,c,h,f){let d=u*h,g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),ce(t,i.x,i.y,i.w,i.h,i.r,l),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,f),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=c,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ar(t,e,a,r,o,n,i,u){const l=t.createLinearGradient(r,o,n,i);l.addColorStop(0,`rgba(255,255,255,${u.toFixed(3)})`),l.addColorStop(.5,`rgba(255,255,255,${(u*.45).toFixed(3)})`),l.addColorStop(1,"rgba(255,255,255,0)"),t.save(),ce(t,e.x,e.y,e.w,e.h,e.r,a),t.globalCompositeOperation="lighter",t.lineWidth=a*2,t.strokeStyle=l,t.beginPath(),V(t,e.x,e.y,e.w,e.h,e.r),t.stroke(),t.restore()}function de(t){const e=getComputedStyle(t),a=[parseFloat(e.borderTopLeftRadius)||0,parseFloat(e.borderTopRightRadius)||0,parseFloat(e.borderBottomRightRadius)||0,parseFloat(e.borderBottomLeftRadius)||0].filter(r=>r>0);return a.length?Math.min.apply(null,a):0}function ue(t){const e=getComputedStyle(t),a=Math.max(parseFloat(e.borderTopWidth)||0,parseFloat(e.borderRightWidth)||0,parseFloat(e.borderBottomWidth)||0,parseFloat(e.borderLeftWidth)||0);let r=0,o=0;const n=e.boxShadow;if(n&&n!=="none"){const u=n.replace(/rgba?\([^)]*\)/g,h=>h.replace(/,/g,"\0")).split(/,\s*/);let l=1/0,c=1/0;for(const h of u){const f=h.match(/-?\d+(?:\.\d+)?px/g);if(!f||f.length<4)continue;const d=parseFloat(f[3]);d>0&&(/\binset\b/.test(h)?d<l&&(l=d):d<c&&(c=d))}Number.isFinite(l)&&(r=l),Number.isFinite(c)&&(o=c)}const i=Math.max(a,o);return{width:Math.max(a,r,o)||1,outerCssPx:i}}function qt(t){t.cornerRadius=de(t.el);const e=ue(t.el);t.hairlineWidth=e.width,t.hairlineOuterCssPx=e.outerCssPx}function rr(t){typeof ResizeObserver<"u"&&(t.resizeObserver=new ResizeObserver(()=>qt(t)),t.resizeObserver.observe(t.el)),typeof MutationObserver<"u"&&(t.mutationObserver=new MutationObserver(()=>qt(t)),t.mutationObserver.observe(t.el,{attributes:!0,attributeFilter:["style","class"]}))}function or(t){var e,a;(e=t.resizeObserver)==null||e.disconnect(),t.resizeObserver=null,(a=t.mutationObserver)==null||a.disconnect(),t.mutationObserver=null}const tt=new Set;function nr(t,e,a){if(typeof document>"u"||Va.has(t.tagName))return null;for(const g of tt)if(g.el===t)return g;const r=document.createElement("div");r.setAttribute("data-metal-fx-reflection",""),r.setAttribute("aria-hidden","true");const o=document.createElement("canvas");o.className="metal-fx-reflection-canvas";const n=o.getContext("2d",{alpha:!0});if(!n)return null;const i=document.createElement("canvas");i.className="metal-fx-reflection-stroke-canvas";const u=i.getContext("2d",{alpha:!0});if(!u)return null;r.appendChild(o),r.appendChild(i);const l=getComputedStyle(t);let c=!1;l.position==="static"&&(t.style.position="relative",c=!0);let h=!1;l.isolation!=="isolate"&&(t.style.isolation="isolate",h=!0),t.setAttribute("data-metal-fx-reflect-host",""),t.insertBefore(r,t.firstChild);const f=ue(t),d={el:t,anchor:e,anchorEl:a,wrap:r,canvas:o,ctx:n,strokeCanvas:i,strokeCtx:u,cornerRadius:de(t),hairlineWidth:f.width,hairlineOuterCssPx:f.outerCssPx,appliedPositionRelative:c,appliedIsolation:h,resizeObserver:null,mutationObserver:null};return rr(d),tt.add(d),d}function ir(t){for(const e of tt)if(e.el===t){or(e),e.canvas.width=0,e.canvas.height=0,e.strokeCanvas.width=0,e.strokeCanvas.height=0,e.wrap.parentNode===e.el&&e.el.removeChild(e.wrap),e.el.removeAttribute("data-metal-fx-reflect-host"),e.appliedPositionRelative&&(e.el.style.position=""),e.appliedIsolation&&(e.el.style.isolation=""),tt.delete(e);return}}function sr(){if(tt.size===0)return;const t=typeof window<"u"&&window.devicePixelRatio||1,e=new Map;for(const a of tt){const r=a.el.getBoundingClientRect();let o=e.get(a.anchorEl);if(o||(o=a.anchorEl.getBoundingClientRect(),e.set(a.anchorEl,o)),r.width<1||r.height<1||o.width<1||o.height<1)continue;if(!Ya(o,r,Gt,Ht)&&!Ka(o,r,Gt,Ht)){a.canvas.width!==1&&(a.canvas.width=1,a.canvas.height=1),a.strokeCanvas.width!==1&&(a.strokeCanvas.width=1,a.strokeCanvas.height=1);continue}const n=a.anchor.canvas,i=n.width|0,u=n.height|0;if(i<4||u<4)continue;const l=(o.left+o.right)*.5,c=(o.top+o.bottom)*.5,h=(r.left+r.right)*.5,f=(r.top+r.bottom)*.5,d=l-h,g=c-f,x=Math.max(o.left-r.right,r.left-o.right,0),m=Math.max(o.top-r.bottom,r.top-o.bottom,0),F=x>=m,b=Xa(o,r);let P=1-Math.min(1,b/yt);P=P*P*(3-2*P);const E=Dt+(Aa-Dt)*P,L=Math.min(Ut,E*Na*Wa),C=a.anchor.scale??1,j=Math.max(Ba*C,a.hairlineWidth),z=Math.max(1,Math.round(j*t)),X=Math.max(1,Math.round(Math.max(Ha*C,a.hairlineWidth)*t)),N=a.hairlineOuterCssPx;a.wrap.style.inset=`${-N}px`,a.wrap.style.borderRadius=`${Math.max(0,a.cornerRadius)}px`;const $=Math.max(1,Math.round((r.width+N*2)*t)),k=Math.max(1,Math.round((r.height+N*2)*t));a.canvas.width!==$&&(a.canvas.width=$),a.canvas.height!==k&&(a.canvas.height=k),a.strokeCanvas.width!==$&&(a.strokeCanvas.width=$),a.strokeCanvas.height!==k&&(a.strokeCanvas.height=k);const I=a.ctx;I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,$,k);const W=a.strokeCtx;W.setTransform(1,0,0,1,0,0),W.clearRect(0,0,$,k);const B=Math.min(yt*t,Math.max($,k));let H,y,w,v;F?(H=d>0?$:0,w=d>0?$-B:B,y=k*.5,v=k*.5):(y=g>0?k:0,v=g>0?k-B:B,H=$*.5,w=$*.5);const M=I.createLinearGradient(H,y,w,v);M.addColorStop(0,`rgba(0,0,0,${Ea})`),M.addColorStop(.5,`rgba(0,0,0,${ja})`),M.addColorStop(1,`rgba(0,0,0,${La})`);const T=i/t,O=Math.max(1,Math.round(Da*Math.max(.1,T/140)*t));let D,U,S,A,Q=!1,Ct=!1;if(F){const at=Math.max(o.top,r.top),ht=Math.min(o.bottom,r.bottom);Q=!0,D=d>0?$-O:0,U=Math.round((at-r.top+N)*t),S=O,A=Math.max(1,Math.round((ht-at)*t))}else{const at=Math.max(o.left,r.left),ht=Math.min(o.right,r.right);Ct=!0,D=Math.round((at-r.left+N)*t),U=g>0?k-O:0,S=Math.max(1,Math.round((ht-at)*t)),A=O}const Tt={x:D,y:U,w:S,h:A,flipX:Q,flipY:Ct},ut={x:0,y:0,w:$,h:k,r:Math.max(0,a.cornerRadius*t)},me=Math.min(Ut,L*Ua*qa*Qa);tr(I,n,i,u,$,k,me,M,Tt,ut,t),er(W,n,i,u,$,k,ut,L,z,M,za,Tt),ar(W,ut,X,H,y,w,v,Math.min(.85,Ga*L)),I.globalCompositeOperation="source-over",W.globalCompositeOperation="source-over"}}let gt=!1,Qt=0;function lr(){gt||(gt=!0,!(typeof requestAnimationFrame>"u")&&requestAnimationFrame(t=>{gt=!1,!(t-Qt<Oe)&&(Qt=t,sr())}))}const Vt="metal-fx-styles",cr=`
.metal-fx-root {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
isolation: isolate;
overflow: visible;
background: #272727;
color: #f8f8f8;
}
.metal-fx-root[data-theme='light'] {
background: #ffffff;
color: #1d1d1d;
}
.metal-fx-root::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
z-index: 2;
box-shadow: inset 0 0 50px 0 rgba(255, 255, 255, 0.02);
}
.metal-fx-root[data-theme='light']::before {
box-shadow: inset 0 0 50px 0 rgba(0, 0, 0, 0.02);
}
.metal-fx-root::after {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
z-index: 4;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.metal-fx-root[data-theme='light']::after {
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
/* Circle variant gets a thicker outer rim than the button variant. */
.metal-fx-root[data-variant='circle']::after {
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}
.metal-fx-root[data-theme='light'][data-variant='circle']::after {
box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.06);
}
.metal-fx-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
z-index: 0;
pointer-events: none;
border-radius: inherit;
}
/* The inner spacer — defines the inset geometry where the metal ring meets
the interior (3 px for Button, 1-2 px for Circle) and carries the Circle dark
hairline ('box-shadow: inset' rules below). Intentionally transparent so
the wrapper's background propagates through to the punched shader centre,
giving consumers a single surface tone to override. See "Single-surface
background" in the file header for the rationale. */
.metal-fx-inner {
position: absolute;
inset: 3px;
border-radius: inherit;
z-index: 1;
pointer-events: none;
}
.metal-fx-root[data-variant='button'][data-shape='pill'] .metal-fx-inner {
border-radius: calc(var(--mfx-radius, 20px) - 3px);
}
.metal-fx-root[data-variant='button'][data-shape='circle'] .metal-fx-inner {
border-radius: calc(var(--mfx-radius, 16px) - 3px);
}
.metal-fx-root[data-variant='circle'][data-shape='pill'] .metal-fx-inner {
inset: 0;
border-radius: var(--mfx-radius, 20px);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
.metal-fx-root[data-variant='circle'][data-shape='circle'] .metal-fx-inner {
inset: 0;
border-radius: var(--mfx-radius, 16px);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
/* Circle-variant hairline alpha — light mode.
Source-of-truth: index.html L2261-2267. The 0.45-alpha black inset that
reads as a single-pixel frame against the dark interior is too heavy
on a #ffffff inner: it ends up looking like a hard 2-px black ring
against the iridescent shader. Suppressed entirely (alpha 0) — the
shader's own iridescent rim already defines the silhouette in light
mode, so an extra dark hairline only competes with it. The rule is
kept (rather than deleted) as a tunable hook in case a future variant
wants to re-introduce a soft edge. NOTE: we keep the dark-mode inset
and border-radius values because — unlike index.html — our renderer
does NOT overscan the canvas in light mode, so there is no 1-px gap
between inner element and shader to compensate for. */
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='pill'] .metal-fx-inner,
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='circle'] .metal-fx-inner {
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0);
}
/* ─── Combined glow SVG (z=3) ──────────────────────────────────────────────
Single SVG per instance that holds BOTH the wide-halo group
(#mfx_haloTravel) and the catch-light group (#mfx_extraTravel), exactly
mirroring canonical's _buildGlowSvgInner (index.html L8078). One
mix-blend-mode: screen lifts the combined composite onto the shader
ring; per-frame opacity attributes on each inner group still drive the
independent fade-in / fade-out cycles for the halo and the catch-light.
Why a single SVG: the circle variant anchors halo + catch-light at the same
perimeter point, so they overlap in the bright zone. Two separately-
screened SVGs would double-screen the overlap (A + B + C - AB - AC -
BC + ABC instead of A + B + C - AB - AC once both groups composite
in source-over inside one SVG and then screen against the host once).
That overlap looked muted versus canonical specifically on the circle
variant where both layers travel together.
Source-of-truth opacity: #btnGlowSvg drops to 0.7 in dark and 0.2746 in
light (index.html L632/L643). */
.metal-fx-glow-svg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
z-index: 3;
pointer-events: none;
opacity: 0.7;
}
.metal-fx-root[data-theme='light'] .metal-fx-glow-svg {
/* Light-mode 1-px overscan mirrors .btn-glow-svg in metal.html so the
halo stays glued to the visible silhouette (the shader ring there sits
1 px outside the host's padding box). */
inset: -1px;
width: calc(100% + 2px);
height: calc(100% + 2px);
mix-blend-mode: multiply;
/* Source-of-truth: html[data-theme="light"] #btnGlowSvg { opacity: 0.2746 }
→ −35 % from 0.4225 from the original 0.7 dark-mode opacity. */
opacity: 0.2746;
filter: saturate(5.355) brightness(0.78);
}
/* Circle light-mode small variants (e.g. 36×36 send button): the geometrically
shrunk halo loses density when multiplied against #ffffff. Mirror the
canonical override at index.html L2316 — bump saturation + drop brightness
so the small glow holds together visually. */
.metal-fx-root[data-variant='circle'][data-shape='circle'][data-theme='light'] .metal-fx-glow-svg {
filter: saturate(7.5) brightness(0.6);
}
/* The wrapped child — hoisted into z=5 so it sits above every overlay, with
normalized chrome so consumer button styles don't fight the metal frame. */
.metal-fx-content {
position: relative;
z-index: 5;
display: inline-flex;
align-items: center;
justify-content: center;
width: 100%;
pointer-events: none;
}
.metal-fx-content > * {
pointer-events: auto;
}
.metal-fx-root[data-normalize='true'] .metal-fx-content > * {
background: transparent !important;
border: 0 !important;
outline: 0 !important;
box-shadow: none !important;
/* Sizing: we deliberately DO NOT force \`width: 100%; height: 100%\` on the
child here. That used to be the contract ("the wrapper is the visible
button surface; the child stretches to fill it"), but it created a cyclic
percentage dependency: the wrapper is \`inline-flex\` with no intrinsic
size, .metal-fx-content is \`width/height: 100%\` of the wrapper, and the
child was \`100%\` of .metal-fx-content. With nothing breaking the cycle,
icon-only / class-sized children collapsed.
The new contract: the child sizes itself (intrinsic content, CSS class,
or inline style — all work), and the wrapper's \`inline-flex\` wraps it
tightly. Consumers who want a metal frame BIGGER than the child (e.g.
padding around an icon) size <MetalFx style={{ width, height }}> AND
explicitly set width/height on the child to fill (or accept that the
child renders at its intrinsic size, centered).
Typography is intentionally NOT touched. We used to apply
\`color: inherit; font: inherit;\` here to "match" the wrapper, but
\`font: inherit\` is a shorthand that overrides font-family, font-size,
font-weight, AND line-height on the child — which (a) shrank the
button height (line-height changes propagate through the flex
content box) and (b) scaled em-based icons / font-icons inside the
child to whatever the wrapper inherited. The wrapper now stays out
of the child's typography entirely; consumers who want typographic
normalization can apply it themselves on the child element. */
}
[data-metal-fx-reflection] {
position: absolute;
inset: 0;
pointer-events: none;
border-radius: inherit;
overflow: hidden;
z-index: 0;
isolation: isolate;
}
.metal-fx-reflection-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
filter: blur(4px) saturate(1.2) brightness(1.58);
}
.metal-fx-reflection-stroke-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
filter: saturate(1.35) brightness(1.75);
}
/* Hosts that participate as reflection targets need positioning + isolation
so the wrap composites only against the host (not the parent stack). The
wrap injects these inline as well, but stating them here keeps reflections
working on hosts that already have other inline styles applied. */
[data-metal-fx-reflect-host] {
isolation: isolate;
}
`;let vt=!1;function dr(){if(vt||typeof document>"u")return;if(document.getElementById(Vt)){vt=!0;return}const t=document.createElement("style");t.id=Vt,t.textContent=cr,document.head.appendChild(t),vt=!0}dr();const ur={position:"absolute",inset:0,width:"100%",height:"100%"},hr={position:"absolute",inset:3},fr={position:"absolute",inset:0,pointerEvents:"none",zIndex:3,borderRadius:"inherit"},ct=new Map;aa((t,e)=>{const a=ct.get(t);a&&Pa(a.handles,t,e,t.opacityMul,a.themeRef.current)});function pr(t){const[e,a]=_.useState(()=>t!=="auto"?t:typeof window>"u"||!window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return _.useEffect(()=>{if(t!=="auto"){a(t);return}if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches?"dark":"light");return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),e}const he=_.forwardRef(function({children:t,variant:e="button",preset:a="chromatic",theme:r="auto",strength:o=1,paused:n=!1,borderRadius:i,normalizeHostStyles:u=!0,reflectionTargets:l,disableGlow:c=!1,shaderScale:h,ringCssPx:f,scale:d=1,className:g,style:x,...m},F){const b=_.useRef(null),P=_.useRef(null),E=_.useRef(null),L=_.useRef(null),C=_.useRef(null),j=_.useRef(null),z=_.useRef("dark"),X=_.useRef(0),[N,$]=_.useState(!1),k=pr(r);z.current=k;const I=e==="circle"?"circle":"pill",W=!c;_.useImperativeHandle(F,()=>b.current,[]);const B=(y,w)=>{if(I==="circle")return Math.min(y,w)/2;const v=typeof i=="number"?i:(()=>{var M;const T=(M=L.current)==null?void 0:M.firstElementChild;if(T){const O=parseFloat(getComputedStyle(T).borderTopLeftRadius);if(Number.isFinite(O)&&O>0)return O}return X.current})();return Math.min(v,Math.min(y,w)/2)};_.useEffect(()=>{ea(a,k)},[a,k]),_.useEffect(()=>{const y=C.current;y&&rt(y,{paused:n})},[n]),_.useEffect(()=>{const y=C.current;if(!y)return;const w={};h!==void 0&&(w.shaderScale=h),f!==void 0&&(w.ringCssPx=f),d!==void 0&&(w.scale=d),Object.keys(w).length>0&&rt(y,w)},[h,f,d]),_.useLayoutEffect(()=>{const y=P.current,w=b.current,v=E.current;if(!y||!w)return;{const S=getComputedStyle(w),A=parseFloat(S.borderTopLeftRadius);X.current=Number.isFinite(A)?A:0}const M=()=>{const S=w.getBoundingClientRect(),A=Math.max(1,Math.round(S.width)),Q=Math.max(1,Math.round(S.height));return{cssWidth:A,cssHeight:Q,cornerRadius:B(A,Q)}},T=M();C.current=Ye({hostCanvas:y,cssWidth:T.cssWidth,cssHeight:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,paused:n,shaderScale:h,ringCssPx:f,scale:d,onFirstCopy:()=>$(!0)}),w.style.setProperty("--mfx-radius",`${T.cornerRadius}px`),w.style.borderRadius=`${T.cornerRadius}px`,v&&(j.current=zt(v,{width:T.cssWidth,height:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,scale:d}));let O=0;const D=new ResizeObserver(()=>{O===0&&(O=requestAnimationFrame(()=>{O=0;const S=M(),A=C.current;A&&(rt(A,{cssWidth:S.cssWidth,cssHeight:S.cssHeight,cornerRadius:S.cornerRadius}),w.style.setProperty("--mfx-radius",`${S.cornerRadius}px`),w.style.borderRadius=`${S.cornerRadius}px`,v&&(v.innerHTML="",j.current=zt(v,{width:S.cssWidth,height:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,scale:d}),A&&j.current&&ct.set(A,{handles:j.current,themeRef:z})))}))});D.observe(w);let U=null;return typeof IntersectionObserver<"u"&&(U=new IntersectionObserver(S=>{const A=C.current;if(A)for(const Q of S)ta(A,Q.isIntersecting)},{rootMargin:"64px"}),U.observe(w)),C.current&&j.current&&(ct.set(C.current,{handles:j.current,themeRef:z}),Ze(C.current)),()=>{D.disconnect(),U?.disconnect(),O!==0&&cancelAnimationFrame(O);const S=C.current;S&&(ct.delete(S),Je(S),Ke(S)),C.current=null,j.current=null,v&&(v.innerHTML="")}},[I]),_.useEffect(()=>{const y=C.current;y&&rt(y,{opacityMul:Math.max(0,Math.min(1,o))})},[o,e]),_.useEffect(()=>{const y=C.current,w=b.current;if(!y||!w||!l||k!=="dark")return;y.onAfterFrame=lr;const v=l.flatMap(M=>M.current?[M.current]:[]);for(const M of v)nr(M,y,w);return()=>{y.onAfterFrame=void 0;for(const M of v)ir(M)}},[l,k]),_.useEffect(()=>{const y=b.current,w=C.current;if(!y||!w)return;const v=B(w.cssWidth,w.cssHeight);rt(w,{cornerRadius:v}),y.style.setProperty("--mfx-radius",`${v}px`),y.style.borderRadius=`${v}px`},[i,k,e,I]);const H=_.useMemo(()=>({...x,"--mfx-strength":String(Math.min(1,Math.max(0,o))),opacity:N?1:0,visibility:N?"visible":"hidden",transition:N?"opacity 0.15s ease-out":"none"}),[x,o,N]);return p.jsxs("div",{...m,ref:b,className:g?`metal-fx-root ${g}`:"metal-fx-root","data-variant":e,"data-shape":I,"data-theme":k,"data-paused":n?"true":void 0,"data-normalize":u?"true":"false",style:H,children:[p.jsx("canvas",{ref:P,className:"metal-fx-canvas",style:ur}),p.jsx("div",{className:"metal-fx-inner","aria-hidden":"true",style:hr}),p.jsx("div",{ref:E,"aria-hidden":"true",style:{...fr,display:W?void 0:"none"}}),p.jsx("div",{ref:L,className:"metal-fx-content",children:t})]})});he.displayName="MetalFx";const et=18;function fe(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"4"}),p.jsx("path",{d:"M12 2v2"}),p.jsx("path",{d:"M12 20v2"}),p.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),p.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),p.jsx("path",{d:"M2 12h2"}),p.jsx("path",{d:"M20 12h2"}),p.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),p.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function pe(){return p.jsx("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function mr(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),p.jsx("path",{d:"M8 21h8"}),p.jsx("path",{d:"M12 17v4"})]})}const xr=[{value:"light",label:"Light",Icon:fe},{value:"dark",label:"Dark",Icon:pe},{value:"system",label:"System",Icon:mr}];function gr(t){return t==="dark"?pe:fe}function vr({theme:t,resolvedTheme:e,onSetTheme:a,className:r="",direction:o="down",align:n="right"}){const[i,u]=_.useState(!1),l=_.useRef(null),c=_.useCallback(()=>u(!1),[]);_.useEffect(()=>{if(!i)return;const f=d=>{l.current&&!l.current.contains(d.target)&&c()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i,c]),_.useEffect(()=>{if(!i)return;const f=d=>{d.key==="Escape"&&c()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[i,c]);const h=gr(e);return p.jsxs("div",{ref:l,className:`relative ${r}`,children:[p.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,onClick:()=>u(f=>!f),className:"flex items-center justify-center w-9 h-9 rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors",children:p.jsx(h,{})}),i&&p.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${o==="up"?"bottom-full mb-1":"top-full mt-1"} ${n==="left"?"left-0":"right-0"}`,children:xr.map(({value:f,label:d,Icon:g})=>{const x=t===f;return p.jsxs("button",{type:"button",onClick:()=>{a(f),c()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${x?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[p.jsx(g,{}),p.jsx("span",{children:d})]},f)})})]})}const br="https://github.com/mm7894215/TokenTracker/releases/latest";function Ir({auth:t,signedIn:e,sessionSoftExpired:a,userId:r}){const{currency:o,rate:n}=ke(),{theme:i,resolvedTheme:u,setTheme:l}=xe(),{openLoginModal:c}=ge(),{signedIn:h,loading:f}=ve(),d=!be(),g=e&&!a,x=_.useMemo(()=>g&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,g]),m=_e({userId:r,period:"total",accessToken:x});return p.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[p.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:p.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsxs(St,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[p.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),p.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),p.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:p.jsx(Me,{})})]}),p.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[p.jsxs(St,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[p.jsx(we,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),p.jsx("span",{children:Y("leaderboard.profile.nav.back")})]}),d&&p.jsx(he,{variant:"button",preset:"chromatic",theme:"dark",borderRadius:9999,disableGlow:!0,className:"!bg-black",children:p.jsxs("a",{href:br,target:"_blank",rel:"noopener noreferrer",className:"group no-underline inline-flex h-8 items-center gap-1.5 px-3 text-xs font-bold rounded-full bg-black text-white transition-transform duration-200 active:scale-[0.98]",children:[p.jsx(Se,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:translate-y-0.5"}),p.jsx("span",{className:"hidden sm:inline",children:Y("leaderboard.profile.nav.download")})]})}),f?p.jsx("div",{className:"h-8 w-16 animate-pulse rounded-full bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):h?p.jsx(ye,{}):p.jsx("button",{type:"button",onClick:c,className:"inline-flex h-8 min-w-[76px] items-center justify-center px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm select-none",children:Y("header.auth.sign_in_aria")})]})]})}),p.jsx("main",{className:"flex-1 px-4 pt-4 pb-10 sm:pt-6 sm:pb-16",children:p.jsx("div",{className:"mx-auto max-w-3xl",children:p.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[m.loading&&p.jsx(Ce,{variant:"page"}),!m.loading&&m.error&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:Y("leaderboard.profile_modal.error")})}),!m.loading&&!m.error&&!m.data&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Y("leaderboard.profile_modal.empty")})}),!m.loading&&!m.error&&m.data&&p.jsx(Te,{data:m.data,currency:o,rate:n,variant:"page"})]})})}),p.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 px-4 transition-colors duration-200",children:p.jsxs("div",{className:"mx-auto flex max-w-3xl items-center justify-between text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[p.jsx("p",{children:Y("landing.v2.footer.line")}),p.jsx(vr,{theme:i,resolvedTheme:u,onSetTheme:l,direction:"up",align:"right"})]})})]})}export{Ir as LeaderboardProfilePage};
import{j as i,V as M,r as f,G as d,U as C,aG as $,i as D,L as A,aH as W}from"./main-DADupgLA.js";import{u as G}from"./use-usage-limits-CFd1PQLO.js";import{L as u,a as H,l as g,b as U,u as z}from"./use-limits-display-prefs-DIfRSzm0.js";import{C as E}from"./Card-Cjd-ZKzN.js";import{F as B}from"./FadeIn-gIH1bR94.js";import{L as V}from"./LocalOnlyNotice-k-0-ORjj.js";import"./arrow-up-right-B_p-ZPxR.js";import"./download-zHPmUqi6.js";const X=[3,2,3,3,2,2,3];function h({className:e}){return i.jsx("div",{className:M("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function Y(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(h,{className:"h-3 w-12 shrink-0"}),i.jsx(h,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(h,{className:"h-3 w-[30px] shrink-0"}),i.jsx(h,{className:"h-3 w-6 shrink-0"})]})}function q({bars:e,index:t}){const r=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(h,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(h,{className:M("h-4",r)})]}),Array.from({length:e},(a,n)=>i.jsx(Y,{},n))]})}function J(){return i.jsx(E,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(h,{className:"h-3.5 w-28"}),X.map((e,t)=>i.jsx(q,{bars:e,index:t},t))]})})}function Q(e,t){if(!(e>0))return null;const r=(e-t)/e;return Number.isFinite(r)?Math.min(Math.max(r,0),1):null}function Z(e,t,r=.03){return e>t+r}function ee(e){const t=Math.max(0,Math.floor(e)),r=Math.floor(t/3600);return r>24?`${Math.floor(r/24)}d`:r>0?`${r}h`:`${Math.floor(t/60)}m`}function te(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const r=t[e.windowSecondsField];return typeof r=="number"&&r>0?r:null}return null}function S(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function ie({usedPercent:e,windowSeconds:t,resetMs:r,mode:a,now:n=Date.now()}){const o=Math.min(Math.max(Number(e)||0,0),100)/100,s={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(r))return s;const c=Math.max(0,(r-n)/1e3),l=Q(t,c);if(l==null)return s;if(s.expectedPercent=Math.round(l*100),s.paceOver=Z(o,l),o>=.05){const m=a==="remaining"?1-l:l;s.pacePercent=m*100}if(l>.02&&o>0){const m=t*l,x=o/m,p=o/l;p>=1&&x>0?s.runsOutEta=ee((1-o)/x):s.projectedEnd=Math.round(Math.min(p,1)*100)}return s}const I={claude:{windows(e){return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400}]}},codex:{windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude",labelKey:"limits.label.antigravity_claude",window:e.primary_window},{key:"gpro",labelKey:"limits.label.antigravity_gpro",window:e.secondary_window},{key:"flash",labelKey:"limits.label.antigravity_flash",window:e.tertiary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}}},re="shrink-0 text-oai-black dark:text-oai-white";function ne(e){const t=S(e);if(!Number.isFinite(t))return null;const r=t-Date.now();if(r<=0)return d("shared.time.now");const a=Math.floor(r/6e4);if(a<60)return`${a}m`;const n=Math.floor(a/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function ae(e,t){const r=t===u.REMAINING?100-e:e;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function b(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function L(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function le(e,t){return ie({usedPercent:b(e.window,e.pctField),windowSeconds:te(e,e.window),resetMs:S(L(e.window,e.resetField)),mode:t})}function oe({label:e,pct:t,reset:r,mode:a=u.USED,pacePercent:n=null,paceOver:o=!1}){const s=Math.max(0,Math.min(100,Number(t)||0)),c=a===u.REMAINING?100-s:s,l=Math.round(c),m=c>0&&l===0?Math.max(c,.35):c;let x=String(l);c>0&&l===0&&(x=d("limits.bar.sub_one_percent"));const p=n==null?null:Math.max(0,Math.min(100,n));return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),i.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[i.jsx("div",{className:`${ae(c,a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${m}%`,minWidth:c>0?"3px":0}}),p!=null&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${p}% - 3px)`,width:"6px"}}),i.jsx("div",{className:`absolute top-0 h-full ${o?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${p}% - 1px)`,width:"2px"}})]})]}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[x,"%"]}),r&&i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r})]})}function se(e,t,r){const a=d(e.labelKey),n=r===u.REMAINING,o=l=>n?100-l:l;if(t.expectedPercent==null){const l=Math.round(Math.max(0,Math.min(100,Number(b(e.window,e.pctField))||0)));return n?d("limits.explain.remaining",{label:a,used:o(l)}):d("limits.explain.used",{label:a,used:l})}if(t.paceOver){if(t.runsOutEta)return d("limits.explain.ahead_eta",{label:a,eta:t.runsOutEta});const l=o(t.projectedEnd??100);return d(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:a,pct:l})}const s=Math.round(Math.max(0,Math.min(100,Number(b(e.window,e.pctField))||0))),c=o(t.projectedEnd??s);return d(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:a,pct:c})}function de({rows:e,mode:t}){if(e.length===0)return null;const r=t===u.REMAINING;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:a,pace:n})=>i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:se(a,n,t)},a.key)),i.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:d(r?"limits.explain.body_remaining":"limits.explain.body")})]})}function _({name:e,providerId:t,children:r,expandable:a=!1,expanded:n=!1,onToggle:o}){const s=U(t),c=i.jsxs("div",{className:"flex items-center gap-1.5",children:[s?i.jsx(C,{provider:s,size:14,className:re}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e})]});return a?i.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:o,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),o?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[c,r]}):i.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,r]})}const ce=H;function y({children:e,tone:t="neutral"}){const r=t==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:e})}function me({rows:e,mode:t,extra:r=null}){const a=e.length===0&&!r;return i.jsxs(i.Fragment,{children:[e.map(({spec:n,pace:o})=>i.jsx(oe,{label:d(n.labelKey),pct:b(n.window,n.pctField),reset:ne(L(n.window,n.resetField)),mode:t,pacePercent:o.pacePercent,paceOver:o.paceOver},n.key)),a?i.jsx(y,{children:d("limits.status.no_data")}):null,r]})}function ue(e,t){return e==="kimi_parallel"&&t.parallel_limit?i.jsx(y,{children:d("limits.label.kimi_parallel",{count:t.parallel_limit})}):e==="copilot_otel"&&!t.otel_has_files&&!t.otel_enabled?i.jsx(we,{defaultDir:t.otel_default_dir}):null}function xe(e,t,r,a,n,o){const s=I[e];if(!s)return null;const c=s.windows(t).filter(m=>m.window).map(m=>({spec:m,pace:le(m,a)})),l=ue(s.extra,t);return i.jsxs(_,{name:r,providerId:e,expandable:c.length>0,expanded:n,onToggle:o,children:[i.jsx(me,{mode:a,rows:c,extra:l}),n?i.jsx(de,{rows:c,mode:a}):null]},e)}function pe(e,t,r,a,n){if(!I[e])return null;if(!t?.configured)return i.jsx(_,{name:g(e),providerId:e,children:i.jsx(y,{children:d("limits.status.not_connected")})},e);if(t.error)return i.jsx(_,{name:g(e),providerId:e,children:i.jsx(y,{tone:"error",children:d("shared.error.prefix",{error:t.error})})},e);const o=g(e),s=t.plan_label?`${o} ${t.plan_label}`:o;return xe(e,t,s,r,a,n)}function we({defaultDir:e}){const[t,r]=f.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
`),o=async s=>{s.stopPropagation();try{await navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.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:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:d("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:d("limits.copilot.otelHint.body")}),i.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:n}),i.jsx("button",{type:"button",onClick:o,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:t?d("limits.copilot.otelHint.copied"):d("limits.copilot.otelHint.copy")})]})}function he(e){const[t,r]=f.useState(0);return f.useLayoutEffect(()=>{const a=e.current;if(!a)return;const n=a.querySelectorAll("[data-limit-label]");let o=0;const s=n.length>0?document.createElement("canvas").getContext("2d"):null;if(s){const l=window.getComputedStyle(n[0]);s.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const m of n)o=Math.max(o,s.measureText(m.textContent).width)}const c=Math.ceil(o);r(l=>l===c?l:c)}),t}function fe({claude:e,codex:t,cursor:r,gemini:a,kimi:n,kiro:o,grok:s,antigravity:c,copilot:l,order:m,visibility:x,displayMode:p}){const P={claude:e,codex:t,cursor:r,gemini:a,kimi:n,kiro:o,grok:s,antigravity:c,copilot:l},k=f.useRef(null),j=he(k),[F,O]=f.useState(null),R=Array.isArray(m)&&m.length>0?m:ce,v=p===u.REMAINING?u.REMAINING:u.USED,K=v===u.REMAINING?d("limits.settings.display_mode_remaining"):d("limits.settings.display_mode_used"),N=R.filter(w=>!x||x[w]!==!1).map(w=>pe(w,P[w],v,F===w,()=>O(T=>T===w?null:w))).filter(Boolean);return i.jsx(B,{delay:.15,children:i.jsx(E,{children:i.jsxs("div",{ref:k,className:"flex flex-col gap-3",style:j>0?{"--tt-limits-label-w":`${j}px`}:void 0,children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[d("limits.panel.title"),d("limits.panel.mode_separator"),K]}),N.length>0?N:i.jsx(y,{children:d("limits.status.all_hidden")})]})})})}const ye=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Ee(){const e=$(),{data:t,error:r,isLoading:a}=G(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),n=z();return!ye&&!D()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(V,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:d("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:d("limits.page.subtitle")})]}),i.jsx(A,{to:"/settings","aria-label":d("limits.page.openSettings"),title:d("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:i.jsx(W,{className:"h-4 w-4","aria-hidden":!0})})]}),a?i.jsx(J,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:d("shared.error.prefix",{error:r})}):null,i.jsx(fe,{claude:t?.claude,codex:t?.codex,cursor:t?.cursor,gemini:t?.gemini,kimi:t?.kimi,kiro:t?.kiro,grok:t?.grok,antigravity:t?.antigravity,copilot:t?.copilot,order:n.order,visibility:n.visibility,displayMode:n.displayMode})]})]})})})}export{Ee as LimitsPage};
import{j as e,G as t}from"./main-DADupgLA.js";import{A as r}from"./arrow-up-right-B_p-ZPxR.js";import{D as o}from"./download-zHPmUqi6.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
import{at as p,aJ as w,Y as v,r,G as s,j as e,L as y,_ as j}from"./main-DADupgLA.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function k(){const i=p(),[t,u]=w(),{enabled:n,loading:f,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[h,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),m=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&m&&d(s("shared.error.prefix",{error:m}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||f)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,f,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{u(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[u]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[h?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:h}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{k as LoginPage};

Sorry, the diff of this file is too big to display

import{c as we,bx as ge,b5 as Ue,by as Ke,bz as le,bA as We,bB as ne,b3 as me,r as m,bC as J,bD as he,bE as Ee,bF as oe,bG as be,bH as qe,bI as Le,bJ as $,b as z,bK as W,ar as ue,b4 as pe,bL as $e,bM as Te,bN as Qe,d as ze,bO as Je,bP as ve,bQ as q,j as Y,bR as Ze,b9 as Me,b8 as et,bS as tt,bT as nt,bU as ot,bV as st,u as rt,a as He,bW as it,bX as ye,bY as at,bZ as ct,b_ as lt,b$ as ut,be as ft,c0 as dt,bf as pt}from"./main-DADupgLA.js";import{b as Ae,c as Be,g as Ce,d as se,P as gt,e as mt,s as ht,F as Et,f as Tt,h as vt,i as Ct,j as Pt,k as bt,l as _e,m as Rt,u as St,n as Ot,p as It,t as Mt,o as yt,I as xt,q as Ft,r as kt,v as wt,w as Lt}from"./useScrollLock-DO1uWkvz.js";import{f as Ht,p as At,g as Bt}from"./DialogTitle-Btt5G5wB.js";import{p as _t,q as Dt,r as Nt,t as jt,v as Yt,w as Vt,x as Gt,y as Xt}from"./SelectItemText-CTgRQ8ND.js";const Ut=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],En=we("chevron-right",Ut);const Kt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tn=we("loader-circle",Kt);function Wt(e,n){return n!=null&&!ge(n)?0:typeof e=="function"?e():e}function Pe(e,n,t){const c=Wt(e,t);return typeof c=="number"?c:c?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function qt(e){return e?.includes("mouse")&&e!=="mousedown"}class Re{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Re}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ne(e,n){const{scopeElement:t,referenceElement:c,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=c,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",c.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function $t(e,n={}){const{enabled:t=!0,closeDelay:c=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),S=o.useState("domReferenceElement"),{dataRef:f}=o.context,r=Ae(),O=Be(),h=je(o),j=We(),l=ne(()=>De(f.current.openEvent?.type,h.interactedInside)),N=ne(()=>qt(f.current.openEvent?.type)),g=ne(()=>{de(h)});me(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),me(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&N()&&J(S)&&E){const F=S,a=E,d=he(E),k=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;k&&(k.style.pointerEvents="");const A=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,T=k!==a?k:null,P=h.handleCloseOptions?.getScope?.()??A??T??F.closest("[data-rootownerid]")??d.body;return Ne(h,{scopeElement:P,referenceElement:F,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,N,r,O,g]),m.useEffect(()=>{if(!t)return;function F(){return!!(r&&O&&Ce(r.nodesRef.current,O).length>0)}function a(b){const M=Pe(c,"close",h.pointerType),_=()=>{o.setOpen(!1,z(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,_):(h.openChangeTimeout.clear(),_())}function d(b){const M=be(b);if(!qe(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function k(){h.openChangeTimeout.clear(),j.clear(),r?.events.off("floating.closed",T),g()}function A(b){if(F()&&r){r.events.on("floating.closed",T);return}if(Le(b.relatedTarget,o.context.triggerElements))return;const M=f.current.floatingContext?.nodeId??i,_=b.relatedTarget;if(!(r&&M&&J(_)&&Ce(r.nodesRef.current,M,!1).some(X=>$(X.context?.elements.floating,_)))){if(h.handler){h.handler(b);return}g(),l()||a(b)}}function T(b){!r||!O||F()||j.start(0,()=>{r.events.off("floating.closed",T),o.setOpen(!1,z(W,b)),r.events.emit("floating.closed",b)})}const P=E;return Ee(P&&oe(P,"mouseenter",k),P&&oe(P,"mouseleave",A),P&&oe(P,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",T)})},[t,E,o,f,c,i,l,g,h,r,O,j])}const Qt={current:null};function zt(e,n={}){const{enabled:t=!0,delay:c=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=Qt,externalTree:f,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:j}=n,l="rootStore"in e?e.rootStore:e,{dataRef:N,events:g}=l.context,F=Ae(f),a=je(l),d=m.useRef(!1),k=se(i),A=se(c),T=se(p),P=se(t),b=se(j),M=se(h),_=ne(()=>De(N.current.openEvent?.type,a.interactedInside)),G=ne(()=>b.current?.()!==!1),X=ne((s,v,H)=>{const R=l.context.triggerElements;if(R.hasElement(v))return!s||!$(s,v);if(!J(H))return!1;const u=H;return R.hasMatchingElement(B=>$(B,u))&&(!s||!$(s,u))}),D=ne(()=>{if(!a.handler)return;he(l.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),L=ne(()=>{de(a)});return r&&(a.handleCloseOptions=k.current?.__options),m.useEffect(()=>D,[D]),m.useEffect(()=>{if(!t)return;function s(v){v.open?d.current=!1:(d.current=v.reason===W,D(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,D]),m.useEffect(()=>{if(!t)return;function s(u,B=!0){const y=Pe(A.current,"close",a.pointerType);y?a.openChangeTimeout.start(y,()=>{l.setOpen(!1,z(W,u)),F?.events.emit("floating.closed",u)}):B&&(a.openChangeTimeout.clear(),l.setOpen(!1,z(W,u)),F?.events.emit("floating.closed",u))}const v=S.current??(r?l.select("domReferenceElement"):null);if(!J(v))return;function H(u){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!ge(a.pointerType))return;const B=xe(T.current),y=Pe(A.current,"open",a.pointerType),V=be(u),U=u.currentTarget??null,I=l.select("domReferenceElement");let w=U;if(J(V)&&!l.context.triggerElements.hasElement(V)){for(const Ie of l.context.triggerElements.elements())if($(Ie,V)){w=Ie;break}}J(U)&&J(I)&&!l.context.triggerElements.hasElement(U)&&$(U,I)&&(w=I);const C=w==null?!1:X(I,w,V),Q=l.select("open"),Z=M.current?.()??l.select("transitionStatus")==="ending",K=!Q&&Z&&d.current,ee=!C&&J(w)&&J(I)&&$(I,w)&&K,te=B>0&&!y,Xe=C&&(Q||K)||ee,Oe=!Q||C;if(Xe){G()&&l.setOpen(!0,z(W,u,w));return}te||(y?a.openChangeTimeout.start(y,()=>{Oe&&G()&&l.setOpen(!0,z(W,u,w))}):Oe&&G()&&l.setOpen(!0,z(W,u,w)))}function R(u){if(_()){L();return}D();const B=l.select("domReferenceElement"),y=he(B);a.restTimeout.clear(),a.restTimeoutPending=!1;const V=N.current.floatingContext??O?.();if(Le(u.relatedTarget,l.context.triggerElements))return;if(k.current&&V){l.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=k.current({...V,tree:F,x:u.clientX,y:u.clientY,onClose(){L(),D(),P.current&&!_()&&I===l.select("domReferenceElement")&&s(u,!0)}}),y.addEventListener("mousemove",a.handler),a.handler(u);return}(a.pointerType!=="touch"||!$(l.select("floatingElement"),u.relatedTarget))&&s(u)}return E?Ee(oe(v,"mousemove",H,{once:!0}),oe(v,"mouseenter",H),oe(v,"mouseleave",R)):Ee(oe(v,"mouseenter",H),oe(v,"mouseleave",R))},[D,L,N,A,l,t,k,a,r,X,_,o,E,T,S,F,P,O,M,G]),m.useMemo(()=>{if(!t)return;function s(v){a.pointerType=v.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(v){const{nativeEvent:H}=v,R=v.currentTarget,u=l.select("domReferenceElement"),B=l.select("open"),y=X(u,R,v.target);if(o&&!ge(a.pointerType))return;if(B&&y&&a.handleCloseOptions?.blockPointerEvents){const I=l.select("floatingElement");if(I){const w=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;Ne(a,{scopeElement:w,referenceElement:R,floatingElement:I})}}const V=xe(T.current);if(B&&!y||V===0||!y&&a.restTimeoutPending&&v.movementX**2+v.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,_())return;const I=l.select("open");!a.blockMouseMove&&(!I||y)&&G()&&l.setOpen(!0,z(W,H,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):y&&B?U():(a.restTimeoutPending=!0,a.restTimeout.start(V,U))}}},[t,a,_,X,o,l,T,G])}const Fe=.1,Jt=Fe*Fe,x=.5;function ie(e,n,t,c,i,o){return c>=n!=o>=n&&e<=(i-t)*(n-c)/(o-c)+t}function ae(e,n,t,c,i,o,p,E,S,f){let r=!1;return ie(e,n,t,c,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,S,f)&&(r=!r),ie(e,n,S,f,t,c)&&(r=!r),r}function Zt(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,c,i,o){const p=Math.min(t,i),E=Math.max(t,i),S=Math.min(c,o),f=Math.max(c,o);return e>=p&&e<=E&&n>=S&&n<=f}function en(e={}){const{blockPointerEvents:n=!1}=e,t=new le,c=({x:i,y:o,placement:p,elements:E,onClose:S,nodeId:f,tree:r})=>{const O=p?.split("-")[0];let h=!1,j=null,l=null,N=typeof performance<"u"?performance.now():0;function g(a,d){const k=performance.now(),A=k-N;if(j===null||l===null||A===0)return j=a,l=d,N=k,!1;const T=a-j,P=d-l,b=T*T+P*P,M=A*A*Jt;return j=a,l=d,N=k,b<M}function F(){t.clear(),S()}return function(d){t.clear();const k=E.domReference,A=E.floating;if(!k||!A||O==null||i==null||o==null)return;const{clientX:T,clientY:P}=d,b=be(d),M=d.type==="mouseleave",_=$(A,b),G=$(k,b);if(_&&(h=!0,!M))return;if(G&&(h=!1,!M)){h=!0;return}if(M&&J(d.relatedTarget)&&$(A,d.relatedTarget))return;function X(){return!!(r&&Ce(r.nodesRef.current,f).length>0)}function D(){X()||F()}if(X())return;const L=k.getBoundingClientRect(),s=A.getBoundingClientRect(),v=i>s.right-s.width/2,H=o>s.bottom-s.height/2,R=s.width>L.width,u=s.height>L.height,B=(R?L:s).left,y=(R?L:s).right,V=(u?L:s).top,U=(u?L:s).bottom;if(O==="top"&&o>=L.bottom-1||O==="bottom"&&o<=L.top+1||O==="left"&&i>=L.right-1||O==="right"&&i<=L.left+1){D();return}let I=!1;switch(O){case"top":I=ce(T,P,B,L.top+1,y,s.bottom-1);break;case"bottom":I=ce(T,P,B,s.top+1,y,L.bottom-1);break;case"left":I=ce(T,P,s.right-1,U,L.left+1,V);break;case"right":I=ce(T,P,L.right-1,U,s.left+1,V);break}if(I)return;if(h&&!Zt(T,P,L)){D();return}if(!M&&g(T,P)){D();return}let w=!1;switch(O){case"top":{const C=R?x/2:x*4,Q=R||v?i+C:i-C,Z=R?i-C:v?i+C:i-C,K=o+x+1,ee=v||R?s.bottom-x:s.top,te=v?R?s.bottom-x:s.top:s.bottom-x;w=ae(T,P,Q,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const C=R?x/2:x*4,Q=R||v?i+C:i-C,Z=R?i-C:v?i+C:i-C,K=o-x,ee=v||R?s.top+x:s.bottom,te=v?R?s.top+x:s.bottom:s.top+x;w=ae(T,P,Q,K,Z,K,s.left,ee,s.right,te);break}case"left":{const C=u?x/2:x*4,Q=u||H?o+C:o-C,Z=u?o-C:H?o+C:o-C,K=i+x+1,ee=H||u?s.right-x:s.left,te=H?u?s.right-x:s.left:s.right-x;w=ae(T,P,ee,s.top,te,s.bottom,K,Q,K,Z);break}case"right":{const C=u?x/2:x*4,Q=u||H?o+C:o-C,Z=u?o-C:H?o+C:o-C,K=i-x,ee=H||u?s.left+x:s.right,te=H?u?s.left+x:s.right:s.left+x;w=ae(T,P,K,Q,K,Z,ee,s.top,te,s.bottom);break}}w?h||t.start(40,D):D()}};return c.__options={...e,blockPointerEvents:n},c}const Ye=m.createContext(void 0);function re(e){const n=m.useContext(Ye);if(n===void 0&&!e)throw new Error(pe(47));return n}function tn(){return{...Bt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const nn={...At,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class Se extends $e{constructor(n,t,c=!1){const i={...tn(),...n},o=new gt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Ht(o,t,c),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},nn)}setOpen=(n,t)=>{const c=t.reason===W,i=t.reason===Te&&t.event.detail===0,o=!n&&(t.reason===Qe||t.reason==null);t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)};const p=this.select("activeTriggerId");if(!n&&t.reason===ze&&t.trigger==null&&p!=null&&(t.trigger=this.context.triggerElements.getById(p)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const E=()=>{const S={open:n,openChangeReason:t.reason};ht(S,n,t.trigger),this.update(S)};c?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Je,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(E)):E(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===ve?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:c,internalStore:i}=mt(n,(o,p)=>new Se(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),c}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:c=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:S,defaultTriggerId:f=null}=e,r=Se.useStore(E?.store,{modal:p,open:c,openProp:t,activeTriggerId:f,triggerIdProp:S});Tt(()=>{t===void 0&&r.state.open===!1&&c===!0&&r.update({open:!0,activeTriggerId:f})}),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",S);const O=r.useState("open"),h=r.useState("mounted"),j=r.useState("payload"),l=Be()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),vt(r,O),Ct(r);const{forceUnmount:N}=Pt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:l}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,z(Ze))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:N,close:g}),[N,g]);const F=O||h,a=m.useMemo(()=>({store:r}),[r]);return Y.jsxs(Ye.Provider,{value:a,children:[F&&Y.jsx(on,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function vn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Et,{children:Y.jsx(ke,{props:e})})}function on({store:e,modal:n}){const t=e.useState("floatingRootContext"),c=bt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=c.reference??Me,o=c.trigger??Me,p=m.useMemo(()=>et(_e,c.floating),[c.floating]);return Rt(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const sn=300;function rn(e,n){const t=m.useRef(null);function c(o){ue.flushSync(()=>{e.setOpen(!1,z(ve,o.nativeEvent,o.currentTarget))}),st(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&tt(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,z(ve,o.nativeEvent,o.currentTarget))});let E=nt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&$(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:c,handleFocusTargetFocus:i}}const Cn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:S,payload:f,openOnHover:r=!1,delay:O=sn,closeDelay:h=0,id:j,...l}=n,N=re(!0),g=S?.store??N?.store;if(!g)throw new Error(pe(74));const F=St(j),a=g.useState("isTriggerActive",F),d=g.useState("floatingRootContext"),k=g.useState("isOpenedByTrigger",F),A=g.useState("triggerPopupId",F),T=m.useRef(null),{registerTrigger:P,isMountedByThisTrigger:b}=Ot(F,T,g,{payload:f,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),_=g.useState("stickIfOpen"),G=g.useState("openMethod"),X=g.useState("focusManagerModal"),D=zt(d,{enabled:d!=null&&r&&(G!=="touch"||M!==Te),mouseOnly:!0,move:!1,handleClose:en(),restMs:O,delay:{close:h},triggerElementRef:T,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),L=_t(d,{enabled:d!=null,stickIfOpen:_}),s=Dt(()=>g.select("open"),w=>{g.set("openMethod",w)}),v=g.useState("triggerProps",b),{getButtonProps:H,buttonRef:R}=rt({disabled:p,native:E}),u={open(w){return w&&M===Te?It.open(w):Mt.open(w)}},{preFocusGuardRef:B,handlePreFocusGuardFocus:y,handleFocusTargetFocus:V}=rn(g,T),I=He("button",n,{state:{disabled:p,open:k},ref:[R,t,P,T],props:[L.reference,D,v,s,{[it]:"",id:F,"aria-haspopup":"dialog","aria-expanded":k,"aria-controls":A},l,H],stateAttributesMapping:u});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:B,onFocus:y}),Y.jsx(m.Fragment,{children:I},F),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:V})]}):Y.jsx(m.Fragment,{children:I},F)}),Ve=m.createContext(void 0);function an(){const e=m.useContext(Ve);if(e===void 0)throw new Error(pe(45));return e}const Pn=m.forwardRef(function(n,t){const{keepMounted:c=!1,...i}=n,{store:o}=re();return o.useState("mounted")||c?Y.jsx(Ve.Provider,{value:c,children:Y.jsx(at,{ref:t,...i})}):null}),Ge=m.createContext(void 0);function cn(){const e=m.useContext(Ge);if(!e)throw new Error(pe(46));return e}const bn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,anchor:p,positionMethod:E="absolute",side:S="bottom",align:f="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:j=5,arrowPadding:l=5,sticky:N=!1,disableAnchorTracking:g=!1,collisionAvoidance:F=ct,...a}=n,{store:d}=re(),k=an(),A=yt(),T=d.useState("floatingRootContext"),P=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),_=d.useState("activeTriggerElement"),G=d.useState("modal"),X=d.useState("openMethod"),D=d.useState("positionerElement"),L=d.useState("instantType"),s=d.useState("transitionStatus"),v=d.useState("hasViewport"),H=m.useRef(null),R=lt(D,!1,!1),u=Nt({anchor:p,floatingRootContext:T,positionMethod:E,mounted:P,side:S,sideOffset:r,align:f,alignOffset:O,arrowPadding:l,collisionBoundary:h,collisionPadding:j,sticky:N,disableAnchorTracking:g,keepMounted:k,nodeId:A,collisionAvoidance:F,adaptiveOrigin:v?Vt:void 0}),B=T.useState("domReferenceElement");me(()=>{const I=B,w=H.current;if(I&&(H.current=I),w&&I&&I!==w){d.set("instantType",void 0);const C=new AbortController;return R(()=>{d.set("instantType","trigger-change")},C.signal),()=>{C.abort()}}},[B,R,d]),jt(b&&G===!0&&M!==W,X==="touch",D,_);const y=m.useCallback(I=>{d.set("positionerElement",I)},[d]),V={open:b,side:u.side,align:u.align,anchorHidden:u.anchorHidden,instant:L},U=Yt(n,V,{styles:u.positionerStyles,transitionStatus:s,props:a,refs:[t,y],hidden:!P,inert:!b});return Y.jsxs(Ge.Provider,{value:u,children:[P&&G===!0&&M!==W&&Y.jsx(xt,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:_}),Y.jsx(Ft,{id:A,children:U})]})}),ln=m.createContext(void 0);function un(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function fn(e){const{value:n,children:t}=e;return Y.jsx(ln.Provider,{value:n,children:t})}const dn={...Lt,...pt},Rn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:f}=re(),r=cn(),O=Gt()!=null,{context:h,hasClosePart:j}=un(),l=f.useState("open"),N=f.useState("openMethod"),g=f.useState("instantType"),F=f.useState("transitionStatus"),a=f.useState("popupProps"),d=f.useState("titleElementId"),k=f.useState("descriptionElementId"),A=f.useState("modal"),T=f.useState("mounted"),P=f.useState("openChangeReason"),b=f.useState("activeTriggerElement"),M=f.useState("floatingRootContext"),_=M.useState("floatingId"),G=f.useState("disabled"),X=f.useState("openOnHover"),D=f.useState("closeDelay"),L=S.id??_;ft({open:l,ref:f.context.popupRef,onComplete(){l&&f.context.onOpenChangeComplete?.(!0)}}),$t(M,{enabled:X&&!G,closeDelay:D});function s(y){return y==="touch"?f.context.popupRef.current:!0}const v=p===void 0?s:p,H=A!==!1&&j;f.useSyncedValue("focusManagerModal",H);const R=m.useCallback(y=>{f.set("popupElement",y)},[f]),u={open:l,side:r.side,align:r.align,instant:g,transitionStatus:F},B=He("div",n,{state:u,ref:[t,f.context.popupRef,R],props:[a,{id:L,role:"dialog",..._e,"aria-labelledby":d,"aria-describedby":k,onKeyDown(y){O&&wt.has(y.key)&&y.stopPropagation()}},Xt(F),S],stateAttributesMapping:dn});return Y.jsx(kt,{context:M,openInteractionType:N,modal:H,disabled:!T||P===W,initialFocus:v,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:f.context.triggerFocusTargetRef,beforeContentFocusGuardRef:f.context.beforeContentFocusGuardRef,children:Y.jsx(fn,{value:h,children:B})})});export{En as C,Tn as L,vn as P,Cn as a,Pn as b,bn as c,Rn as d};
import{aJ as d,Y as m,r as t,j as e,L as l,G as o,_ as x}from"./main-DADupgLA.js";function n(s,a){for(const r of a){const i=s.get(r);if(typeof i=="string"&&i.trim())return i.trim()}return""}function u(){const[s]=d(),{enabled:a}=m(),r=t.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),i=t.useMemo(()=>n(s,["email"]),[s]),c=t.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:r?"reset_confirm":"reset_email",tokenFromUrl:r,initialEmail:i,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:o("login.cloud_only")})})]})}export{u as ResetPasswordPage};
import{r as v,b2 as l,bB as w,a as k,j as e,V as x}from"./main-DADupgLA.js";import{u as j,z as N,s as i,L as C,A as E,S as I,h as R,i as T,C as A,j as L,k as P,l as V,m as _,o as z,n as B}from"./SelectItemText-CTgRQ8ND.js";import{C as D}from"./useScrollLock-DO1uWkvz.js";const G=v.forwardRef(function(t,s){const{render:n,className:p,style:o,...c}=t,{store:r,scrollHandlerRef:d}=j(),{alignItemWithTriggerActive:g}=N(),u=l(r,i.hasScrollArrows),h=l(r,i.openMethod),a=l(r,i.multiple),m={id:`${l(r,i.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(b){d.current?.(b.currentTarget)},...g&&{style:C},className:u&&h!=="touch"?E.className:void 0},S=w(b=>{r.set("listElement",b)});return k("div",t,{ref:[s,S],props:[m,c]})}),M="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function U({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:p,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(I,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(R,{id:p,"aria-label":n,className:x(M,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c,e.jsx(T,{className:"truncate"})]}),e.jsx(A,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(V,{className:x("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(G,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:f,disabled:m})=>x("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",f?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",m&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(z,{children:e.jsx(D,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(B,{children:a.label})})]},String(a.value)))})})})})]})}export{U as S};

Sorry, the diff of this file is too big to display

import{c as y,r as l,ao as X,ai as q,aL as L,j as n,m as O,U as ee,V as v,G as s,Y as te,av as ne,aM as ae,az as ie,aA as se,aB as P,aN as oe,aO as re,W as le,R as ce,S as ue,T as de,a2 as ge,aP as he,aQ as pe,aR as me,aS as be,K as fe,aT as xe,aU as ye,aV as ve,aW as je,aX as ke,aY as Ne,aZ as Se,ag as we}from"./main-DADupgLA.js";import{b as G,l as A,u as Ce,L as E}from"./use-limits-display-prefs-DIfRSzm0.js";import{S as j,T as k,a as b,b as _,u as T}from"./use-native-settings-BuBDLdTx.js";import{C as Le}from"./useScrollLock-DO1uWkvz.js";import{u as Ge}from"./useCurrency-CIJjQNSk.js";import{S as D}from"./Select-DXD3JLWK.js";import{I as Ae}from"./info-Cje0RF1w.js";import{D as Ee}from"./download-zHPmUqi6.js";import"./Card-Cjd-ZKzN.js";import"./SelectItemText-CTgRQ8ND.js";const Ie=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Oe=y("activity",Ie);const Pe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],_e=y("copy",Pe);const Te=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],De=y("grip-vertical",Te);const Me=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Ue=y("languages",Me);const Re=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Fe=y("log-out",Re);const He=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],$e=y("pencil",He),Be=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach(Be);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const ze=l.createContext(null);function Ve(){const e=l.useRef(!1);return X(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function We(){const e=Ve(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>q.postRender(i),[i]),t]}const M=e=>e===!0,Ze=e=>M(e===!0)||e==="id",Ke=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(ze),[r,c]=We(),u=l.useRef(null),g=i.id||o;u.current===null&&(Ze(a)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:M(a)&&i.group||I()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:h,children:e})},Ye="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Je({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:v("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:v("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Qe({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},m=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},x=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Ke,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const p=a[d]!==!1,N=r===d;return n.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:f,onDrop:x,className:v("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[n.jsx(De,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),G(d)?n.jsx(ee,{provider:G(d),size:18,className:v("pointer-events-none",Ye)}):null,n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:A(d)}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx(Je,{checked:p,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${A(d)}`})})]},d)})})})}function Xe(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function qe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function et(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function tt(e,t,a){const[i,o]=l.useState(()=>ne()),r=t&&a&&ae(),c=l.useCallback(async()=>{const u=!i;if(ie(u),o(u),!!u)try{await se(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function nt(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[f,x]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[H,C]=l.useState(""),[$,B]=l.useState(""),[z,V]=l.useState(!1),[W,Z]=l.useState(null),K=l.useMemo(()=>Xe(e),[e]),Y=l.useMemo(()=>qe(e),[e]),J=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:h,displayName:K,editingGithub:z,editingName:f,email:Y,githubError:W,githubInput:$,githubUrl:H,loadSetters:Q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:V,setEditingName:x,setGithubError:Z,setGithubInput:B,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:N,userId:J}}function at(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await P({getAccessToken:e});if(!i||!o)return;const r=await oe({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function it(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await P({getAccessToken:e});if(!c)return!1;const u=await re({accessToken:c,...a});return r?.(u),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function st(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function ot(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function rt(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function lt(e,t,a){const i=l.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await t({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),a?.()}})},[t,e,a]),o=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function ct(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=et(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function ut(){const e=te(),t=nt(e.user),a=tt(e.getAccessToken,e.enabled,e.signedIn);at(e.getAccessToken,e.signedIn,t.loadSetters);const i=it(e.getAccessToken,t),o=rt(t,i),r=lt(t,i,e.refreshDisplayName),c=ct(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:t.userId,name:st(t,{...o,...r}),github:ot(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function U({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),n.jsx("button",{type:"button",onClick:t,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function dt({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),n.jsx(U,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function gt({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&a(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),n.jsx(U,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function R({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function F({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function ht({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function pt({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:f,startEditingName:x}=e,d=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(F,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(dt,{nameInput:u,setEditingName:m,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:n.jsx(ht,{name:e})})}function mt({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f,showGithubOn:x,startEditingGithub:d}=e;return n.jsx(F,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(gt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{label:s("settings.account.edit"),onClick:d}),n.jsx(k,{checked:x,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function bt(){const{openLoginModal:e}=le();return n.jsx(j,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function ft({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(pt,{name:e}),n.jsx(mt,{github:t})]})}function xt(){const e=ut();return e.enabled?e.signedIn?n.jsxs(j,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(vt,{onSignOut:e.signOut}),children:[n.jsx(yt,{userId:e.userId}),n.jsx(jt,{settings:e}),n.jsx(kt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(Nt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(bt,{}):null}function yt({userId:e}){const[t,a]=ce.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),a(!0),globalThis.setTimeout(()=>a(!1),1200)}catch{a(!1)}};return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),n.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":s("settings.account.copyUserId"),children:[t?n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}):n.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t?s("settings.account.copied"):s("settings.account.copy")]})]})}function vt({onSignOut:e}){return n.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[n.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function jt({settings:e}){return e.showLocalCloudSync?n.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function kt({checked:e,disabled:t,onChange:a}){return n.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function Nt({visible:e,name:t,github:a}){return n.jsx(ue,{initial:!1,children:e?n.jsx(O.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:n.jsx(ft,{name:t,github:a})},"public-profile-fields"):null})}function St(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:he},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:pe},{value:"system",label:s("settings.appearance.theme.system"),Icon:me}]}function wt(){return[{value:xe,label:s("settings.appearance.language.system")},{value:ye,label:s("settings.appearance.language.english")},{value:ve,label:s("settings.appearance.language.chinese")},{value:je,label:s("settings.appearance.language.traditional_chinese")},{value:ke,label:s("settings.appearance.language.japanese")},{value:Ne,label:s("settings.appearance.language.korean")}]}function Ct(e){if(!e)return null;try{const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString()}catch{return null}}function Lt(e,t){const a=s(`settings.appearance.currency.rate_source.${e}`),i=Ct(t),o=i?s("settings.appearance.currency.rate_updated",{when:i}):s("settings.appearance.currency.rate_never");return`${a} · ${o}`}function Gt({locale:e,setLocale:t}){const a=wt();return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:n.jsx(Ue,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function At({currency:e,setCurrency:t}){const a=be().map(i=>({value:i.code,label:s(i.labelKey)}));return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Et({currency:e,rate:t,rateSource:a,rateFetchedAt:i}){if(e===fe)return n.jsx(n.Fragment,{children:s("settings.appearance.currency.hint")});const o=Lt(a,i);return n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{children:`1 USD = ${t.toFixed(4)} ${e}`}),n.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:n.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function It(){const{theme:e,setTheme:t}=de(),{locale:a,setLocale:i}=ge(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ge();return n.jsxs(j,{title:s("settings.section.appearance"),children:[n.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(_,{options:St(),value:e,onChange:t})}),n.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(Gt,{locale:a,setLocale:i})}),n.jsx(b,{label:s("settings.appearance.currency.label"),hint:n.jsx(Et,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:n.jsx(At,{currency:o,setCurrency:g})})]})}function Ot(){const{available:e,settings:t,setSetting:a,runAction:i}=T();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,u=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(j,{title:s("settings.section.menubar"),children:[r?n.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Se,{className:v("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Pt(){const{available:e,settings:t,runAction:a}=T(),i=e&&t?.version;return n.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[i?n.jsxs(n.Fragment,{children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),n.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,n.jsxs("a",{href:we,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[n.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function _t({prefs:e}){return n.jsx(_,{options:[{value:E.USED,label:s("limits.settings.display_mode_used")},{value:E.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Vt(){const e=Ce();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(It,{}),n.jsx(Ot,{}),n.jsx(xt,{}),n.jsx(j,{title:s("settings.section.limits"),action:n.jsx(_t,{prefs:e}),children:n.jsx(Qe,{prefs:e})})]}),n.jsx(Pt,{})]})})})}export{Vt as SettingsPage};
import{c as Oe,r as n,a as ea,j as e,M as U,V as W,b2 as nt,X as Se,G as s,b3 as da,b4 as Pa,b5 as ot,u as lt,b6 as xa,b7 as dt,b8 as ct,b9 as ut,ba as pa,bb as gt,bc as mt,b as ht,bd as xt,be as pt,bf as yt,S as ft,e as bt,m as ya,ad as kt,I as wt,U as ye,bg as vt,bh as jt,bi as Nt,bj as Ct,bk as St,bl as _t,i as Pt,aZ as Rt,bm as ca,R as Lt,bn as It,bo as fa,bp as Ce,bq as ba,br as ka,bs as Dt,bt as wa,bu as va,bv as $t,bw as Et}from"./main-DADupgLA.js";import{L as Bt}from"./LocalOnlyNotice-k-0-ORjj.js";import{C as Mt}from"./Card-Cjd-ZKzN.js";import{u as Tt,D as Ot,a as Ut,b as zt,c as Ft,d as At,e as Kt}from"./DialogTitle-Btt5G5wB.js";import{u as Qe,t as Vt,a as qt,C as _e}from"./useScrollLock-DO1uWkvz.js";import{I as Ra}from"./info-Cje0RF1w.js";import{u as Ht}from"./useCurrency-CIJjQNSk.js";import{L as ae,P as La,a as Ia,b as Da,c as $a,d as Ea,C as Gt}from"./PopoverPopup-C4YO4_N-.js";import{u as Wt,s as Qt,f as Ba,a as Xt,b as Yt,c as Jt,d as Zt,e as er,g as ar,S as Ma,h as Ta,i as Oa,C as ga,j as Ua,k as za,l as Fa,m as Xe,n as Ye,o as Je}from"./SelectItemText-CTgRQ8ND.js";import{D as Aa}from"./download-zHPmUqi6.js";import"./arrow-up-right-B_p-ZPxR.js";const tr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Ka=Oe("circle-arrow-up",tr);const rr=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ua=Oe("external-link",rr);const sr=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],ir=Oe("flame",sr);const nr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Va=Oe("plus",nr);const or=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ma=Oe("trash-2",or),lr=n.forwardRef(function(r,o){const{render:g,className:c,style:x,id:u,...m}=r,{store:h}=Tt(),y=Qe(u);return h.useSyncedValueWithCleanup("descriptionElementId",y),ea("p",r,{ref:o,props:[{id:y},m]})});function ja({open:a,title:r,description:o,confirmLabel:g,cancelLabel:c,destructive:x=!1,busy:u=!1,onConfirm:m,onCancel:h}){return e.jsx(Ot,{open:a,onOpenChange:y=>{!y&&!u&&h?.()},children:e.jsxs(Ut,{children:[e.jsx(zt,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsx(Ft,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(At,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[e.jsx(Kt,{className:"text-base font-semibold text-oai-black dark:text-white",children:r}),o?e.jsx(lr,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:o}):null,e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"secondary",size:"sm",disabled:u,onClick:()=>h?.(),children:c}),e.jsx(U,{type:"button",size:"sm",disabled:u,onClick:()=>m?.(),className:W(x&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:g})]})]})})]})})}function ha({id:a,value:r,onChange:o,placeholder:g,disabled:c=!1,type:x="text",label:u,error:m,className:h="",...y}){const l=n.useId(),k=a||l,C=m?`${k}-error`:void 0,N=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${c?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${m?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${h}`;return e.jsxs("div",{className:"w-full",children:[u&&e.jsx("label",{htmlFor:k,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:u}),e.jsx("input",{id:k,type:x,value:r,onChange:o,placeholder:g,disabled:c,"aria-invalid":m?!0:void 0,"aria-describedby":C,className:N,...y}),m&&e.jsx("p",{id:C,className:"mt-1.5 text-sm text-oai-error",children:m})]})}const qa=n.forwardRef(function(r,o){const{render:g,className:c,style:x,...u}=r,{store:m}=Wt(),y={open:nt(m,Qt.open)};return ea("span",r,{state:y,ref:o,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:Vt})}),dr="tt:hint:dismissed:";function Ha(a){return dr+a}function cr(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ha(a))==="1"}catch{return!1}}function ur({id:a,children:r,className:o,ariaLabel:g}){const[c,x]=n.useState(()=>cr(a)),u=n.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(Ha(a),"1")}catch{}x(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":g||s("hint.dismissible_aria"),className:W("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",o),children:[e.jsx("button",{type:"button",onClick:u,"aria-label":s("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(Ra,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:r})]})]})}function gr(a){if(!a)return null;for(const r of a.elements){const o=r.tagName;if(o==="BUTTON"||o==="INPUT"){const g=r;if(g.type==="submit")return g}}return null}let Na=(function(a){return a.checked="data-checked",a.unchecked="data-unchecked",a.indeterminate="data-indeterminate",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a})({});function Ga(a){return n.useMemo(()=>({checked(r){return a.indeterminate?{}:r?{[Na.checked]:""}:{[Na.unchecked]:""}},...Ba}),[a.indeterminate])}const mr=n.createContext({disabled:!1});function hr(){return n.useContext(mr)}function xr(a,r,o,g=!0,c){const[x,u]=n.useState(),m=Qe(c?`${c}-label`:void 0),h=a??r??x;return da(()=>{const y=a||r||!g?void 0:pr(o.current,m);x!==y&&u(y)}),h}function pr(a,r){const o=yr(a);if(o)return!o.id&&r&&(o.id=r),o.id||void 0}function yr(a){if(!a)return;const r=a.parentElement;if(r&&r.tagName==="LABEL")return r;const o=a.id;if(o){const c=a.nextElementSibling;if(c&&c.htmlFor===o)return c}const g=a.labels;return g&&g[0]}const fr=n.createContext(void 0);function br(a=!0){const r=n.useContext(fr);if(r===void 0&&!a)throw new Error(Pa(3));return r}const Wa=n.createContext(void 0);function kr(){const a=n.useContext(Wa);if(a===void 0)throw new Error(Pa(14));return a}const wr="data-parent",vr=n.forwardRef(function(r,o){const{checked:g,className:c,defaultChecked:x=!1,"aria-labelledby":u,disabled:m=!1,form:h,id:y,indeterminate:l=!1,inputRef:k,name:C,onCheckedChange:w,parent:v=!1,readOnly:f=!1,render:N,required:D=!1,uncheckedValue:z,value:Q,nativeButton:F=!1,style:de,...j}=r,{clearErrors:te}=Xt(),{disabled:$,name:H,setDirty:X,setFilled:re,setFocused:A,setTouched:fe,state:be,validationMode:Ue,validityData:Pe,shouldValidateOnChange:ze,validation:Fe}=Yt(),M=hr(),{labelId:se,controlId:Re,registerControlId:Y,getDescriptionProps:ke}=Jt(),S=br(),ie=S?.parent,ne=ie&&S.allValues,J=$||M.disabled||S?.disabled||m,Z=H??C,P=Q??Z,xe=Qe(),aa=Qe();let G=Re;ne?G=v?aa:`${ie.id}-${P}`:y&&(G=y);let we={};ne&&(v?we=S.parent.getParentProps():P&&(we=S.parent.getChildProps(P)));const{checked:ve=g,indeterminate:ce=l,onCheckedChange:je,...Ne}=we,T=S?.value,pe=S?.setValue,ue=S?.defaultValue,ge=n.useRef(null),oe=ot(()=>Symbol("checkbox-control")),Le=n.useRef(!1),{getButtonProps:Ae,buttonRef:Ke}=lt({disabled:J,native:F}),I=S?.validation??Fe,[E,ta]=Zt({controlled:P&&T&&!v?T.includes(P):ve,default:P&&ue&&!v?ue.includes(P):x,name:"Checkbox",state:"checked"});da(()=>{Y!==xa&&(Le.current=!0,Y(oe.current,G))},[G,Y,oe]),n.useEffect(()=>{const b=oe.current;return()=>{!Le.current||Y===xa||(Le.current=!1,Y(b,void 0))}},[Y,oe]),er(ge,xe,E,void 0,!S);const le=n.useRef(null),Ve=dt(k,le,I.inputRef),Ie=xr(u,se,le,!F,G??void 0);da(()=>{le.current&&(le.current.indeterminate=ce,E&&re(!0))},[E,ce,re]),ar(E,()=>{S&&!v||(te(Z),re(E),X(E!==Pe.initialValue),ze()?I.commit(E):I.commit(E,!0))});const ra=ct({checked:E,disabled:J,form:h,name:v?void 0:Z,id:F?void 0:G??void 0,required:D,ref:Ve,style:Z?gt:mt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(f){b.preventDefault();return}const K=b.currentTarget.checked,me=ht(xt,b.nativeEvent);if(je?.(K,me),w?.(K,me),!me.isCanceled&&(ta(K),P&&T&&pe&&!v&&!ne)){const R=K?[...T,P]:T.filter(V=>V!==P);pe(R,me)}},onFocus(){ge.current?.focus()}},Q!==void 0?{value:(S?E&&Q:Q)||""}:ut,ke,S?I.getValidationProps:I.getInputValidationProps),De=ne?!!ve:E,qe=ne&&ce||l;n.useEffect(()=>{if(!ie||!P)return;const b=ie.disabledStatesRef.current;return b.set(P,J),()=>{b.delete(P)}},[ie,J,P]);const $e=n.useMemo(()=>({...be,checked:De,disabled:J,readOnly:f,required:D,indeterminate:qe}),[be,De,J,f,D,qe]),sa=Ga($e),ia=ea("span",r,{state:$e,ref:[Ke,ge,o,S?.registerControlRef],props:[{id:F?G??void 0:xe,role:"checkbox","aria-checked":ce?"mixed":E,"aria-readonly":f||void 0,"aria-required":D||void 0,"aria-labelledby":Ie,[wr]:v?"":void 0,onFocus(){A(!0)},onBlur(){const b=le.current;b&&(fe(!0),A(!1),Ue==="onBlur"&&I.commit(S?T:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const K=le.current?.form??null,me=b.currentTarget,R=b.nativeEvent,V=b.preventDefault,Ee=R.preventDefault;let Be=!1;b.preventDefault=()=>{Be=!0,V.call(b)},R.preventDefault=()=>{Be=!0,Ee.call(R)},Ee.call(R),pa(me).queueMicrotask(()=>{b.preventDefault=V,R.preventDefault=Ee,Be||gr(K)?.click()})},onClick(b){if(f||J)return;b.preventDefault();const K=le.current;K&&K.dispatchEvent(new(pa(K)).PointerEvent("click",{bubbles:!0,shiftKey:b.shiftKey,ctrlKey:b.ctrlKey,altKey:b.altKey,metaKey:b.metaKey}))}},ke,I.getValidationProps,j,Ne,Ae],stateAttributesMapping:sa});return e.jsxs(Wa.Provider,{value:$e,children:[ia,!E&&!S&&Z&&!v&&z!==void 0&&e.jsx("input",{type:"hidden",form:h,name:Z,value:z}),e.jsx("input",{...ra,suppressHydrationWarning:!0})]})}),jr=n.forwardRef(function(r,o){const{render:g,className:c,style:x,keepMounted:u=!1,...m}=r,h=kr(),y=h.checked||h.indeterminate,{mounted:l,transitionStatus:k,setMounted:C}=qt(y),w=n.useRef(null),v={...h,transitionStatus:k};pt({open:y,ref:w,onComplete(){y||C(!1)}});const N={...Ga(h),...yt,...Ba},D=u||l,z=ea("span",r,{ref:[o,w],state:v,stateAttributesMapping:N,props:m});return D?z:null});function Nr(a,r){return`target:${a}:${r}`}function Cr(a){return`remove:${a.id||a.directory}`}function Qa(a){if(!a)return null;const r=new Date(a).getTime();return Number.isFinite(r)?Math.floor((Date.now()-r)/864e5):null}function Sr(a){const r=Qa(a);if(r==null)return null;if(r<=0)return s("skills.usage.today");if(r<30)return s("skills.usage.days_ago",{days:r});const o=Math.max(1,Math.floor(r/30));return s("skills.usage.months_ago",{months:o})}function _r(a){const r=Qa(a);return r==null?"bg-oai-gray-300 dark:bg-oai-gray-600":r<=7?"bg-emerald-500":r<=30?"bg-amber-500":"bg-oai-gray-300 dark:bg-oai-gray-600"}function oa({label:a,children:r}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[e.jsx("dt",{className:"flex items-center gap-1 text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"text-right font-medium tabular-nums text-oai-black dark:text-white",children:r})]})}function Pr({skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:x,onUpdate:u,onClose:m,onToggleTarget:h,onRemove:y}){return e.jsx(ft,{children:a?e.jsx(Rr,{skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:x,onUpdate:u,onClose:m,onToggleTarget:h,onRemove:y},a.id||a.directory):null})}function Rr({skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:x,onUpdate:u,onClose:m,onToggleTarget:h,onRemove:y}){const l=bt(),{currency:k,rate:C}=Ht(),w=n.useRef(null);n.useEffect(()=>{const j=$=>{$.key==="Escape"&&($.stopPropagation(),m?.())},te=$=>{const H=$.target;H instanceof Element&&(w.current?.contains(H)||H.closest('[data-skill-row="1"]')||m?.())};return document.addEventListener("keydown",j),document.addEventListener("mousedown",te),()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousedown",te)}},[m]);const v=a.name||a.directory,f=!!(a.repoOwner&&a.repoName),N=f?`https://github.com/${a.repoOwner}/${a.repoName}`:null,D=new Set(a.targets||[]),z=o===Cr(a),Q=Sr(g?.lastUsedAt),F=!!(g&&g.invocations>0),de=l?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(ya.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:l?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:l?0:.15},onClick:m,"aria-hidden":!0}),e.jsxs(ya.aside,{ref:w,role:"complementary","aria-label":v,initial:l?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:l?{opacity:0}:{opacity:0,x:24,scale:.98},transition:de,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[e.jsxs("header",{className:"flex items-center gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:v,children:v}),f?e.jsxs("a",{href:N,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:N,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(ua,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==v?e.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:a.directory,children:a.directory}):null]}),e.jsx("button",{type:"button",onClick:m,"aria-label":s("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[c?e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-xl bg-sky-50/80 px-3 py-2.5 ring-1 ring-sky-200 dark:bg-sky-950/30 dark:ring-sky-800/60",children:[e.jsx(Ka,{className:"h-4 w-4 shrink-0 text-sky-600 dark:text-sky-300","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 text-xs text-sky-800 dark:text-sky-200",children:s("skills.update.available")}),e.jsxs("button",{type:"button",onClick:()=>u?.(a),disabled:x,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-md bg-sky-600 px-2.5 text-xs font-semibold text-white transition hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-400/40 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-sky-500 dark:hover:bg-sky-400",children:[x?e.jsx(ae,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,s("skills.update.action")]})]}):null,a.description?e.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a.description}):null,e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.usage.section_title")}),e.jsxs("dl",{className:"divide-y divide-oai-gray-200/60 dark:divide-white/[0.06]",children:[e.jsx(oa,{label:s("skills.usage.invocations"),children:kt(g?.invocations||0)}),e.jsx(oa,{label:s("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:W("h-1.5 w-1.5 rounded-full",_r(g?.lastUsedAt)),"aria-hidden":!0}),F?Q||s("skills.usage.unknown"):s("skills.usage.never")]})}),e.jsx(oa,{label:e.jsxs(e.Fragment,{children:[s("skills.usage.cost"),e.jsx("span",{title:s("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(Ra,{className:"h-3 w-3","aria-label":s("skills.usage.disclaimer")})})]}),children:wt(g?.cost||0,{currency:k,rate:C})})]}),F?null:e.jsx("p",{className:"mt-2 text-[11px] leading-4 text-oai-gray-400 dark:text-oai-gray-500",children:s("skills.usage.unused")})]}),e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.detail.sync_section_title")}),e.jsx("div",{children:(r||[]).map(j=>{const te=D.has(j.id),$=o===Nr(a.id,j.id),H=`skill-detail-sync-${a.id||a.directory}-${j.id}`;return e.jsxs("label",{htmlFor:H,className:"-mx-2 flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-sm text-oai-black transition-colors hover:bg-oai-gray-100/70 dark:text-white dark:hover:bg-white/[0.05]",children:[e.jsx(vr,{id:H,checked:te,disabled:$,onCheckedChange:X=>h?.(a,j.id,!!X),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:e.jsx(jr,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(_e,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center","aria-hidden":!0,children:e.jsx(ye,{provider:j.id,size:16})}),e.jsx("span",{className:"flex-1",children:j.label}),$?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},j.id)})})]})]}),e.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[e.jsxs("button",{type:"button",onClick:()=>y?.(a),disabled:z,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[z?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("skills.detail.remove_button")]}),e.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.detail.remove_confirm_hint")})]})]})]})}const Lr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),la=["claude","codex"],O="popular",Ir={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},he="all",B="skillssh";function Ze(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Xa(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function Dr(a){return Xa(a).split("/").filter(Boolean).pop()||""}function $r(a){if(a.repoOwner||a.repoName)return"";const r=Xa(a.directory);return!r||r.includes("/")?"":`dir:${r}`}function Ca(a){const r=Dr(a.directory);return r?`dir:${r}`:""}function Sa(a){const r=new Set([Ze(a).toLowerCase()]);a.repoOwner&&a.repoName&&r.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const o=$r(a);return o&&r.add(o),r}function We(a){return`install:${Ze(a)}`}function _a(a){return`remove:${a.id||a.directory}`}function Ya(a,r){return`target:${a}:${r}`}function Er({target:a,state:r,busy:o,onToggle:g}){const c=r==="synced",x=r==="orphan",u=x?s("skills.dot.orphan_aria",{agent:a.label}):c?s("skills.dot.synced_aria",{agent:a.label}):s("skills.dot.off_aria",{agent:a.label});return e.jsxs("button",{type:"button",title:u,"aria-label":u,"aria-pressed":c,disabled:o,onClick:m=>{m.stopPropagation(),g?.(a.id,!c)},className:"relative flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/40 disabled:cursor-not-allowed dark:hover:bg-oai-gray-800/60",children:[o?e.jsx(ae,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:W("flex h-[18px] w-[18px] items-center justify-center transition",c&&Ir[a.id],!c&&!x&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(ye,{provider:a.id,size:18})}),x&&!o?e.jsx("span",{className:"absolute -bottom-px -right-px h-2 w-2 rounded-full bg-amber-500 ring-2 ring-oai-white dark:ring-oai-gray-900","aria-hidden":!0}):null]})}function Br({skill:a,targets:r,onToggleTarget:o,busyKey:g}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:r.map(c=>e.jsx(Er,{target:c,state:a.targetStates?.[c.id]||"off",busy:g===Ya(a.id,c.id),onToggle:(x,u)=>o?.(a,x,u)},c.id))})}function Mr({skill:a,targets:r,selected:o,onSelect:g,selectable:c,checked:x,onToggleSelect:u,onToggleTarget:m,hasUpdate:h,busyKey:y}){const l=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,k=l?`${a.directory} · ${l}`:a.directory,C=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),g?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":o,"aria-label":s("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>g?.(a),onKeyDown:C,className:W("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",o?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":x?"bg-oai-gray-50 dark:bg-oai-gray-900/40":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[c?e.jsx("label",{className:"flex shrink-0 items-center",onClick:w=>w.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:x,onChange:w=>u?.(a,w.target.checked),"aria-label":s("skills.select.row_aria",{name:a.name||a.directory}),className:"h-4 w-4 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white"})}):null,e.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-oai-black dark:text-white",title:k,children:a.name||a.directory}),h?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-sky-50 px-1.5 py-0.5 text-[10px] font-semibold text-sky-700 ring-1 ring-sky-200 dark:bg-sky-950/40 dark:text-sky-300 dark:ring-sky-800/60",children:[e.jsx(Ka,{className:"h-2.5 w-2.5","aria-hidden":!0}),s("skills.update.badge")]}):null,e.jsx(Br,{skill:a,targets:r,onToggleTarget:m,busyKey:y}),e.jsx(Gt,{className:W("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",o&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]}),a.description?e.jsx("p",{className:W("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",c&&"pl-7"),children:a.description}):null]})}function Tr({agentFilter:a,agentOptions:r,onAgentFilter:o,filteredCount:g,totalCount:c,anyFilter:x,onClearFilters:u,searchQuery:m,onSearchQuery:h,searchPlaceholder:y}){return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsxs(Ma,{value:a,onValueChange:o,children:[e.jsxs(Ta,{"aria-label":s("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[s("skills.filter.agent_label"),":"]}),e.jsx(Oa,{children:l=>l==="all"?s("skills.filter.agent_all"):r.find(k=>k.id===l)?.label||l}),e.jsx(qa,{className:"text-oai-gray-400",children:e.jsx(ga,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ua,{children:e.jsx(za,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Fa,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Xe,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Ye,{children:s("skills.filter.agent_all")}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),r.map(l=>e.jsxs(Xe,{value:l.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{provider:l.id,size:14}),e.jsx(Ye,{children:l.label})]}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},l.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(ca,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ha,{type:"search",value:m,onChange:l=>h(l.target.value),onKeyDown:l=>{l.key==="Escape"&&m&&(l.preventDefault(),h(""))},"aria-label":s("skills.action.search_aria"),placeholder:y,className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:l=>l.preventDefault(),onClick:()=>h(""),"aria-label":s("skills.action.search_clear"),"aria-hidden":!m,tabIndex:m?0:-1,className:W("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out before:absolute before:-inset-1.5 before:content-[''] hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 motion-reduce:transition-none dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",m?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{role:"status","aria-live":"polite",className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.filter.result_count",{filtered:g,total:c})}),x?e.jsxs("button",{type:"button",onClick:u,className:"shrink-0 inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),s("skills.filter.clear")]}):null]})}function Or({count:a,targets:r,busy:o,onBulkSync:g,onBulkRemove:c,onClear:x}){return e.jsxs("div",{role:"toolbar","aria-label":s("skills.select.toolbar_aria"),className:"mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/50",children:[e.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200","aria-live":"polite",children:s("skills.select.count",{count:a})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs(La,{children:[e.jsxs(Ia,{disabled:o,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:[e.jsx(Aa,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("skills.select.bulk_sync"),e.jsx(ga,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Da,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Ea,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.select.bulk_sync_hint")}),r.map(u=>e.jsxs("button",{type:"button",onClick:()=>g(u.id),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx(ye,{provider:u.id,size:16}),e.jsx("span",{className:"flex-1",children:u.label})]},u.id))]})})})]}),e.jsxs(U,{type:"button",variant:"ghost",size:"sm",disabled:o,onClick:c,children:[e.jsx(ma,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:x,className:"inline-flex h-7 items-center gap-1 rounded-full px-2 text-[11px] font-medium text-oai-gray-500 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),s("skills.select.clear")]})]})]})}function Ur({items:a,totalCount:r,targets:o,agentOptions:g,agentFilter:c,onAgentFilter:x,anyFilter:u,onClearFilters:m,searchQuery:h,onSearchQuery:y,searchPlaceholder:l,selectedId:k,onSelect:C,onToggleTarget:w,busyKey:v,updates:f,selectedIds:N,onToggleSelect:D,onClearSelection:z,onBulkSync:Q,onBulkRemove:F}){const de=N.size;return e.jsxs("div",{children:[de>0?e.jsx(Or,{count:de,targets:o,busy:v==="batch",onBulkSync:Q,onBulkRemove:F,onClear:z}):e.jsx(Tr,{agentFilter:c,agentOptions:g,onAgentFilter:x,filteredCount:a.length,totalCount:r,anyFilter:u,onClearFilters:m,searchQuery:h,onSearchQuery:y,searchPlaceholder:l}),a.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:s("skills.empty.no_match")}),e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:m,children:s("skills.filter.clear")})]}):e.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(j=>e.jsx(Mr,{skill:j,targets:o,selected:k===(j.id||j.directory),onSelect:C,selectable:!0,checked:N.has(j.id),onToggleSelect:D,onToggleTarget:w,hasUpdate:!!(j.id&&f?.[j.id]),busyKey:v},j.id||j.key))})]})}const zr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Fr=Lt.memo(function({skill:r,installed:o,installing:g,allTargets:c,defaultTargets:x,onInstall:u,onManage:m}){const[h,y]=n.useState(()=>(x||[]).filter(f=>c.some(N=>N.id===f))),l=f=>{y(N=>N.includes(f)?N.filter(D=>D!==f):[...N,f])},k=r.repoOwner&&r.repoName?`${r.repoOwner}/${r.repoName}`:null,C=k?`https://github.com/${r.repoOwner}/${r.repoName}`:null,w=r.installs!=null?s("skills.card.installs",{count:Number(r.installs||0).toLocaleString()}):null,v=h.length?h.map(f=>c.find(N=>N.id===f)?.label||f).join(", "):s("skills.action.choose_targets");return e.jsxs(Mt,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[r.readmeUrl?e.jsxs("a",{href:r.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:r.readmeUrl,children:[e.jsx("span",{className:"truncate",children:r.name||r.directory}),e.jsx(ua,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:r.name||r.directory}),k||w?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[C?e.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",onClick:f=>f.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:C,children:[e.jsx("span",{className:"truncate",children:k}),e.jsx(ua,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,k&&w?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,w?e.jsx("span",{className:"truncate",children:w}):null]}):null]})}),r.description?e.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:r.description}):null,e.jsx("div",{className:"mt-auto pt-5",children:o?e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>m?.(r),className:"w-full",children:[e.jsx(_e,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-500 dark:text-emerald-400","aria-hidden":!0}),s("skills.card.manage")]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.card.targets_prefix")}),e.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:h.length?v:s("skills.target.none")}),e.jsxs(La,{children:[e.jsx(Ia,{disabled:g,"aria-label":s("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:s("skills.card.targets_change")}),e.jsx(Da,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Ea,{className:"min-w-[220px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.target.menu_label")}),c.map(f=>{const N=h.includes(f.id);return e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:N,onChange:()=>l(f.id)}),e.jsx(ye,{provider:f.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:f.label})]},f.id)})]})})})]})]}),e.jsxs(U,{type:"button",size:"sm",onClick:()=>u(r,h),disabled:g||h.length===0,className:"w-full",children:[g?e.jsx(ae,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Aa,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("skills.action.install")]})]})})]})});function Ar({repos:a,repoInput:r,onRepoInput:o,busyKey:g,onAdd:c,onRemove:x}){return e.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx(ha,{value:r,onChange:u=>o(u.target.value),placeholder:s("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(U,{type:"button",variant:"secondary",size:"md",onClick:c,disabled:g==="repo:add",className:"shrink-0 whitespace-nowrap",children:[g==="repo:add"?e.jsx(ae,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Va,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),s("skills.repo.add")]})]}),a.length?e.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(u=>{const m=g===`repo:${u.owner}/${u.name}`;return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[u.owner,"/",u.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:u.branch})]}),e.jsxs(U,{type:"button",variant:"ghost",size:"sm",disabled:m,onClick:()=>x(u),className:"shrink-0",children:[m?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:s("skills.repo.remove")})]})]},`${u.owner}/${u.name}`)})}):null]})}function Kr(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function as(){const[a,r]=n.useState(Kr),[o,g]=n.useState({skills:[],targets:[]}),[c,x]=n.useState([]),[u,m]=n.useState([]),[h,y]=n.useState([]),[l,k]=n.useState(he),[C,w]=n.useState(""),[v,f]=n.useState(""),[N,D]=n.useState(""),[z,Q]=n.useState(""),[F,de]=n.useState(""),[j,te]=n.useState(!1),[$,H]=n.useState("all"),[X,re]=n.useState(null),[A,fe]=n.useState(""),[be,Ue]=n.useState(!0),[Pe,ze]=n.useState(!1),[Fe,M]=n.useState(""),[se,Re]=n.useState(null),[Y,ke]=n.useState(null),[S,ie]=n.useState(()=>new Set),[ne,J]=n.useState({}),[Z,P]=n.useState({}),[xe,aa]=n.useState([]),[G,we]=n.useState(!1),ve=n.useRef(!1),ce=n.useMemo(()=>{const t=new Set;for(const i of o.skills||[])for(const d of Sa(i))t.add(d);return t},[o.skills]),je=n.useCallback(async()=>{const t=await vt();g({skills:t.skills||[],targets:t.targets||[]})},[]),Ne=n.useCallback(async()=>{const t=await jt();y(t.repos||[])},[]),T=n.useCallback(async({force:t=!1}={})=>{ze(!0);try{const i=await Nt({force:t});x(i.skills||[])}finally{ze(!1)}},[]),pe=n.useCallback(async({force:t=!1}={})=>{we(!0);try{const i=await Ct({force:t});aa(i.skills||[])}finally{we(!1)}},[]),ue=n.useCallback(async()=>{try{const t=await St();J(t?.updates||{})}catch{J({})}},[]),ge=n.useCallback(async()=>{try{const t=await _t(),i={};for(const d of t?.skills||[])d.installed&&(d.directory&&(i[String(d.directory).toLowerCase()]=d),i[String(d.skill).toLowerCase()]=d);P(i)}catch{P({})}},[]),oe=n.useCallback(async()=>{Ue(!0),M("");try{await Promise.all([je(),Ne()])}catch(t){M(t?.message||s("skills.error.generic"))}finally{Ue(!1)}},[je,Ne]),Le=n.useCallback(async()=>{await oe();const t=i=>M(i?.message||s("skills.error.generic"));a==="my"?(ue(),ge()):l===O?pe({force:!0}).catch(t):l!==B&&T({force:!0}).catch(t)},[T,oe,pe,ue,ge,l,a]);n.useEffect(()=>{oe()},[oe]),n.useEffect(()=>{if(ve.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("skill");if(!i){ve.current=!0;return}const d=o.skills||[];if(!d.length)return;const p=d.find(_=>_.directory===i||_.id===i);p&&(r("my"),re(p.id||p.directory)),ve.current=!0,t.delete("skill");const L=t.toString();window.history.replaceState({},"",`${window.location.pathname}${L?`?${L}`:""}${window.location.hash}`)},[o.skills]),n.useEffect(()=>{a==="browse"&&(l===B||l===O||c.length===0&&T().catch(t=>M(t?.message||s("skills.error.generic"))))},[c.length,T,l,a]),n.useEffect(()=>{a!=="browse"||l!==O||xe.length===0&&pe().catch(t=>M(t?.message||s("skills.error.generic")))},[pe,xe.length,l,a]);const Ae=Object.keys(ne).length>0,Ke=Object.keys(Z).length>0;if(n.useEffect(()=>{a==="my"&&(Ae||ue(),Ke||ge())},[a,Ae,Ke,ue,ge]),n.useEffect(()=>{const t=setTimeout(()=>f(C),200);return()=>clearTimeout(t)},[C]),n.useEffect(()=>{const t=setTimeout(()=>Q(N),120);return()=>clearTimeout(t)},[N]),n.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("tab");if(a==="my"){if(!i)return;t.delete("tab")}else{if(i===a)return;t.set("tab",a)}const d=t.toString(),p=`${window.location.pathname}${d?`?${d}`:""}${window.location.hash}`;window.history.replaceState({},"",p)},[a]),!Lr&&!Pt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(Bt,{})});const I=async(t,i)=>{fe(t),M("");try{await i(),await je()}catch(d){M(d?.message||s("skills.error.generic"))}finally{fe("")}},E=(t,i)=>{const d=(i&&i.length?i:la).filter(p=>(o.targets||[]).some(L=>L.id===p));I(We(t),async()=>{await fa(t,d);const p=d.map(L=>(o.targets||[]).find(_=>_.id===L)?.label||L).join(", ");Ce({title:s("skills.toast.installed",{name:t.name||t.directory,targets:p||s("skills.target.none")}),timeout:4e3})})},ta=t=>{Re(t)},le=()=>{const t=se;t&&(Re(null),I(_a(t),async()=>{let i=null;t.managed?i=await ba(t.id):await ka(t.directory,t.targets||[]);const d=!!(i?.trashed&&t.managed&&t.id);Ce({title:s("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:d?{onUndo:async()=>{try{await Dt(t.id),await je()}catch(p){M(p?.message||s("skills.error.generic"))}}}:void 0})}))},Ve=(t,i,d)=>I(Ya(t.id,i),async()=>{const p=new Set(t.targets||[]);d?p.add(i):p.delete(i),t.managed?await wa(t.id,Array.from(p)):await va(t.directory,Array.from(p));const L={name:t.name||t.directory,agent:De(i)};Ce({title:d?s("skills.toast.synced_one",L):s("skills.toast.unsynced_one",L),timeout:3e3})}),Ie=n.useCallback(()=>ie(new Set),[]),ra=n.useCallback((t,i)=>{ie(d=>{const p=new Set(d);return i?p.add(t.id):p.delete(t.id),p})},[]),De=t=>(o.targets||[]).find(i=>i.id===t)?.label||t,qe=t=>{const i=(o.skills||[]).filter(d=>S.has(d.id));i.length&&I("batch",async()=>{for(const d of i){const p=new Set(d.targets||[]);p.add(t),d.managed?await wa(d.id,Array.from(p)):await va(d.directory,Array.from(p))}Ie(),Ce({title:s("skills.toast.bulk_synced",{count:i.length,agent:De(t)}),timeout:4e3})})},$e=()=>{const t=(o.skills||[]).filter(i=>S.has(i.id));t.length&&ke(t)},sa=()=>{const t=Y;t&&(ke(null),I("batch",async()=>{for(const i of t)i.managed?await ba(i.id):await ka(i.directory,i.targets||[]);Ie(),Ce({title:s("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},ia=t=>{!t?.repoOwner||!t?.repoName||I(We(t),async()=>{await fa({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:la),await ue(),Ce({title:s("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},b=async()=>{const t=C.trim();if(!(t.length<2)){fe("search"),M("");try{const i=await It(t);m(i.skills||[])}catch(i){M(i?.message||s("skills.error.generic"))}finally{fe("")}}},K=async()=>{const t=F.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[i,d]=t.split("/");if(!i||!d){M(s("skills.repo.invalid"));return}await I("repo:add",async()=>{await Et({owner:i,name:d,branch:"main",enabled:!0}),de(""),await Ne(),await T()})},me=async t=>{await I(`repo:${t.owner}/${t.name}`,async()=>{await $t(t.owner,t.name),await Ne(),await T()})},R=o.targets||[],V=o.skills||[],Ee=n.useMemo(()=>{const t=$==="all"?V:V.filter(d=>(d.targets||[]).includes($)),i=z.trim().toLowerCase();return i?t.filter(d=>(d.name||"").toLowerCase().includes(i)||(d.directory||"").toLowerCase().includes(i)||(d.description||"").toLowerCase().includes(i)):t},[V,$,z]),Be=$!=="all",ee=n.useMemo(()=>X&&V.find(t=>(t.id||t.directory)===X)||null,[V,X]),Ja=n.useCallback(()=>{H("all"),D("")},[]),Za=n.useCallback(t=>{re(i=>{const d=t?.id||t?.directory||null;return i===d?null:d})},[]),et=n.useCallback(()=>re(null),[]),at=n.useCallback(t=>{const i=Ze(t).toLowerCase(),d=Ca(t),p=(o.skills||[]).find(L=>{const _=Sa(L);return _.has(i)||d&&_.has(d)});p&&re(p.id||p.directory)},[o.skills]);n.useEffect(()=>{a!=="my"&&S.size&&ie(new Set)},[a,S.size]),n.useEffect(()=>{X&&!ee&&re(null)},[ee,X]);const Me=n.useMemo(()=>{const t=l===B?u:l===O?xe:c,d=l===B||l===O||l===he?t:t.filter(_=>`${_.repoOwner}/${_.repoName}`===l),p=v.trim().toLowerCase();return(l===B||!p?d:d.filter(_=>(_.name||"").toLowerCase().includes(p)||(_.directory||"").toLowerCase().includes(p)||(_.description||"").toLowerCase().includes(p))).map(_=>{const na=Ze(_).toLowerCase(),q=Ca(_);return{..._,installed:ce.has(na)||q&&ce.has(q)}})},[v,c,ce,xe,u,l]),tt=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(ae,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),rt=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(ae,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.browse.loading_hint")})]}),He=(t,i=null)=>e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:s(t)}),i]});let Ge;if(be)Ge=tt;else if(a==="my")Ge=V.length?e.jsx(Ur,{items:Ee,totalCount:V.length,targets:R,agentOptions:R,agentFilter:$,onAgentFilter:H,anyFilter:Be,onClearFilters:Ja,searchQuery:N,onSearchQuery:D,searchPlaceholder:s("skills.my.placeholder"),selectedId:X,onSelect:Za,onToggleTarget:Ve,busyKey:A,updates:ne,selectedIds:S,onToggleSelect:ra,onClearSelection:Ie,onBulkSync:qe,onBulkRemove:$e}):e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[R.length>0?e.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...R,...R].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ye,{provider:t.id,size:30})},`b-${i}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...R,...R].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ye,{provider:t.id,size:30})},`c-${i}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.empty.my")}),e.jsx(U,{type:"button",size:"sm",onClick:()=>r("browse"),children:s("skills.empty.my_cta")})]});else{const t=l===B,i=l===O,d=h.length===0&&!t&&!i,p=Pe&&!t&&!i||i&&G,L=!t&&!i&&(v.trim()!==""||l!==he),_=()=>{w(""),k(he)},na=!d&&!p&&(Me.length>0||L)?e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:s("skills.filter.result_count_browse",{count:Me.length})}),L?e.jsxs("button",{type:"button",onClick:_,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),s("skills.filter.clear")]}):null]}):null;let q;d?q=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:s("skills.browse.empty_sources")})}):p?q=rt:t&&C.trim().length<2?q=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:s("skills.browse.hint_skillssh")}):Me.length?q=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Me.map(Te=>e.jsx("div",{style:zr,children:e.jsx(Fr,{skill:Te,installed:!!Te.installed,installing:A===We(Te),allTargets:R,defaultTargets:la,onInstall:E,onManage:at})},Te.id||Te.key))}):L?q=He("skills.empty.no_match",e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:_,children:s("skills.filter.clear")})):t?q=He("skills.empty.search"):i?q=He("skills.empty.popular"):q=He("skills.empty.browse");const st=d||j?e.jsx("div",{className:"mb-5",children:e.jsx(Ar,{repos:h,repoInput:F,onRepoInput:de,busyKey:A,onAdd:K,onRemove:me})}):null,it=!j&&!t&&!i&&h.length<=1&&Me.length>0?e.jsx(ur,{id:"skills-browse-intro",className:"mt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{children:s("skills.browse.add_repo_hint")}),e.jsx("button",{type:"button",onClick:()=>te(!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;Ge=e.jsxs(e.Fragment,{children:[st,na,q,it]})}return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("skills.page.title")}),e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:Le,disabled:be||Pe||G,children:[e.jsx(Rt,{className:W("mr-1.5 h-3.5 w-3.5",(be||Pe||G)&&"animate-spin"),"aria-hidden":!0}),s("skills.action.refresh")]})]}),e.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",s("skills.tab.my")],["browse",s("skills.tab.browse")]].map(([t,i])=>e.jsx("button",{type:"button","aria-pressed":a===t,onClick:()=>r(t),className:W("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",a===t?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:i},t))}),Fe?e.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:Fe}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("div",{role:"tablist","aria-label":s("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",s("skills.mode.repo"),l!==B&&l!==O],["popular",s("skills.mode.popular"),l===O],["skillssh",s("skills.mode.skillssh"),l===B]].map(([t,i,d])=>e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>{t==="skillssh"?k(B):t==="popular"?k(O):(l===B||l===O)&&k(he)},className:W("inline-flex items-center gap-1.5 rounded px-3 py-1 text-sm font-medium transition-colors",d?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:[t==="popular"?e.jsx(ir,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,i]},t))}),l!==B&&l!==O?e.jsxs(Ma,{value:l,onValueChange:k,children:[e.jsxs(Ta,{"aria-label":s("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Oa,{children:t=>t===he?s("skills.source.all"):t}),e.jsx(qa,{className:"text-oai-gray-400",children:e.jsx(ga,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsx(Ua,{children:e.jsx(za,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Fa,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Xe,{value:he,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Ye,{children:s("skills.source.all")}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),h.map(t=>{const i=`${t.owner}/${t.name}`;return e.jsxs(Xe,{value:i,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Ye,{children:i}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},i)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ca,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ha,{type:"search",value:C,onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Enter"&&l===B&&b()},"aria-label":s("skills.action.search_aria"),placeholder:l===B?s("skills.browse.placeholder_skillssh"):l===O?s("skills.browse.placeholder_popular"):l===he?s("skills.browse.placeholder_all"):s("skills.browse.placeholder_repo",{repo:l}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),l===B?e.jsxs(U,{type:"button",onClick:b,disabled:C.trim().length<2||A==="search",className:"focus:!ring-oai-gray-400/30",children:[A==="search"?e.jsx(ae,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(ca,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),s("skills.action.search")]}):l===O?null:e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>te(t=>!t),"aria-expanded":j,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("skills.browse.manage_sources"),e.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:h.length})]})]}):null,Ge,e.jsx(Pr,{skill:ee,targets:R,busyKey:A,usage:ee&&(Z[String(ee.directory||"").toLowerCase()]||Z[String(ee.name||"").toLowerCase()])||null,hasUpdate:!!(ee?.id&&ne?.[ee.id]),updating:ee?A===We(ee):!1,onUpdate:ia,onClose:et,onToggleTarget:Ve,onRemove:ta})]})}),e.jsx(ja,{open:!!se,title:s("skills.confirm.remove_title",{name:se?.name||se?.directory||""}),description:se?se.managed?s("skills.confirm.remove_managed"):s("skills.confirm.remove_local"):"",confirmLabel:s("skills.action.remove"),cancelLabel:s("shared.action.cancel"),destructive:!0,busy:A===_a(se||{}),onCancel:()=>Re(null),onConfirm:le}),e.jsx(ja,{open:!!Y,title:s("skills.confirm.bulk_remove_title",{count:Y?.length||0}),description:s("skills.confirm.bulk_remove_desc"),confirmLabel:s("skills.action.remove"),cancelLabel:s("shared.action.cancel"),destructive:!0,busy:A==="batch",onCancel:()=>ke(null),onConfirm:sa})]})}export{as as SkillsPage};
import{G as u,r as a,a_ as M,a$ as j,b0 as G,b1 as J}from"./main-DADupgLA.js";const B=["claude","codex","cursor","gemini","kimi","kiro","grok","copilot","antigravity"],q={claude:"CLAUDE",codex:"CODEX",cursor:"CURSOR",gemini:"GEMINI",kimi:"KIMI",kiro:"KIRO",grok:"GROK",copilot:"COPILOT",antigravity:"ANTIGRAVITY"};function se(e){return q[e]||null}function ae(e){switch(e){case"claude":return u("limits.provider.claude");case"codex":return u("limits.provider.codex");case"cursor":return u("limits.provider.cursor");case"gemini":return u("limits.provider.gemini");case"kimi":return u("limits.provider.kimi");case"kiro":return u("limits.provider.kiro");case"grok":return u("limits.provider.grok");case"copilot":return u("limits.provider.copilot");case"antigravity":return u("limits.provider.antigravity");default:return String(e||"")}}const y=B,A="tt.limits.providerOrder",E="tt.limits.providerVisibility",h="tt.limits.displayMode",O="tt.limits.updatedAt",V="limitsPreferences",F="limitsDisplayMode",v=Object.freeze({USED:"used",REMAINING:"remaining"}),g=new Set(Object.values(v)),L=new Set([A,E,h,O]);function I(){return[...y]}function b(){return Object.fromEntries(y.map(e=>[e,!0]))}function _(e){const r=[];if(Array.isArray(e))for(const n of e)y.includes(n)&&!r.includes(n)&&r.push(n);for(const n of y)r.includes(n)||r.push(n);return r}function N(e){const r=b();if(!e||typeof e!="object"||Array.isArray(e))return r;for(const n of y)typeof e[n]=="boolean"&&(r[n]=e[n]);return r}function X(e){return g.has(e)?e:v.USED}function m(e){if(e!=null){if(typeof e=="number")return Number.isSafeInteger(e)?e:void 0;if(typeof e=="string"){const r=e.trim();if(r==="")return;const n=Number(r);return Number.isSafeInteger(n)?n:void 0}}}function w(e={}){const r=e&&typeof e=="object"?e:{};return{displayMode:X(r.displayMode),providerOrder:_(r.providerOrder),providerVisibility:N(r.providerVisibility),updatedAt:m(r.updatedAt)}}function $(){if(typeof window>"u")return I();try{const e=window.localStorage.getItem(A);return _(e?JSON.parse(e):void 0)}catch{return I()}}function H(){if(typeof window>"u")return b();try{const e=window.localStorage.getItem(E);return N(e?JSON.parse(e):void 0)}catch{return b()}}function Q(){if(typeof window>"u")return v.USED;try{const e=window.localStorage.getItem(h);return g.has(e)?e:v.USED}catch{return v.USED}}function W(){if(!(typeof window>"u"))try{return m(window.localStorage.getItem(O))}catch{return}}function Z(){if(typeof window>"u")return!1;try{for(const e of L)if(window.localStorage.getItem(e)!==null)return!0}catch{return!1}return!1}function S(){return w({displayMode:Q(),providerOrder:$(),providerVisibility:H(),updatedAt:W()})}function ee(e){if(typeof window>"u")return;const r=w(e);try{window.localStorage.setItem(A,JSON.stringify(r.providerOrder)),window.localStorage.setItem(E,JSON.stringify(r.providerVisibility)),window.localStorage.setItem(h,r.displayMode),r.updatedAt===void 0?window.localStorage.removeItem(O):window.localStorage.setItem(O,String(r.updatedAt))}catch(n){console.warn("[tokentracker] limits preferences localStorage write failed:",n)}}function re(e){const r=w(e);return{displayMode:r.displayMode,providerOrder:[...r.providerOrder],providerVisibility:{...r.providerVisibility},updatedAt:r.updatedAt??null}}function te(...e){let r;for(const s of e){const l=m(s);l!==void 0&&(r=r===void 0?l:Math.max(r,l))}const n=Date.now();return r!==void 0&&n<=r?r+1:n}function ie(e,r){return e.length===r.length&&e.every((n,s)=>n===r[s])}function ne(e,r){return y.every(n=>e[n]===r[n])}function R(e,r){return e.displayMode===r.displayMode&&ie(e.providerOrder,r.providerOrder)&&ne(e.providerVisibility,r.providerVisibility)}function oe(e,r){return R(e,r)&&m(e.updatedAt)===m(r.updatedAt)}function k(e,r){const n=m(e.updatedAt),s=m(r.updatedAt);return n!==void 0&&(s===void 0||n>s)}function ce(){const[e,r]=a.useState(S),n=a.useRef(e),s=a.useCallback((o,t={})=>{const i=w(o);return n.current=i,r(i),t.writeLocal&&ee(i),i},[]),l=a.useCallback(o=>{M()&&j(V,re(o))},[]),c=a.useCallback(o=>{const t=S(),i=k(t,n.current)?s(t):n.current,d=w(o(i));if(R(i,d))return;const f=te(t.updatedAt,i.updatedAt),p=s({...d,updatedAt:f},{writeLocal:!0});l(p)},[s,l]),P=a.useCallback(o=>{g.has(o)&&c(t=>({...t,displayMode:o}))},[c]),D=a.useCallback(o=>{if(!g.has(o))return;const t=S();if(t.updatedAt!==void 0){s(t);return}s({...t,displayMode:o,updatedAt:void 0},{writeLocal:!0})},[s]);a.useEffect(()=>{if(!M())return;const o=G(t=>{const i=t?.[V];if(i&&typeof i=="object"){const d=w(i);if(!Z()){s(d,{writeLocal:!0});return}const f=S();if(k(d,f))s(d,{writeLocal:!0});else{const p=s(f);oe(d,f)||l(p)}return}D(t?.[F])});return J(),o},[D,s,l]),a.useEffect(()=>{if(typeof window>"u")return;const o=t=>{(t.key===null||L.has(t.key))&&s(S())};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[s]);const x=a.useCallback(o=>{y.includes(o)&&c(t=>({...t,providerVisibility:{...t.providerVisibility,[o]:!t.providerVisibility[o]}}))},[c]),C=a.useCallback(o=>{c(t=>{const i=t.providerOrder.indexOf(o);if(i<=0)return t;const d=[...t.providerOrder];return[d[i-1],d[i]]=[d[i],d[i-1]],{...t,providerOrder:d}})},[c]),U=a.useCallback(o=>{c(t=>{const i=t.providerOrder.indexOf(o);if(i<0||i>=t.providerOrder.length-1)return t;const d=[...t.providerOrder];return[d[i],d[i+1]]=[d[i+1],d[i]],{...t,providerOrder:d}})},[c]),T=a.useCallback((o,t)=>{o!==t&&c(i=>{const d=i.providerOrder.indexOf(o),f=i.providerOrder.indexOf(t);if(d<0||f<0)return i;const p=[...i.providerOrder],[z]=p.splice(d,1);return p.splice(f,0,z),{...i,providerOrder:p}})},[c]),Y=a.useCallback(()=>{c(()=>({displayMode:v.USED,providerOrder:I(),providerVisibility:b()}))},[c]),K=a.useMemo(()=>e.providerOrder.filter(o=>e.providerVisibility[o]!==!1),[e.providerOrder,e.providerVisibility]);return{order:e.providerOrder,visibility:e.providerVisibility,displayMode:e.displayMode,setDisplayMode:P,visibleOrdered:K,toggle:x,moveUp:C,moveDown:U,moveToward:T,reset:Y}}export{v as L,B as a,se as b,ae as l,ce as u};
import{j as a,V as x,r as n,aD as g,c4 as m,b0 as b,b1 as u,a$ as f,c3 as h}from"./main-DADupgLA.js";import{C as y}from"./Card-Cjd-ZKzN.js";function k({checked:s,onChange:t,disabled:e,ariaLabel:i}){return a.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":i,onClick:t,disabled:e,className:x("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",s?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:a.jsx("span",{className:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",s?"translate-x-[18px]":"translate-x-[3px]")})})}function p({label:s,hint:t,control:e}){return a.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s}),t?a.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),a.jsx("div",{className:"shrink-0",children:e})]})}function N({title:s,subtitle:t,action:e,children:i}){return a.jsxs(y,{children:[a.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:s}),t?a.jsx("p",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),e?a.jsx("div",{className:"shrink-0",children:e}):null]}),a.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:i})]})}function w({options:s,value:t,onChange:e}){return a.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 bg-oai-gray-50 p-0.5 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:s.map(({value:i,label:d,Icon:l})=>{const r=t===i;return a.jsxs("button",{type:"button",onClick:()=>e(i),"aria-pressed":r,className:x("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors",r?"bg-white text-oai-black shadow-sm dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[l?a.jsx(l,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,a.jsx("span",{children:d})]},i)})})}function S(){const[s,t]=n.useState(null),e=g()&&m();n.useEffect(()=>{if(!e)return;const r=b(o=>t(o));return u(),r},[e]);const i=n.useCallback((r,o)=>{e&&(t(c=>c&&{...c,[r]:o}),f(r,o))},[e]),d=n.useCallback(r=>{e&&h(r)},[e]),l=n.useCallback(()=>{e&&u()},[e]);return{available:e,settings:s,setSetting:i,runAction:d,refresh:l}}export{N as S,k as T,p as a,w as b,S as u};
import{r as a,ab as w,aI as c}from"./main-DADupgLA.js";function v(i){const o=!!i?.initialState,[b,l]=a.useState(()=>o?i?.initialState?.data??null:null),[m,s]=a.useState(()=>o?i?.initialState?.error??null:null),[y,g]=a.useState(!o),u=!!i?.initialRefresh,f=!!i?.publishToPreloadCache,r=a.useCallback((e,t)=>{!f||!e||typeof e!="object"||w(e,{source:t})},[f]),S=a.useCallback(async()=>{try{const e=await c({refresh:!0}),t=e&&typeof e=="object"?e:null;l(t),s(null),r(t,"manual-refresh")}catch(e){s(e?.message||String(e))}},[r]),d=a.useCallback(async()=>{try{const e=await c(),t=e&&typeof e=="object"?e:null;l(t),s(null),r(t,"page-load")}catch(e){s(e?.message||String(e))}},[r]);return a.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const e=15e3;let t=Date.now();const n=()=>{if(document.visibilityState!=="visible")return;const h=Date.now();h-t<e||(t=h,d())};return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[d]),a.useEffect(()=>{if(o&&!u)return;let e=!1;return(async()=>{try{const t=await c();if(e)return;const n=t&&typeof t=="object"?t:null;l(n),s(null),r(n,"page-load")}catch(t){if(e)return;s(t?.message||String(t))}finally{e||g(!1)}})(),()=>{e=!0}},[o,u,r]),{data:b,error:m,isLoading:y,refresh:S}}export{v as u};
import{r as e,c1 as t,c2 as r,K as c}from"./main-DADupgLA.js";const s=Object.freeze({currency:c,rate:1,symbol:"$",rates:{...r},rateSource:"default",rateFetchedAt:null,setCurrency:()=>{}});function a(){return e.useContext(t)??s}export{a as u};
import{c as _t,b5 as St,b3 as G,b6 as Tt,bD as D,d9 as vt,cz as Ot,j as Te,cF as ze,r as f,bB as U,cH as ot,da as Bt,b7 as ct,bA as Ae,c5 as Gt,cG as it,db as wt,bF as x,bE as xe,c0 as Ee,dc as $e,dd as le,cL as ae,bJ as C,bK as Kt,d3 as Ct,cX as Dt,cY as Xt,d6 as xt,c6 as Vt,bX as ut,bS as lt,bU as Ut,de as $t,cM as qt,bG as Re,bW as jt,c_ as zt,b as Me,bP as Jt,df as Je,ba as We,dg as Qt,dh as He,bM as Zt,di as en,bz as Ne,bN as tn,cE as nn,bC as Ce,cv as _e,cu as rn,dj as sn,cs as on,bL as cn,dk as un,bQ as Se,dl as ye,be as ln,b9 as Be,dm as an,dn as at,d0 as fn,cA as Qe}from"./main-DADupgLA.js";const dn=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],jn=_t("check",dn);function Ie(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Ie(e,s.id,n)])}function ft(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(c=>c.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function Ge(e){const t=St(pn,e).current;return t.next=e,G(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let Fe=0;function Ke(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(Fe);function c(){s&&!s()||e?.focus({preventScroll:n})}if(r)return c(),Tt;const o=requestAnimationFrame(c);return Fe=o,()=>{Fe===o&&(cancelAnimationFrame(o),Fe=0)}}const De={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",qe={inert:new WeakSet,"aria-hidden":new WeakSet};let we=new WeakMap,Xe=0;function gn(e){return qe[e]}function It(e){return e?vt(e)?e.host:It(e.parentNode):null}const Ve=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=It(n);return e.contains(r)?r:null}).filter(n=>n!=null),pt=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},gt=(e,t,n)=>{const r=[],s=c=>{!c||n.has(c)||Array.from(c.children).forEach(o=>{Ot(o)!=="script"&&(t.has(o)?s(o):r.push(o))})};return s(e),r};function hn(e,t,n,r,{mark:s=!0,markerIgnoreElements:c=[]}){const o=r?"inert":n?"aria-hidden":null;let u=null,v=null;const M=Ve(t,e),O=s?Ve(t,c):[],A=new Set(O),z=s?gt(t,pt(M),new Set(M)).filter(m=>!A.has(m)):[],w=[],k=[];if(o){const m=De[o],y=gn(o);v=y,u=m;const b=Ve(t,Array.from(t.querySelectorAll("[aria-live]"))),E=M.concat(b);gt(t,pt(E),new Set(E)).forEach(N=>{const Y=N.getAttribute(o),J=Y!==null&&Y!=="false",I=(m.get(N)||0)+1;m.set(N,I),w.push(N),I===1&&J&&y.add(N),J||N.setAttribute(o,o==="inert"?"":"true")})}return s&&z.forEach(m=>{const y=(we.get(m)||0)+1;we.set(m,y),k.push(m),y===1&&m.setAttribute(dt,"")}),Xe+=1,()=>{u&&w.forEach(m=>{const b=(u.get(m)||0)-1;u.set(m,b),b||(!v?.has(m)&&o&&m.removeAttribute(o),v?.delete(m))}),s&&k.forEach(m=>{const y=(we.get(m)||0)-1;we.set(m,y),y||m.removeAttribute(dt)}),Xe-=1,Xe||(De.inert=new WeakMap,De["aria-hidden"]=new WeakMap,qe.inert=new WeakSet,qe["aria-hidden"]=new WeakSet,we=new WeakMap)}}function ht(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0,markerIgnoreElements:c=[]}=t,o=D(e[0]).body;return hn(e,o,n,r,{mark:s,markerIgnoreElements:c})}function kt(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class mn{nodesRef={current:[]};events=kt();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Pt=f.createContext(null),Ft=f.createContext(null),Ze=()=>f.useContext(Pt)?.id||null,et=e=>{const t=f.useContext(Ft);return e??t};function zn(e){const t=ze(),n=et(e),r=Ze();return G(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function Jn(e){const{children:t,id:n}=e,r=Ze();return Te.jsx(Pt.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Qn(e){const{children:t,externalTree:n}=e,r=St(()=>n??new mn).current;return Te.jsx(Ft.Provider,{value:r,children:t})}function bn(e,t){const n=We(Re(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const mt=20;let fe=[];function tt(){fe=fe.filter(e=>e.deref()?.isConnected)}function En(e){tt(),e&&Ot(e)!=="body"&&(fe.push(new WeakRef(e)),fe.length>mt&&(fe=fe.slice(-mt)))}function Ue(){return tt(),fe[fe.length-1]?.deref()}function yn(e){return e?Je(e)?e:wt(e)[0]||e:null}function bt(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=Qt(e).filter(c=>{const o=c.getAttribute("data-tabindex")||"";return Je(c)||c.hasAttribute("data-tabindex")&&!o.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Zn(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:c=!0,restoreFocus:o=!1,modal:u=!0,closeOnFocusOut:v=!0,openInteractionType:M="",nextFocusableElement:O,previousFocusableElement:A,beforeContentFocusGuardRef:z,externalTree:w,getInsideElements:k}=e,m="rootStore"in t?t.rootStore:t,y=m.useState("open"),b=m.useState("domReferenceElement"),E=m.useState("floatingElement"),{events:Z,dataRef:N}=m.context,Y=U(()=>N.current.floatingContext?.nodeId),J=s===!1,I=ot(b)&&J,ee=f.useRef(["content"]),se=Ge(s),P=Ge(c),ie=Ge(M),j=et(w),p=Bt(),$=f.useRef(!1),Q=f.useRef(!1),de=f.useRef(!1),oe=f.useRef(null),te=f.useRef(""),pe=f.useRef(""),ge=f.useRef(null),he=f.useRef(null),ke=ct(ge,z,p?.beforeInsideRef),R=ct(he,p?.afterInsideRef),q=Ae(),ce=Ae(),me=Gt(),Pe=p!=null,g=it(E),K=U((a=g)=>a?wt(a):[]),ne=U(()=>k?.().filter(a=>a!=null)??[]);f.useEffect(()=>{if(r||!u)return;function a(H){H.key==="Tab"&&C(g,ae(D(g)))&&K().length===0&&!I&&qt(H)}const W=D(g);return x(W,"keydown",a)},[r,g,u,I,K]),f.useEffect(()=>{if(r||!y)return;const a=D(g);function W(){de.current=!1}function H(S){const h=Re(S),F=ne(),d=C(E,h)||C(b,h)||C(p?.portalNode,h)||F.some(_=>_===h||C(_,h));de.current=!d,pe.current=S.pointerType||"keyboard",h?.closest(`[${jt}]`)&&(Q.current=!0)}function L(){pe.current="keyboard"}return xe(x(a,"pointerdown",H,!0),x(a,"pointerup",W,!0),x(a,"pointercancel",W,!0),x(a,"keydown",L,!0))},[r,E,b,g,y,p,ne]),f.useEffect(()=>{if(r||!v)return;const a=D(g);function W(){Q.current=!0,ce.start(0,()=>{Q.current=!1})}function H(F){const d=Re(F);Je(d)&&(oe.current=d)}function L(F){const d=F.relatedTarget,_=F.currentTarget,X=Re(F);queueMicrotask(()=>{const be=Y(),V=m.context.triggerElements,Le=ne(),i=d?.hasAttribute($e("focus-guard"))&&[ge.current,he.current,p?.beforeInsideRef.current,p?.afterInsideRef.current,p?.beforeOutsideRef.current,p?.afterOutsideRef.current,le(A),le(O)].includes(d),l=!(C(b,d)||C(E,d)||C(d,E)||C(p?.portalNode,d)||Le.some(T=>T===d||C(T,d))||d!=null&&V.hasElement(d)||V.hasMatchingElement(T=>C(T,d))||i||j&&(Ie(j.nodesRef.current,be).find(T=>C(T.context?.elements.floating,d)||C(T.context?.elements.domReference,d))||ft(j.nodesRef.current,be).find(T=>[T.context?.elements.floating,it(T.context?.elements.floating)].includes(d)||T.context?.elements.domReference===d)));if(_===b&&g&&bt(g,ee),o&&_!==b&&!zt(X)&&ae(a)===a.body){if(Ee(g)&&(g.focus(),o==="popup")){me.request(()=>{g.focus()});return}const T=K(),B=oe.current,ue=(B&&T.includes(B)?B:null)||T[T.length-1]||g;Ee(ue)&&ue.focus()}if(N.current.insideReactTree){N.current.insideReactTree=!1;return}(I||!u)&&d&&l&&!Q.current&&(I||d!==Ue())&&($.current=!0,m.setOpen(!1,Me(Jt,F)))})}function S(){de.current||(N.current.insideReactTree=!0,q.start(0,()=>{N.current.insideReactTree=!1}))}const h=Ee(b)?b:null;if(!(!E&&!h))return xe(h&&x(h,"focusout",L),h&&x(h,"pointerdown",W),E&&x(E,"focusin",H),E&&x(E,"focusout",L),E&&p&&x(E,"focusout",S,!0))},[r,b,E,g,u,j,p,m,v,o,K,I,Y,ee,N,q,ce,me,O,A,ne]),f.useEffect(()=>{if(r||!E||!y)return;const a=Array.from(p?.portalNode?.querySelectorAll(`[${$e("portal")}]`)||[]),H=(j?ft(j.nodesRef.current,Y()):[]).find(_=>ot(_.context?.elements.domReference||null))?.context?.elements.domReference,S=[...[E,...a,ge.current,he.current,p?.beforeOutsideRef.current,p?.afterOutsideRef.current,...ne()],H,le(A),le(O),I?b:null].filter(_=>_!=null),h=ht(S,{ariaHidden:u||I,mark:!1}),F=[E,...a].filter(_=>_!=null),d=ht(F);return()=>{d(),h()}},[y,r,b,E,u,p,I,j,Y,O,A,ne]),G(()=>{if(!y||r||!Ee(g))return;const a=D(g),W=ae(a);queueMicrotask(()=>{const H=se.current,L=typeof H=="function"?H(ie.current||""):H;if(L===void 0||L===!1||C(g,W))return;let h=null;const F=()=>(h==null&&(h=K(g)),h[0]||g);let d;L===!0||L===null?d=F():d=le(L),d=d||F();const _=C(g,ae(a));Ke(d,{preventScroll:d===g,shouldFocus(){if(_)return!0;const X=ae(a);return!(X!==d&&C(g,X))}})})},[r,y,g,K,se,ie]),G(()=>{if(r||!g)return;const a=D(g),W=ae(a);En(W);function H(S){if(S.open||(te.current=bn(S.nativeEvent,pe.current)),S.reason===Kt&&S.nativeEvent.type==="mouseleave"&&($.current=!0),S.reason===Ct)if(S.nested)$.current=!1;else if(Dt(S.nativeEvent)||Xt(S.nativeEvent))$.current=!1;else{let h=!1;D(g).createElement("div").focus({get preventScroll(){return h=!0,!1}}),h?$.current=!1:$.current=!0}}Z.on("openchange",H);function L(){const S=P.current;let h=typeof S=="function"?S(te.current):S;if(h===void 0||h===!1)return null;if(h===null&&(h=!0),typeof h=="boolean")return b?.isConnected?b:Ue()||null;const F=b?.isConnected?b:Ue();return le(h)||F||null}return()=>{Z.off("openchange",H);const S=ae(a),h=ne(),F=C(E,S)||h.some(X=>X===S||C(X,S))||j&&Ie(j.nodesRef.current,Y(),!1).some(X=>C(X.context?.elements.floating,S)),d=P.current,_=L();queueMicrotask(()=>{const X=yn(_),be=typeof d!="boolean";d&&!$.current&&Ee(X)&&(!(!be&&X!==S&&S!==a.body)||F)&&X.focus({preventScroll:!0}),$.current=!1})}},[r,E,g,P,Z,j,b,Y,ne]),G(()=>{if(!xt||y||!E)return;const a=ae(D(E));!Ee(a)||!Vt(a)||C(E,a)&&a.blur()},[y,E]),G(()=>{if(!(r||!p))return p.setFocusManagerState({modal:u,closeOnFocusOut:v,open:y,onOpenChange:m.setOpen,domReference:b}),()=>{p.setFocusManagerState(null)}},[r,p,u,y,m,v,b]),G(()=>{if(!(r||!g))return bt(g,ee),()=>{queueMicrotask(tt)}},[r,g,ee]);const ve=!r&&(u?!I:!0)&&(Pe||u);return Te.jsxs(f.Fragment,{children:[ve&&Te.jsx(ut,{"data-type":"inside",ref:ke,onFocus:a=>{if(u){const W=K();Ke(W[W.length-1])}else p?.portalNode&&($.current=!1,lt(a,p.portalNode)?Ut(b)?.focus():le(A??p.beforeOutsideRef)?.focus())}}),n,ve&&Te.jsx(ut,{"data-type":"inside",ref:R,onFocus:a=>{u?Ke(K()[0]):p?.portalNode&&(v&&($.current=!0),lt(a,p.portalNode)?$t(b)?.focus():le(O??p.afterOutsideRef)?.focus())}})]})}const Rn={intentional:"onClick",sloppy:"onPointerDown"};function Sn(){return!1}function Tn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function er(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:c="sloppy",referencePress:o=Sn,referencePressEvent:u="sloppy",bubbles:v,externalTree:M}=t,O="rootStore"in e?e.rootStore:e,A=O.useState("open"),z=O.useState("floatingElement"),{dataRef:w}=O.context,k=et(M),m=U(typeof s=="function"?s:()=>!1),y=typeof s=="function"?m:s,b=y!==!1,E=U(()=>c),{escapeKey:Z,outsidePress:N}=Tn(v),Y=f.useRef(!1),J=f.useRef(!1),I=f.useRef(!1),ee=f.useRef(!1),se=f.useRef(""),P=f.useRef(null),ie=Ae(),j=Ae(),p=U(()=>{j.clear(),w.current.insideReactTree=!1}),$=U(R=>{const q=w.current.floatingContext?.nodeId;return(k?Ie(k.nodesRef.current,q):[]).some(me=>me.context?.open&&!me.context.dataRef.current[R])}),Q=U(R=>He(R,O.select("floatingElement"))||He(R,O.select("domReferenceElement"))),de=U(R=>{o()&&O.setOpen(!1,Me(Zt,R.nativeEvent))}),oe=U(R=>{if(!A||!n||!r||R.key!=="Escape"||ee.current||!Z&&$("__escapeKeyBubbles"))return;const q=en(R)?R.nativeEvent:R,ce=Me(tn,q);O.setOpen(!1,ce),ce.isCanceled||R.preventDefault(),!Z&&!ce.isPropagationAllowed&&R.stopPropagation()}),te=U(()=>{w.current.insideReactTree=!0,j.start(0,p)}),pe=U(R=>{if(!A||!n||R.button!==0)return;const q=Re(R.nativeEvent);C(O.select("floatingElement"),q)&&(Y.current||(Y.current=!0,J.current=!1))}),ge=U(R=>{!A||!n||(R.defaultPrevented||R.nativeEvent.defaultPrevented)&&Y.current&&(J.current=!0)});f.useEffect(()=>{if(!A||!n)return;w.current.__escapeKeyBubbles=Z,w.current.__outsidePressBubbles=N;const R=new Ne,q=new Ne;function ce(){R.clear(),ee.current=!0}function me(){R.start(nn()?5:0,()=>{ee.current=!1})}function Pe(){I.current=!0,q.start(0,()=>{I.current=!1})}function g(){Y.current=!1,J.current=!1}function K(){const i=se.current,l=i==="pen"||!i?"mouse":i,T=E(),B=typeof T=="function"?T():T;return typeof B=="string"?B:B[l]}function ne(i){const l=K();return l==="intentional"&&i.type!=="click"||l==="sloppy"&&i.type==="click"}function ve(i){const l=w.current.floatingContext?.nodeId,T=k&&Ie(k.nodesRef.current,l).some(B=>He(i,B.context?.elements.floating));return Q(i)||T}function a(i){if(ne(i)){i.type!=="click"&&!Q(i)&&(q.clear(),I.current=!1),p();return}if(w.current.insideReactTree){p();return}const l=Re(i),T=`[${$e("inert")}]`,B=Ce(l)?l.getRootNode():null,ue=Array.from((vt(B)?B:D(O.select("floatingElement"))).querySelectorAll(T)),rt=O.context.triggerElements;if(l&&(rt.hasElement(l)||rt.hasMatchingElement(re=>C(re,l))))return;let Oe=Ce(l)?l:null;for(;Oe&&!_e(Oe);){const re=rn(Oe);if(_e(re)||!Ce(re))break;Oe=re}if(!(ue.length&&Ce(l)&&!sn(l)&&!C(l,O.select("floatingElement"))&&ue.every(re=>!C(Oe,re)))){if(Ee(l)&&!("touches"in i)){const re=_e(l),Ye=on(l),st=/auto|scroll/,Mt=re||st.test(Ye.overflowX),At=re||st.test(Ye.overflowY),Nt=Mt&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Wt=At&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Lt=Ye.direction==="rtl",Yt=Wt&&(Lt?i.offsetX<=l.offsetWidth-l.clientWidth:i.offsetX>l.clientWidth),Ht=Nt&&i.offsetY>l.clientHeight;if(Yt||Ht)return}if(!ve(i)){if(K()==="intentional"&&I.current){q.clear(),I.current=!1;return}typeof y=="function"&&!y(i)||$("__outsidePressBubbles")||(O.setOpen(!1,Me(Ct,i)),p())}}}function W(i){K()!=="sloppy"||i.pointerType==="touch"||!O.select("open")||!n||Q(i)||a(i)}function H(i){if(K()!=="sloppy"||!O.select("open")||!n||Q(i))return;const l=i.touches[0];l&&(P.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},ie.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function L(i,l){const T=Re(i);if(!T)return;const B=x(T,i.type,()=>{l(i),B()})}function S(i){se.current="touch",L(i,H)}function h(i){ie.clear(),i.type==="pointerdown"&&(se.current=i.pointerType),!(i.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&L(i,l=>{l.type==="pointerdown"?W(l):a(l)})}function F(i){if(!Y.current)return;const l=J.current;if(g(),K()==="intentional"){if(i.type==="pointercancel"){l&&Pe();return}if(!ve(i)){if(l){Pe();return}typeof y=="function"&&!y(i)||(q.clear(),I.current=!0,p())}}}function d(i){if(K()!=="sloppy"||!P.current||Q(i))return;const l=i.touches[0];if(!l)return;const T=Math.abs(l.clientX-P.current.startX),B=Math.abs(l.clientY-P.current.startY),ue=Math.sqrt(T*T+B*B);ue>5&&(P.current.dismissOnTouchEnd=!0),ue>10&&(a(i),ie.clear(),P.current=null)}function _(i){L(i,d)}function X(i){K()!=="sloppy"||!P.current||Q(i)||(P.current.dismissOnTouchEnd&&a(i),ie.clear(),P.current=null)}function be(i){L(i,X)}const V=D(z),Le=xe(r&&xe(x(V,"keydown",oe),x(V,"compositionstart",ce),x(V,"compositionend",me)),b&&xe(x(V,"click",h,!0),x(V,"pointerdown",h,!0),x(V,"pointerup",F,!0),x(V,"pointercancel",F,!0),x(V,"mousedown",h,!0),x(V,"mouseup",F,!0),x(V,"touchstart",S,!0),x(V,"touchmove",_,!0),x(V,"touchend",be,!0)));return()=>{Le(),R.clear(),q.clear(),g(),I.current=!1}},[w,z,r,b,y,A,n,Z,N,oe,p,E,$,Q,k,O,ie]),f.useEffect(p,[y,p]);const he=f.useMemo(()=>({onKeyDown:oe,[Rn[u]]:de,...u!=="intentional"&&{onClick:de}}),[oe,de,u]),ke=f.useMemo(()=>({onKeyDown:oe,onPointerDown:ge,onMouseDown:ge,onClickCapture:te,onMouseDownCapture(R){te(),pe(R)},onPointerDownCapture(R){te(),pe(R)},onMouseUpCapture:te,onTouchEndCapture:te,onTouchMoveCapture:te}),[oe,te,pe,ge]);return f.useMemo(()=>n?{reference:he,floating:ke,trigger:he}:{},[n,he,ke])}const vn={open:Se(e=>e.open),transitionStatus:Se(e=>e.transitionStatus),domReferenceElement:Se(e=>e.domReferenceElement),referenceElement:Se(e=>e.positionReference??e.referenceElement),floatingElement:Se(e=>e.floatingElement),floatingId:Se(e=>e.floatingId)};class On extends cn{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:c,...o}=t;super({...o,positionReference:o.referenceElement,domReferenceElement:o.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:kt(),nested:r,triggerElements:c},vn),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&un(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function wn(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:c,onOpenChange:o}=e,u=t.useState("open"),v=t.useState("activeTriggerElement"),M=t.useState(n?"popupElement":"positionerElement"),O=t.context.triggerElements,A=o,z=f.useRef(null);r===void 0&&z.current===null&&(z.current=new On({open:u,transitionStatus:void 0,referenceElement:v,floatingElement:M,triggerElements:O,onOpenChange:A,floatingId:s,syncOnly:!0,nested:c}));const w=r??z.current;return t.useSyncedValue("floatingId",s),G(()=>{const k={open:u,floatingId:s,referenceElement:v,floatingElement:M};Ce(v)&&(k.domReferenceElement=v),w.state.positionReference===w.state.referenceElement&&(k.positionReference=v),w.update(k)},[u,s,v,M,w]),w.context.onOpenChange=A,w.context.nested=c,w}function Cn(e,t=!1,n=!1){const[r,s]=f.useState(e&&t?"idle":void 0),[c,o]=f.useState(e);return e&&!c&&(o(!0),s("starting")),!e&&c&&r!=="ending"&&!n&&s("ending"),!e&&!c&&r==="ending"&&s(void 0),G(()=>{if(!e&&c&&r!=="ending"&&n){const u=ye.request(()=>{s("ending")});return()=>{ye.cancel(u)}}},[e,c,r,n]),G(()=>{if(!e||t)return;const u=ye.request(()=>{s(void 0)});return()=>{ye.cancel(u)}},[t,e]),G(()=>{if(!e||!t)return;e&&c&&r!=="idle"&&s("starting");const u=ye.request(()=>{s("idle")});return()=>{ye.cancel(u)}},[t,e,c,r]),{mounted:c,setMounted:o,transitionStatus:r}}const tr={tabIndex:-1,[an]:""};function nr(e,t,n=!1){const r=ze(),s=Ze()!=null,c=f.useRef(null);e===void 0&&c.current===null&&(c.current=t(r,s));const o=e??c.current;return wn({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:s,onOpenChange:o.setOpen}),{store:o,internalStore:c.current}}function xn(e,t){const n=f.useRef(null),r=f.useRef(null);return f.useCallback(s=>{if(e===void 0)return;let c=!1;if(n.current!==null){const o=n.current,u=r.current,v=t.context.triggerElements.getById(o);u&&v===u&&(t.context.triggerElements.delete(o),c=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),c=!0),c){const o=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==o&&t.set("triggerCount",o)}},[t,e])}function rr(e,t,n){const r=n?.id??null;(r||t)&&(e.activeTriggerId=r,e.activeTriggerElement=n??null)}function sr(e,t,n,r){const s=n.useState("isMountedByTrigger",e),c=xn(e,n),o=U(u=>{if(c(u),!u)return;const v=n.select("open"),M=n.select("activeTriggerId");if(M===e){n.update({activeTriggerElement:u,...v?r:null});return}M==null&&v&&n.update({activeTriggerId:e,activeTriggerElement:u,...r})});return G(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:s}}function or(e){const t=e.useState("open"),n=e.useState("triggerCount");G(()=>{if(!t){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const r=e.context.triggerElements.size,s={};if(e.state.triggerCount!==r&&(s.triggerCount=r),!e.select("activeTriggerId")&&r===1){const c=e.context.triggerElements.entries().next();if(!c.done){const[o,u]=c.value;s.activeTriggerId=o,s.activeTriggerElement=u}}(s.triggerCount!==void 0||s.activeTriggerId!==void 0)&&e.update(s)},[t,e,n])}function cr(e,t,n){const{mounted:r,setMounted:s,transitionStatus:c}=Cn(e);t.useSyncedValues({mounted:r,transitionStatus:c});const o=U(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),u=t.useState("preventUnmountingOnClose");return ln({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:c}}function ir(e,t){e.useSyncedValues(t),G(()=>()=>{e.update({activeTriggerProps:Be,inactiveTriggerProps:Be,popupProps:Be})},[e])}function ur(e,t){G(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),G(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class lr{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}let nt=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=at.startingStyle]="startingStyle",e[e.endingStyle=at.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),je=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const In={[je.popupOpen]:""},kn={[je.popupOpen]:"",[je.pressed]:""},Pn={[nt.open]:""},Fn={[nt.closed]:""},Mn={[nt.anchorHidden]:""},ar={open(e){return e?In:null}},fr={open(e){return e?kn:null}},dr={open(e){return e?Pn:Fn},anchorHidden(e){return e?Mn:null}};function pr(e){return ze(e,"base-ui")}const An="ArrowUp",Nn="ArrowDown",Wn="ArrowLeft",Ln="ArrowRight",Yn="Home",Hn="End",_n=new Set([Wn,Ln]),Bn=new Set([An,Nn]),Gn=new Set([..._n,...Bn]),gr=new Set([...Gn,Yn,Hn]),hr=f.forwardRef(function(t,n){const{cutout:r,...s}=t;let c;if(r){const o=r.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${o.left}px ${o.top}px,${o.left}px ${o.bottom}px,${o.right}px ${o.bottom}px,${o.right}px ${o.top}px,${o.left}px ${o.top}px)`}return Te.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});function mr(e){const t=f.useRef(!0);t.current&&(t.current=!1,e())}let Et={},yt={},Rt="";function Kn(e){if(typeof document>"u")return!1;const t=D(e);return We(t).innerWidth-t.documentElement.clientWidth>0}function Dn(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=D(e),r=n.documentElement,s=n.body,c=Qe(r)?r:s,o=c.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",c.style.overflowY="scroll";const v=c.offsetWidth;c.style.overflowY="hidden";const M=c.offsetWidth;return c.style.overflowY=o,r.style.scrollbarGutter=u,v===M}function Xn(e){const t=D(e),n=t.documentElement,r=t.body,s=Qe(n)?n:r,c={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,c)}}function Vn(e){const t=D(e),n=t.documentElement,r=t.body,s=We(n);let c=0,o=0,u=!1;const v=ye.create();if(xt&&(s.visualViewport?.scale??1)!==1)return()=>{};function M(){const w=s.getComputedStyle(n),k=s.getComputedStyle(r),b=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=n.scrollTop,o=n.scrollLeft,Et={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Rt=n.style.scrollBehavior,yt={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const E=n.scrollHeight>n.clientHeight,Z=n.scrollWidth>n.clientWidth,N=w.overflowY==="scroll"||k.overflowY==="scroll",Y=w.overflowX==="scroll"||k.overflowX==="scroll",J=Math.max(0,s.innerWidth-r.clientWidth),I=Math.max(0,s.innerHeight-r.clientHeight),ee=parseFloat(k.marginTop)+parseFloat(k.marginBottom),se=parseFloat(k.marginLeft)+parseFloat(k.marginRight),P=Qe(n)?n:r;if(u=Dn(e),u){n.style.scrollbarGutter=b,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:b,overflowY:"hidden",overflowX:"hidden"}),(E||N)&&(n.style.overflowY="scroll"),(Z||Y)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:ee||I?`calc(100dvh - ${ee+I}px)`:"100dvh",width:se||J?`calc(100vw - ${se+J}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=c,r.scrollLeft=o,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function O(){Object.assign(n.style,Et),Object.assign(r.style,yt),u||(n.scrollTop=c,n.scrollLeft=o,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Rt)}function A(){O(),v.request(M)}M();const z=x(s,"resize",A);return()=>{v.cancel(),O(),typeof s.removeEventListener=="function"&&z()}}class Un{lockCount=0;restore=null;timeoutLock=Ne.create();timeoutUnlock=Ne.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=D(t).documentElement,s=We(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=Tt;return}const c=fn||!Kn(t);this.restore=c?Xn(t):Vn(t)}}const $n=new Un;function br(e=!0,t=null){G(()=>{if(e)return $n.acquire(t)},[e,t])}export{nt as A,jn as C,Qn as F,hr as I,lr as P,Cn as a,et as b,Ze as c,Ge as d,nr as e,mr as f,Ie as g,ur as h,or as i,cr as j,er as k,tr as l,ir as m,sr as n,zn as o,fr as p,Jn as q,Zn as r,rr as s,ar as t,pr as u,gr as v,dr as w,On as x,Ke as y,br as z};
import{j as e,G as o,c3 as P,aR as I,r as u,a_ as B,R as D,V as M}from"./main-DADupgLA.js";import{S as E}from"./Select-DXD3JLWK.js";import{u as K,T as R}from"./use-native-settings-BuBDLdTx.js";import{F as L,S as G,a as O}from"./FadeIn-gIH1bR94.js";import{A as $}from"./arrow-up-right-B_p-ZPxR.js";import{D as z}from"./download-zHPmUqi6.js";import"./SelectItemText-CTgRQ8ND.js";import"./useScrollLock-DO1uWkvz.js";import"./Card-Cjd-ZKzN.js";const H=["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:"codexSpark5h",label:"Codex Spark 5h Limit",shortLabel:"Cx Spark 5h",category:"limits"},{id:"codexSpark7d",label:"Codex Spark 7d Limit",shortLabel:"Cx Spark 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"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,a=F,r=2){const i=new Set(a.map(n=>n.id)),l=new Set,s=Array.isArray(t)?t.filter(n=>!i.has(n)||l.has(n)?!1:(l.add(n),!0)):[];return(s.length>0?s:H).slice(0,Math.max(1,Number(r)||2))}const U=264,V=124,h="ui-rounded, -apple-system, system-ui",C=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],X={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Y(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function b({size:t="sm",children:a}){const r=t==="lg",i=r?560:264,l=r?32:22;return e.jsx("div",{className:M("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",r?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:i,aspectRatio:`${U} / ${V}`,borderRadius:l},children:a})})}function Z({size:t="sm"}){const a="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",r=`${a} L264,124 L0,124 Z`,i=`sparkArea-${t}`;return e.jsx(b,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:h,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:h,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:"$673.61"}),e.jsx("path",{d:r,fill:`url(#${i})`,stroke:"none"}),e.jsx("path",{d:a,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const S=(()=>{const r=[];for(let i=0;i<26;i++)for(let l=0;l<7;l++){const s=Math.sin((i+1)*12.9898+(l+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(s-Math.floor(s))*100);r.push({w:i,d:l,v:c})}return r})();function A(t,a){return t<18?a?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function q(){return e.jsx(b,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:S.map(s=>e.jsx("rect",{x:s.w*(7.5+1.2),y:s.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(s.v,!0)},`d-${s.w}-${s.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:S.map(s=>e.jsx("rect",{x:s.w*(7.5+1.2),y:s.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(s.v,!1)},`l-${s.w}-${s.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:h,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function J(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],a=22,r=28,i=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((s,c)=>{const n=r+c*a,g=C[c%C.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:s.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:h,children:s.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:h,children:[s.pct,"%"]}),e.jsx("rect",{x:i,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:g})]},s.name)})})})}function Q(){const t=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],a=22,r=28,i=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((s,c)=>{const n=r+c*a,g=X[s.source],y=Y(s.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:s.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:s.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:h,children:[s.pct,"%"]}),e.jsx("rect",{x:i,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},s.label)})})})}function ee(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function te(t,a){switch(t){case"todayTokens":return o("menubar.metric.today_tokens");case"todayCost":return o("menubar.metric.today_cost");case"last7dTokens":return o("menubar.metric.last_7d_tokens");case"totalTokens":return o("menubar.metric.total_tokens");case"totalCost":return o("menubar.metric.total_cost");case"claude5h":return o("menubar.metric.claude_5h");case"claude7d":return o("menubar.metric.claude_7d");case"codex5h":return o("menubar.metric.codex_5h");case"codex7d":return o("menubar.metric.codex_7d");case"codexSpark5h":return o("menubar.metric.codex_spark_5h");case"codexSpark7d":return o("menubar.metric.codex_spark_7d");default:return a}}function ae(t,a){const r=new Set(a.map(l=>l.id)),i=t.filter(l=>r.has(l));for(const l of a){if(i.length>=2)break;i.includes(l.id)||i.push(l.id)}return i.slice(0,2)}function ie({slotConfigs:t,showStats:a}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),a?t.map(({slot:r,item:i},l)=>e.jsxs(D.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:M("flex min-w-[52px] flex-col items-center justify-center py-1.5",l===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:i?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:i?.shortLabel||"Metric"})]})]},r)):null]})})}function se({slot:t,value:a,options:r,disabled:i,onChange:l}){const s=t===0?o("menubar.slot.primary"):o("menubar.slot.secondary");return e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:s}),e.jsx(E,{value:a,disabled:i,ariaLabel:s,onValueChange:c=>l(t,c),options:r.map(c=>({value:c.id,label:c.displayLabel})),matchTriggerWidth:!0,className:"w-full px-3 py-2 text-sm font-medium"})]})}function p({label:t,hint:a,checked:r,disabled:i,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),a?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a}):null]}),e.jsx(R,{checked:r,disabled:i,onChange:l,ariaLabel:t})]})}function re(){const{available:t,settings:a,setSetting:r}=K(),i=u.useMemo(()=>(Array.isArray(a?.menuBarAvailableItems)?a.menuBarAvailableItems:F).map(m=>({...m,displayLabel:te(m.id,m.label),previewValue:ee(m)})),[a?.menuBarAvailableItems]),l=Number(a?.menuBarMaxItems)||2,s=u.useMemo(()=>N(a?.menuBarItems,i,l),[i,l,a?.menuBarItems]),c=u.useMemo(()=>ae(s,i),[i,s]),n=a?.showStats!==!1,g=d=>{r("menuBarItems",N(d,i,l))},y=(d,m)=>{const x=[...c];x[d===0?1:0]!==m&&(x[d]=m,g(x))},k=[0,1].map(d=>{const m=c[d]||i[d]?.id||"",v=c[d===0?1:0],W=i.filter(f=>f.id===m||f.id!==v),T=i.find(f=>f.id===m);return{slot:d,currentValue:m,options:W,item:T}}),w=a?.animatedIcon!==!1,j=a?.confettiOnReset!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(ie,{slotConfigs:k,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:k.map(({slot:d,currentValue:m,options:x})=>e.jsx(se,{slot:d,value:m,options:x,disabled:!t||!n,onChange:y},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(p,{label:o("settings.menubar.showStats"),hint:t?o("settings.menubar.showStatsHint"):o("menubar.native_only"),checked:n,disabled:!t,onChange:()=>r("showStats",!n)}),e.jsx(p,{label:o("settings.menubar.animatedIcon"),hint:o("settings.menubar.animatedIconHint"),checked:w,disabled:!t,onChange:()=>r("animatedIcon",!w)}),e.jsx(p,{label:o("settings.menubar.confettiOnReset"),hint:o("settings.menubar.confettiOnResetHint"),checked:j,disabled:!t,onChange:()=>r("confettiOnReset",!j)})]})]})}function le(){const[t,a]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(B()){a("native");return}const r=(navigator.userAgent||"").toLowerCase(),i=/mac/.test(r)&&!/iphone|ipad/.test(r);a(i?"mac-web":"other")},[]),t}function oe(){const t=le();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>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($,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(z,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(I,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.macos_only")]})}const ne=[{id:"summary",Preview:Z,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:q,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:J,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:Q,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function ce({Preview:t,nameKey:a,descKey:r}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:o(a)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:o(r)})]})]})}function _({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:o(t)})}function pe(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(L,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:o("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(oe,{})})]})}),e.jsx(L,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":o("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(_,{titleKey:"widgets.menubar.section.title"}),e.jsx(re,{})]})}),e.jsxs("section",{"aria-label":o("widgets.gallery.section.title"),children:[e.jsx(_,{titleKey:"widgets.gallery.section.title"}),e.jsx(G,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:ne.map(({id:t,Preview:a,nameKey:r,descKey:i})=>e.jsx(O,{children:e.jsx(ce,{Preview:a,nameKey:r,descKey:i})},t))})})]})]})})})}export{pe as WidgetsPage};
import{r as l,j as e,J as y}from"./main-DADupgLA.js";function o(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":y(a,{decimals:2}):"0"}function r({children:a,accent:n=!1,className:i=""}){const c="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",d=n?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${c} ${d} ${i}`,children:a})}function u(){const[a,n]=l.useState(null),[i,c]=l.useState("loading"),[d,g]=l.useState("");if(l.useEffect(()=>{let t=!1;const h=new URLSearchParams(window.location.search).get("year"),p=h?`/functions/tokentracker-wrapped?year=${encodeURIComponent(h)}`:"/functions/tokentracker-wrapped";return fetch(p).then(async s=>{if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}).then(s=>{t||(n(s),c(s.totals&&s.totals.tokens>0?"ready":"empty"))}).catch(s=>{t||(g(String(s?.message||s)),c("error"))}),()=>{t=!0}},[]),i==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:"Loading…"})});if(i==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-red-600 dark:text-red-300",children:["Couldn't load Wrapped: ",d]})})});if(i==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-oai-gray-500",children:["No data for that year yet. Run ",e.jsx("code",{children:"tracker sync"})," first."]})})});const x=t=>`${(t*100).toFixed(0)}%`;return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"TokenTracker Wrapped"}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(r,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:"Total tokens"}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:o(a.totals.tokens)}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:["across ",e.jsx("strong",{children:a.totals.conversations.toLocaleString("en-US")})," conversations,"," ",e.jsx("strong",{children:a.totals.active_days})," active days, and"," ",e.jsx("strong",{children:a.totals.sources})," tools"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top tools"}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[o(t.tokens)," · ",x(t.share)]})]},t.source))})]}),e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top models"}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[o(t.tokens)," · ",x(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Peak hour"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[o(a.peak_hour.tokens)," tokens"]})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Longest streak"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[a.longest_streak.days," days"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top days"}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:o(t.tokens)})]},t.day))})]}),a.highlights.length>0&&e.jsxs(r,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:"Highlights"}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:a.highlights.map((t,m)=>e.jsxs("li",{className:"text-base",children:["· ",t]},m))})]}),e.jsxs("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:["Generated from local queue.jsonl · share with"," ",e.jsx("code",{className:"font-mono",children:"tracker wrapped --json"})]})]})})}export{u as default};
+1
-1

@@ -238,3 +238,3 @@ <!doctype html>

</script>
<script type="module" crossorigin src="/assets/main-BbEXIjk8.js"></script>
<script type="module" crossorigin src="/assets/main-DADupgLA.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-DCfktJsK.css">

@@ -241,0 +241,0 @@ </head>

@@ -78,3 +78,3 @@ <!doctype html>

</script>
<script type="module" crossorigin src="/assets/main-BbEXIjk8.js"></script>
<script type="module" crossorigin src="/assets/main-DADupgLA.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-DCfktJsK.css">

@@ -81,0 +81,0 @@ </head>

{
"name": "tokentracker-cli",
"version": "0.53.2",
"version": "0.53.3",
"description": "Token usage tracker for AI agent CLIs (Claude Code, Codex, Cursor, Gemini, Kiro, OpenCode, OpenClaw, Every Code, Hermes, GitHub Copilot, Kimi Code, CodeBuddy, Grok Build, oh-my-pi, pi, Craft Agents, Kilo CLI, Kilo Code, Roo Code, Zed Agent, Goose)",

@@ -5,0 +5,0 @@ "main": "src/cli.js",

import{c as ue,r as i,j as e,G as n,T as We,n as Fe,I as Ie,X as He,ar as Ge,J as Oe}from"./main-BbEXIjk8.js";import{u as qe}from"./useCurrency-CVVJYL2V.js";import{I as Ze}from"./info-C-aAjjA6.js";const Ke=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Ve=ue("maximize-2",Ke);const Je=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Qe=ue("pause",Je);const et=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],tt=ue("play",et);const at=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],rt=ue("rotate-ccw",at);const ot=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],nt=ue("terminal",ot),Q={emerald:{light:["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],dark:["#2d333b","#065f46","#059669","#10b981","#34d399"],gridColor:{light:"rgba(16, 185, 129, 0.12)",dark:"rgba(52, 211, 153, 0.08)"}},ocean:{light:["#f1f5f9","#93c5fd","#60a5fa","#3b82f6","#1d4ed8"],dark:["#1e293b","#1e3a8a","#2563eb","#3b82f6","#60a5fa"],gridColor:{light:"rgba(59, 130, 246, 0.12)",dark:"rgba(96, 165, 250, 0.08)"}},neon:{light:["#faf5ff","#ebd5ff","#c084fc","#a855f7","#7e22ce"],dark:["#2e1065","#581c87","#8b5cf6","#a855f7","#c084fc"],gridColor:{light:"rgba(168, 85, 247, 0.12)",dark:"rgba(192, 132, 252, 0.08)"}},amber:{light:["#fffbeb","#fde68a","#f59e0b","#d97706","#b45309"],dark:["#451a03","#78350f","#b45309","#d97706","#f59e0b"],gridColor:{light:"rgba(245, 158, 11, 0.12)",dark:"rgba(245, 158, 11, 0.08)"}}};function st(l,x){const p=/^#([0-9a-f]{6})$/i.exec(l);if(!p)return l;const c=parseInt(p[1],16),z=c>>16&255,P=c>>8&255,$=c&255,S=E=>Math.max(0,Math.min(255,Math.round(E*x)));return`rgb(${S(z)}, ${S(P)}, ${S($)})`}function O(l,x,p,c,z){const P=Math.cos(c),$=Math.sin(c),S=l*P-x*$,E=l*$+x*P,L=p,_=Math.cos(z),m=Math.sin(z),N=S,ee=E*_-L*m,te=E*m+L*_;return{x:N,y:ee,z:te}}function lt(l,x,p,c,z){return O(l,x,p,c,z)}function Se(l,x){const p=Number(x).toLocaleString();if(l>=4){const c=Math.floor(Math.random()*3)+1;return n(`heatmap.3d.voxel.joke.${c}`,{value:p})}else return l===3?n("heatmap.3d.voxel.level3",{value:p}):l===2?n("heatmap.3d.voxel.level2",{value:p}):l===1?n("heatmap.3d.voxel.level1",{value:p}):n("heatmap.3d.voxel.level0")}function _e({weeks:l,palette:x="auto",isDark:p=!1,interactive:c=!1,autoRotateInit:z=!1,onResetViewRef:P=null}){const $=Q[x]||(x==="auto"?Q.emerald:null),S=$?p?$.dark:$.light:Array.isArray(x)?x:p?Q.emerald.dark:Q.emerald.light,E=$?p?$.gridColor.dark:$.gridColor.light:p?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",L=-.2,_=.88,[m,N]=i.useState({yaw:L,pitch:_}),[ee,te]=i.useState(z),[he,A]=i.useState(1),j=c?13:10.5,pe=i.useMemo(()=>{const t=[],r=l.length;if(r===0||!c)return[];for(let s=0;s<=7;s++){const o=(s-3.5)*j,d=O(-r/2*j,o,0,m.yaw,m.pitch),h=O(r/2*j,o,0,m.yaw,m.pitch);t.push({d:`M${d.x},${d.y} L${h.x},${h.y}`,key:`horiz-${s}`})}for(let s=0;s<=r;s+=4){const o=(s-r/2)*j,d=O(o,-3.5*j,0,m.yaw,m.pitch),h=O(o,3.5*j,0,m.yaw,m.pitch);t.push({d:`M${d.x},${d.y} L${h.x},${h.y}`,key:`vert-${s}`})}if(r%4!==0){const s=(r-r/2)*j,o=O(s,-3.5*j,0,m.yaw,m.pitch),d=O(s,3.5*j,0,m.yaw,m.pitch);t.push({d:`M${o.x},${o.y} L${d.x},${d.y}`,key:"vert-last"})}return t},[l.length,m,j,c]);i.useEffect(()=>{P&&(P.current={reset:()=>{N({yaw:L,pitch:_}),te(!1),A(1),ye()},toggleAutoRotate:t=>{te(t)}})},[P]);const q=i.useRef(null),F=i.useRef(null),W=i.useRef(!1),ie=i.useRef({x:0,y:0}),Z=i.useRef({yaw:L,pitch:_}),Y=i.useRef({x:0,y:0}),oe=i.useRef({x:0,y:0,time:0}),ne=i.useRef(null),[fe,ge]=i.useState(0),K=i.useRef(null),se=i.useRef(!0);i.useEffect(()=>(se.current=!0,()=>{se.current=!1}),[]);const ye=()=>{K.current&&cancelAnimationFrame(K.current),ge(0);const t=performance.now(),r=1200,s=o=>{if(!se.current)return;const d=o-t,h=Math.min(1,d/r),k=1-Math.pow(1-h,3);ge(k),h<1?K.current=requestAnimationFrame(s):K.current=null};K.current=requestAnimationFrame(s)};i.useEffect(()=>(ye(),()=>{K.current&&cancelAnimationFrame(K.current)}),[c]),i.useEffect(()=>{if(!ee||W.current||typeof window>"u"||typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let r;const s=()=>{if(typeof document<"u"&&document.visibilityState==="hidden"){r=requestAnimationFrame(s);return}N(o=>({yaw:o.yaw+.002,pitch:o.pitch})),r=requestAnimationFrame(s)};return r=requestAnimationFrame(s),()=>cancelAnimationFrame(r)},[ee]);const ce=(t,r)=>{c&&(W.current=!0,ie.current={x:t,y:r},Z.current={yaw:m.yaw,pitch:m.pitch},Y.current={x:0,y:0},oe.current={x:t,y:r,time:performance.now()},ne.current&&cancelAnimationFrame(ne.current))},U=(t,r)=>{if(!W.current)return;const s=t-ie.current.x,o=r-ie.current.y,d=performance.now(),h=d-oe.current.time;h>0&&(Y.current={x:(t-oe.current.x)/h,y:(r-oe.current.y)/h}),oe.current={x:t,y:r,time:d};const k=.005,f=Z.current.yaw-s*k,g=Math.PI/2.3,D=Math.max(-g,Math.min(g,Z.current.pitch-o*k));N({yaw:f,pitch:D})},be=()=>{if(!W.current)return;W.current=!1;let t=-Y.current.x*12,r=-Y.current.y*12;const s=.95,o=()=>{W.current||(t*=s,r*=s,!(Math.abs(t)<.01&&Math.abs(r)<.01)&&(N(d=>{const h=d.yaw+t*.005,k=Math.PI/2.3,f=Math.max(-k,Math.min(k,d.pitch+r*.005));return{yaw:h,pitch:f}}),ne.current=requestAnimationFrame(o)))};ne.current=requestAnimationFrame(o)},[b,de]=i.useState(null),[V,xe]=i.useState({x:0,y:0,shiftX:0}),y=i.useRef(null);i.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]),i.useEffect(()=>{if(!c||!F.current)return;const t=s=>{s.preventDefault();const o=-s.deltaY*.0025;A(d=>{const h=d+o;return Math.max(.5,Math.min(3,h))})},r=F.current;return r.addEventListener("wheel",t,{passive:!1}),()=>{r.removeEventListener("wheel",t)}},[c]);const C=i.useMemo(()=>{const t=[];return l.forEach((r,s)=>{(Array.isArray(r)?r:[]).forEach((o,d)=>{o&&t.push({key:o.day||`${s}-${d}`,col:s,row:d,level:o.level||0,value:o.value||0,day:o.day,models:o.models||null})})}),t},[l]),ve=j-(c?1.8:1.5),ke=c?38:28,J=t=>Math.max(1.8,Number(t)/4*ke),ae=i.useMemo(()=>{if(C.length===0)return[];const t=l.length;return C.map(r=>{const s=J(r.level),o=Math.sqrt(Math.pow(r.col-t/2,2)+Math.pow(r.row-3.5,2)),d=Math.sqrt(Math.pow(t/2,2)+Math.pow(3.5,2)),h=o/d*.4,k=Math.min(1,Math.max(0,(fe-h)*(1/.6))),f=s*k,g=(r.col-t/2)*j,D=(r.row-3.5)*j,w=ve/2,I=[{x:g-w,y:D-w,z:0},{x:g+w,y:D-w,z:0},{x:g+w,y:D+w,z:0},{x:g-w,y:D+w,z:0},{x:g-w,y:D-w,z:f},{x:g+w,y:D-w,z:f},{x:g+w,y:D+w,z:f},{x:g-w,y:D+w,z:f}].map(B=>O(B.x,B.y,B.z,m.yaw,m.pitch)),me=O(g,D,f/2,m.yaw,m.pitch),Le=[{name:"top",indices:[4,5,6,7],scale:1,normal:[0,0,1]},{name:"bottom",indices:[3,2,1,0],scale:.4,normal:[0,0,-1]},{name:"left",indices:[3,0,4,7],scale:.55,normal:[-1,0,0]},{name:"right",indices:[1,2,6,5],scale:.75,normal:[1,0,0]},{name:"front",indices:[0,1,5,4],scale:.85,normal:[0,-1,0]},{name:"back",indices:[2,3,7,6],scale:.65,normal:[0,1,0]}],Re=S[Math.min(4,Math.max(0,Number(r.level)||0))],Ne=[],Ae=.35,De=-.4,Pe=.83;return Le.forEach(B=>{const we=lt(B.normal[0],B.normal[1],B.normal[2],m.yaw,m.pitch);if(we.z>.001){const Ce=I[B.indices[0]],ze=I[B.indices[1]],Me=I[B.indices[2]],Te=I[B.indices[3]],Ye=`M${Ce.x},${Ce.y} L${ze.x},${ze.y} L${Me.x},${Me.y} L${Te.x},${Te.y} Z`,Ue=we.x*Ae+we.y*De+we.z*Pe,Xe=p?.18:0,Be=B.scale*(.82+.28*Math.max(0,Ue))+Xe;Ne.push({name:B.name,d:Ye,fill:st(Re,Be)})}}),{...r,centerProj:me,renderedFaces:Ne}})},[C,m,S,l.length,fe,j,ve,ke]),le=i.useMemo(()=>[...ae].sort((t,r)=>t.centerProj.z-r.centerProj.z),[ae]),M=i.useMemo(()=>{if(le.length===0)return{minX:-100,minY:-100,maxX:100,maxY:100};let t=1/0,r=1/0,s=-1/0,o=-1/0;return le.forEach(d=>{const h=j*2,k=d.centerProj.x,f=d.centerProj.y;k-h<t&&(t=k-h),k+h>s&&(s=k+h),f-h<r&&(r=f-h),f+h>o&&(o=f+h)}),{minX:t,minY:r,maxX:s,maxY:o}},[le,j]),R=12,a=M.maxX-M.minX+R*2,u=M.maxY-M.minY+R*2,T=a/he,v=u/he,X=M.minX-R+(a-T)/2,H=M.minY-R+(u-v)/2,G=`${X} ${H} ${T} ${v}`;return C.length===0?e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:n("heatmap.empty")}):e.jsxs("div",{ref:F,className:`relative select-none outline-none ${c?"cursor-grab active:cursor-grabbing w-full h-full flex items-center justify-center":"w-full overflow-hidden flex justify-center"}`,onMouseDown:t=>{if(!c)return;ce(t.clientX,t.clientY);const r=o=>U(o.clientX,o.clientY),s=()=>{be(),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",s)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",s)},onTouchStart:t=>{!c||t.touches.length===0||ce(t.touches[0].clientX,t.touches[0].clientY)},onTouchMove:t=>{!c||t.touches.length===0||U(t.touches[0].clientX,t.touches[0].clientY)},onTouchEnd:()=>{c&&be()},children:[e.jsxs("svg",{ref:q,viewBox:G,width:c?"95%":"100%",height:c?"95%":"auto",role:"img","aria-label":n("heatmap.iso.aria")||"3D interactive activity heatmap",style:{display:"block",width:"100%",height:"auto",maxWidth:c?"none":`${a}px`,maxHeight:c?"78vh":"none"},className:"transition-transform duration-300 ease-out",children:[c&&pe.map(t=>e.jsx("path",{d:t.d,fill:"none",stroke:E,strokeWidth:.25,strokeDasharray:"1.5 2.5",strokeLinecap:"round"},t.key)),le.map(t=>{const r=b&&b.key===t.key;return e.jsxs("g",{onMouseEnter:s=>{if(y.current&&(clearTimeout(y.current),y.current=null),de(t),c&&q.current){const o=O((t.col-l.length/2)*j,(t.row-3.5)*j,J(t.level),m.yaw,m.pitch);let d=0,h=0;const k=q.current;if(F.current&&typeof k.createSVGPoint=="function"&&typeof k.getScreenCTM=="function")try{const w=k.createSVGPoint();w.x=o.x,w.y=o.y;const re=k.getScreenCTM();if(re){const I=w.matrixTransform(re),me=F.current.getBoundingClientRect();d=I.x-me.left,h=I.y-me.top}}catch{const re=k.getBoundingClientRect(),I=M.maxX-M.minX+R*2,me=M.maxY-M.minY+R*2;d=(o.x-(M.minX-R))/I*re.width,h=(o.y-(M.minY-R))/me*re.height}else{const w=k.getBoundingClientRect(),re=M.maxX-M.minX+R*2,I=M.maxY-M.minY+R*2;d=(o.x-(M.minX-R))/re*w.width,h=(o.y-(M.minY-R))/I*w.height}const f=140;let g=0;const D=F.current?F.current.getBoundingClientRect().width:k.getBoundingClientRect().width;d<f?g=f-d:d>D-f&&(g=D-f-d),xe({x:d,y:h,shiftX:g})}},onMouseLeave:()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{de(null)},150)},className:"transition-all duration-200",style:{filter:r?"brightness(1.15) drop-shadow(0 4px 6px rgba(0,0,0,0.15))":"none",cursor:c?"pointer":"default"},children:[!c&&t.day&&e.jsx("title",{children:`${t.day}: ${Number(t.value).toLocaleString()} tokens`}),t.renderedFaces.map((s,o)=>e.jsx("path",{d:s.d,fill:s.fill,stroke:s.fill,strokeWidth:.25,strokeLinejoin:"round"},o))]},t.key)})]}),c&&b&&e.jsxs("div",{onMouseEnter:()=>{y.current&&(clearTimeout(y.current),y.current=null)},onMouseLeave:()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{de(null)},150)},className:"absolute z-[9999] w-0 h-0 transition-all duration-100 ease-out",style:{left:`${V.x}px`,top:`${V.y}px`},children:[e.jsxs("div",{className:"absolute left-0 bottom-[10px] backdrop-blur-md bg-white/90 dark:bg-oai-gray-900/90 border border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-xl rounded-xl p-3.5 max-w-[280px] min-w-[200px] flex flex-col gap-2 animate-in fade-in zoom-in-95 duration-100",style:{transform:`translateX(calc(-50% + ${V.shiftX}px))`},children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-oai-gray-100 dark:border-oai-gray-800/80 pb-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-oai-gray-500 dark:text-oai-gray-400",children:b.day}),(()=>{const t=b.level===0?p?"#9ca3af":"#6b7280":S[b.level];return e.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:t+"22",color:t,border:`1px solid ${t}44`},children:["Level ",b.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:Number(b.value).toLocaleString()}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),b.models&&Object.keys(b.models).length>0?e.jsxs("div",{className:"mt-1.5 border-t border-oai-gray-100 dark:border-oai-gray-800/60 pt-2 flex flex-col gap-1.5",children:[e.jsx("div",{className:"text-[10px] font-semibold text-oai-gray-400 dark:text-oai-gray-500 uppercase tracking-wider",children:"Model Breakdown"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-[150px] overflow-y-auto pr-1.5 scrollbar-thin",children:Object.entries(b.models).map(([t,r])=>({name:t,val:Number(r)})).sort((t,r)=>r.val-t.val).map(({name:t,val:r})=>{const s=Number(b.value)||1,o=Math.round(r/s*100);return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] gap-3",children:[e.jsx("span",{className:"font-medium text-oai-gray-750 dark:text-oai-gray-200 truncate max-w-[120px]",title:t,children:t}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:r.toLocaleString()}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[o,"%"]})]})]}),e.jsx("div",{className:"w-full h-1 bg-oai-gray-100 dark:bg-oai-gray-800/85 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${o}%`,backgroundColor:S[4],boxShadow:`0 0 4px ${S[4]}55`}})})]},t)})})]}):e.jsx("p",{className:"text-[11px] text-oai-gray-600 dark:text-oai-gray-300 leading-relaxed font-normal mt-1 border-t border-dashed border-oai-gray-100 dark:border-oai-gray-800/60 pt-1.5",children:Se(b.level,b.value)})]})]}),e.jsx("div",{className:"absolute bottom-[6px] left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 border-r border-b border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-sm",style:{marginBottom:"1px"}})]})]})}const it=12,ct=3,dt=26,mt=["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],xt=["#30363d","#065f46","#059669","#10b981","#34d399"];function $e(l){const x=Number(l);return Number.isFinite(x)?x<1e3?x.toLocaleString():Oe(x,{decimals:2}):"0"}function ut(l){if(typeof l!="string")return null;const x=/^(\d{4})-(\d{2})-(\d{2})$/.exec(l.trim());if(!x)return null;const p=new Date(Date.UTC(Number(x[1]),Number(x[2])-1,Number(x[3])));return Number.isFinite(p.getTime())?p:null}function Ee(l,x){return new Date(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()+x))}function ht(l,x){return Math.floor((Date.UTC(x.getUTCFullYear(),x.getUTCMonth(),x.getUTCDate())-Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()))/864e5)}function pt(l,x){const p=x==="mon"?1:0,c=l.getUTCDay();return Ee(l,-((c-p+7)%7))}function ft(l,x,p,c){if(!l)return[];const z=ut(x)||new Date,P=[];for(let _=11;_>=0;_-=1)P.push(new Date(Date.UTC(z.getUTCFullYear(),z.getUTCMonth()-_,1)));const $=pt(z,p),S=Ee($,-(l-1)*7),E=[],L=new Set;for(const _ of P){const m=Math.floor(ht(S,_)/7);m<0||m>=l||L.has(m)||(L.add(m),E.push({label:c[_.getUTCMonth()],index:m}))}return E}function vt({heatmap:l,timeZoneLabel:x,timeZoneShortLabel:p,hideLegend:c=!1,embedded:z=!1}){const{resolvedTheme:P}=We(),{currency:$,rate:S}=qe(),E=P==="dark",L=E?xt:mt,_=i.useRef(null),m=i.useRef(null),[N,ee]=i.useState(null),[te,he]=i.useState({x:0,y:0,shiftX:0}),A=i.useRef(null);i.useEffect(()=>()=>{A.current&&clearTimeout(A.current)},[]);const[j,pe]=i.useState(!1),[q,F]=i.useState(!1),[W,ie]=i.useState(!1),Z=i.useRef(null),[Y,oe]=i.useState("emerald"),ne=[n("heatmap.month.jan"),n("heatmap.month.feb"),n("heatmap.month.mar"),n("heatmap.month.apr"),n("heatmap.month.may"),n("heatmap.month.jun"),n("heatmap.month.jul"),n("heatmap.month.aug"),n("heatmap.month.sep"),n("heatmap.month.oct"),n("heatmap.month.nov"),n("heatmap.month.dec")],fe=(a,u)=>{if(!u||!u.day)return;A.current&&(clearTimeout(A.current),A.current=null),ee(u);const T=a.currentTarget.getBoundingClientRect(),v=typeof window<"u"?window.innerWidth:1024,X=T.left+T.width/2,H=T.top,G=140;let t=0;X<G?t=G-X:X>v-G&&(t=v-G-X),he({x:X,y:H,shiftX:t})},ge=()=>{A.current&&clearTimeout(A.current),A.current=setTimeout(()=>{ee(null)},150)},K=()=>{F(!1),pe(!0)},se=()=>{F(!0)},ye=a=>{a.target===a.currentTarget&&q&&(pe(!1),F(!1))};i.useEffect(()=>{if(!j||q)return;const a=u=>{u.key==="Escape"&&se()};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[j,q]);const ce=i.useMemo(()=>({emerald:{accentText:"text-emerald-500 dark:text-emerald-400",accentBg:"bg-emerald-500/10 dark:bg-emerald-400/10",accentBorder:"border-emerald-500/20 dark:border-emerald-400/15",hoverBorder:"hover:border-emerald-500/30 dark:hover:border-emerald-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(16,185,129,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(52,211,153,0.25)]",rawColor:"#10b981"},ocean:{accentText:"text-blue-500 dark:text-blue-400",accentBg:"bg-blue-500/10 dark:bg-blue-400/10",accentBorder:"border-blue-500/20 dark:border-blue-400/15",hoverBorder:"hover:border-blue-500/30 dark:hover:border-blue-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(59,130,246,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(96,165,250,0.25)]",rawColor:"#3b82f6"},neon:{accentText:"text-purple-500 dark:text-purple-400",accentBg:"bg-purple-500/10 dark:bg-purple-400/10",accentBorder:"border-purple-500/20 dark:border-purple-400/15",hoverBorder:"hover:border-purple-500/30 dark:hover:border-purple-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(168,85,247,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(192,132,252,0.25)]",rawColor:"#a855f7"},amber:{accentText:"text-amber-500 dark:text-amber-400",accentBg:"bg-amber-500/10 dark:bg-amber-400/10",accentBorder:"border-amber-500/20 dark:border-amber-400/15",hoverBorder:"hover:border-amber-500/30 dark:hover:border-amber-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(245,158,11,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(245,158,11,0.25)]",rawColor:"#f59e0b"}}),[]),U=ce[Y]||ce.emerald,be=Q[Y]?E?Q[Y].dark:Q[Y].light:E?Q.emerald.dark:Q.emerald.light,[b,de]=i.useState(()=>{if(z)return"2d";try{return window.localStorage?.getItem("tt:heatmap-view")==="3d"?"3d":"2d"}catch{return"2d"}});i.useEffect(()=>{if(!z)try{window.localStorage?.setItem("tt:heatmap-view",b)}catch{}},[b,z]),i.useEffect(()=>{if(b!=="2d")return;const a=_.current;a&&(a.scrollLeft=a.scrollWidth)},[l?.weeks,b]),i.useEffect(()=>{const a=_.current;if(!a)return;const u=()=>{A.current&&(clearTimeout(A.current),A.current=null),ee(null)};return a.addEventListener("scroll",u),()=>a.removeEventListener("scroll",u)},[]);const V=l?.week_starts_on==="mon"?"mon":"sun",xe=i.useMemo(()=>{const a=Array.isArray(l?.weeks)?l.weeks:[];if(!a.length)return{weeks:[]};const u=[];for(const T of a)for(const v of Array.isArray(T)?T:[])v?.day&&u.push({day:v.day,total_tokens:v.total_tokens??v.value??0,billable_total_tokens:v.billable_total_tokens??v.value??v.total_tokens??0,models:v.models??null});return Fe({dailyRows:u,weeks:Math.max(52,a.length),to:l?.to,weekStartsOn:V})},[l?.to,l?.weeks,V]),y=xe?.weeks||[],C=i.useMemo(()=>{let a=0,u=0,T={day:"无数据",value:0},v=0,X=0;const H=[];y.forEach(f=>{(Array.isArray(f)?f:[]).forEach(g=>{g&&g.day&&H.push(g)})}),H.sort((f,g)=>f.day.localeCompare(g.day)),H.forEach(f=>{const g=Number(f.value)||0;a+=g,g>0?(u++,v++,v>X&&(X=v)):v=0,g>T.value&&(T={day:f.day,value:g})});const G=H.length||365,t=(u/G*100).toFixed(1);let r="heatmap.3d.modal.ai.eval.default",s="heatmap.3d.modal.ai.title.default";a>=15e6?(s="heatmap.3d.modal.ai.title.peak",r="heatmap.3d.modal.ai.eval.peak"):a>=5e6?(s="heatmap.3d.modal.ai.title.heavy",r="heatmap.3d.modal.ai.eval.heavy"):a>=1e6?(s="heatmap.3d.modal.ai.title.core",r="heatmap.3d.modal.ai.eval.core"):a>=2e4&&(s="heatmap.3d.modal.ai.title.steady",r="heatmap.3d.modal.ai.eval.steady");const o=l?.total_cost_usd,d=Number(o),k=o!=null&&(typeof o!="string"||o.trim()!=="")&&Number.isFinite(d)?d:a/15e5;return{totalTokens:a,activeDays:u,activeRate:t,maxSingleDay:T,maxStreak:X,aiEvaluationTitleKey:s,aiEvaluationKey:r,totalCostUsd:k}},[y,l?.total_cost_usd]),je=i.useMemo(()=>Ie(C.totalCostUsd,{currency:$,rate:S}),[C.totalCostUsd,$,S]),ve=V==="mon"?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(a=>n(`heatmap.day.${a.toLowerCase()}`)):["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(a=>n(`heatmap.day.${a.toLowerCase()}`)),ke=i.useMemo(()=>ft(y.length,xe?.to,V,ne),[xe?.to,y.length,V,ne]);if(!y.length)return e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:n("heatmap.empty")});const J=z?10:it,ae=z?2:ct,le=z?22:dt,M=le+y.length*J+Math.max(0,y.length-1)*ae,R=`${le}px repeat(${y.length}, ${J}px)`;return e.jsxs("div",{ref:m,className:z?"relative":"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[!z&&e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:n("heatmap.title")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{role:"tablist","aria-label":"Heatmap view",className:"flex rounded-md border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 text-[10px]",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":b==="2d",onClick:()=>de("2d"),className:b==="2d"?"px-2 py-0.5 rounded bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-oai-white font-medium":"px-2 py-0.5 rounded text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200",children:n("heatmap.view.2d")}),e.jsx("button",{type:"button",role:"tab","aria-selected":b==="3d",onClick:()=>de("3d"),className:b==="3d"?"px-2 py-0.5 rounded bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-oai-white font-medium":"px-2 py-0.5 rounded text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200",children:n("heatmap.view.3d")})]}),e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-450",children:p||n("heatmap.legend.utc")})]})]}),b==="3d"&&e.jsxs("div",{onClick:K,className:"cursor-pointer group relative overflow-hidden rounded-lg hover:border-oai-gray-350 dark:hover:border-oai-gray-700 border border-transparent transition-all",title:n("heatmap.3d.hover_tip"),children:[e.jsx(_e,{weeks:y,isDark:E,palette:Y}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-oai-gray-900/5 to-transparent pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity flex items-end justify-center pb-2",children:e.jsxs("span",{className:"text-[10px] bg-white/95 dark:bg-oai-gray-900/95 shadow border border-oai-gray-200/60 dark:border-oai-gray-800/80 px-2.5 py-1 rounded-full font-medium text-oai-gray-500 dark:text-oai-gray-400 flex items-center gap-1 transform translate-y-2 group-hover:translate-y-0 transition-transform duration-200",children:[e.jsx(Ve,{size:9}),n("heatmap.3d.hover_tip")]})})]}),b==="2d"&&e.jsx("div",{ref:_,className:"overflow-x-auto overflow-y-hidden heatmap-scroll-thin",children:e.jsxs("div",{style:{minWidth:M},children:[e.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:R,columnGap:ae},children:[e.jsx("span",{}),ke.map(a=>e.jsx("span",{style:{gridColumnStart:a.index+2},className:"whitespace-nowrap",children:a.label},`${a.label}-${a.index}`))]}),e.jsxs("div",{className:"grid",style:{gridTemplateColumns:R,columnGap:ae},children:[e.jsx("div",{className:"grid text-[10px] text-oai-gray-400 dark:text-oai-gray-400 sticky left-0 bg-white dark:bg-oai-gray-900 pr-2",style:{gridTemplateRows:`repeat(7, ${J}px)`,rowGap:ae},children:ve.map(a=>e.jsx("span",{className:"leading-none",children:a},a))}),e.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${J}px)`,gap:ae},children:y.map((a,u)=>(Array.isArray(a)?a:[]).map((T,v)=>{if(!T)return null;const X=T.day||`e-${u}-${v}`,H=Number(T.level)||0,G=L[H]||L[0];return e.jsx("span",{onMouseEnter:t=>fe(t,T),onMouseLeave:ge,className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10 cursor-pointer",style:{width:J,height:J,background:G}},X)}))})]})]})}),!c&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mt-3",children:[e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:n("heatmap.legend.less")}),e.jsx("div",{className:"flex gap-0.5",children:L.map((a,u)=>e.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:a}},u))}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:n("heatmap.legend.more")})]}),j&&e.jsx("div",{onAnimationEnd:ye,onClick:a=>{a.target===a.currentTarget&&se()},className:`fixed inset-0 z-50 flex items-center justify-center p-3 md:p-6 backdrop-blur-md bg-black/15 dark:bg-black/40 ${q?"animate-tt-fade-out":"animate-tt-fade-in"}`,children:e.jsxs("div",{className:`relative w-full max-w-6xl h-[88vh] backdrop-blur-2xl bg-white/90 dark:bg-oai-gray-900/90 border border-oai-gray-200/50 dark:border-white/10 shadow-2xl rounded-2xl flex flex-col md:flex-row overflow-hidden ${q?"animate-tt-modal-exit":"animate-tt-modal"}`,children:[e.jsx("button",{type:"button",onClick:se,className:"absolute top-4 right-4 z-50 p-2 rounded-full border border-oai-gray-200/60 dark:border-oai-gray-800/60 bg-white/50 dark:bg-oai-gray-900/50 text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:rotate-90 hover:scale-105 active:scale-95 transition-all duration-300",children:e.jsx(He,{size:16})}),e.jsxs("div",{className:"w-full md:w-[340px] border-b md:border-b-0 md:border-r border-zinc-200/50 dark:border-zinc-800/40 p-5 md:p-6 flex flex-col gap-6 overflow-y-auto backdrop-blur-md bg-zinc-50/50 dark:bg-zinc-950/50",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:U.rawColor}}),e.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5",style:{backgroundColor:U.rawColor}})]}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500",children:"3D Insight"})]}),e.jsx("h4",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight leading-none mt-2 select-none",children:n("heatmap.3d.modal.title")}),e.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-400 dark:text-zinc-500 mt-2 font-normal select-none",children:n("heatmap.3d.modal.desc")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-5 gap-y-5 border-y border-zinc-200/50 dark:border-zinc-800/50 py-5 select-none",children:[e.jsxs("div",{className:"flex flex-col gap-1 relative group cursor-help",children:[e.jsx("div",{className:"absolute left-0 bottom-full mb-2 pointer-events-none opacity-0 translate-y-1 group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-200 z-50",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-950 text-zinc-900 dark:text-zinc-50 text-[10px] font-semibold font-mono rounded-lg px-2.5 py-1.5 shadow-xl border border-zinc-200 dark:border-zinc-800/80 whitespace-nowrap flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-zinc-400 dark:text-zinc-500",children:n("heatmap.3d.modal.stats.precision_total_tokens")}),e.jsxs("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:[C.totalTokens.toLocaleString()," Tokens"]})]})}),e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.total_tokens")}),e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:$e(C.totalTokens)}),e.jsx("div",{className:"opacity-30 group-hover:opacity-60 transition-opacity",children:e.jsx("svg",{width:"24",height:"10",viewBox:"0 0 24 10",fill:"none",children:e.jsx("path",{d:"M1 9C3 7 5 7 7 4C9 1 11 0 13 2C15 4 17 0 23 0",stroke:U.rawColor,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.estimated_cost")}),e.jsx("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:je})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.active_rate_days")}),e.jsxs("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[C.activeRate,"% ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",C.activeDays,"D)"]})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.max_streak")}),e.jsxs("span",{className:"text-xl font-black text-amber-500 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[C.maxStreak," ",e.jsx("span",{className:"text-[10px] font-bold text-amber-500/80 font-mono",children:n("heatmap.3d.modal.stats.days_suffix")})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 col-span-2 relative group cursor-help",children:[e.jsx("div",{className:"absolute left-0 bottom-full mb-2 pointer-events-none opacity-0 translate-y-1 group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-200 z-50",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-950 text-zinc-900 dark:text-zinc-50 text-[10px] font-semibold font-mono rounded-lg px-2.5 py-1.5 shadow-xl border border-zinc-200 dark:border-zinc-800/80 whitespace-nowrap flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-zinc-400 dark:text-zinc-500",children:n("heatmap.3d.modal.stats.precision_peak_value")}),e.jsxs("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:[C.maxSingleDay.value>0?C.maxSingleDay.value.toLocaleString():n("heatmap.3d.modal.stats.no_data")," Tokens"]}),e.jsx("span",{className:"text-[8px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:C.maxSingleDay.day!=="无数据"?C.maxSingleDay.day:n("heatmap.3d.modal.stats.no_data")})]})}),e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.peak_day")}),e.jsxs("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[C.maxSingleDay.value>0?$e(C.maxSingleDay.value):n("heatmap.3d.modal.stats.no_data")," ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",C.maxSingleDay.day!=="无数据"?C.maxSingleDay.day:n("heatmap.3d.modal.stats.no_data"),")"]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2.5 py-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[e.jsx(nt,{size:11,style:{color:U.rawColor}}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono",style:{color:U.rawColor},children:n(C.aiEvaluationTitleKey)})]}),e.jsxs("div",{className:"pl-3.5 border-l-2 relative transition-all duration-300 group",style:{borderColor:U.rawColor},children:[e.jsx("div",{className:"absolute inset-y-0 left-0 w-[3px] blur-[2px] opacity-15 pointer-events-none rounded-full",style:{backgroundColor:U.rawColor}}),e.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-600 dark:text-zinc-400 font-normal",children:n(C.aiEvaluationKey)})]})]}),e.jsx("div",{className:"mt-auto border-t border-zinc-200/50 dark:border-zinc-800/50 pt-4 select-none",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.legend.title")}),e.jsx("span",{className:"text-[10px] font-medium text-zinc-500 dark:text-zinc-400",children:n(`heatmap.3d.modal.palette.${Y}`)})]}),e.jsx("div",{className:"flex gap-1",children:be.map((a,u)=>e.jsx("div",{className:"flex-1 h-1 rounded-[2px]",style:{backgroundColor:a},title:`Level ${u}`},u))})]})})]}),e.jsxs("div",{className:"flex-1 h-full relative flex items-center justify-center overflow-hidden p-4",children:[e.jsx("div",{className:"absolute top-1/4 left-1/3 w-96 h-96 rounded-full blur-[130px] pointer-events-none -translate-x-1/2 -translate-y-1/2 transition-all duration-500",style:{backgroundColor:U.rawColor+"15"}}),e.jsx("div",{className:"absolute bottom-1/4 right-1/3 w-80 h-80 rounded-full blur-[120px] pointer-events-none translate-x-1/2 translate-y-1/2 bg-purple-500/[0.04] dark:bg-purple-500/[0.08]"}),e.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 flex items-center gap-3 p-1.5 backdrop-blur-md bg-white/70 dark:bg-oai-gray-900/75 border border-oai-gray-200/60 dark:border-oai-gray-800/80 rounded-full shadow-lg z-30 select-none",children:[e.jsx("div",{className:"flex items-center gap-1.5 px-2",children:Object.keys(ce).map(a=>{const u=Y===a;return e.jsx("button",{type:"button",onClick:()=>oe(a),title:n(`heatmap.3d.modal.palette.${a}`),className:`w-3.5 h-3.5 rounded-full transition-all duration-200 relative hover:scale-125 ${a==="emerald"?"bg-[#10b981]":a==="ocean"?"bg-[#3b82f6]":a==="neon"?"bg-[#a855f7]":"bg-[#f59e0b]"}`,children:u&&e.jsx("span",{className:"absolute inset-0 rounded-full ring-2 ring-offset-1 ring-offset-white dark:ring-offset-oai-gray-900 ring-oai-gray-900 dark:ring-white scale-110"})},a)})}),e.jsx("div",{className:"w-[1px] h-4 bg-oai-gray-200 dark:bg-oai-gray-800"}),e.jsxs("div",{className:"flex items-center gap-1 pr-1",children:[e.jsx("button",{type:"button",onClick:()=>{const a=!W;ie(a),Z.current&&Z.current.toggleAutoRotate(a)},title:W?n("heatmap.3d.modal.control.pause"):n("heatmap.3d.modal.control.play"),className:`p-1.5 rounded-full transition-all duration-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 ${W?U.accentText:"text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250"}`,children:W?e.jsx(Qe,{size:12}):e.jsx(tt,{size:12})}),e.jsx("button",{type:"button",onClick:()=>{ie(!1),Z.current&&Z.current.reset()},title:n("heatmap.3d.modal.control.reset"),className:"p-1.5 rounded-full text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-all duration-200",children:e.jsx(rt,{size:12})})]})]}),e.jsx(_e,{weeks:y,isDark:E,interactive:!0,palette:Y,autoRotateInit:W,onResetViewRef:Z}),e.jsxs("div",{className:"absolute bottom-4 right-4 flex items-center gap-1.5 text-[9px] font-bold text-oai-gray-400 bg-white/80 dark:bg-oai-gray-900/80 border border-oai-gray-200/50 dark:border-oai-gray-800/80 rounded-md px-2.5 py-1.5 select-none pointer-events-none backdrop-blur-md shadow-sm",children:[e.jsx(Ze,{size:10,className:U.accentText}),e.jsx("span",{children:n("heatmap.3d.modal.footer.tip")})]})]})]})}),N&&!j&&typeof document<"u"&&Ge.createPortal(e.jsxs("div",{className:"fixed z-[9999] w-0 h-0 transition-all duration-100 ease-out pointer-events-none",style:{left:`${te.x}px`,top:`${te.y}px`},children:[e.jsxs("div",{className:"absolute left-0 bottom-[10px] backdrop-blur-md bg-white/95 dark:bg-oai-gray-900/95 border border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-xl rounded-xl p-3.5 max-w-[280px] min-w-[200px] flex flex-col gap-2 animate-in fade-in zoom-in-95 duration-100",style:{transform:`translateX(calc(-50% + ${te.shiftX}px))`},children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-oai-gray-100 dark:border-oai-gray-800/80 pb-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-oai-gray-500 dark:text-oai-gray-400",children:N.day}),(()=>{const a=N.level===0?E?"#9ca3af":"#6b7280":L[N.level];return e.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:a+"22",color:a,border:`1px solid ${a}44`},children:["Level ",N.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:Number(N.total_tokens??N.value).toLocaleString()}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),N.models&&Object.keys(N.models).length>0?e.jsxs("div",{className:"mt-1.5 border-t border-oai-gray-100 dark:border-oai-gray-800/60 pt-2 flex flex-col gap-1.5",children:[e.jsx("div",{className:"text-[10px] font-semibold text-oai-gray-400 dark:text-oai-gray-500 uppercase tracking-wider",children:"Model Breakdown"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-[150px] overflow-y-auto pr-1.5 oai-scrollbar",children:Object.entries(N.models).map(([a,u])=>({name:a,val:Number(u)})).sort((a,u)=>u.val-a.val).map(({name:a,val:u})=>{const T=Number(N.total_tokens??N.value)||1,v=Math.round(u/T*100);return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] gap-3",children:[e.jsx("span",{className:"font-medium text-oai-gray-750 dark:text-oai-gray-200 truncate max-w-[120px]",title:a,children:a}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:u.toLocaleString()}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[v,"%"]})]})]}),e.jsx("div",{className:"w-full h-1 bg-oai-gray-100 dark:bg-oai-gray-800/85 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${v}%`,backgroundColor:L[4],boxShadow:`0 0 4px ${L[4]}55`}})})]},a)})})]}):e.jsx("p",{className:"text-[11px] text-oai-gray-600 dark:text-oai-gray-300 leading-relaxed font-normal mt-1 border-t border-dashed border-oai-gray-100 dark:border-oai-gray-800/60 pt-1.5",children:Se(N.level,N.total_tokens??N.value)})]})]}),e.jsx("div",{className:"absolute bottom-[6px] left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 border-r border-b border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-sm",style:{marginBottom:"1px"}})]}),document.body),e.jsx("style",{children:`
@keyframes tt-fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes tt-fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
@keyframes tt-modal-entrance {
from {
opacity: 0;
transform: scale(0.96) translateY(10px);
}
to {
opacity: 1;
transform: scale(1) translateY(0);
}
}
@keyframes tt-modal-exit {
from {
opacity: 1;
transform: scale(1) translateY(0);
}
to {
opacity: 0;
transform: scale(0.96) translateY(10px);
}
}
.animate-tt-fade-in {
animation: tt-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-tt-fade-out {
animation: tt-fade-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-tt-modal {
animation: tt-modal-entrance 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}
.animate-tt-modal-exit {
animation: tt-modal-exit 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
`})]})}export{vt as A,Ve as M,nt as T};
import{ah as I,ai as j,aj as w,ak as M,al as h,am as N,r as u,an as V,ao as G,ap as H,aq as g,j as p,R as F,m as v,S as C,U as D}from"./main-BbEXIjk8.js";function P(...e){const t=!Array.isArray(e[0]),n=t?0:-1,o=e[0+n],r=e[1+n],i=e[2+n],a=e[3+n],s=I(r,i,a);return t?s(o):s}function K(e,t,n={}){const o=e.get();let r=null,i=o,a;const s=typeof o=="string"?o.replace(/[\d.-]/g,""):void 0,c=()=>{r&&(r.stop(),r=null),e.animation=void 0},d=()=>{const l=b(e.get()),m=b(i);if(l===m){c();return}const y=r?r.getGeneratorVelocity():e.getVelocity();c(),r=new M({keyframes:[l,m],velocity:y,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:a})},f=()=>{d(),e.animation=r??void 0,e.events.animationStart?.notify(),r?.then(()=>{e.animation=void 0,e.events.animationComplete?.notify()})};if(e.attach((l,m)=>{i=l,a=y=>m(x(y,s)),j.postRender(f)},c),w(t)){let l=n.skipInitialAnimation===!0;const m=t.on("change",A=>{l?(l=!1,e.jump(x(A,s),!1)):e.set(x(A,s))}),y=e.on("destroy",m);return()=>{m(),y()}}return c}function x(e,t){return t?e+t:e}function b(e){return typeof e=="number"?e:parseFloat(e)}function k(e){const t=h(()=>N(e)),{isStatic:n}=u.useContext(V);if(n){const[,o]=u.useState(e);u.useEffect(()=>t.on("change",o),[])}return t}function E(e,t){const n=k(t()),o=()=>n.set(t());return o(),G(()=>{const r=()=>j.preRender(o,!1,!0),i=e.map(a=>a.on("change",r));return()=>{i.forEach(a=>a()),H(o)}}),n}function T(e){g.current=[],e();const t=E(g.current,e);return g.current=void 0,t}function L(e,t,n,o){if(typeof e=="function")return T(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!="function")return U(e,t,n,o);const a=typeof t=="function"?t:P(t,n,o),s=Array.isArray(e)?S(e,a):S([e],([d])=>a(d)),c=Array.isArray(e)?void 0:e.accelerate;return c&&!c.isTransformed&&typeof t!="function"&&Array.isArray(n)&&o?.clamp!==!1&&(s.accelerate={...c,times:t,keyframes:n,isTransformed:!0}),s}function S(e,t){const n=h(()=>[]);return E(e,()=>{n.length=0;const o=e.length;for(let r=0;r<o;r++)n[r]=e[r].get();return t(n)})}function U(e,t,n,o){const r=h(()=>Object.keys(n)),i=h(()=>({}));for(const a of r)i[a]=L(e,t,n[a],o);return i}function z(e,t={}){const{isStatic:n}=u.useContext(V),o=()=>w(e)?e.get():e;if(n)return L(o);const r=k(o());return u.useInsertionEffect(()=>K(r,e,t),[r,JSON.stringify(t)]),r}function O(e,t={}){return z(e,{type:"spring",...t})}function J(e){const t=[...e];for(let n=t.length-1;n>0;n--){const o=Math.floor(Math.random()*(n+1));[t[n],t[o]]=[t[o],t[n]]}return t}function $(e,t){const n=J(e),o=Array.from({length:t},()=>[]);n.forEach((i,a)=>{o[a%t].push(i)});const r=Math.max(...o.map(i=>i.length));return o.forEach(i=>{for(;i.length<r;)i.push(n[Math.floor(Math.random()*n.length)])}),o}const q=F.memo(function({logos:t,index:n,currentTime:o,onHoverChange:r}){const[i,a]=u.useState(!1),s=4e3,c=n*400,d=(o+c)%(s*t.length),f=Math.floor(d/s),l=t[f],m=y=>{a(y),r(y)};return p.jsxs("div",{className:"relative flex flex-col items-center",onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[p.jsx(v.div,{className:"relative h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 overflow-hidden",initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{delay:n*.1,duration:.5,ease:"easeOut"},children:p.jsx(C,{mode:"wait",children:p.jsx(v.div,{className:"absolute inset-0 flex items-center justify-center",initial:{y:"18%",opacity:0,filter:"blur(4px)"},animate:{y:"0%",opacity:1,filter:"blur(0px)",transition:{type:"tween",ease:[.22,1,.36,1],duration:.9}},exit:{y:"-18%",opacity:0,filter:"blur(4px)",transition:{type:"tween",ease:[.4,0,1,1],duration:.55}},children:p.jsx(D,{provider:l.provider,size:24,className:"object-contain"})},`${l.id}-${f}`)})}),p.jsx(C,{children:i&&p.jsx(v.span,{className:"pointer-events-none absolute -bottom-7 z-10 whitespace-nowrap rounded bg-oai-gray-800 px-2 py-0.5 text-xs font-medium text-oai-gray-100 shadow-lg ring-1 ring-oai-gray-700",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:l.name})})]})});function _({logos:e,columnCount:t=2}){const[n,o]=u.useState([]),[r,i]=u.useState(0),[a,s]=u.useState(!1);u.useEffect(()=>{o($(e,t))},[e,t]),u.useEffect(()=>{if(a)return;const d=setInterval(()=>i(f=>f+100),100);return()=>clearInterval(d)},[a]);const c=u.useCallback(d=>{s(d)},[]);return p.jsx("div",{className:"flex gap-2.5 sm:gap-4 text-oai-gray-200",children:n.map((d,f)=>p.jsx(q,{logos:d,index:f,currentTime:r,onHoverChange:c},f))})}const Q=[{id:1,name:"Claude Code",provider:"claude"},{id:2,name:"Codex",provider:"codex"},{id:3,name:"Cursor",provider:"cursor"},{id:4,name:"Gemini",provider:"gemini"},{id:5,name:"OpenCode",provider:"opencode"},{id:6,name:"OpenClaw",provider:"openclaw"},{id:7,name:"Antigravity",provider:"antigravity"},{id:8,name:"Kiro",provider:"kiro"},{id:9,name:"Hermes",provider:"hermes"},{id:10,name:"GitHub Copilot",provider:"copilot"},{id:11,name:"Kimi",provider:"kimi"},{id:12,name:"oh-my-pi",provider:"omp"},{id:13,name:"Pi",provider:"pi"},{id:14,name:"CodeBuddy",provider:"codebuddy"},{id:15,name:"Grok",provider:"grok"},{id:16,name:"Kilo",provider:"kilo-cli"},{id:17,name:"Craft",provider:"craft"},{id:18,name:"Droid",provider:"droid"},{id:19,name:"GitHub",provider:"github"}];export{Q as A,_ as L,O as a,L as b,k as u};
import{c as o}from"./main-BbEXIjk8.js";const t=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],a=o("arrow-up-right",t);export{a as A};
import{j as r}from"./main-BbEXIjk8.js";function t({children:i,title:a,subtitle:o,className:s="",bodyClassName:d=""}){return r.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 transition-colors duration-200 ${s}`,children:[(a||o)&&r.jsxs("div",{className:"px-5 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 transition-colors duration-200",children:[a&&r.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide transition-colors duration-200",children:a}),o&&r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-1 transition-colors duration-200",children:o})]}),r.jsx("div",{className:`p-5 ${d}`,children:i})]})}export{t as C};

Sorry, the diff of this file is too big to display

import{Y as p,r as c,j as e,aK as b}from"./main-BbEXIjk8.js";const f={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_VERSION:"0.53.2",VITE_INSFORGE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC0xMjM0LTU2NzgtOTBhYi1jZGVmMTIzNDU2NzgiLCJlbWFpbCI6ImFub25AaW5zZm9yZ2UuY29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODExNDU5NDd9.T0auta_IrVIh0uXW1bob5QSnzvsnJmN28r5XkSGEuQY",VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function x(){return b(),`${(f&&"https://srctyff5.us-east.insforge.app"||"https://srctyff5.us-east.insforge.app").replace(/\/$/,"")}/functions/tokentracker-device-flow-grant`}function l(a){return(a||"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9-]/g,"")}function k(){const a=p(),[m,u]=c.useState(""),[t,r]=c.useState({kind:"idle",message:""});c.useEffect(()=>{try{const i=new URLSearchParams(window.location.search).get("user_code");i&&u(l(i))}catch{}},[]);async function g(d){if(d?.preventDefault?.(),!a?.signedIn){r({kind:"error",message:"Please sign in first."});return}const i=l(m);if(!/^[A-HJKMNP-Z2-9]{4}-[A-HJKMNP-Z2-9]{4}$/.test(i)){r({kind:"error",message:"Invalid code format. Expected XXXX-XXXX."});return}r({kind:"working",message:"Approving…"});try{const n=await a.getAccessToken?.();if(!n){r({kind:"error",message:"No access token — please sign in again."});return}const s=await fetch(x(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({user_code:i})}),o=await s.json().catch(()=>({}));s.ok?r({kind:"success",message:o.status==="already_approved"?`Already approved earlier${o.client_info?" ("+o.client_info+")":""}.`:`Approved${o.client_info?" for "+o.client_info:""}. You can close this tab — your CLI will pick it up within a few seconds.`}):s.status===404?r({kind:"error",message:"Code not found. Double-check what your CLI printed."}):s.status===410?r({kind:"error",message:"Code expired. Re-run `tracker device-login` and try again."}):s.status===401?r({kind:"error",message:"Session expired. Sign out, sign in, and try again."}):r({kind:"error",message:o?.error||`Server error (HTTP ${s.status}).`})}catch(n){r({kind:"error",message:`Network error: ${n?.message||n}`})}}return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-oai-gray-950 px-6 py-12",children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-8",children:[e.jsx("h1",{className:"text-2xl font-semibold text-oai-gray-900 dark:text-white mb-2",children:"Approve your CLI"}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mb-6",children:"Type the code your CLI showed you. We'll link it to your account so token usage from that machine flows into your leaderboard profile."}),a?.signedIn?null:e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 dark:bg-amber-900/20 dark:border-amber-800 p-4 mb-4",children:e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"Sign in first, then return to this page."})}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-xs font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400 mb-1",children:"CLI code"}),e.jsx("input",{type:"text",value:m,onChange:d=>u(l(d.target.value)),placeholder:"XXXX-XXXX",spellCheck:!1,autoCapitalize:"characters",maxLength:9,className:"w-full font-mono text-xl tracking-widest text-center rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-white dark:bg-oai-gray-900 text-oai-gray-900 dark:text-white px-4 py-3 focus:outline-none focus:ring-inset focus:ring-2 focus:ring-emerald-600"})]}),e.jsx("button",{type:"submit",disabled:t.kind==="working"||!a?.signedIn,className:"w-full rounded-md bg-emerald-600 hover:bg-emerald-500 disabled:bg-oai-gray-300 disabled:cursor-not-allowed text-white font-medium py-3 transition-colors",children:t.kind==="working"?"Approving…":"Approve"})]}),t.kind==="success"&&e.jsx("div",{className:"mt-4 rounded-md border border-emerald-200 bg-emerald-50 dark:bg-emerald-900/20 dark:border-emerald-800 p-4",children:e.jsx("p",{className:"text-sm text-emerald-700 dark:text-emerald-300",children:t.message})}),t.kind==="error"&&e.jsx("div",{className:"mt-4 rounded-md border border-red-200 bg-red-50 dark:bg-red-900/20 dark:border-red-800 p-4",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:t.message})})]})})}export{k as default};
import{bQ as s,b9 as T,r as i,b4 as W,a as k,bf as K,be as ee,j as I,bY as te,b$ as ne,b as oe,bR as se,bG as re,bJ as ae,b8 as ie,bL as le}from"./main-BbEXIjk8.js";import{x as z,P as G,w as L,A as x,l as H,v as ue,r as de,I as pe,h as ce,i as ge,j as fe,k as me,z as Se,m as Ce,s as Pe,e as Oe,f as Re,u as xe}from"./useScrollLock-Dm_66oFo.js";function Ee(){return new z({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new G,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function he(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Ee(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:T,inactiveTriggerProps:T,popupProps:T}}function Ie(e,t,o=!1){return new z({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:o,onOpenChange:void 0})}const w=s(e=>e.triggerIdProp??e.activeTriggerId),Y=s(e=>e.openProp??e.open),$=s(e=>(e.popupElement?.id??e.floatingId)||void 0);function Q(e,t){return t!==void 0&&Y(e)&&w(e)===t}function ve(e,t){return Q(e,t)?!0:t!==void 0&&Y(e)&&w(e)==null&&e.triggerCount===1}const ye={open:Y,mounted:s(e=>e.mounted),transitionStatus:s(e=>e.transitionStatus),floatingRootContext:s(e=>e.floatingRootContext),triggerCount:s(e=>e.triggerCount),preventUnmountingOnClose:s(e=>e.preventUnmountingOnClose),payload:s(e=>e.payload),activeTriggerId:w,activeTriggerElement:s(e=>e.mounted?e.activeTriggerElement:null),popupId:$,isTriggerActive:s((e,t)=>t!==void 0&&w(e)===t),isOpenedByTrigger:s((e,t)=>Q(e,t)),isMountedByTrigger:s((e,t)=>t!==void 0&&w(e)===t&&e.mounted),triggerProps:s((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:s((e,t)=>ve(e,t)?$(e):void 0),popupProps:s(e=>e.popupProps),popupElement:s(e=>e.popupElement),positionerElement:s(e=>e.positionerElement)},q=i.createContext(!1),X=i.createContext(void 0);function b(e){const t=i.useContext(X);if(e===!1&&t===void 0)throw new Error(W(27));return t}const be={...L,...K},Ye=i.forwardRef(function(t,o){const{render:r,className:a,style:l,forceRender:u=!1,...d}=t,{store:p}=b(),n=p.useState("open"),C=p.useState("nested"),m=p.useState("mounted"),S=p.useState("transitionStatus");return k("div",t,{state:{open:n,transitionStatus:S},ref:[p.context.backdropRef,o],stateAttributesMapping:be,props:[{role:"presentation",hidden:!m,style:{userSelect:"none",WebkitUserSelect:"none"}},d],enabled:u||!C})});let Te=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),we=(function(e){return e[e.open=x.open]="open",e[e.closed=x.closed]="closed",e[e.startingStyle=x.startingStyle]="startingStyle",e[e.endingStyle=x.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Z=i.createContext(void 0);function V(){const e=i.useContext(Z);if(e===void 0)throw new Error(W(26));return e}const De={...L,...K,nestedDialogOpen(e){return e?{[we.nestedDialogOpen]:""}:null}},_e=i.forwardRef(function(t,o){const{render:r,className:a,style:l,finalFocus:u,initialFocus:d,...p}=t,{store:n}=b(),C=n.useState("descriptionElementId"),m=n.useState("disablePointerDismissal"),S=n.useState("floatingRootContext"),O=n.useState("popupProps"),f=n.useState("modal"),R=n.useState("mounted"),E=n.useState("nested"),h=n.useState("nestedOpenDialogCount"),g=n.useState("open"),v=n.useState("openMethod"),P=n.useState("titleElementId"),c=n.useState("transitionStatus"),M=n.useState("role"),N=S.useState("floatingId"),F=p.id??N;V(),ee({open:g,ref:n.context.popupRef,onComplete(){g&&n.context.onOpenChangeComplete?.(!0)}});function B(D){return D==="touch"?n.context.popupRef.current:!0}const j=d===void 0?B:d,U=h>0,y=n.useStateSetter("popupElement"),A=k("div",t,{state:{open:g,nested:E,transitionStatus:c,nestedDialogOpen:U},props:[O,{id:F,"aria-labelledby":P??void 0,"aria-describedby":C??void 0,role:M,...H,hidden:!R,onKeyDown(D){ue.has(D.key)&&D.stopPropagation()},style:{[Te.nestedDialogs]:h}},p],ref:[o,n.context.popupRef,y],stateAttributesMapping:De});return I.jsx(de,{context:S,openInteractionType:v,disabled:!R,closeOnFocusOut:!m,initialFocus:j,returnFocus:u,modal:f!==!1,restoreFocus:"popup",children:A})}),$e=i.forwardRef(function(t,o){const{keepMounted:r=!1,...a}=t,{store:l}=b(),u=l.useState("mounted"),d=l.useState("modal"),p=l.useState("open");return u||r?I.jsx(Z.Provider,{value:r,children:I.jsxs(te,{ref:o,...a,children:[u&&d===!0&&I.jsx(pe,{ref:l.context.internalBackdropRef,inert:ne(!p)}),t.children]})}):null});function ke(e){const{store:t,parentContext:o,actionsRef:r,isDrawer:a}=e,l=t.useState("open");ce(t,l),ge(t);const{forceUnmount:u}=fe(l,t),d=i.useCallback(()=>{t.setOpen(!1,oe(se))},[t]);return i.useImperativeHandle(r,()=>({unmount:u,close:d}),[u,d]),{parentContext:o,isDrawer:a}}function Me({store:e,dialogRoot:t}){const{parentContext:o,isDrawer:r}=t,a=e.useState("open"),l=e.useState("disablePointerDismissal"),u=e.useState("modal"),d=e.useState("popupElement"),p=e.useState("floatingRootContext"),[n,C]=i.useState(0),[m,S]=i.useState(0),O=n===0,f=me(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0||"touches"in g&&g.touches.length!==1)return!1;const v=re(g);if(O&&!l){const P=v;return u&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===P||e.context.backdropRef.current===P||ae(P,d)&&!P?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:O});Se(a&&u===!0,d),e.useContextCallback("onNestedDialogOpen",(g,v)=>{C(g),S(v)}),e.useContextCallback("onNestedDialogClose",()=>{C(0),S(0)}),i.useEffect(()=>(o?.onNestedDialogOpen&&a&&o.onNestedDialogOpen(n+1,m+(r?1:0)),o?.onNestedDialogClose&&!a&&o.onNestedDialogClose(),()=>{o?.onNestedDialogClose&&a&&o.onNestedDialogClose()}),[r,a,n,m,o]);const R=f.reference??T,E=f.trigger??T,h=i.useMemo(()=>ie(H,f.floating),[f.floating]);return Ce(e,{activeTriggerProps:R,inactiveTriggerProps:E,popupProps:h,nestedOpenDialogCount:n,nestedOpenDrawerCount:m}),null}const Ne={...ye,modal:s(e=>e.modal),nested:s(e=>e.nested),nestedOpenDialogCount:s(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:s(e=>e.nestedOpenDrawerCount),disablePointerDismissal:s(e=>e.disablePointerDismissal),openMethod:s(e=>e.openMethod),descriptionElementId:s(e=>e.descriptionElementId),titleElementId:s(e=>e.titleElementId),viewportElement:s(e=>e.viewportElement),role:s(e=>e.role)};class _ extends le{constructor(t,o,r=!1){const a=new G,l=Fe(t);l.floatingRootContext=Ie(a,o,r),super(l,{popupRef:i.createRef(),backdropRef:i.createRef(),internalBackdropRef:i.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:a,onOpenChange:void 0,onOpenChangeComplete:void 0},Ne)}setOpen=(t,o)=>{if(o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,o);const r={open:t};Pe(r,t,o.trigger),this.update(r)};static useStore(t,o){return Oe(t,(a,l)=>new _(o,a,l),!0).store}}function Fe(e={}){return{...he(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function Be(e,t="dialog"){const{children:o,open:r,defaultOpen:a=!1,onOpenChange:l,onOpenChangeComplete:u,disablePointerDismissal:d=!1,modal:p=!0,actionsRef:n,handle:C,triggerId:m,defaultTriggerId:S=null}=e,O=t==="drawer",f=t==="alert-dialog",R=f?!0:p,E=f||d,h=f?"alertdialog":"dialog",g=b(!0),P={modal:R,disablePointerDismissal:E,nested:!!g,role:h},c=_.useStore(C?.store,{open:a,openProp:r,activeTriggerId:S,triggerIdProp:m,...P});Re(()=>{const y=r===void 0&&c.state.open===!1&&a===!0?{open:!0,activeTriggerId:S}:null;f?c.update(y?{...P,...y}:P):y&&c.update(y)}),c.useControlledProp("openProp",r),c.useControlledProp("triggerIdProp",m),c.useSyncedValues(P),c.useContextCallback("onOpenChange",l),c.useContextCallback("onOpenChangeComplete",u);const M=c.useState("open"),N=c.useState("mounted"),F=c.useState("payload"),B=ke({store:c,actionsRef:n,parentContext:g?.store.context,isDrawer:O}),j=M||N,U=i.useMemo(()=>({store:c}),[c]);return I.jsx(q.Provider,{value:!1,children:I.jsxs(X.Provider,{value:U,children:[j&&I.jsx(Me,{store:c,dialogRoot:B}),typeof o=="function"?o({payload:F}):o]})})}function Je(e){const t=i.useContext(q)?"drawer":"dialog";return Be(e,t)}let J=(function(e){return e[e.open=x.open]="open",e[e.closed=x.closed]="closed",e[e.startingStyle=x.startingStyle]="startingStyle",e[e.endingStyle=x.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const je={...L,...K,nested(e){return e?{[J.nested]:""}:null},nestedDialogOpen(e){return e?{[J.nestedDialogOpen]:""}:null}},We=i.forwardRef(function(t,o){const{render:r,className:a,style:l,children:u,...d}=t,p=V(),{store:n}=b(),C=n.useState("open"),m=n.useState("nested"),S=n.useState("transitionStatus"),O=n.useState("nestedOpenDialogCount"),f=n.useState("mounted"),R=n.useStateSetter("viewportElement"),E=O>0;return k("div",t,{enabled:p||f,state:{open:C,nested:m,transitionStatus:S,nestedDialogOpen:E},ref:[o,R],stateAttributesMapping:je,props:[{role:"presentation",hidden:!f,style:{pointerEvents:C?void 0:"none"},children:u},d]})}),ze=i.forwardRef(function(t,o){const{render:r,className:a,style:l,id:u,...d}=t,{store:p}=b(),n=xe(u);return p.useSyncedValueWithCleanup("titleElementId",n),k("h2",t,{ref:o,props:[{id:n},d]})});export{Je as D,$e as a,Ye as b,We as c,_e as d,ze as e,Ie as f,he as g,ye as p,b as u};
import{c as o}from"./main-BbEXIjk8.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],e=o("download",a);export{e as D};
import{e as d,j as n,m as a}from"./main-BbEXIjk8.js";function v({children:i,delay:t=0,duration:o=.35,y:e=12,className:s="",once:r=!0}){return d()?n.jsx("div",{className:s,children:i}):n.jsx(a.div,{initial:{opacity:0,y:e},animate:{opacity:1,y:0},transition:{duration:o,delay:t,ease:[.16,1,.3,1]},className:s,children:i})}function x({children:i,staggerDelay:t=.1,initialDelay:o=0,className:e=""}){return d()?n.jsx("div",{className:e,children:i}):n.jsx(a.div,{initial:"hidden",animate:"visible",variants:{hidden:{},visible:{transition:{staggerChildren:t,delayChildren:o}}},className:e,children:i})}function h({children:i,className:t="",y:o=12}){return d()?n.jsx("div",{className:t,children:i}):n.jsx(a.div,{variants:{hidden:{opacity:0,y:o},visible:{opacity:1,y:0,transition:{duration:.35,ease:[.16,1,.3,1]}}},className:t,children:i})}export{v as F,x as S,h as a};
import{r as s,aF as c,j as t}from"./main-BbEXIjk8.js";function u({repo:r="mm7894215/TokenTracker"}){const[a,o]=s.useState(null);return s.useEffect(()=>{if(typeof window>"u")return;const n=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,i=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));c({prefersReducedMotion:n,screenshotCapture:i})&&fetch(`https://api.github.com/repos/${r}`).then(e=>e.json()).then(e=>{e&&typeof e.stargazers_count=="number"&&o(e.stargazers_count)}).catch(()=>{})},[r]),t.jsxs("a",{href:`https://github.com/${r}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-2 px-3 py-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 transition-colors no-underline",children:[t.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"shrink-0 fill-oai-gray-700 dark:fill-oai-gray-300",children:t.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),t.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap",children:"Star"}),a!==null&&t.jsx("span",{className:"text-xs font-semibold text-oai-gray-900 dark:text-oai-white tabular-nums whitespace-nowrap",children:a})]})}export{u as H};
import{c}from"./main-BbEXIjk8.js";const o=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],t=c("info",o);export{t as I};
import{r as ge,G as t,j as n}from"./main-BbEXIjk8.js";const Ge=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),j=Ge?"/proxy/ipcheck":"https://ip.net.coffee",fe="claude_ip_history",Se=6,Ue=["CN","HK","MO","RU","KP","IR","SY","CU","BY","VE"],ze={CN:"Asia/Shanghai",TW:"Asia/Taipei",HK:"Asia/Hong_Kong",MO:"Asia/Macau",JP:"Asia/Tokyo",KR:"Asia/Seoul",SG:"Asia/Singapore",MY:"Asia/Kuala_Lumpur",TH:"Asia/Bangkok",VN:"Asia/Ho_Chi_Minh",ID:"Asia/Jakarta",PH:"Asia/Manila",IN:"Asia/Kolkata",PK:"Asia/Karachi",BD:"Asia/Dhaka",IR:"Asia/Tehran",IL:"Asia/Jerusalem",AE:"Asia/Dubai",SA:"Asia/Riyadh",TR:"Europe/Istanbul",RU:"Europe/Moscow",UA:"Europe/Kyiv",GB:"Europe/London",IE:"Europe/Dublin",FR:"Europe/Paris",DE:"Europe/Berlin",IT:"Europe/Rome",ES:"Europe/Madrid",PT:"Europe/Lisbon",NL:"Europe/Amsterdam",BE:"Europe/Brussels",CH:"Europe/Zurich",AT:"Europe/Vienna",SE:"Europe/Stockholm",NO:"Europe/Oslo",DK:"Europe/Copenhagen",FI:"Europe/Helsinki",PL:"Europe/Warsaw",CZ:"Europe/Prague",GR:"Europe/Athens",RO:"Europe/Bucharest",US:"America/Los_Angeles",CA:"America/Toronto",MX:"America/Mexico_City",BR:"America/Sao_Paulo",AR:"America/Argentina/Buenos_Aires",CL:"America/Santiago",AU:"Australia/Sydney",NZ:"Pacific/Auckland",ZA:"Africa/Johannesburg",EG:"Africa/Cairo",NG:"Africa/Lagos",KE:"Africa/Nairobi"},We={CN:["zh"],TW:["zh"],HK:["zh","en"],MO:["zh","en"],JP:["ja"],KR:["ko"],TH:["th"],VN:["vi"],SG:["en","zh","ms","ta"],MY:["ms","en","zh","ta"],ID:["id","en"],PH:["en","tl","fil"],IN:["en","hi"],PK:["ur","en"],BD:["bn","en"],LK:["si","ta","en"],NP:["ne","en"],US:["en"],GB:["en"],IE:["en","ga"],AU:["en"],NZ:["en","mi"],CA:["en","fr"],DE:["de"],AT:["de"],CH:["de","fr","it","rm"],BE:["nl","fr","de"],FR:["fr"],IT:["it"],ES:["es","ca","gl","eu"],PT:["pt"],NL:["nl","fy"],LU:["lb","fr","de"],SE:["sv"],NO:["no","nb","nn"],DK:["da"],FI:["fi","sv"],IS:["is","en"],PL:["pl"],CZ:["cs"],SK:["sk"],HU:["hu"],RO:["ro"],BG:["bg"],GR:["el"],RU:["ru"],UA:["uk","ru"],BY:["be","ru"],TR:["tr"],IL:["he","ar","en"],SA:["ar"],AE:["ar","en"],EG:["ar"],IR:["fa"],IQ:["ar","ku"],ZA:["en","af","zu","xh"],KE:["en","sw"],NG:["en"],ET:["am","en"],BR:["pt"],AR:["es"],MX:["es"],CL:["es"],CO:["es"],PE:["es"],VE:["es"]},Be={jp:"Japan",tw:"Taiwan",hk:"Hong Kong",sg:"Singapore",us:"United States",de:"Germany",kr:"South Korea",fr:"France",nl:"Netherlands",gb:"United Kingdom",au:"Australia",ca:"Canada",br:"Brazil",in:"India"};function Z(p){return!!p&&p.includes(":")}function Ke(p){return!Z(p)||p.length<=20?p:p.substring(0,18)+"..."}function w(p){return p==null?"":String(p).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function B(p){if(!p||!/^[a-zA-Z]{2}$/.test(p))return"";const b=p.toLowerCase();return`<img src="${b==="cn"?`${j}/favicons/cn.png`:b==="tw"?`${j}/favicons/flags/tw.png`:`${j}/favicons/flags/${b}.png`}" alt="${b}" class="inline-block h-4 w-auto align-[-2px]" onerror="this.onerror=null;this.style.display='none'">`}function Fe(p){if(!p)return"";const b=String(p).trim();if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(b)){const S=b.split(".");return S[0]+"."+S[1]+".*.*"}if(b.includes("…")){const S=b.lastIndexOf("…");return b.substring(0,S+1)+"*"}if(b.includes(":")){const S=b.split(":");if(S.length>=2)return S[0]+":"+S[1]+":*"}return b}function Ve(p){if(!p)return null;try{const S=new Intl.DateTimeFormat("en-US",{timeZone:p,timeZoneName:"longOffset"}).formatToParts(new Date).find(q=>q.type==="timeZoneName");if(!S)return null;if(S.value==="GMT"||S.value==="UTC")return 0;const M=S.value.match(/GMT([+-])(\d{1,2}):?(\d{0,2})/);return M?(M[1]==="+"?1:-1)*(parseInt(M[2],10)*60+parseInt(M[3]||"0",10)):null}catch{return null}}function Ye(p){if(p==null)return"";const b=p>=0?"+":"-",S=Math.abs(p),M=Math.floor(S/60),D=S%60;return"UTC"+b+M+(D?":"+String(D).padStart(2,"0"):"")}const Te={safe:"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",warn:"bg-amber-50 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300",danger:"bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",info:"bg-blue-50 text-blue-700 dark:bg-blue-500/15 dark:text-blue-300",neutral:"bg-oai-gray-100 text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-400"};function Je(){const p=ge.useRef(null),[b,S]=ge.useState(!1);ge.useEffect(()=>{const _=p.current;if(!_)return;const C=a=>_.querySelector(`#${a}`);let se=!1;const e={unknown:t("ipcheck.common.unknown"),failed:t("ipcheck.ip.failed"),regionAccessible:t("ipcheck.trust.region.accessible"),regionWarnTitle:a=>t("ipcheck.trust.region_warn.title",{region:a}),regionWarnBody:t("ipcheck.trust.region_warn.body"),regionRestrictedText:t("ipcheck.trust.text.restricted"),noData:t("ipcheck.trust.no_data"),noIp:t("ipcheck.trust.no_ip"),noScore:t("ipcheck.trust.no_score"),score:{pristine:t("ipcheck.trust.label.pristine"),clean:t("ipcheck.trust.label.clean"),good:t("ipcheck.trust.label.good"),neutral:t("ipcheck.trust.label.neutral"),suspicious:t("ipcheck.trust.label.suspicious"),unreachable:t("ipcheck.trust.label.unreachable")},scoreText:{excellent:t("ipcheck.trust.text.excellent"),great:t("ipcheck.trust.text.great"),minor:t("ipcheck.trust.text.minor"),moderate:t("ipcheck.trust.text.moderate"),severe:t("ipcheck.trust.text.severe")},propsRegion:t("ipcheck.props.region"),propsCity:t("ipcheck.props.city"),propsType:t("ipcheck.props.type"),propsAsn:t("ipcheck.props.asn"),propsOrg:t("ipcheck.props.org"),propsResidential:t("ipcheck.props.residential"),propsDatacenter:t("ipcheck.props.datacenter"),secVpn:t("ipcheck.security.vpn"),secProxy:t("ipcheck.security.proxy"),secTor:t("ipcheck.security.tor"),secCrawler:t("ipcheck.security.crawler"),secAbuser:t("ipcheck.security.abuser"),secProxyFlag:t("ipcheck.security.proxy_flag"),secCrawlerYes:t("ipcheck.security.crawler_yes"),secCrawlerNo:t("ipcheck.security.crawler_no"),secAbuserYes:t("ipcheck.security.abuser_yes"),secAbuserNo:t("ipcheck.security.abuser_no"),secClean:t("ipcheck.security.clean"),availSvc:t("ipcheck.avail.svc_row"),availLat:{normal:t("ipcheck.avail.latency.normal"),good:t("ipcheck.avail.latency.good"),slow:t("ipcheck.avail.latency.slow"),unreachable:t("ipcheck.avail.latency.unreachable")},availSvcStatus:{none:t("ipcheck.avail.svc.none"),minor:t("ipcheck.avail.svc.minor"),major:t("ipcheck.avail.svc.major"),critical:t("ipcheck.avail.svc.critical"),maintenance:t("ipcheck.avail.svc.maintenance"),other:t("ipcheck.avail.svc.other")},dnsStatus:t("ipcheck.dns.status"),dnsOutlet:t("ipcheck.dns.outlet"),dnsOutletIp:t("ipcheck.dns.outlet_ip"),dnsIsp:t("ipcheck.dns.isp"),dnsLeaked:t("ipcheck.dns.leaked"),dnsNoLeak:t("ipcheck.dns.no_leak"),dnsEncrypted:t("ipcheck.dns.encrypted"),dnsCnTag:t("ipcheck.dns.cn_tag"),udpStatus:t("ipcheck.udp.status"),udpOutlet:t("ipcheck.udp.outlet"),udpOutletIp:t("ipcheck.udp.outlet_ip"),udpOrigin:t("ipcheck.udp.origin"),udpDisabled:t("ipcheck.udp.disabled"),udpNoLeak:t("ipcheck.udp.no_leak"),udpLeaked:t("ipcheck.udp.leaked"),udpAnomaly:t("ipcheck.udp.anomaly"),devTz:t("ipcheck.device.tz"),devLang:t("ipcheck.device.lang"),devOs:t("ipcheck.device.os"),devTouch:t("ipcheck.device.touch"),devNet:t("ipcheck.device.net"),devDnt:t("ipcheck.device.dnt"),devWebglRender:t("ipcheck.device.webgl_render"),devCanvasFp:t("ipcheck.device.canvas_fp"),devWebglFp:t("ipcheck.device.webgl_fp"),devMatch:t("ipcheck.device.match"),devMismatch:t("ipcheck.device.mismatch"),devLocal:t("ipcheck.device.local"),devEstSuffix:t("ipcheck.device.estimate_suffix"),devDiffEqual:t("ipcheck.device.diff_equal"),devDiffAhead:a=>t("ipcheck.device.diff_ahead",{h:a}),devDiffBehind:a=>t("ipcheck.device.diff_behind",{h:a}),devLangExpected:t("ipcheck.device.lang_expected"),devTouchYes:t("ipcheck.device.touch_yes"),devTouchNo:t("ipcheck.device.touch_no"),devDntOn:t("ipcheck.device.dnt_on"),devDntOff:t("ipcheck.device.dnt_off"),devDntUnset:t("ipcheck.device.dnt_unset"),devNetUnsupported:t("ipcheck.device.net_unsupported"),devUnsupported:t("ipcheck.device.unsupported"),histEmpty:t("ipcheck.history.empty"),histCurrent:t("ipcheck.history.current"),histLoading:t("ipcheck.ip.loading")};function f(a,i="neutral"){return`<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${Te[i]||Te.neutral}">${a}</span>`}function J(a,i,r){return a===!0?f(i,"danger"):a===!1?f(r,"safe"):f(e.unknown,"neutral")}function he(a){if(!a)return`<span class="text-oai-gray-400 dark:text-oai-gray-500">${w(e.failed)}</span>`;const i=w(a);return Z(a)?`<span class="ip-mask-target truncate" title="${i}">${w(Ke(a))}</span>`:`<span class="ip-mask-target">${i}</span>`}function K(a){return a?`<span class="ip-link">${he(a)}</span>`:`<span class="text-oai-gray-400 dark:text-oai-gray-500">${w(e.failed)}</span>`}function d(a,i,r=!1){let u=i;return i===void 0?r?u=`<div class="inline-flex items-center gap-1.5 text-xs text-oai-gray-400">
<svg class="animate-spin-subtle h-3.5 w-3.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
</div>`:u='<span class="block h-3 w-20 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></span>':u=`<div class="animate-scale-up-fade">${i}</div>`,`<div class="flex items-center justify-between py-2.5 gap-3">
<span class="text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0">${a}</span>
<span class="text-sm font-medium text-oai-black dark:text-white text-right min-w-0">${u}</span>
</div>`}function re(a){return a.map(i=>d(i,void 0)).join("")}function oe(){return'<div class="h-7 w-44 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></div>'}function ce(){return'<div class="h-3 w-52 mt-2 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></div>'}function _e(a){return a>=95?{text:e.score.pristine,variant:"safe"}:a>=80?{text:e.score.clean,variant:"safe"}:a>=50?{text:e.score.good,variant:"info"}:a>=25?{text:e.score.neutral,variant:"warn"}:{text:e.score.suspicious,variant:"danger"}}const m={ip:null,ippure:null,ipapis:null,claudeGeo:null,claudeRisk:null,cfGeo:"",scoreAnimId:null,lastScore:0};function xe(){const a=(m.claudeRisk?.countryCode||"").toUpperCase();return!a||!Ue.includes(a)?null:t(`ipcheck.region.${a}`)}function le(){const a=C("ipv6Warn");a&&a.classList.remove("hidden")}function te(a,i){const r=C(a);r&&(r.textContent=i||"",r.classList.remove("animate-pulse","bg-oai-gray-200","dark:bg-oai-gray-800","w-52","h-3","mt-2","rounded"))}const Le={gaugeScore:'<span class="block h-8 w-16 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></span>',ipAddrCN:oe(),ipGeoCN:ce(),ipAddr:oe(),ipGeo:ce(),ipAddrClaude:oe(),ipGeoClaude:ce(),propsContent:re([e.propsRegion,e.propsCity,e.propsType,e.propsAsn,e.propsOrg]),securityContent:re([e.secVpn,e.secProxy,e.secTor,e.secCrawler,e.secAbuser]),claudeAvailContent:d("claude.ai",void 0,!0)+d("anthropic.com",void 0,!0),dnsLeakContent:d(e.dnsStatus,void 0,!0)+d(e.dnsOutletIp,void 0,!0),udpLeakContent:d(e.udpStatus,void 0,!0)+d(e.udpOutletIp,void 0,!0),deviceContent:re([e.devTz,e.devLang,e.devOs,e.devTouch,e.devNet,e.devDnt,e.devWebglRender,e.devCanvasFp]),ipHistoryContent:`<span class="text-sm text-oai-gray-400 dark:text-oai-gray-500">${e.histLoading}</span>`};Object.entries(Le).forEach(([a,i])=>{const r=C(a);r&&(r.innerHTML=i)});let ye=!1;function Ne(a){if(!a)return;a.dataset.realText||(a.dataset.realText=(a.textContent||"").trim());const i=a.dataset.realText,r=ye?Fe(i):i;a.textContent!==r&&(a.textContent=r)}function ke(){_.querySelectorAll(".ip-link, .ip-mask-target").forEach(Ne)}const ve=new MutationObserver(()=>requestAnimationFrame(ke));["ipHeroCN","ipHero","ipHeroClaude","ipHistoryContent","dnsLeakContent","udpLeakContent"].forEach(a=>{const i=C(a);i&&ve.observe(i,{childList:!0,subtree:!0})}),_.__setMaskOn=a=>{ye=!!a,ke()};async function $e(){try{const r=(await(await fetch("https://1.1.1.1/cdn-cgi/trace",{signal:AbortSignal.timeout(5e3)})).text()).match(/ip=([^\n]+)/);r&&(m.ip=r[1].trim())}catch{}}async function je(){try{const i=await(await fetch("https://claude.ai/cdn-cgi/trace",{cache:"no-store",signal:AbortSignal.timeout(8e3)})).text(),r=Object.fromEntries(i.trim().split(`
`).map(u=>u.split("=")));return{ip:r.ip||null,loc:r.loc?.toLowerCase()||null}}catch{return null}}async function Me(){try{const r=(await(await fetch("https://2026.ip138.com/",{signal:AbortSignal.timeout(5e3)})).text()).match(/(\d+\.\d+\.\d+\.\d+)/);if(r)return{ip:r[1]}}catch{}try{const r=(await(await fetch("https://my.ip.cn/",{signal:AbortSignal.timeout(5e3)})).text()).match(/(\d+\.\d+\.\d+\.\d+)/);if(r)return{ip:r[1]}}catch{}return null}async function Ee(a,i,r,u){const g=C(a),o=C(i);if(!(!g||!o)){if(!r){g.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`,o.textContent="";return}Z(r)&&le(),g.innerHTML=`${B(u)+" "}${K(r)}`;try{const l=await fetch(`${j}/api/geoip/${r}`,{signal:AbortSignal.timeout(5e3)});if(l.ok){const h=await l.json(),s=[h.country,h.region,h.city,h.isp].filter(Boolean).join(" · "),x=h.country_code||u||"";g.innerHTML=`${B(x)} ${K(r)}`,te(i,s)}}catch{}}}function Ie(){const a=m.ippure,i=m.claudeRisk,r=m.claudeGeo,u=m.ipapis,g=i?.asn||a?.asn||"",o=i?.asOrganization||a?.asOrganization||u?.company?.name||"",l=xe(),h=!!(i&&i.ip);let s,x=null;h?l?(s=0,x=e.regionRestrictedText):s=typeof i.trust_score=="number"?i.trust_score:null:s=null;const v=C("gaugePointer"),c=C("gaugeScore"),P=C("gaugeText");if(s===null)c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums text-oai-gray-400 dark:text-oai-gray-500">—</span> ${f(e.noData,"neutral")}`,v.style.left="0%",v.style.opacity="0.3",v.style.borderColor="",v.style.boxShadow="",P.textContent=h?e.noScore:e.noIp;else{const A=l?{text:e.score.unreachable,variant:"danger"}:_e(s),L=s>=50?"text-emerald-500":s>=25?"text-amber-500":"text-red-500",X=s>=50?"#10b981":s>=25?"#f59e0b":"#ef4444";if(m.lastScore!==s){m.scoreAnimId&&cancelAnimationFrame(m.scoreAnimId);const Q=m.lastScore||0;m.lastScore=s;const de=performance.now(),ee=800,ne=ue=>{const N=ue-de,k=Math.min(N/ee,1),$=k*(2-k),I=Math.round(Q+(s-Q)*$),Y=I>=50?"text-emerald-500":I>=25?"text-amber-500":"text-red-500";c&&(c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums ${Y}">${I}</span> ${f(A.text,A.variant)}`),k<1?m.scoreAnimId=requestAnimationFrame(ne):m.scoreAnimId=null};m.scoreAnimId=requestAnimationFrame(ne)}else c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums ${L}">${s}</span> ${f(A.text,A.variant)}`;requestAnimationFrame(()=>{requestAnimationFrame(()=>{v&&(v.style.left=Math.min(s,100)+"%",v.style.opacity="1",v.style.borderColor=X,v.style.boxShadow=`0 0 10px ${X}80, 0 2px 6px rgba(0,0,0,0.15)`)})}),P.textContent=x||(s>=95?e.scoreText.excellent:s>=80?e.scoreText.great:s>=50?e.scoreText.minor:s>=25?e.scoreText.moderate:e.scoreText.severe)}const y=C("statusDotClaude");if(y){let A,L;s===null?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-oai-gray-300 dark:bg-oai-gray-600 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"):l||s<25?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-red-500"):s<50?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-amber-500"):(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-emerald-500"),y.innerHTML=`<span class="${A}"></span><span class="${L}"></span>`}const H=C("regionWarn");H&&(l?(H.innerHTML=`<span class="font-medium">⚠️ ${e.regionWarnTitle(l)}</span><br><span class="text-[13px] font-normal mt-1 block opacity-90">${e.regionWarnBody}</span>`,H.classList.remove("hidden")):H.classList.add("hidden"));const G=C("claudeRegionSupportRow"),F=C("claudeRegionSupport");if(G&&F)if(l)G.classList.add("hidden");else{const A=!!(i&&i.ip),L=!!(i&&i.countryCode);F.innerHTML=!A||!L?f(e.unknown,"neutral"):f(e.regionAccessible,"safe"),G.classList.remove("hidden")}const U=i?.isResidential??(u?!u.is_datacenter:null),O=u?.company?.type||"",z=r?.country||i?.country||"",W=r?.city||i?.city||"";let T;if(U===!0?T=f(e.propsResidential,"safe"):U===!1?T=f(e.propsDatacenter,"warn"):T=f(e.unknown,"neutral"),O){const L={hosting:"Hosting",isp:"ISP",business:"Business",education:"Education"}[O]||w(O);T+=` <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${L}</span>`}C("propsContent").innerHTML=d(e.propsRegion,z?w(z):f(e.unknown,"neutral"))+d(e.propsCity,W?w(W):f(e.unknown,"neutral"))+d(e.propsType,T)+d(e.propsAsn,g?`<span class="font-mono tabular-nums">AS${w(g)}</span>`:f(e.unknown,"neutral"))+d(e.propsOrg,o?w(o):f(e.unknown,"neutral"));const E=u||{};C("securityContent").innerHTML=d(e.secVpn,J(E.is_vpn,e.secVpn,e.secClean))+d(e.secProxy,J(E.is_proxy,e.secProxyFlag,e.secClean))+d(e.secTor,J(E.is_tor,e.secTor,e.secClean))+d(e.secCrawler,J(E.is_crawler,e.secCrawlerYes,e.secCrawlerNo))+d(e.secAbuser,J(E.is_abuser,e.secAbuserYes,e.secAbuserNo))}async function Re(){const a=C("dnsLeakContent");if(!a)return;a.innerHTML=d(e.dnsStatus,void 0,!0)+d(e.dnsOutletIp,void 0,!0);const i=Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2);for(let s=1;s<=2;s++)await new Promise(x=>{const v=new Image,c=setTimeout(x,2e3);v.onload=v.onerror=()=>{clearTimeout(c),x()},v.src=`http://${i}-${s}.d.ip.net.coffee/pixel.gif?_=${Date.now()}`});await new Promise(s=>setTimeout(s,1500));let r=[];for(let s=0;s<2;s++){try{const x=await fetch(`${j}/api/dns/result/${i}`,{signal:AbortSignal.timeout(3e3)});if(x.ok&&(r=(await x.json()).dns_servers||[],r.length>0))break}catch{}s===0&&await new Promise(x=>setTimeout(x,1500))}if(r.length===0){a.innerHTML=d(e.dnsStatus,f(e.dnsEncrypted,"safe"));return}const u=(m.claudeRisk?.country||"").toLowerCase(),g=u.includes("china")||u.includes("中国");let o=null,l=!1;for(const s of r){let x=null;try{const y=await fetch(`${j}/api/geoip/${s}`,{signal:AbortSignal.timeout(3e3)});y.ok&&(x=await y.json())}catch{}const v=x?.country_code||"",c=x?.isp||"";if(v==="cn"&&!g){o={ip:s,cc:v,isp:c,leaked:!0},l=!0;break}o||(o={ip:s,cc:v,isp:c,leaked:!1})}let h=d(e.dnsStatus,l?f(e.dnsLeaked,"warn"):f(e.dnsNoLeak,"safe"));if(o){const s=`${B(o.cc)} <span class="ip-mask-target ${o.leaked?"text-amber-600 dark:text-amber-400 font-medium":""}">${w(o.ip)}</span>${o.leaked?" "+f(e.dnsCnTag,"warn"):""}`;h+=d(e.dnsOutlet,s),o.isp&&(h+=d(e.dnsIsp,`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal truncate inline-block max-w-[12rem] align-bottom">${w(o.isp)}</span>`))}a.innerHTML=h}async function He(){const a=C("udpLeakContent");if(!a)return;a.innerHTML=d(e.udpStatus,void 0,!0)+d(e.udpOutletIp,void 0,!0);const i=new Set;try{const y=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.cloudflare.com:3478"}]});y.createDataChannel("");const H=await y.createOffer();await y.setLocalDescription(H),await new Promise(G=>{const F=setTimeout(()=>{y.close(),G()},5e3);y.onicecandidate=U=>{if(!U.candidate){clearTimeout(F),y.close(),G();return}const O=U.candidate.candidate.match(/([0-9]{1,3}\.){3}[0-9]{1,3}/);if(O){const W=O[0];!W.startsWith("0.")&&!W.startsWith("127.")&&W!=="0.0.0.0"&&i.add(W)}const z=U.candidate.candidate.match(/([a-f0-9]{1,4}:){2,7}[a-f0-9]{1,4}/i);z&&i.add(z[0])}})}catch{}const r=m.claudeRisk?.ip||"",u=[...i],g=u.filter(y=>!Z(y)&&!y.startsWith("192.168.")&&!y.startsWith("10.")&&!y.startsWith("172.")&&!y.startsWith("198.18.")&&!y.startsWith("198.19.")&&!y.startsWith("100.64.")&&!y.startsWith("127.")&&!y.startsWith("0."));if(g.length===0&&u.length===0){a.innerHTML=d(e.udpStatus,f(e.udpDisabled,"safe"));return}if(g.length===0){a.innerHTML=d(e.udpStatus,f(e.udpNoLeak,"safe"));return}let o=g.find(y=>y===r)||g[0];const l=new Set(g).size>1,h=o===r,s=l&&!h;let x=d(e.udpStatus,s?f(e.udpLeaked,"warn"):f(e.udpNoLeak,"safe")),v="",c="";try{const y=await fetch(`${j}/api/geoip/${o}`,{signal:AbortSignal.timeout(5e3)});if(y.ok){const H=await y.json();v=H.country_code||"",c=H.country||""}}catch{}const P=`${B(v)} <span class="${s?"text-amber-600 dark:text-amber-400 font-medium":""}">${he(o)}</span>${h?"":s?" "+f(e.udpAnomaly,"warn"):""}`;x+=d(e.udpOutlet,P),c&&(x+=d(e.udpOrigin,`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${w(c)}</span>`)),a.innerHTML=x}async function be(){const a=C("claudeAvailContent");if(!a)return;a.innerHTML=d("claude.ai",void 0,!0)+d("anthropic.com",void 0,!0);const i=[{name:"claude.ai",url:"https://claude.ai/cdn-cgi/trace"},{name:"anthropic.com",url:"https://www.anthropic.com/favicon.ico"}],r=await Promise.allSettled(i.map(async o=>{const l=performance.now();try{return await fetch(o.url,{mode:"no-cors",signal:AbortSignal.timeout(6e3)}),{name:o.name,ms:Math.round(performance.now()-l),ok:!0}}catch{return{name:o.name,ms:-1,ok:!1}}})),u=xe();let g="";r.forEach(o=>{const l=o.value;if(u)g+=d(l.name,f(e.availLat.unreachable,"danger"));else if(l.ok){const h=l.ms<250?"safe":l.ms<500?"info":"warn",s=l.ms<250?e.availLat.normal:l.ms<500?e.availLat.good:e.availLat.slow;g+=d(l.name,`${f(s,h)} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${l.ms}ms</span>`)}else g+=d(l.name,f(e.availLat.unreachable,"danger"))});try{const o=await fetch(`${j}/claude/status.json`,{signal:AbortSignal.timeout(3e3)});if(o.ok){const h=(await o.json()).overall_indicator||"none",s=e.availSvcStatus[h]||e.availSvcStatus.other,x={none:"safe",minor:"warn",major:"danger",critical:"danger",maintenance:"warn"};g+=d(e.availSvc,f(s,x[h]||"warn"))}}catch{}a.innerHTML=g}_.__detectClaudeAvail=be;function Oe(){const a=Intl.DateTimeFormat().resolvedOptions().timeZone||e.unknown,i=-(new Date().getTimezoneOffset()/60),r="UTC"+(i>=0?"+":"")+i,u=m.claudeRisk,g=(u?.countryCode||"").toUpperCase(),o=u?.timezone||ze[g]||"",l=!!u?.timezone,h=Ve(o),s=-new Date().getTimezoneOffset();let x=null;o&&h!=null&&(x=Math.abs(h-s)<=60);let v;const c=w(a),P=w(o);if(x===!0)v=`${f(e.devMatch,"safe")} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${c} (${r})</span>`;else if(x===!1){const N=Ye(h),k=Math.round((h-s)/60),$=k===0?e.devDiffEqual:k>0?e.devDiffAhead(k):e.devDiffBehind(-k),I=l?P:`${P} ${e.devEstSuffix}`;v=`${f(e.devMismatch,"warn")}<br><span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${e.devLocal} ${c} (${r})<br>Claude ${I} (${N}) · ${$}</span>`}else v=`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${c} (${r})</span>`;const y=navigator.languages||[navigator.language],H=y.join(", ")||e.unknown,G=(y[0]||"").split("-")[0].toLowerCase(),F=We[g]||[],U=G&&F.length?F.includes(G):null;let O;const z=w(H),W=w(F.join(" / "));U===!0?O=`${f(e.devMatch,"safe")} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${z}</span>`:U===!1?O=`${f(e.devMismatch,"warn")}<br><span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${e.devLocal} ${z}<br>${e.devLangExpected} ${W}</span>`:O=`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${z}</span>`;const T=navigator.userAgent;let E=e.unknown,A=e.unknown;T.includes("Windows")?E="Windows":T.includes("Mac OS")?E="macOS":T.includes("iPhone")||T.includes("iPad")?E="iOS":T.includes("Android")?E="Android":T.includes("Linux")&&(E="Linux"),T.includes("Edg/")?A="Edge "+(T.match(/Edg\/([\d.]+)/)||[])[1]:T.includes("Chrome/")?A="Chrome "+(T.match(/Chrome\/([\d.]+)/)||[])[1]:T.includes("Firefox/")?A="Firefox "+(T.match(/Firefox\/([\d.]+)/)||[])[1]:T.includes("Safari/")&&!T.includes("Chrome")&&(A="Safari "+(T.match(/Version\/([\d.]+)/)||[])[1]);let L=e.devUnsupported;try{const N=document.createElement("canvas"),k=N.getContext("webgl")||N.getContext("experimental-webgl");if(k){const $=k.getExtension("WEBGL_debug_renderer_info");$&&(L=k.getParameter($.UNMASKED_RENDERER_WEBGL))}}catch{}let X=e.devUnsupported;try{const N=document.createElement("canvas"),k=N.getContext("webgl")||N.getContext("experimental-webgl");if(k){const $=k.getExtension("WEBGL_debug_renderer_info"),I=$?k.getParameter($.UNMASKED_VENDOR_WEBGL):"",Y=$?k.getParameter($.UNMASKED_RENDERER_WEBGL):"",Ce=I+"~"+Y+"~"+k.getParameter(k.VERSION)+"~"+k.getParameter(k.SHADING_LANGUAGE_VERSION);let ie=0;for(let pe=0;pe<Ce.length;pe++)ie=(ie<<5)-ie+Ce.charCodeAt(pe)|0;X=(ie>>>0).toString(16).toUpperCase()}}catch{}let Q=e.devUnsupported;try{const N=document.createElement("canvas");N.width=200,N.height=50;const k=N.getContext("2d");k.textBaseline="top",k.font="14px Arial",k.fillStyle="#f60",k.fillRect(50,0,100,50),k.fillStyle="#069",k.fillText("net.coffee",2,15),k.fillStyle="rgba(102,204,0,0.7)",k.fillText("canvas fp",4,30);const $=N.toDataURL();let I=0;for(let Y=0;Y<$.length;Y++)I=(I<<5)-I+$.charCodeAt(Y)|0;Q=(I>>>0).toString(16).toUpperCase()}catch{}const de=navigator.maxTouchPoints>0,ee=navigator.connection||navigator.mozConnection||navigator.webkitConnection,ne=ee?ee.effectiveType||ee.type||e.unknown:e.devNetUnsupported,ue=navigator.doNotTrack==="1"?e.devDntOn:navigator.doNotTrack==="0"?e.devDntOff:e.devDntUnset;C("deviceContent").innerHTML=d(e.devTz,v)+d(e.devLang,O)+d(e.devOs,`${w(E)} <span class="text-oai-gray-400 dark:text-oai-gray-500">/</span> ${w(A)}`)+d(e.devTouch,de?f(e.devTouchYes,"info"):f(e.devTouchNo,"neutral"))+d(e.devNet,`<span class="font-mono uppercase">${w(ne)}</span>`)+d(e.devDnt,w(ue))+d(e.devWebglRender,`<span class="text-xs font-normal text-oai-gray-600 dark:text-oai-gray-400 break-all">${w(L)}</span>`)+d(e.devCanvasFp,`<span class="font-mono text-oai-gray-700 dark:text-oai-gray-300">${w(Q)}</span>`)+d(e.devWebglFp,`<span class="font-mono text-oai-gray-700 dark:text-oai-gray-300">${w(X)}</span>`)}function we(){try{return JSON.parse(localStorage.getItem(fe))||[]}catch{return[]}}function Pe(){const a=m.claudeRisk?.ip||"",i=(m.claudeRisk?.countryCode||"").toLowerCase(),r=m.claudeRisk?.city||"";if(!a){ae();return}const u=we(),g=new Date,o={ip:a,cc:i,geo:r,time:g.toISOString()};if(u.length>0){const l=u[0],h=(g-new Date(l.time))/(1e3*60*60);if(l.ip===a&&h<24){ae();return}}u.unshift(o),u.length>Se&&(u.length=Se),localStorage.setItem(fe,JSON.stringify(u)),ae()}function ae(){const a=C("ipHistoryContent");if(!a)return;const i=we();if(i.length===0){a.innerHTML=`<span class="text-sm text-oai-gray-500 dark:text-oai-gray-400">${e.histEmpty}</span>`;return}a.innerHTML=`<ul class="divide-y divide-oai-gray-100 dark:divide-oai-gray-800">${i.map((r,u)=>{const g=new Date(r.time),o=`${g.getMonth()+1}-${g.getDate()} ${String(g.getHours()).padStart(2,"0")}:${String(g.getMinutes()).padStart(2,"0")}`,l=u===0;return`<li class="flex items-center justify-between py-3 gap-4">
<div class="flex items-center gap-2 min-w-0">
<span class="text-sm ${l?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400"}">${o}</span>
${l?`<span class="inline-flex items-center rounded-full bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300 px-1.5 py-0.5 text-[10px] font-medium">${w(e.histCurrent)}</span>`:""}
</div>
<div class="flex items-center gap-2 text-sm font-medium text-oai-black dark:text-white min-w-0">
${B(r.cc)}
${K(r.ip)}
${r.geo?`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal truncate">${w(r.geo)}</span>`:""}
</div>
</li>`}).join("")}</ul>`}_.__clearIPHistory=()=>{localStorage.removeItem(fe),ae()};async function De(){const[,a,i]=await Promise.allSettled([$e(),Me(),je()]);if(se)return;const r=a.status==="fulfilled"?a.value:null,u=i.status==="fulfilled"?i.value:null,g=[];g.push(Ee("ipAddrCN","ipGeoCN",r?.ip,"cn")),g.push((async()=>{const o=C("ipAddr"),l=C("ipGeo");if(!m.ip){o&&(o.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`),l&&(l.textContent="");return}Z(m.ip)&&le(),o&&(o.innerHTML=K(m.ip));try{const h=await fetch(`${j}/api/geoip/${m.ip}`,{signal:AbortSignal.timeout(5e3)});if(h.ok){const s=await h.json(),x=(s.country_code||"").toLowerCase();m.ippure={ip:m.ip,country:s.country,countryCode:(s.country_code||"").toUpperCase(),region:s.region,city:s.city},m.cfGeo=[s.country,s.region,s.city,s.isp].filter(Boolean).join(" · "),o&&(o.innerHTML=`${B(x)} ${K(m.ip)}`),te("ipGeo",m.cfGeo)}}catch{}})()),g.push((async()=>{const o=u?.ip,l=C("ipAddrClaude"),h=C("ipGeoClaude");if(!o){l&&(l.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`),h&&(h.textContent="");return}Z(o)&&le(),l&&(l.innerHTML=`${B(u.loc||"")} ${K(o)}`);const[s,x]=await Promise.allSettled([fetch(`${j}/api/iprisk/${o}`,{signal:AbortSignal.timeout(1e4)}),fetch(`${j}/api/geoip/${o}`,{signal:AbortSignal.timeout(5e3)})]);let v=!1;if(x.status==="fulfilled"&&x.value.ok)try{const c=await x.value.json();if(c.country){m.claudeGeo={country:c.country,region:c.region,city:c.city,isp:c.isp,country_code:c.country_code};const P=[c.country,c.region,c.city,c.isp].filter(Boolean).join(" · ");l&&(l.innerHTML=`${B(c.country_code||u.loc||"")} ${K(o)}`),te("ipGeoClaude",P),v=!0}}catch{}if(!v&&u.loc&&(l&&(l.innerHTML=`${B(u.loc)} ${K(o)}`),te("ipGeoClaude",Be[u.loc]||u.loc.toUpperCase())),s.status==="fulfilled"&&s.value.ok){const c=await s.value.json();m.ipapis={is_datacenter:c.is_datacenter,is_vpn:c.is_vpn,is_proxy:c.is_proxy,is_tor:c.is_tor,is_crawler:c.is_crawler,is_abuser:c.is_abuser,is_mobile:c.is_mobile,company:{type:c.company_type,name:c.company_name},abuser_score:c.abuser_score,datacenter_name:c.datacenter_name},m.claudeRisk={ip:o,asn:c.asn,asOrganization:c.asOrganization,country:c.country,countryCode:c.countryCode,region:c.region,city:c.city,isResidential:c.isResidential,isBroadcast:c.isBroadcast,trust_score:c.trust_score,timezone:c.timezone}}})()),await Promise.allSettled(g),!se&&(Ie(),Promise.allSettled([Re(),He(),be()]),Oe(),Pe())}return De(),()=>{se=!0,ve.disconnect(),m.scoreAnimId&&cancelAnimationFrame(m.scoreAnimId),delete _.__setMaskOn,delete _.__clearIPHistory,delete _.__detectClaudeAvail}},[]);const M=_=>{S(_),p.current?.__setMaskOn?.(_)},D=()=>p.current?.__clearIPHistory?.(),q=()=>p.current?.__detectClaudeAvail?.(),R={__html:""};return n.jsx("div",{ref:p,className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:n.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:n.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[n.jsxs("div",{className:"flex items-start justify-between gap-4 mb-8",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:t("ipcheck.page.title")}),n.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base max-w-3xl text-pretty",children:t("ipcheck.page.subtitle")})]}),n.jsxs("label",{className:"shrink-0 inline-flex items-center gap-2.5 cursor-pointer select-none group",children:[n.jsx("div",{className:"text-oai-gray-400 group-hover:text-oai-gray-600 dark:text-oai-gray-500 dark:group-hover:text-oai-gray-300 transition-colors duration-200",children:b?n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4.5 w-4.5 animate-scale-up-fade",children:[n.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),n.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),n.jsx("path",{d:"M6.61 6.61A13.52 13.52 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),n.jsx("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]}):n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4.5 w-4.5 animate-scale-up-fade",children:[n.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),n.jsx("span",{className:"text-xs font-medium text-oai-gray-500 group-hover:text-oai-gray-700 dark:text-oai-gray-400 dark:group-hover:text-oai-gray-200 transition-colors duration-200",children:t("ipcheck.mask.toggle")}),n.jsxs("span",{className:"relative inline-block w-9 h-5",children:[n.jsx("input",{type:"checkbox",checked:b,onChange:_=>M(_.target.checked),className:"peer sr-only"}),n.jsx("span",{className:"absolute inset-0 rounded-full bg-oai-gray-200 dark:bg-oai-gray-800 peer-checked:bg-oai-brand-500 transition-colors duration-200"}),n.jsx("span",{className:"absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white shadow-sm transition-transform duration-200 peer-checked:translate-x-4"})]})]})]}),n.jsx("div",{id:"ipv6Warn",className:"hidden mb-4 rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-500/30 dark:bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200",children:t("ipcheck.ipv6.warn")}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[n.jsx(me,{id:"CN",label:t("ipcheck.ip.cn"),icon:null,className:"animate-fade-in-up stagger-1"}),n.jsx(me,{id:"",label:t("ipcheck.ip.cloudflare"),icon:n.jsx("img",{src:`${j}/favicons/cloudflare.webp`,alt:"",className:"h-4 w-4"}),className:"animate-fade-in-up stagger-2"}),n.jsx(me,{id:"Claude",label:t("ipcheck.ip.claude"),icon:n.jsx("img",{src:`${j}/favicons/claude.webp`,alt:"",className:"h-4 w-4"}),statusDot:!0,className:"animate-fade-in-up stagger-3"})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[n.jsx(V,{title:t("ipcheck.trust.title"),subtitle:t("ipcheck.trust.subtitle"),className:"animate-fade-in-up stagger-4",children:n.jsxs("div",{className:"px-1 py-2",children:[n.jsx("div",{className:"flex items-baseline justify-between mb-2 gap-3",children:n.jsx("div",{id:"gaugeScore",className:"flex items-baseline gap-2 min-h-[2.5rem]",dangerouslySetInnerHTML:R})}),n.jsx("div",{id:"gaugeText",className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mb-4 min-h-[1rem]"}),n.jsxs("div",{children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"h-1.5 rounded-full",style:{background:"linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%)"}}),n.jsx("span",{id:"gaugePointer",className:"absolute top-1/2 -translate-y-1/2 h-3.5 w-3.5 rounded-full bg-white dark:bg-oai-gray-900 border-2 border-oai-gray-300 dark:border-oai-gray-700 shadow-[0_2px_6px_rgba(0,0,0,0.15)] dark:shadow-[0_2px_6px_rgba(0,0,0,0.4)] -translate-x-1/2 transition-[left,border-color] duration-700 ease-out",style:{left:"0%"}})]}),n.jsxs("div",{className:"mt-2 flex justify-between text-[10px] uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 font-medium",children:[n.jsx("span",{children:t("ipcheck.trust.gauge.low")}),n.jsx("span",{className:"tracking-normal",children:"25"}),n.jsx("span",{className:"tracking-normal",children:"50"}),n.jsx("span",{className:"tracking-normal",children:"75"}),n.jsx("span",{children:t("ipcheck.trust.gauge.high")})]})]}),n.jsx("div",{id:"regionWarn",className:"hidden mt-4 rounded-lg border border-red-200 bg-red-50 dark:border-red-500/30 dark:bg-red-500/10 px-3 py-2 text-xs text-red-800 dark:text-red-300"}),n.jsxs("div",{id:"claudeRegionSupportRow",className:"hidden mt-4 pt-4 border-t border-oai-gray-100 dark:border-oai-gray-800 flex items-center justify-between",children:[n.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:t("ipcheck.trust.region_support")}),n.jsx("span",{id:"claudeRegionSupport",className:"text-sm font-medium text-oai-black dark:text-white",dangerouslySetInnerHTML:R})]})]})}),n.jsx(V,{title:t("ipcheck.props.title"),className:"animate-fade-in-up stagger-4",children:n.jsx("div",{id:"propsContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.security.title"),className:"animate-fade-in-up stagger-4",children:n.jsx("div",{id:"securityContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[n.jsx(V,{title:n.jsxs("span",{className:"flex items-center gap-1.5",children:[t("ipcheck.avail.title"),n.jsx(Ze,{text:t("ipcheck.avail.tooltip")})]}),action:n.jsx(Ae,{label:t("ipcheck.avail.refresh"),onClick:q}),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"claudeAvailContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.dns.title"),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"dnsLeakContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.udp.title"),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"udpLeakContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})})]}),n.jsx(V,{title:t("ipcheck.device.title"),className:"animate-fade-in-up stagger-6",children:n.jsx("div",{id:"deviceContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.history.title"),subtitle:t("ipcheck.history.subtitle"),action:n.jsx(Ae,{label:t("ipcheck.history.clear"),onClick:D}),className:"animate-fade-in-up stagger-6",children:n.jsx("div",{id:"ipHistoryContent",dangerouslySetInnerHTML:R})})]})]})})})}function V({title:p,subtitle:b,action:S,children:M,className:D=""}){return n.jsxs("section",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 sm:p-6 transition-colors duration-200 ${D}`,children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:p}),b?n.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:b}):null]}),S]}),M]})}function Ae({label:p,onClick:b}){return n.jsx("button",{type:"button",onClick:b,className:"shrink-0 inline-flex h-7 items-center px-2.5 rounded-md text-xs font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-200 dark:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:p})}function Ze({text:p}){return n.jsxs("span",{className:"relative inline-flex items-center group",children:[n.jsx("svg",{viewBox:"0 0 16 16",className:"h-3.5 w-3.5 text-oai-gray-400 dark:text-oai-gray-500",fill:"currentColor","aria-hidden":!0,children:n.jsx("path",{d:"M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13zM7.25 6.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-1.5 0V6.75zM8 4a.85.85 0 1 1 0 1.7A.85.85 0 0 1 8 4z"})}),n.jsx("span",{className:"pointer-events-none absolute left-1/2 top-full z-10 mt-1.5 -translate-x-1/2 w-56 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-2 text-[11px] font-normal text-white opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-relaxed shadow-lg origin-top",children:p})]})}function me({id:p,label:b,icon:S,statusDot:M,className:D=""}){const q=`ipAddr${p}`,R=`ipGeo${p}`;return n.jsxs("article",{id:`ipHero${p}`,className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 sm:p-6 cursor-default transition-colors duration-200 ${D}`,children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-wider font-medium text-oai-gray-500 dark:text-oai-gray-400 mb-2",children:[S,n.jsx("span",{children:b}),M?n.jsxs("span",{id:`statusDot${p}`,className:"relative inline-flex h-2 w-2 ml-1.5","aria-hidden":!0,children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-oai-gray-300 dark:bg-oai-gray-600 opacity-75"}),n.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"})]}):null]}),n.jsx("div",{id:q,className:"text-xl sm:text-2xl font-semibold text-oai-black dark:text-white flex items-center gap-2 min-h-[2rem]",dangerouslySetInnerHTML:{__html:""}}),n.jsx("div",{id:R,className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate min-h-[1rem]"})]})}export{Je as default};

Sorry, the diff of this file is too big to display

import{R as l,j as c,V as h}from"./main-BbEXIjk8.js";function x(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function d(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={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",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=x(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:d(t)})}export{g as L};

Sorry, the diff of this file is too big to display

import{c as D,r as g,dp as K,j as e,G as n,dq as Q,aB as ee,dr as ae,V as c,Y as re,ds as te,aD as se,L as ie,n as oe,U as T,X as ne,J as I,I as le,ae as de}from"./main-BbEXIjk8.js";import{u as ce}from"./useCurrency-CVVJYL2V.js";import{L as W}from"./LeaderboardAvatar-94z-hs6u.js";import{A as me}from"./ActivityHeatmap-CoVxkSjr.js";import{A as U}from"./arrow-up-right-DJo_-PxX.js";import{C as xe}from"./useScrollLock-Dm_66oFo.js";import{D as ge,a as pe,b as he,c as fe,d as be,e as ue}from"./DialogTitle--jWfmv_b.js";import"./info-C-aAjjA6.js";const ye=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],ke=D("code-xml",ye);const je=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],ve=D("heart",je);const Ne=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],_e=D("link-2",Ne),C="tokentracker_likes";function F(a){if(!a)return!1;try{const r=localStorage.getItem(C);return r?!!JSON.parse(r)?.[a]:!1}catch{return!1}}function z(a,r){if(a)try{const t=localStorage.getItem(C),s=t?JSON.parse(t):{};r?s[a]=!0:delete s[a],localStorage.setItem(C,JSON.stringify(s))}catch{}}function E({userId:a}){const[r,t]=g.useState(!1),[s,i]=g.useState(0),[l,m]=g.useState(!1),[d,p]=g.useState(!1),[y,k]=g.useState(!1),[j,M]=g.useState([]),[v,b]=g.useState(!1),N=g.useRef(0);g.useEffect(()=>{let o=!1;return a?(m(!1),t(F(a)),K({userId:a}).then(x=>{o||(i(Number(x?.count)||0),m(!0))}).catch(()=>{o||(i(0),m(!0))}),()=>{o=!0}):(m(!1),()=>{o=!0})},[a]);const _=()=>{k(!0),setTimeout(()=>k(!1),450),b(!0),setTimeout(()=>b(!1),500);const o=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],x=["circle","heart"],f=[];for(let h=0;h<12;h++){const S=(h*30+Math.random()*20-10)*(Math.PI/180),A=45+Math.random()*45,O=Math.cos(S)*A,q=Math.sin(S)*A-(10+Math.random()*15),J=Math.random()*360-180,X=6+Math.random()*8,Y=o[Math.floor(Math.random()*o.length)],V=x[Math.floor(Math.random()*x.length)],Z=++N.current;f.push({id:Z,tx:O,ty:q,rot:J,size:X,color:Y,shape:V})}M(h=>[...h,...f]),setTimeout(()=>{M(h=>h.filter(S=>!f.find(A=>A.id===S.id)))},850)},u=async o=>{p(!0);try{const x=await Q({userId:a,delta:o}),f=Number(x?.count);Number.isFinite(f)&&i(f)}catch{t(x=>!x),i(x=>Math.max(0,x-o)),z(a,!F(a))}finally{p(!1)}},w=o=>{o.stopPropagation(),!(!a||!l||d)&&(r?(t(!1),i(x=>Math.max(0,x-1)),z(a,!1),u(-1)):(t(!0),i(x=>x+1),z(a,!0),_(),u(1)))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
@keyframes tt-like-pop {
0% { transform: scale(1); }
25% { transform: scale(0.75); }
50% { transform: scale(1.35); }
75% { transform: scale(0.9); }
100% { transform: scale(1); }
}
@keyframes tt-particle-fly {
0% {
transform: translate(0, 0) scale(1) rotate(0deg);
opacity: 1;
}
70% {
opacity: 0.8;
}
100% {
transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot));
opacity: 0;
}
}
@keyframes tt-num-scroll {
0% { transform: translateY(8px); opacity: 0; }
100% { transform: translateY(0); opacity: 1; }
}
.tt-animate-pop {
animation: tt-like-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.tt-particle {
position: absolute;
top: 50%;
left: 50%;
margin-top: -6px;
margin-left: -6px;
pointer-events: none;
z-index: 50;
}
.tt-num-anim {
animation: tt-num-scroll 0.25s ease-out forwards;
}
`}}),j.map(o=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${o.tx}px`,"--ty":`${o.ty}px`,"--rot":`${o.rot}deg`,width:`${o.size}px`,height:`${o.size}px`,backgroundColor:o.shape==="circle"?o.color:"transparent",borderRadius:o.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:o.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:o.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},o.id)),e.jsxs("button",{type:"button",onClick:w,disabled:!l||d,"aria-label":r?n("leaderboard.profile.like.aria_unlike"):n("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${r?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:y?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(ve,{size:14,className:`transition-all duration-300 ${r?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${r?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${v?"tt-num-anim":""}`,children:l?s:"·"})]})]})}function we(a,r,t){const s=Number(a);return!Number.isFinite(s)||s<0?"—":s>0&&s<.01?`<${r==="USD"?"$":""}0.01`:le(s,{decimals:2,currency:r,rate:t})}function H(a,r,t){const s=Number(a);if(!Number.isFinite(s)||s<0)return"—";if(s<1e3)return we(s,r,t);const i=r==="USD"?s:s*(t||1);return`${r==="USD"?"$":""}${I(i,{decimals:1})}`}function $(a){const r=Number(a);return!Number.isFinite(r)||r<=0?"0":I(r,{decimals:1})}function Se(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const t=r.map(i=>({day:i.date,total_tokens:i.total_tokens,models:i.models||null})),s=r[r.length-1]?.date;return oe({dailyRows:t,weeks:52,to:s})}const Ae=`
@keyframes tt-shimmer {
100% { transform: translateX(100%); }
}
.tt-shimmer-bar {
position: relative;
overflow: hidden;
}
.tt-shimmer-bar::after {
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
transform: translateX(-100%);
background-image: linear-gradient(
90deg,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.02) 20%,
rgba(0, 0, 0, 0.06) 60%,
rgba(0, 0, 0, 0) 100%
);
animation: tt-shimmer 1.6s infinite;
content: '';
}
.dark .tt-shimmer-bar::after {
background-image: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.02) 20%,
rgba(255, 255, 255, 0.06) 60%,
rgba(255, 255, 255, 0) 100%
);
}
`;function Le({variant:a="modal"}){const r="rounded bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar",t=a==="page";return e.jsxs("div",{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:Ae}}),t?e.jsxs("div",{className:"flex items-start gap-5 px-6 sm:px-8 pt-8 pb-7 animate-fade-in",children:[e.jsx("div",{className:"h-[68px] w-[68px] rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 flex items-start justify-between gap-4 pt-0.5",children:[e.jsxs("div",{className:"min-w-0 space-y-2.5",children:[e.jsx("div",{className:c(r,"h-7 w-48")}),e.jsx("div",{className:c(r,"h-3.5 w-32")})]}),e.jsxs("div",{className:"shrink-0 space-y-1.5 flex flex-col items-end",children:[e.jsx("div",{className:c(r,"h-2.5 w-8")}),e.jsx("div",{className:c(r,"h-7 w-12")})]})]})]}):e.jsxs("div",{className:"flex items-start gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60 animate-fade-in",children:[e.jsx("div",{className:"h-14 w-14 rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2 pt-1",children:[e.jsx("div",{className:c(r,"h-4 w-40")}),e.jsx("div",{className:c(r,"h-3 w-56")})]}),e.jsx("div",{className:c(r,"h-4 w-4 shrink-0 mt-1")})]}),e.jsxs("div",{className:c("space-y-6",t?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"px-6 py-5"),children:[e.jsx("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:Array.from({length:4}).map((s,i)=>e.jsxs("div",{children:[e.jsx("div",{className:c(r,"h-6 w-20")}),e.jsx("div",{className:c(r,"mt-2 h-3 w-14")})]},i))}),e.jsx("div",{className:"space-y-3 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:Array.from({length:3}).map((s,i)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-3 w-24")}),e.jsx("div",{className:c(r,"h-3 w-44")})]},i))}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-44 mb-4")}),e.jsx("div",{className:"grid grid-cols-[repeat(52,1fr)] gap-[2px]",children:Array.from({length:364}).map((s,i)=>e.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},i))})]}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-28 mb-3")}),e.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((s,i)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-4 w-4")}),e.jsx("div",{className:c(r,"h-3 w-16")}),e.jsx("div",{className:c(r,"h-[3px] flex-1")}),e.jsx("div",{className:c(r,"h-3 w-12")})]},i))})]})]})]})}function G(a){if(!a)return null;const r=String(a).match(/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})/i);return r?r[1]:null}function R({children:a}){return e.jsx("h3",{className:"text-[11px] uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400 mb-3",children:a})}function L({value:a,label:r}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-black tabular-nums tracking-tight leading-none text-oai-black dark:text-white",style:{fontFamily:'"DIN Alternate-Bold", "DIN Alternate", "DIN Condensed-Bold", "Impact", -apple-system, sans-serif',fontWeight:900},children:a}),e.jsx("div",{className:"mt-1.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r})]})}function P({label:a,children:r}){return e.jsxs("div",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"shrink-0 w-28 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"min-w-0 flex-1 text-oai-gray-900 dark:text-oai-gray-100 tabular-nums truncate flex items-baseline gap-2 flex-wrap",children:r})]})}function Me({user:a,onClose:r}){const t=G(a?.github_url);return e.jsxs("div",{className:"flex items-center gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60",children:[e.jsx(W,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"lg",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.rank?e.jsx("span",{className:c("shrink-0 inline-flex items-center px-2 py-0.5 rounded text-xs font-bold font-mono uppercase tracking-wider border shadow-sm",a.rank===1&&"bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400 dark:bg-amber-400/10",a.rank===2&&"bg-slate-500/10 text-slate-600 border-slate-500/20 dark:text-slate-400 dark:bg-slate-400/10",a.rank===3&&"bg-orange-500/10 text-orange-700 border-orange-500/20 dark:text-orange-400 dark:bg-orange-400/10",a.rank>3&&"bg-oai-gray-100 dark:bg-oai-gray-900/60 text-oai-gray-500 dark:text-oai-gray-400 border-oai-gray-200/60 dark:border-oai-gray-800"),children:n("leaderboard.profile_modal.rank",{rank:a.rank})}):null]}),t&&e.jsxs("a",{href:a.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:[e.jsx(T,{provider:"GITHUB",size:11}),e.jsxs("span",{children:["@",t]})]})]}),a?.user_id&&e.jsx("div",{className:"shrink-0 flex items-center justify-center",children:e.jsx(E,{userId:a.user_id})}),r&&e.jsx("button",{type:"button",onClick:r,className:"shrink-0 -mr-1 -mt-1 flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors group","aria-label":n("leaderboard.profile_modal.close"),children:e.jsx(ne,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function ze({user:a}){const r=G(a?.github_url),t=Number(a?.rank)||0,s=t===1?"text-amber-500 dark:text-amber-400":t===2?"text-slate-500 dark:text-slate-300":t===3?"text-orange-600 dark:text-orange-400":"text-oai-gray-400 dark:text-oai-gray-500";return e.jsxs("div",{className:"flex items-center gap-5 px-6 sm:px-8 pt-8 pb-7",children:[e.jsx(W,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"xl",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"truncate text-2xl sm:text-[28px] font-semibold tracking-tight leading-tight text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.user_id&&e.jsx(E,{userId:a.user_id})]}),r?e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white transition-colors",children:[e.jsx(T,{provider:"GITHUB",size:13}),e.jsxs("span",{children:["@",r]})]}):null]}),t?e.jsxs("div",{className:"shrink-0 text-right leading-none",children:[e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.profile.hero.rank_label")}),e.jsx("div",{className:c("mt-1.5 text-3xl font-black tabular-nums tracking-tight",s),children:n("leaderboard.profile_modal.rank",{rank:t})})]}):null]})]})}function Pe({data:a}){const r=Array.isArray(a)?a:[];return r.length===0?e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.providers.none")}):e.jsx("ul",{className:"space-y-2",children:r.map(t=>{const s=Math.max(0,Math.min(1,Number(t?.percent)||0));return e.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center w-4 h-4",children:e.jsx(T,{provider:String(t.source).toUpperCase(),size:14})}),e.jsx("span",{className:"shrink-0 capitalize w-16 text-oai-gray-700 dark:text-oai-gray-300",children:t.source}),e.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:e.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(s*100).toFixed(1)}%`}})}),e.jsx("span",{className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:$(t.total_tokens)}),e.jsxs("span",{className:"shrink-0 w-10 text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[(s*100).toFixed(0),"%"]})]},t.source)})})}function B({icon:a,label:r,value:t}){const[s,i]=g.useState(!1),l=async()=>{await de(t)&&(i(!0),setTimeout(()=>i(!1),1600))};return e.jsxs("button",{type:"button",onClick:l,className:c("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",s?"border-emerald-500/30 text-emerald-600 dark:text-emerald-400 bg-emerald-500/[0.06]":"border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-gray-900 dark:hover:text-oai-gray-100 hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[s?e.jsx(xe,{size:13,strokeWidth:2,"aria-hidden":!0}):e.jsx(a,{size:13,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:s?n("leaderboard.profile_modal.badge.copied"):r})]})}function Ce({data:a,currency:r,rate:t,onClose:s,variant:i="modal"}){const{user:l,totals:m,streak:d,best_day:p,models:y,by_provider:k,heatmap:j,period:M}=a,v=i==="page",b=g.useMemo(()=>Se(j),[j]),N=y?.favorite?.model_name,_=Number(y?.count)||0,u=re(),w=!!(u?.user?.id&&l?.user_id&&u.user.id===l.user_id),o=l?.user_id?`https://www.tokentracker.cc/u/${l.user_id}`:null,x=l?.user_id?`[![My AI coding usage](${te()}/functions/tokentracker-embed-svg?user_id=${l.user_id}&theme=dark)](${o}?ref=readme)`:null;return e.jsxs(e.Fragment,{children:[v?e.jsx(ze,{user:l}):e.jsx(Me,{user:l,onClose:s}),e.jsxs("div",{className:c("space-y-6",v?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"flex-1 min-h-0 overflow-y-auto oai-scrollbar px-6 py-5"),children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-4",children:[e.jsx(L,{value:$(m?.total_tokens),label:n("leaderboard.profile_modal.stat.total_tokens")}),e.jsx(L,{value:H(m?.estimated_cost_usd,r,t),label:n("leaderboard.profile_modal.stat.total_cost")}),e.jsx(L,{value:String(m?.active_days??0),label:n("leaderboard.profile_modal.stat.active_days")}),e.jsx(L,{value:H(m?.avg_per_day_usd,r,t),label:n("leaderboard.profile_modal.stat.avg_per_day")})]}),e.jsxs("dl",{className:"space-y-2 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsxs(P,{label:n("leaderboard.profile_modal.streak.current"),children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:n("leaderboard.profile_modal.streak.days",{count:d?.current_days??0})}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",d?.longest_days??0,")"]})]}),e.jsx(P,{label:n("leaderboard.profile_modal.best_day.title"),children:p?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:$(p.total_tokens)}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",p.date]})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.best_day.none")})}),e.jsx(P,{label:n("leaderboard.profile_modal.models.favorite"),children:N?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30 truncate max-w-[200px] inline-block align-bottom",children:N}),_>1&&e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:n("leaderboard.profile_modal.models.count",{count:_})})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.models.none")})})]}),b&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(R,{children:n("leaderboard.profile_modal.heatmap.title")}),e.jsx("div",{className:"min-w-0",children:e.jsx(me,{heatmap:b,hideLegend:!0,embedded:!0})})]}),e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(R,{children:n("leaderboard.profile_modal.providers.title")}),e.jsx(Pe,{data:k})]}),l?.user_id&&(s||w)&&e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-3",children:[s&&(se()?e.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",onClick:s,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(U,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]}):e.jsxs(ie,{to:`/u/${l.user_id}`,onClick:s,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(U,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})),w&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{icon:_e,label:n("leaderboard.profile_modal.badge.copy_url"),value:o}),e.jsx(B,{icon:ke,label:n("leaderboard.profile_modal.badge.copy"),value:x})]})]})]})]})}function $e({userId:a,period:r,accessToken:t,enabled:s=!0}){const[i,l]=g.useState({loading:!1,error:null,data:null});return g.useEffect(()=>{if(!s||!a)return;let m=!0;return l({loading:!0,error:null,data:null}),(async()=>{try{const d=t?await ee(t):null;if(!m)return;const p=await ae({accessToken:d,userId:a,period:r||"week"});if(!m)return;l({loading:!1,error:null,data:p})}catch(d){if(!m)return;d?.status===404?l({loading:!1,error:null,data:null}):l({loading:!1,error:d?.message||String(d),data:null})}})(),()=>{m=!1}},[s,a,r,t]),i}function We({isOpen:a,onClose:r,userId:t,period:s,accessToken:i}){const{currency:l,rate:m}=ce(),d=$e({userId:t,period:s,accessToken:i,enabled:a});return e.jsx(ge,{open:a,onOpenChange:p=>{p||r?.()},children:e.jsxs(pe,{children:[e.jsx(he,{className:"cost-modal-backdrop"}),e.jsx(fe,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(be,{className:c("cost-modal-popup","relative w-full max-w-[540px] max-h-[calc(100vh-2rem)] flex flex-col","rounded-2xl bg-white dark:bg-oai-gray-950","shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)]","ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden","dark:border-t dark:border-white/[0.08]"),children:[e.jsx(ue,{render:e.jsx("h2",{className:"sr-only"}),children:d.data?.user?.display_name||n("leaderboard.profile_modal.loading")}),d.loading&&e.jsx(Le,{}),!d.loading&&d.error&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:n("leaderboard.profile_modal.error")})}),!d.loading&&!d.error&&!d.data&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.empty")})}),!d.loading&&!d.error&&d.data&&e.jsx(Ce,{data:d.data,currency:l,rate:m,onClose:r})]})})]})})}export{We as LeaderboardProfileModal,Ce as ProfileContent,Le as ProfileSkeleton,$e as useLeaderboardProfileData};
import{r as _,j as p,T as xe,W as ge,Y as ve,aD as be,L as St,aE as we,G as Y,af as ye}from"./main-BbEXIjk8.js";import{u as ke}from"./useCurrency-CVVJYL2V.js";import{H as Me}from"./HeaderGithubStar-DGtt-L8c.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Te}from"./LeaderboardProfileModal-BcppEyBi.js";import{D as Se}from"./download-BwsW6vug.js";import"./LeaderboardAvatar-94z-hs6u.js";import"./ActivityHeatmap-CoVxkSjr.js";import"./info-C-aAjjA6.js";import"./arrow-up-right-DJo_-PxX.js";import"./useScrollLock-Dm_66oFo.js";import"./DialogTitle--jWfmv_b.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,Ee=16,je=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
attribute vec2 a_position;
void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
`,Ge=`
precision highp float;
uniform vec2 u_resolution;
uniform float u_time;
uniform vec3 u_color1, u_color2, u_color3, u_color4, u_color5, u_color6, u_color7;
uniform float u_alpha1, u_alpha2, u_alpha3, u_alpha4, u_alpha5, u_alpha6, u_alpha7;
uniform float u_intensity, u_scale, u_direction;
uniform float u_softness, u_distortion, u_complexity, u_shape;
uniform float u_vignette, u_vigOpacity, u_blur, u_shaderOpacity;
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec2 mod289v2(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec3 permute(vec3 x) { return mod289((x * 34.0 + 1.0) * x); }
float snoise(vec2 v) {
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
-0.577350269189626, 0.024390243902439);
vec2 i = floor(v + dot(v, C.yy));
vec2 x0 = v - i + dot(i, C.xx);
vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
vec4 x12 = x0.xyxy + C.xxzz;
x12.xy -= i1;
i = mod289v2(i);
vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));
vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);
m = m * m; m = m * m;
vec3 x_ = 2.0 * fract(p * C.www) - 1.0;
vec3 h = abs(x_) - 0.5;
vec3 ox = floor(x_ + 0.5);
vec3 a0 = x_ - ox;
m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);
vec3 g;
g.x = a0.x * x0.x + h.x * x0.y;
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
return 130.0 * dot(m, g);
}
float fbm(vec2 p, float oct) {
float val = 0.0, amp = 0.5;
int n = int(oct);
for (int i = 0; i < 7; i++) {
if (i >= n) break;
val += amp * snoise(p);
p *= 2.0;
amp *= 0.5;
}
return val;
}
float nfbm(vec2 p) { return fbm(p, 3.0 + u_complexity * 4.0); }
/* 5-stop palette used by effect 1 (Plasma) — direct port of \`palette\` from
* the canonical engine. Stops at t = 0, 0.25, 0.5, 0.75, 1.0. */
vec3 palette(float t) {
t = clamp(t, 0.0, 1.0);
t = t * t * (3.0 - 2.0 * t);
float k = 64.0;
float w1 = u_alpha1 * exp(-k * t * t);
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
float total = w1 + w2 + w3 + w4 + w5 + 0.0001;
return (u_color1 * w1 + u_color2 * w2 + u_color3 * w3 +
u_color4 * w4 + u_color5 * w5) / total;
}
/* Per-pixel alpha that re-introduces transparency when the user dials any
* palette stop's alpha below 1. Same \`paletteAlpha\` from the canonical
* engine. With every preset shipping all-1 alphas, this returns ~1 for every
* pixel — but mirroring it keeps custom-preset behaviour identical. */
float paletteAlpha(float t) {
t = clamp(t, 0.0, 1.0);
t = t * t * (3.0 - 2.0 * t);
float k = 64.0;
float w1 = u_alpha1 * exp(-k * t * t);
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
float totalW = w1 + w2 + w3 + w4 + w5 + 0.0001;
float rawW = exp(-k * t * t)
+ exp(-k * (t - 0.25) * (t - 0.25))
+ exp(-k * (t - 0.5) * (t - 0.5))
+ exp(-k * (t - 0.75) * (t - 0.75))
+ exp(-k * (t - 1.0) * (t - 1.0))
+ 0.0001;
return totalW / rawW;
}
vec2 warp(vec2 p, float t) {
float str = u_distortion * 2.0;
return vec2(
nfbm(p + vec2(t * 0.1, 0.0)),
nfbm(p + vec2(0.0, t * 0.12) + 5.0)
) * str;
}
/* Plasma: four sine bands warped by an FBM field, mapped through the
* 5-stop palette. Identical to effect 1 in the canonical engine. */
vec3 computeEffect(vec2 uv, float aspect, float t, float dist, float cpx) {
vec2 p = (uv - 0.5) * u_scale;
p.x *= aspect;
p += vec2(cos(u_direction), sin(u_direction)) * t * 0.15;
float freq = 3.0 + cpx * 8.0;
float val = 0.0;
val += sin(p.x * freq + t);
val += sin(p.y * freq + t * 1.3);
val += sin((p.x + p.y) * freq * 0.7 + t * 0.7);
val += sin(length(p) * freq * 0.8 - t * 1.5);
vec2 w = warp(p, t);
val += (w.x + w.y) * dist;
val = val * 0.2 * u_intensity + 0.5;
return palette(clamp(val, 0.0, 1.0));
}
void main() {
vec2 uv = gl_FragCoord.xy / u_resolution;
float aspect = u_resolution.x / u_resolution.y;
float t = u_time; // JS already multiplied u_time by preset.speed.
float dist = u_distortion;
float cpx = u_complexity;
/* 5-tap cross blur (center + cardinal offsets). The chromatic/silver/gold
* presets all ship with blur=1 so this path is always active. 5 taps
* instead of the canonical engine's 9 saves ~44% fragment work; the
* perceptual difference is nil because the output is already soft from
* the plasma's low spatial frequency and CSS blur on reflections. */
vec3 col;
if (u_blur < 0.01) {
col = computeEffect(uv, aspect, t, dist, cpx);
} else {
float r = u_blur * 0.02;
col = computeEffect(uv, aspect, t, dist, cpx) * 0.4;
col += computeEffect(uv + vec2( r, 0.0), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(-r, 0.0), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(0.0, r), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(0.0, -r), aspect, t, dist, cpx) * 0.15;
}
/* Gamma punch — adds the contrast pop that defines the chromatic
* highlights. From the canonical engine: \`col = pow(col, vec3(1.3))\`. */
col = pow(col, vec3(1.3));
/* Vignette — soft edge darkening so corners read as recessed. The 40-px
* scale at the bottom of the formula is hard-coded in the canonical
* engine; we keep it for visual parity. */
float edgeDist = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));
float vigPx = 40.0 / min(u_resolution.x, u_resolution.y);
float vigRange = vigPx * (1.0 + u_vignette * 3.0);
float vig = edgeDist * edgeDist / (vigRange * vigRange);
vig = smoothstep(0.0, 1.0, vig);
col *= mix(1.0, vig, u_vignette * u_vigOpacity);
/* Per-pixel alpha. With all-1 alphas the formula collapses to ~1 but the
* computation matches the canonical engine so custom presets behave the
* same. */
float colorAlpha = (u_alpha1 + u_alpha2 + u_alpha3 + u_alpha4 + u_alpha5) / 5.0;
if (colorAlpha < 0.999) {
vec3 c1d = col - u_color1, c2d = col - u_color2, c3d = col - u_color3,
c4d = col - u_color4, c5d = col - u_color5;
float prox1 = exp(-8.0 * dot(c1d, c1d));
float prox2 = exp(-8.0 * dot(c2d, c2d));
float prox3 = exp(-8.0 * dot(c3d, c3d));
float prox4 = exp(-8.0 * dot(c4d, c4d));
float prox5 = exp(-8.0 * dot(c5d, c5d));
float pTotal = prox1 + prox2 + prox3 + prox4 + prox5 + 0.0001;
colorAlpha = (prox1 * u_alpha1 + prox2 * u_alpha2 + prox3 * u_alpha3 +
prox4 * u_alpha4 + prox5 * u_alpha5) / pTotal;
}
float alpha = colorAlpha;
/* Touch the unused-at-effect-1 uniforms so GL drivers that complain about
* declared-but-unread uniforms (some Mali / Adreno builds do) keep them
* live. The contribution is provably zero. */
alpha += 0.0 * (u_softness + u_shape +
u_alpha6 + u_alpha7 +
u_color6.x + u_color7.x);
gl_FragColor = vec4(col, alpha * u_shaderOpacity);
}
`;function Rt(t,e,a){const r=t.createShader(e);if(!r)throw new Error("metal-fx: gl.createShader returned null");if(t.shaderSource(r,a),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error(`metal-fx: shader compile failed: ${o??"(no info log)"}`)}return r}function De(t,e,a){const r=t.createProgram();if(!r)throw new Error("metal-fx: gl.createProgram returned null");if(t.attachShader(r,e),t.attachShader(r,a),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS)){const o=t.getProgramInfoLog(r);throw t.deleteProgram(r),new Error(`metal-fx: program link failed: ${o??"(no info log)"}`)}return r}const Yt=140,Kt=40,Zt=1.6,Jt=1.3;let s=null,bt=null;function Ue(t){bt=t}const qe=["u_resolution","u_time","u_color1","u_color2","u_color3","u_color4","u_color5","u_color6","u_color7","u_alpha1","u_alpha2","u_alpha3","u_alpha4","u_alpha5","u_alpha6","u_alpha7","u_intensity","u_scale","u_direction","u_softness","u_distortion","u_complexity","u_shape","u_vignette","u_vigOpacity","u_blur","u_shaderOpacity"];function Ft(t){t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);const e=Rt(t,t.VERTEX_SHADER,He),a=Rt(t,t.FRAGMENT_SHADER,Ge),r=De(t,e,a);t.useProgram(r);const o=t.createBuffer();if(!o)throw new Error("metal-fx: gl.createBuffer returned null");t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),t.STATIC_DRAW);const n=t.getAttribLocation(r,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0);const i={};for(const u of qe)i[u]=t.getUniformLocation(r,u);return{program:r,buffer:o,uniforms:i}}function te(){if(s)return s;const t=Math.min(Ne,typeof window<"u"&&window.devicePixelRatio||1),e=Math.round(Le*t),a=typeof OffscreenCanvas<"u";let r,o;if(a)r=new OffscreenCanvas(e,e),o=r.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1});else{const h=document.createElement("canvas");h.width=e,h.height=e,o=h.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1,preserveDrawingBuffer:!0})??h.getContext("experimental-webgl"),r=h}if(!o)throw new Error("metal-fx: WebGL not supported");const{program:n,buffer:i,uniforms:u}=Ft(o),l=h=>{h.preventDefault(),s&&(s.contextLost=!0)},c=()=>{if(!s)return;const h=Ft(s.gl);s.program=h.program,s.buffer=h.buffer,s.uniforms=h.uniforms,s.presetDirty=!0,s.contextLost=!1,bt?.()};return r.addEventListener("webglcontextlost",l,!1),r.addEventListener("webglcontextrestored",c,!1),s={glCanvas:r,gl:o,program:n,buffer:i,uniforms:u,preset:Xt.chromatic.modes.dark,presetDirty:!0,contextLost:!1,useOffscreen:a,frameBitmap:null,startMs:performance.now(),pausedMs:0,pausedAtMs:null,rafId:0,dpr:t,instances:new Set,frameCount:0,glowQueue:[],glowIdx:0,glowSkip:0,glowPixels:new Uint8Array(e*e*4),glowPixelsW:e,glowPixelsH:e},s}function Qe(){var t;if(!s)return;const{gl:e,program:a,buffer:r,frameBitmap:o}=s;try{o?.close(),e.deleteBuffer(r),e.deleteProgram(a),(t=e.getExtension("WEBGL_lose_context"))==null||t.loseContext()}catch{}s=null}let It=0;function dt(){if(!s)return;const t=performance.now();if(t-It<Pe)return;It=t;const{gl:e,glCanvas:a}=s,r=a.width,o=a.height;(s.glowPixelsW!==r||s.glowPixelsH!==o)&&(s.glowPixelsW=r,s.glowPixelsH=o,s.glowPixels=new Uint8Array(r*o*4)),e.readPixels(0,0,r,o,e.RGBA,e.UNSIGNED_BYTE,s.glowPixels)}const K={bx:0,by:0};function kt(t,e,a){if(!s)return K.bx=0,K.by=0,K;const{glCanvas:r}=s,o=r.width,n=r.height,i=t.dpr,u=t.cssWidth*i,l=t.cssHeight*i,c=Yt*i,h=Kt*i;let f=u*(o/c)/t.shaderScale,d=l*(n/h)/t.shaderScale;f>o&&(f=o),d>n&&(d=n);const g=(o-f)/2,x=(n-d)/2,m=g+e/t.cssWidth*f,F=x+a/t.cssHeight*d;return K.bx=Math.round(m),K.by=Math.round(n-1-F),K}const G={r:0,g:0,b:0,lum:0,count:0};function ee(t,e,a,r,o,n){const i=Math.max(1,n|0),u=Math.max(0,r-i),l=Math.min(e,r+i+1),c=Math.max(0,o-i),h=Math.min(a,o+i+1);G.r=0,G.g=0,G.b=0,G.lum=0,G.count=0;for(let f=c;f<h;f++){const d=f*e;for(let g=u;g<l;g++){const x=(d+g)*4;G.r+=t[x],G.g+=t[x+1],G.b+=t[x+2],G.lum+=(.2126*t[x]+.7152*t[x+1]+.0722*t[x+2])/255,G.count++}}return G}const R={r:255,g:255,b:255};function Ot(t,e,a,r){if(!s)return 0;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count>0?n.lum/n.count:0}function Ve(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count===0?(R.r=255,R.g=255,R.b=255,R):(R.r=n.r/n.count,R.g=n.g/n.count,R.b=n.b/n.count,R)}function Xe(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),{glowPixels:n,glowPixelsW:i,glowPixelsH:u}=s,l=Math.max(1,r|0),c=Math.max(0,o.bx-l),h=Math.min(i,o.bx+l+1),f=Math.max(0,o.by-l),d=Math.min(u,o.by+l+1);let g=-1;R.r=255,R.g=255,R.b=255;for(let x=f;x<d;x++){const m=x*i;for(let F=c;F<h;F++){const b=(m+F)*4,P=n[b],E=n[b+1],L=n[b+2],C=Math.max(P,E,L),j=Math.min(P,E,L),z=(C>0?(C-j)/C:0)*(.35+.65*(C/255));z>g&&(g=z,R.r=P,R.g=E,R.b=L)}}return R}Ue(()=>{s&&s.instances.size>0&&s.pausedAtMs===null&&nt()});typeof document<"u"&&document.addEventListener("visibilitychange",()=>{!s||s.pausedAtMs!==null||s.contextLost||(document.hidden?oe():s.instances.size>0&&nt())});function Ye(t){const e=te(),a=t.hostCanvas.getContext("2d",{alpha:!0});if(!a)throw new Error("metal-fx: canvas 2D context unavailable");const r=t.scale??1,o={canvas:t.hostCanvas,ctx:a,cssWidth:t.cssWidth,cssHeight:t.cssHeight,cornerRadius:t.cornerRadius,kind:t.kind,ringCssPx:t.ringCssPx??(t.kind==="circle"?2:1)*r,shaderScale:t.shaderScale??(t.kind==="circle"?Jt:Zt)*r,opacityMul:t.opacityMul??1,visible:!0,paused:t.paused??!1,everCopied:!1,dpr:typeof window<"u"&&window.devicePixelRatio||1,scale:r,onAfterFrame:t.onAfterFrame,onFirstCopy:t.onFirstCopy};return ae(o),e.instances.add(o),e.rafId===0&&e.pausedAtMs===null&&nt(),o}function Ke(t){if(!s)return;s.instances.delete(t);const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1),s.instances.size===0&&(oe(),Qe())}function Ze(t){s&&(s.glowQueue.includes(t)||s.glowQueue.push(t))}function Je(t){if(!s)return;const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1)}function rt(t,e){let a=!1;e.cssWidth!==void 0&&e.cssWidth!==t.cssWidth&&(t.cssWidth=e.cssWidth,a=!0),e.cssHeight!==void 0&&e.cssHeight!==t.cssHeight&&(t.cssHeight=e.cssHeight,a=!0),e.cornerRadius!==void 0&&(t.cornerRadius=e.cornerRadius),e.scale!==void 0&&(t.scale=e.scale),e.kind!==void 0&&e.kind!==t.kind&&(t.kind=e.kind,e.shaderScale===void 0&&(t.shaderScale=(e.kind==="circle"?Jt:Zt)*t.scale),e.ringCssPx===void 0&&(t.ringCssPx=(e.kind==="circle"?2:1)*t.scale)),e.shaderScale!==void 0&&(t.shaderScale=e.shaderScale),e.ringCssPx!==void 0&&(t.ringCssPx=e.ringCssPx),e.opacityMul!==void 0&&(t.opacityMul=e.opacityMul),e.paused!==void 0&&e.paused!==t.paused&&(t.paused=e.paused,!e.paused&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()),a&&ae(t)}function ta(t,e){t.visible=e,e&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()}function ea(t,e){const a=te();a.preset=Xt[t].modes[e],a.presetDirty=!0}let wt=null;function aa(t){wt=t}function ae(t){t.dpr=typeof window<"u"&&window.devicePixelRatio||1;const e=Math.max(1,Math.round(t.cssWidth*t.dpr)),a=Math.max(1,Math.round(t.cssHeight*t.dpr));t.canvas.width!==e&&(t.canvas.width=e),t.canvas.height!==a&&(t.canvas.height=a)}function ra(t){const{ctx:e,dpr:a,canvas:r}=t,o=t.ringCssPx*a,n=r.width,i=r.height,u=Math.max(0,(t.cornerRadius-t.ringCssPx)*a);e.save(),e.globalCompositeOperation="destination-out",e.fillStyle="#000",e.beginPath(),e.roundRect(o,o,n-2*o,i-2*o,u),e.fill(),e.restore()}function oa(t){var e;if(!s)return;const a=s.frameBitmap??s.glCanvas,r=t.dpr,o=t.canvas.width,n=t.canvas.height;if(o<1||n<1)return;const i=s.glCanvas.width,u=s.glCanvas.height,l=Yt*r,c=Kt*r;let h=o*(i/l)/t.shaderScale,f=n*(u/c)/t.shaderScale;h>i&&(h=i),f>u&&(f=u);const d=Math.max(0,(i-h)/2),g=Math.max(0,(u-f)/2);if(t.ctx.clearRect(0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=t.opacityMul),t.ctx.drawImage(a,d,g,h,f,0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=1),ra(t),t.onFirstCopy){const x=t.onFirstCopy;t.onFirstCopy=void 0,x()}(e=t.onAfterFrame)==null||e.call(t)}function na(){if(!s)return;const{gl:t,uniforms:e,preset:a,glCanvas:r}=s;e.u_resolution&&t.uniform2f(e.u_resolution,r.width,r.height);for(let o=0;o<7;o++){const n=e[`u_color${o+1}`];if(n){const[u,l,c]=$e(a.colors[o]);t.uniform3f(n,u,l,c)}const i=e[`u_alpha${o+1}`];i&&t.uniform1f(i,a.alphas[o])}e.u_intensity&&t.uniform1f(e.u_intensity,a.intensity),e.u_scale&&t.uniform1f(e.u_scale,a.scale),e.u_direction&&t.uniform1f(e.u_direction,a.direction*Math.PI/180),e.u_softness&&t.uniform1f(e.u_softness,a.softness),e.u_distortion&&t.uniform1f(e.u_distortion,a.distortion),e.u_complexity&&t.uniform1f(e.u_complexity,a.complexity),e.u_shape&&t.uniform1f(e.u_shape,a.shape),e.u_vignette&&t.uniform1f(e.u_vignette,a.vignette),e.u_vigOpacity&&t.uniform1f(e.u_vigOpacity,a.vigOpacity),e.u_blur&&t.uniform1f(e.u_blur,a.blur),e.u_shaderOpacity&&t.uniform1f(e.u_shaderOpacity,a.shaderOpacity),s.presetDirty=!1}function ia(t){if(!s)return;const{gl:e,uniforms:a,preset:r,glCanvas:o}=s,n=(t-s.startMs-s.pausedMs)/1e3*r.speed;e.viewport(0,0,o.width,o.height),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),s.presetDirty&&na(),a.u_time&&e.uniform1f(a.u_time,n),e.drawArrays(e.TRIANGLES,0,6),s.frameCount++}let Pt=0;function re(t){var e;if(!s)return;if(s.contextLost){s.rafId=0;return}let a=!1;for(const r of s.instances)if(r.visible&&(!r.paused||!r.everCopied)){a=!0;break}if(!a){s.rafId=0;return}if(s.rafId=requestAnimationFrame(re),!(t-Pt<Ie)){Pt=t,ia(t),s.useOffscreen&&(s.glowQueue.length>0&&dt(),(e=s.frameBitmap)==null||e.close(),s.frameBitmap=s.glCanvas.transferToImageBitmap());for(const r of s.instances)r.visible&&(r.paused&&r.everCopied||(oa(r),r.everCopied=!0));if(wt&&s.glowQueue.length>0&&++s.glowSkip%Ae===0){const r=s.glowQueue;s.glowIdx>=r.length&&(s.glowIdx=0);const o=r[s.glowIdx];o.visible&&!o.paused&&wt(o,t),s.glowIdx++}}}function nt(){!s||s.rafId!==0||(s.rafId=requestAnimationFrame(re))}function oe(){s&&(s.rafId!==0&&cancelAnimationFrame(s.rafId),s.rafId=0)}const lt={linear:t=>t,smoothstep:t=>t*t*(3-2*t)};function Z(t,e,a,r=lt.linear){return{from:t,to:e,dur:a,ease:r,startMs:-1,val:t,done:!1}}function J(t,e){t.startMs=e,t.val=t.from,t.done=!1}function At(t,e){if(t.done||t.startMs<0)return t.val;const a=Math.min(1,(e-t.startMs)/t.dur);return t.val=t.from+(t.to-t.from)*t.ease(a),a>=1&&(t.done=!0),t.val}const sa=1.5,it=1/3,la=4*it,ca=2*it,da=2*it,ua=1.35*it,ha=13*it;function Mt(t,e,a){const r=Math.max(0,Math.min(a,Math.min(t,e)/2));return 2*Math.max(0,t-2*r)+2*Math.max(0,e-2*r)+2*Math.PI*r}function _t(t,e,a,r){return r==="circle"?2*Math.PI*Math.max(0,Math.min(a,Math.min(t,e)/2)):Mt(t,e,a)}function ot(t,e,a,r,o,n,i,u){const l=u||{x:0,y:0},c=Math.max(0,Math.min(r,Math.min(e,a)/2));if(i==="circle"){const b=2*Math.PI*c;if(b<=1e-4)return l.x=e*.5,l.y=a*.5,l;t=(t%b+b)%b;const P=-Math.PI/2+t/b*Math.PI*2,E=Math.max(0,c-o+n);return l.x=e*.5+E*Math.cos(P),l.y=a*.5+E*Math.sin(P),l}const h=Math.max(0,e-2*c),f=Math.max(0,a-2*c),d=Math.PI*c/2,g=2*(h+f)+4*d;t=(t%g+g)%g;const x=Math.max(0,c-o+n);let m=t;if(m<h)return l.x=c+m,l.y=o-n,l;if(m-=h,m<d){const b=-Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=e-o+n,l.y=c+m,l;if(m-=f,m<d){const b=(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<h)return l.x=e-c-m,l.y=a-o+n,l;if(m-=h,m<d){const b=Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=o-n,l.y=a-c-m,l;m-=f;const F=Math.PI+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(F),l.y=c+x*Math.sin(F),l}function Et(t,e){const a=t*2/e;let r="";for(let o=0;o<=e;o++){const n=-t+o*a;r+=(o===0?"M ":"L ")+n.toFixed(3)+" 0 "}return r}const ft={x:0,y:0},pt={x:0,y:0};function fa(t,e,a,r,o,n){return ot(t-.1,e,a,r,o,0,n,ft),ot(t+.1,e,a,r,o,0,n,pt),Math.atan2(pt.y-ft.y,pt.x-ft.x)}function jt(t,e,a){const r=Math.max(0,Math.min(1,(a-t)/(e-t)));return r*r*(3-2*r)}function pa(t){const e=_t(t.width,t.height,t.cornerRadius,t.kind),a=sa*(t.scale??1),r=[];for(let o=0;o<$t;o++){const n=o/$t*e,i=ot(n,t.width,t.height,t.cornerRadius,a,0,t.kind);r.push({x:i.x,y:i.y,arc:n})}return r}function ma(t,e){const{width:a,height:r,cornerRadius:o}=t,n=t.scale??1,i=t.kind==="circle"?2:1,u=Math.max(0,o-i),l=(-200*n).toFixed(0),c=l,h=(540*n).toFixed(0),f=(440*n).toFixed(0),d=`x="${l}" y="${c}" width="${h}" height="${f}"`,g=`${d} filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"`,x=F=>(F*n).toFixed(3),m=F=>(F*n).toFixed(3);return["<defs>",`<filter id="${e}_bXl" ${g}><feGaussianBlur stdDeviation="${m(8.4)}"/></filter>`,`<filter id="${e}_bLg" ${g}><feGaussianBlur stdDeviation="${m(4.8)}"/></filter>`,`<filter id="${e}_bMd" ${g}><feGaussianBlur stdDeviation="${m(2.1)}"/></filter>`,`<filter id="${e}_bSm" ${g}><feGaussianBlur stdDeviation="${m(.9)}"/></filter>`,`<filter id="${e}_ebO" ${g}><feGaussianBlur stdDeviation="${m(da)}"/></filter>`,`<filter id="${e}_ebC" ${g}><feGaussianBlur stdDeviation="${m(ua)}"/></filter>`,`<radialGradient id="${e}_fg" cx="0.5" cy="0.5" r="0.5"><stop offset="0" stop-color="white"/><stop offset="0.30" stop-color="white"/><stop offset="0.65" stop-color="#404040"/><stop offset="1" stop-color="black"/></radialGradient>`,`<mask id="${e}_fm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="black"/><circle id="${e}_fc" cx="0" cy="0" r="${(ha*n).toFixed(3)}" fill="url(#${e}_fg)"/></mask>`,`<mask id="${e}_rm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="#808080"/><rect x="0" y="0" width="${a}" height="${r}" rx="${o}" ry="${o}" fill="white"/><rect x="${i}" y="${i}" width="${a-i*2}" height="${r-i*2}" rx="${u}" ry="${u}" fill="black"/></mask>`,"</defs>",`<g id="${e}_h" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g id="${e}_hI" stroke="white">`,`<path id="${e}_pXl" stroke-width="${x(26.4)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.385" filter="url(#${e}_bXl)"/>`,`<path id="${e}_pLg" stroke-width="${x(15.6)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.595" filter="url(#${e}_bLg)"/>`,`<path id="${e}_pMd" stroke-width="${x(7.2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bMd)"/>`,`<path id="${e}_pSm" stroke-width="${x(3)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bSm)"/>`,"</g></g>",`<g id="${e}_e" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g mask="url(#${e}_fm)">`,`<g id="${e}_eI" stroke="white">`,`<path id="${e}_eO" stroke-width="${x(la)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.85" filter="url(#${e}_ebO)"/>`,`<path id="${e}_eC" stroke-width="${x(ca)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="1.0" filter="url(#${e}_ebC)"/>`,"</g></g></g>"].join("")}const xa=.00875,Lt=.08,Nt=.32,ga=.05,va=3e3,Wt=.85,st=.34,mt=1500,ba=15,wa=.0075,ya=120,ka=1.5,Ma=7.8,_a=9.13952,Ca=1,Ta=1/3,Sa=.8,$a=3.51,Bt=2e3,xt=400,Ra=2.625,Fa=1.008,Ia=.31,ne=140,ie=40,se=20;let Oa=0;const q={x:0,y:0};function zt(t,e){const a=`mfxg_${++Oa}`,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","metal-fx-glow-svg"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e.width} ${e.height}`),r.innerHTML=ma(e,a),t.appendChild(r);const o=b=>r.querySelector(`#${a}_${b}`),n=o("h"),i=o("hI"),u=o("e"),l=o("eI"),c=o("fc"),h=_t(e.width,e.height,e.cornerRadius,e.kind)/Mt(ne,ie,se),f=Math.max(1,Ma*h),d=Math.max(.6,_a*Ta*h),g=Et(f,Ee),x=Et(d,je),m=[o("pXl"),o("pLg"),o("pMd"),o("pSm")],F=[o("eO"),o("eC")];for(const b of m)b.setAttribute("d",g);for(const b of F)b.setAttribute("d",x);return i.style.transformOrigin="0 0",l.style.transformOrigin="0 0",i.style.willChange="transform",l.style.willChange="transform",i.style.transition="transform 100ms linear",l.style.transition="transform 100ms linear",n.style.willChange="opacity",u.style.willChange="opacity",n.style.transition="opacity 100ms linear",u.style.transition="opacity 100ms linear",c.style.willChange="transform",{svg:r,haloGroup:n,haloInner:i,extraGroup:u,extraInner:l,fadeCircle:c,width:e.width,height:e.height,cornerRadius:e.cornerRadius,kind:e.kind,scale:e.scale??1,perim:pa(e),currentIdx:0,appearedAt:0,glowOpacity:0,relocTween:null,relocNextIdx:-1,wanderS:0,wanderTargetS:0,wanderFrames:0,tintFrom:{r:255,g:255,b:255},tintTarget:{r:255,g:255,b:255},tintTween:null,tintHoldUntil:0,lastHaloStroke:"",lastExtraStroke:""}}function Pa(t,e,a,r,o="dark"){var n;const{width:i,height:u,cornerRadius:l,perim:c}=t;if(c.length===0)return;const h=2;let f=-1,d=t.currentIdx,g=0;for(let v=0;v<c.length;v++){const M=c[v],T=Ot(e,M.x,M.y,h);T>f&&(f=T,d=v),v===t.currentIdx&&(g=T)}const x=t.appearedAt>0&&a-t.appearedAt<va,m=st+(Wt-st)*jt(Lt,Nt,g),F=!x&&f-g>ga;if(!t.relocTween||t.relocTween.done)if(t.appearedAt===0)t.currentIdx=d,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0,t.relocTween=Z(0,m,mt,lt.smoothstep),J(t.relocTween,a);else if((n=t.relocTween)!=null&&n.done&&t.relocTween.to===0){t.currentIdx=t.relocNextIdx,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0;const v=c[t.currentIdx],M=Ot(e,v.x,v.y,h),T=st+(Wt-st)*jt(Lt,Nt,M);t.relocTween=Z(0,T,mt,lt.smoothstep),J(t.relocTween,a)}else F?(t.relocNextIdx=d,t.relocTween=Z(t.glowOpacity,0,mt,lt.smoothstep),J(t.relocTween,a)):t.glowOpacity+=(m-t.glowOpacity)*xa;t.relocTween&&(t.glowOpacity=At(t.relocTween,a)),t.glowOpacity=Math.max(0,Math.min(1,t.glowOpacity));const b=_t(i,u,l,t.kind)/Mt(ne,ie,se),P=ba*b;t.wanderFrames++>=ya&&(t.wanderTargetS=(Math.random()*2-1)*P,t.wanderFrames=0),t.wanderS+=(t.wanderTargetS-t.wanderS)*wa;const E=c[t.currentIdx].arc+t.wanderS,L=ka*t.scale;ot(E,i,u,l,L,0,t.kind,q);const C=q.x,j=q.y,z=fa(E,i,u,l,L,t.kind),X=`translate(${C.toFixed(3)}px,${j.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`;t.haloInner.style.transform=X;const N=Ca*b*t.scale;ot(E,i,u,l,L,N,t.kind,q),t.extraInner.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`,t.fadeCircle.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px)`;const $=o==="light",k=$?Xe(e,C,j,h):Ve(e,C,j,h);t.tintTween?t.tintTween.done&&($?(t.tintFrom={r:t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*t.tintTween.val,g:t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*t.tintTween.val,b:t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*t.tintTween.val},t.tintTarget={...k},t.tintTween=Z(0,1,xt),J(t.tintTween,a)):a>=t.tintHoldUntil&&(t.tintFrom={...t.tintTarget},t.tintTarget={...k},t.tintTween=Z(0,1,xt),J(t.tintTween,a),t.tintHoldUntil=a+Bt)):(t.tintFrom={...k},t.tintTarget={...k},t.tintTween=Z(0,1,xt),J(t.tintTween,a),t.tintHoldUntil=$?0:a+Bt),At(t.tintTween,a);const I=t.tintTween.val;let W,B,H;if($)W=Math.round(t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I),B=Math.round(t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I),H=Math.round(t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I);else{const v=t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I,M=t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I,T=t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I,O=Math.max(v,M,T)||1;W=Math.round(255*(v/O)),B=Math.round(255*(M/O)),H=Math.round(255*(T/O))}const y=`rgb(${W},${B},${H})`;if(y!==t.lastHaloStroke&&(t.lastHaloStroke=y,t.haloInner.style.stroke=y),$){const v=Re(W,B,H),[M,T,O]=Fe(v[0],Math.min(1,v[1]*Ra),Math.max(Ia,v[2]*Fa)),D=`rgb(${M},${T},${O})`;D!==t.lastExtraStroke&&(t.lastExtraStroke=D,t.extraInner.style.stroke=D)}else t.lastExtraStroke!=="#ffffff"&&(t.lastExtraStroke="#ffffff",t.extraInner.style.stroke="#ffffff");const w=Math.max(0,Math.min(1,r));t.haloGroup.style.opacity=(t.glowOpacity*Sa*w).toFixed(3),t.extraGroup.style.opacity=Math.min(1,t.glowOpacity*$a*w).toFixed(3)}const yt=12,Ht=32,Gt=1,Dt=.55,Aa=1,Ea=1,ja=.85,La=0,Na=1.3,Ut=3.6,Wa=.7,Ba=1,za=.52,Ha=1,Ga=.044,Da=235,Ua=2.535,qa=.7,Qa=.5,Va=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function Xa(t,e){const a=Math.max(t.left-e.right,e.left-t.right,0),r=Math.max(t.top-e.bottom,e.top-t.bottom,0);return Math.sqrt(a*a+r*r)}function Ya(t,e,a,r){return!(Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top)<a||Math.max(t.left-e.right,e.left-t.right,0)>r)}function Ka(t,e,a,r){return Math.min(t.right,e.right)-Math.max(t.left,e.left)<a?!1:Math.max(t.top-e.bottom,e.top-t.bottom,0)<=r}function V(t,e,a,r,o,n){const i=Math.max(0,Math.min(n,r*.5,o*.5)),u=t.roundRect;if(typeof u=="function"){u.call(t,e,a,r,o,i);return}t.moveTo(e+i,a),t.lineTo(e+r-i,a),t.quadraticCurveTo(e+r,a,e+r,a+i),t.lineTo(e+r,a+o-i),t.quadraticCurveTo(e+r,a+o,e+r-i,a+o),t.lineTo(e+i,a+o),t.quadraticCurveTo(e,a+o,e,a+o-i),t.lineTo(e,a+i),t.quadraticCurveTo(e,a,e+i,a)}function le(t,e,a,r,o){if(!o.flipX&&!o.flipY){t.drawImage(e,0,0,a,r,o.x,o.y,o.w,o.h);return}t.save(),o.flipX&&(t.translate(o.x+o.w,0),t.scale(-1,1)),o.flipY&&(t.translate(0,o.y+o.h),t.scale(1,-1)),t.drawImage(e,0,0,a,r,o.flipX?0:o.x,o.flipY?0:o.y,o.w,o.h),t.restore()}const Za=4;function Ja(t,e,a,r,o,n,i){if(r<=2*i||o<=2*i){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+i,a+i,r-2*i,o-2*i,Math.max(0,n-i)),t.clip("evenodd")}function tr(t,e,a,r,o,n,i,u,l,c,h){const f=Math.max(1,Math.round((yt+Za*3)*h));let d=Math.max(0,i),g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),Ja(t,c.x,c.y,c.w,c.h,c.r,f),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,l),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=u,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ce(t,e,a,r,o,n,i){const u=i|0;if(u<1||r<=2*u||o<=2*u){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+u,a+u,r-2*u,o-2*u,Math.max(0,n-u)),t.clip("evenodd")}function er(t,e,a,r,o,n,i,u,l,c,h,f){let d=u*h,g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),ce(t,i.x,i.y,i.w,i.h,i.r,l),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,f),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=c,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ar(t,e,a,r,o,n,i,u){const l=t.createLinearGradient(r,o,n,i);l.addColorStop(0,`rgba(255,255,255,${u.toFixed(3)})`),l.addColorStop(.5,`rgba(255,255,255,${(u*.45).toFixed(3)})`),l.addColorStop(1,"rgba(255,255,255,0)"),t.save(),ce(t,e.x,e.y,e.w,e.h,e.r,a),t.globalCompositeOperation="lighter",t.lineWidth=a*2,t.strokeStyle=l,t.beginPath(),V(t,e.x,e.y,e.w,e.h,e.r),t.stroke(),t.restore()}function de(t){const e=getComputedStyle(t),a=[parseFloat(e.borderTopLeftRadius)||0,parseFloat(e.borderTopRightRadius)||0,parseFloat(e.borderBottomRightRadius)||0,parseFloat(e.borderBottomLeftRadius)||0].filter(r=>r>0);return a.length?Math.min.apply(null,a):0}function ue(t){const e=getComputedStyle(t),a=Math.max(parseFloat(e.borderTopWidth)||0,parseFloat(e.borderRightWidth)||0,parseFloat(e.borderBottomWidth)||0,parseFloat(e.borderLeftWidth)||0);let r=0,o=0;const n=e.boxShadow;if(n&&n!=="none"){const u=n.replace(/rgba?\([^)]*\)/g,h=>h.replace(/,/g,"\0")).split(/,\s*/);let l=1/0,c=1/0;for(const h of u){const f=h.match(/-?\d+(?:\.\d+)?px/g);if(!f||f.length<4)continue;const d=parseFloat(f[3]);d>0&&(/\binset\b/.test(h)?d<l&&(l=d):d<c&&(c=d))}Number.isFinite(l)&&(r=l),Number.isFinite(c)&&(o=c)}const i=Math.max(a,o);return{width:Math.max(a,r,o)||1,outerCssPx:i}}function qt(t){t.cornerRadius=de(t.el);const e=ue(t.el);t.hairlineWidth=e.width,t.hairlineOuterCssPx=e.outerCssPx}function rr(t){typeof ResizeObserver<"u"&&(t.resizeObserver=new ResizeObserver(()=>qt(t)),t.resizeObserver.observe(t.el)),typeof MutationObserver<"u"&&(t.mutationObserver=new MutationObserver(()=>qt(t)),t.mutationObserver.observe(t.el,{attributes:!0,attributeFilter:["style","class"]}))}function or(t){var e,a;(e=t.resizeObserver)==null||e.disconnect(),t.resizeObserver=null,(a=t.mutationObserver)==null||a.disconnect(),t.mutationObserver=null}const tt=new Set;function nr(t,e,a){if(typeof document>"u"||Va.has(t.tagName))return null;for(const g of tt)if(g.el===t)return g;const r=document.createElement("div");r.setAttribute("data-metal-fx-reflection",""),r.setAttribute("aria-hidden","true");const o=document.createElement("canvas");o.className="metal-fx-reflection-canvas";const n=o.getContext("2d",{alpha:!0});if(!n)return null;const i=document.createElement("canvas");i.className="metal-fx-reflection-stroke-canvas";const u=i.getContext("2d",{alpha:!0});if(!u)return null;r.appendChild(o),r.appendChild(i);const l=getComputedStyle(t);let c=!1;l.position==="static"&&(t.style.position="relative",c=!0);let h=!1;l.isolation!=="isolate"&&(t.style.isolation="isolate",h=!0),t.setAttribute("data-metal-fx-reflect-host",""),t.insertBefore(r,t.firstChild);const f=ue(t),d={el:t,anchor:e,anchorEl:a,wrap:r,canvas:o,ctx:n,strokeCanvas:i,strokeCtx:u,cornerRadius:de(t),hairlineWidth:f.width,hairlineOuterCssPx:f.outerCssPx,appliedPositionRelative:c,appliedIsolation:h,resizeObserver:null,mutationObserver:null};return rr(d),tt.add(d),d}function ir(t){for(const e of tt)if(e.el===t){or(e),e.canvas.width=0,e.canvas.height=0,e.strokeCanvas.width=0,e.strokeCanvas.height=0,e.wrap.parentNode===e.el&&e.el.removeChild(e.wrap),e.el.removeAttribute("data-metal-fx-reflect-host"),e.appliedPositionRelative&&(e.el.style.position=""),e.appliedIsolation&&(e.el.style.isolation=""),tt.delete(e);return}}function sr(){if(tt.size===0)return;const t=typeof window<"u"&&window.devicePixelRatio||1,e=new Map;for(const a of tt){const r=a.el.getBoundingClientRect();let o=e.get(a.anchorEl);if(o||(o=a.anchorEl.getBoundingClientRect(),e.set(a.anchorEl,o)),r.width<1||r.height<1||o.width<1||o.height<1)continue;if(!Ya(o,r,Gt,Ht)&&!Ka(o,r,Gt,Ht)){a.canvas.width!==1&&(a.canvas.width=1,a.canvas.height=1),a.strokeCanvas.width!==1&&(a.strokeCanvas.width=1,a.strokeCanvas.height=1);continue}const n=a.anchor.canvas,i=n.width|0,u=n.height|0;if(i<4||u<4)continue;const l=(o.left+o.right)*.5,c=(o.top+o.bottom)*.5,h=(r.left+r.right)*.5,f=(r.top+r.bottom)*.5,d=l-h,g=c-f,x=Math.max(o.left-r.right,r.left-o.right,0),m=Math.max(o.top-r.bottom,r.top-o.bottom,0),F=x>=m,b=Xa(o,r);let P=1-Math.min(1,b/yt);P=P*P*(3-2*P);const E=Dt+(Aa-Dt)*P,L=Math.min(Ut,E*Na*Wa),C=a.anchor.scale??1,j=Math.max(Ba*C,a.hairlineWidth),z=Math.max(1,Math.round(j*t)),X=Math.max(1,Math.round(Math.max(Ha*C,a.hairlineWidth)*t)),N=a.hairlineOuterCssPx;a.wrap.style.inset=`${-N}px`,a.wrap.style.borderRadius=`${Math.max(0,a.cornerRadius)}px`;const $=Math.max(1,Math.round((r.width+N*2)*t)),k=Math.max(1,Math.round((r.height+N*2)*t));a.canvas.width!==$&&(a.canvas.width=$),a.canvas.height!==k&&(a.canvas.height=k),a.strokeCanvas.width!==$&&(a.strokeCanvas.width=$),a.strokeCanvas.height!==k&&(a.strokeCanvas.height=k);const I=a.ctx;I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,$,k);const W=a.strokeCtx;W.setTransform(1,0,0,1,0,0),W.clearRect(0,0,$,k);const B=Math.min(yt*t,Math.max($,k));let H,y,w,v;F?(H=d>0?$:0,w=d>0?$-B:B,y=k*.5,v=k*.5):(y=g>0?k:0,v=g>0?k-B:B,H=$*.5,w=$*.5);const M=I.createLinearGradient(H,y,w,v);M.addColorStop(0,`rgba(0,0,0,${Ea})`),M.addColorStop(.5,`rgba(0,0,0,${ja})`),M.addColorStop(1,`rgba(0,0,0,${La})`);const T=i/t,O=Math.max(1,Math.round(Da*Math.max(.1,T/140)*t));let D,U,S,A,Q=!1,Ct=!1;if(F){const at=Math.max(o.top,r.top),ht=Math.min(o.bottom,r.bottom);Q=!0,D=d>0?$-O:0,U=Math.round((at-r.top+N)*t),S=O,A=Math.max(1,Math.round((ht-at)*t))}else{const at=Math.max(o.left,r.left),ht=Math.min(o.right,r.right);Ct=!0,D=Math.round((at-r.left+N)*t),U=g>0?k-O:0,S=Math.max(1,Math.round((ht-at)*t)),A=O}const Tt={x:D,y:U,w:S,h:A,flipX:Q,flipY:Ct},ut={x:0,y:0,w:$,h:k,r:Math.max(0,a.cornerRadius*t)},me=Math.min(Ut,L*Ua*qa*Qa);tr(I,n,i,u,$,k,me,M,Tt,ut,t),er(W,n,i,u,$,k,ut,L,z,M,za,Tt),ar(W,ut,X,H,y,w,v,Math.min(.85,Ga*L)),I.globalCompositeOperation="source-over",W.globalCompositeOperation="source-over"}}let gt=!1,Qt=0;function lr(){gt||(gt=!0,!(typeof requestAnimationFrame>"u")&&requestAnimationFrame(t=>{gt=!1,!(t-Qt<Oe)&&(Qt=t,sr())}))}const Vt="metal-fx-styles",cr=`
.metal-fx-root {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
isolation: isolate;
overflow: visible;
background: #272727;
color: #f8f8f8;
}
.metal-fx-root[data-theme='light'] {
background: #ffffff;
color: #1d1d1d;
}
.metal-fx-root::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
z-index: 2;
box-shadow: inset 0 0 50px 0 rgba(255, 255, 255, 0.02);
}
.metal-fx-root[data-theme='light']::before {
box-shadow: inset 0 0 50px 0 rgba(0, 0, 0, 0.02);
}
.metal-fx-root::after {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
z-index: 4;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.metal-fx-root[data-theme='light']::after {
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
/* Circle variant gets a thicker outer rim than the button variant. */
.metal-fx-root[data-variant='circle']::after {
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}
.metal-fx-root[data-theme='light'][data-variant='circle']::after {
box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.06);
}
.metal-fx-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
z-index: 0;
pointer-events: none;
border-radius: inherit;
}
/* The inner spacer — defines the inset geometry where the metal ring meets
the interior (3 px for Button, 1-2 px for Circle) and carries the Circle dark
hairline ('box-shadow: inset' rules below). Intentionally transparent so
the wrapper's background propagates through to the punched shader centre,
giving consumers a single surface tone to override. See "Single-surface
background" in the file header for the rationale. */
.metal-fx-inner {
position: absolute;
inset: 3px;
border-radius: inherit;
z-index: 1;
pointer-events: none;
}
.metal-fx-root[data-variant='button'][data-shape='pill'] .metal-fx-inner {
border-radius: calc(var(--mfx-radius, 20px) - 3px);
}
.metal-fx-root[data-variant='button'][data-shape='circle'] .metal-fx-inner {
border-radius: calc(var(--mfx-radius, 16px) - 3px);
}
.metal-fx-root[data-variant='circle'][data-shape='pill'] .metal-fx-inner {
inset: 0;
border-radius: var(--mfx-radius, 20px);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
.metal-fx-root[data-variant='circle'][data-shape='circle'] .metal-fx-inner {
inset: 0;
border-radius: var(--mfx-radius, 16px);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
/* Circle-variant hairline alpha — light mode.
Source-of-truth: index.html L2261-2267. The 0.45-alpha black inset that
reads as a single-pixel frame against the dark interior is too heavy
on a #ffffff inner: it ends up looking like a hard 2-px black ring
against the iridescent shader. Suppressed entirely (alpha 0) — the
shader's own iridescent rim already defines the silhouette in light
mode, so an extra dark hairline only competes with it. The rule is
kept (rather than deleted) as a tunable hook in case a future variant
wants to re-introduce a soft edge. NOTE: we keep the dark-mode inset
and border-radius values because — unlike index.html — our renderer
does NOT overscan the canvas in light mode, so there is no 1-px gap
between inner element and shader to compensate for. */
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='pill'] .metal-fx-inner,
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='circle'] .metal-fx-inner {
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0);
}
/* ─── Combined glow SVG (z=3) ──────────────────────────────────────────────
Single SVG per instance that holds BOTH the wide-halo group
(#mfx_haloTravel) and the catch-light group (#mfx_extraTravel), exactly
mirroring canonical's _buildGlowSvgInner (index.html L8078). One
mix-blend-mode: screen lifts the combined composite onto the shader
ring; per-frame opacity attributes on each inner group still drive the
independent fade-in / fade-out cycles for the halo and the catch-light.
Why a single SVG: the circle variant anchors halo + catch-light at the same
perimeter point, so they overlap in the bright zone. Two separately-
screened SVGs would double-screen the overlap (A + B + C - AB - AC -
BC + ABC instead of A + B + C - AB - AC once both groups composite
in source-over inside one SVG and then screen against the host once).
That overlap looked muted versus canonical specifically on the circle
variant where both layers travel together.
Source-of-truth opacity: #btnGlowSvg drops to 0.7 in dark and 0.2746 in
light (index.html L632/L643). */
.metal-fx-glow-svg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
z-index: 3;
pointer-events: none;
opacity: 0.7;
}
.metal-fx-root[data-theme='light'] .metal-fx-glow-svg {
/* Light-mode 1-px overscan mirrors .btn-glow-svg in metal.html so the
halo stays glued to the visible silhouette (the shader ring there sits
1 px outside the host's padding box). */
inset: -1px;
width: calc(100% + 2px);
height: calc(100% + 2px);
mix-blend-mode: multiply;
/* Source-of-truth: html[data-theme="light"] #btnGlowSvg { opacity: 0.2746 }
→ −35 % from 0.4225 from the original 0.7 dark-mode opacity. */
opacity: 0.2746;
filter: saturate(5.355) brightness(0.78);
}
/* Circle light-mode small variants (e.g. 36×36 send button): the geometrically
shrunk halo loses density when multiplied against #ffffff. Mirror the
canonical override at index.html L2316 — bump saturation + drop brightness
so the small glow holds together visually. */
.metal-fx-root[data-variant='circle'][data-shape='circle'][data-theme='light'] .metal-fx-glow-svg {
filter: saturate(7.5) brightness(0.6);
}
/* The wrapped child — hoisted into z=5 so it sits above every overlay, with
normalized chrome so consumer button styles don't fight the metal frame. */
.metal-fx-content {
position: relative;
z-index: 5;
display: inline-flex;
align-items: center;
justify-content: center;
width: 100%;
pointer-events: none;
}
.metal-fx-content > * {
pointer-events: auto;
}
.metal-fx-root[data-normalize='true'] .metal-fx-content > * {
background: transparent !important;
border: 0 !important;
outline: 0 !important;
box-shadow: none !important;
/* Sizing: we deliberately DO NOT force \`width: 100%; height: 100%\` on the
child here. That used to be the contract ("the wrapper is the visible
button surface; the child stretches to fill it"), but it created a cyclic
percentage dependency: the wrapper is \`inline-flex\` with no intrinsic
size, .metal-fx-content is \`width/height: 100%\` of the wrapper, and the
child was \`100%\` of .metal-fx-content. With nothing breaking the cycle,
icon-only / class-sized children collapsed.
The new contract: the child sizes itself (intrinsic content, CSS class,
or inline style — all work), and the wrapper's \`inline-flex\` wraps it
tightly. Consumers who want a metal frame BIGGER than the child (e.g.
padding around an icon) size <MetalFx style={{ width, height }}> AND
explicitly set width/height on the child to fill (or accept that the
child renders at its intrinsic size, centered).
Typography is intentionally NOT touched. We used to apply
\`color: inherit; font: inherit;\` here to "match" the wrapper, but
\`font: inherit\` is a shorthand that overrides font-family, font-size,
font-weight, AND line-height on the child — which (a) shrank the
button height (line-height changes propagate through the flex
content box) and (b) scaled em-based icons / font-icons inside the
child to whatever the wrapper inherited. The wrapper now stays out
of the child's typography entirely; consumers who want typographic
normalization can apply it themselves on the child element. */
}
[data-metal-fx-reflection] {
position: absolute;
inset: 0;
pointer-events: none;
border-radius: inherit;
overflow: hidden;
z-index: 0;
isolation: isolate;
}
.metal-fx-reflection-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
filter: blur(4px) saturate(1.2) brightness(1.58);
}
.metal-fx-reflection-stroke-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
filter: saturate(1.35) brightness(1.75);
}
/* Hosts that participate as reflection targets need positioning + isolation
so the wrap composites only against the host (not the parent stack). The
wrap injects these inline as well, but stating them here keeps reflections
working on hosts that already have other inline styles applied. */
[data-metal-fx-reflect-host] {
isolation: isolate;
}
`;let vt=!1;function dr(){if(vt||typeof document>"u")return;if(document.getElementById(Vt)){vt=!0;return}const t=document.createElement("style");t.id=Vt,t.textContent=cr,document.head.appendChild(t),vt=!0}dr();const ur={position:"absolute",inset:0,width:"100%",height:"100%"},hr={position:"absolute",inset:3},fr={position:"absolute",inset:0,pointerEvents:"none",zIndex:3,borderRadius:"inherit"},ct=new Map;aa((t,e)=>{const a=ct.get(t);a&&Pa(a.handles,t,e,t.opacityMul,a.themeRef.current)});function pr(t){const[e,a]=_.useState(()=>t!=="auto"?t:typeof window>"u"||!window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return _.useEffect(()=>{if(t!=="auto"){a(t);return}if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches?"dark":"light");return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),e}const he=_.forwardRef(function({children:t,variant:e="button",preset:a="chromatic",theme:r="auto",strength:o=1,paused:n=!1,borderRadius:i,normalizeHostStyles:u=!0,reflectionTargets:l,disableGlow:c=!1,shaderScale:h,ringCssPx:f,scale:d=1,className:g,style:x,...m},F){const b=_.useRef(null),P=_.useRef(null),E=_.useRef(null),L=_.useRef(null),C=_.useRef(null),j=_.useRef(null),z=_.useRef("dark"),X=_.useRef(0),[N,$]=_.useState(!1),k=pr(r);z.current=k;const I=e==="circle"?"circle":"pill",W=!c;_.useImperativeHandle(F,()=>b.current,[]);const B=(y,w)=>{if(I==="circle")return Math.min(y,w)/2;const v=typeof i=="number"?i:(()=>{var M;const T=(M=L.current)==null?void 0:M.firstElementChild;if(T){const O=parseFloat(getComputedStyle(T).borderTopLeftRadius);if(Number.isFinite(O)&&O>0)return O}return X.current})();return Math.min(v,Math.min(y,w)/2)};_.useEffect(()=>{ea(a,k)},[a,k]),_.useEffect(()=>{const y=C.current;y&&rt(y,{paused:n})},[n]),_.useEffect(()=>{const y=C.current;if(!y)return;const w={};h!==void 0&&(w.shaderScale=h),f!==void 0&&(w.ringCssPx=f),d!==void 0&&(w.scale=d),Object.keys(w).length>0&&rt(y,w)},[h,f,d]),_.useLayoutEffect(()=>{const y=P.current,w=b.current,v=E.current;if(!y||!w)return;{const S=getComputedStyle(w),A=parseFloat(S.borderTopLeftRadius);X.current=Number.isFinite(A)?A:0}const M=()=>{const S=w.getBoundingClientRect(),A=Math.max(1,Math.round(S.width)),Q=Math.max(1,Math.round(S.height));return{cssWidth:A,cssHeight:Q,cornerRadius:B(A,Q)}},T=M();C.current=Ye({hostCanvas:y,cssWidth:T.cssWidth,cssHeight:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,paused:n,shaderScale:h,ringCssPx:f,scale:d,onFirstCopy:()=>$(!0)}),w.style.setProperty("--mfx-radius",`${T.cornerRadius}px`),w.style.borderRadius=`${T.cornerRadius}px`,v&&(j.current=zt(v,{width:T.cssWidth,height:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,scale:d}));let O=0;const D=new ResizeObserver(()=>{O===0&&(O=requestAnimationFrame(()=>{O=0;const S=M(),A=C.current;A&&(rt(A,{cssWidth:S.cssWidth,cssHeight:S.cssHeight,cornerRadius:S.cornerRadius}),w.style.setProperty("--mfx-radius",`${S.cornerRadius}px`),w.style.borderRadius=`${S.cornerRadius}px`,v&&(v.innerHTML="",j.current=zt(v,{width:S.cssWidth,height:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,scale:d}),A&&j.current&&ct.set(A,{handles:j.current,themeRef:z})))}))});D.observe(w);let U=null;return typeof IntersectionObserver<"u"&&(U=new IntersectionObserver(S=>{const A=C.current;if(A)for(const Q of S)ta(A,Q.isIntersecting)},{rootMargin:"64px"}),U.observe(w)),C.current&&j.current&&(ct.set(C.current,{handles:j.current,themeRef:z}),Ze(C.current)),()=>{D.disconnect(),U?.disconnect(),O!==0&&cancelAnimationFrame(O);const S=C.current;S&&(ct.delete(S),Je(S),Ke(S)),C.current=null,j.current=null,v&&(v.innerHTML="")}},[I]),_.useEffect(()=>{const y=C.current;y&&rt(y,{opacityMul:Math.max(0,Math.min(1,o))})},[o,e]),_.useEffect(()=>{const y=C.current,w=b.current;if(!y||!w||!l||k!=="dark")return;y.onAfterFrame=lr;const v=l.flatMap(M=>M.current?[M.current]:[]);for(const M of v)nr(M,y,w);return()=>{y.onAfterFrame=void 0;for(const M of v)ir(M)}},[l,k]),_.useEffect(()=>{const y=b.current,w=C.current;if(!y||!w)return;const v=B(w.cssWidth,w.cssHeight);rt(w,{cornerRadius:v}),y.style.setProperty("--mfx-radius",`${v}px`),y.style.borderRadius=`${v}px`},[i,k,e,I]);const H=_.useMemo(()=>({...x,"--mfx-strength":String(Math.min(1,Math.max(0,o))),opacity:N?1:0,visibility:N?"visible":"hidden",transition:N?"opacity 0.15s ease-out":"none"}),[x,o,N]);return p.jsxs("div",{...m,ref:b,className:g?`metal-fx-root ${g}`:"metal-fx-root","data-variant":e,"data-shape":I,"data-theme":k,"data-paused":n?"true":void 0,"data-normalize":u?"true":"false",style:H,children:[p.jsx("canvas",{ref:P,className:"metal-fx-canvas",style:ur}),p.jsx("div",{className:"metal-fx-inner","aria-hidden":"true",style:hr}),p.jsx("div",{ref:E,"aria-hidden":"true",style:{...fr,display:W?void 0:"none"}}),p.jsx("div",{ref:L,className:"metal-fx-content",children:t})]})});he.displayName="MetalFx";const et=18;function fe(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"4"}),p.jsx("path",{d:"M12 2v2"}),p.jsx("path",{d:"M12 20v2"}),p.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),p.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),p.jsx("path",{d:"M2 12h2"}),p.jsx("path",{d:"M20 12h2"}),p.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),p.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function pe(){return p.jsx("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function mr(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),p.jsx("path",{d:"M8 21h8"}),p.jsx("path",{d:"M12 17v4"})]})}const xr=[{value:"light",label:"Light",Icon:fe},{value:"dark",label:"Dark",Icon:pe},{value:"system",label:"System",Icon:mr}];function gr(t){return t==="dark"?pe:fe}function vr({theme:t,resolvedTheme:e,onSetTheme:a,className:r="",direction:o="down",align:n="right"}){const[i,u]=_.useState(!1),l=_.useRef(null),c=_.useCallback(()=>u(!1),[]);_.useEffect(()=>{if(!i)return;const f=d=>{l.current&&!l.current.contains(d.target)&&c()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i,c]),_.useEffect(()=>{if(!i)return;const f=d=>{d.key==="Escape"&&c()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[i,c]);const h=gr(e);return p.jsxs("div",{ref:l,className:`relative ${r}`,children:[p.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,onClick:()=>u(f=>!f),className:"flex items-center justify-center w-9 h-9 rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors",children:p.jsx(h,{})}),i&&p.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${o==="up"?"bottom-full mb-1":"top-full mt-1"} ${n==="left"?"left-0":"right-0"}`,children:xr.map(({value:f,label:d,Icon:g})=>{const x=t===f;return p.jsxs("button",{type:"button",onClick:()=>{a(f),c()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${x?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[p.jsx(g,{}),p.jsx("span",{children:d})]},f)})})]})}const br="https://github.com/mm7894215/TokenTracker/releases/latest";function Ir({auth:t,signedIn:e,sessionSoftExpired:a,userId:r}){const{currency:o,rate:n}=ke(),{theme:i,resolvedTheme:u,setTheme:l}=xe(),{openLoginModal:c}=ge(),{signedIn:h,loading:f}=ve(),d=!be(),g=e&&!a,x=_.useMemo(()=>g&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,g]),m=_e({userId:r,period:"total",accessToken:x});return p.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[p.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:p.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsxs(St,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[p.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),p.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),p.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:p.jsx(Me,{})})]}),p.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[p.jsxs(St,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[p.jsx(we,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),p.jsx("span",{children:Y("leaderboard.profile.nav.back")})]}),d&&p.jsx(he,{variant:"button",preset:"chromatic",theme:"dark",borderRadius:9999,disableGlow:!0,className:"!bg-black",children:p.jsxs("a",{href:br,target:"_blank",rel:"noopener noreferrer",className:"group no-underline inline-flex h-8 items-center gap-1.5 px-3 text-xs font-bold rounded-full bg-black text-white transition-transform duration-200 active:scale-[0.98]",children:[p.jsx(Se,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:translate-y-0.5"}),p.jsx("span",{className:"hidden sm:inline",children:Y("leaderboard.profile.nav.download")})]})}),f?p.jsx("div",{className:"h-8 w-16 animate-pulse rounded-full bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):h?p.jsx(ye,{}):p.jsx("button",{type:"button",onClick:c,className:"inline-flex h-8 min-w-[76px] items-center justify-center px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm select-none",children:Y("header.auth.sign_in_aria")})]})]})}),p.jsx("main",{className:"flex-1 px-4 pt-4 pb-10 sm:pt-6 sm:pb-16",children:p.jsx("div",{className:"mx-auto max-w-3xl",children:p.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[m.loading&&p.jsx(Ce,{variant:"page"}),!m.loading&&m.error&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:Y("leaderboard.profile_modal.error")})}),!m.loading&&!m.error&&!m.data&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Y("leaderboard.profile_modal.empty")})}),!m.loading&&!m.error&&m.data&&p.jsx(Te,{data:m.data,currency:o,rate:n,variant:"page"})]})})}),p.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 px-4 transition-colors duration-200",children:p.jsxs("div",{className:"mx-auto flex max-w-3xl items-center justify-between text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[p.jsx("p",{children:Y("landing.v2.footer.line")}),p.jsx(vr,{theme:i,resolvedTheme:u,onSetTheme:l,direction:"up",align:"right"})]})})]})}export{Ir as LeaderboardProfilePage};
import{j as i,V as M,r as f,G as d,U as C,aG as $,i as D,L as A,aH as W}from"./main-BbEXIjk8.js";import{u as G}from"./use-usage-limits-LOfhEW65.js";import{L as u,a as H,l as g,b as U,u as z}from"./use-limits-display-prefs-BUrvvpbW.js";import{C as E}from"./Card-CJiPCvnj.js";import{F as B}from"./FadeIn-BrYhLQwK.js";import{L as V}from"./LocalOnlyNotice-CBRDpg-i.js";import"./arrow-up-right-DJo_-PxX.js";import"./download-BwsW6vug.js";const X=[3,2,3,3,2,2,3];function h({className:e}){return i.jsx("div",{className:M("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function Y(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(h,{className:"h-3 w-12 shrink-0"}),i.jsx(h,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(h,{className:"h-3 w-[30px] shrink-0"}),i.jsx(h,{className:"h-3 w-6 shrink-0"})]})}function q({bars:e,index:t}){const r=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(h,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(h,{className:M("h-4",r)})]}),Array.from({length:e},(a,n)=>i.jsx(Y,{},n))]})}function J(){return i.jsx(E,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(h,{className:"h-3.5 w-28"}),X.map((e,t)=>i.jsx(q,{bars:e,index:t},t))]})})}function Q(e,t){if(!(e>0))return null;const r=(e-t)/e;return Number.isFinite(r)?Math.min(Math.max(r,0),1):null}function Z(e,t,r=.03){return e>t+r}function ee(e){const t=Math.max(0,Math.floor(e)),r=Math.floor(t/3600);return r>24?`${Math.floor(r/24)}d`:r>0?`${r}h`:`${Math.floor(t/60)}m`}function te(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const r=t[e.windowSecondsField];return typeof r=="number"&&r>0?r:null}return null}function S(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function ie({usedPercent:e,windowSeconds:t,resetMs:r,mode:a,now:n=Date.now()}){const o=Math.min(Math.max(Number(e)||0,0),100)/100,s={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(r))return s;const c=Math.max(0,(r-n)/1e3),l=Q(t,c);if(l==null)return s;if(s.expectedPercent=Math.round(l*100),s.paceOver=Z(o,l),o>=.05){const m=a==="remaining"?1-l:l;s.pacePercent=m*100}if(l>.02&&o>0){const m=t*l,x=o/m,p=o/l;p>=1&&x>0?s.runsOutEta=ee((1-o)/x):s.projectedEnd=Math.round(Math.min(p,1)*100)}return s}const I={claude:{windows(e){return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400}]}},codex:{windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude",labelKey:"limits.label.antigravity_claude",window:e.primary_window},{key:"gpro",labelKey:"limits.label.antigravity_gpro",window:e.secondary_window},{key:"flash",labelKey:"limits.label.antigravity_flash",window:e.tertiary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}}},re="shrink-0 text-oai-black dark:text-oai-white";function ne(e){const t=S(e);if(!Number.isFinite(t))return null;const r=t-Date.now();if(r<=0)return d("shared.time.now");const a=Math.floor(r/6e4);if(a<60)return`${a}m`;const n=Math.floor(a/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function ae(e,t){const r=t===u.REMAINING?100-e:e;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function b(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function L(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function le(e,t){return ie({usedPercent:b(e.window,e.pctField),windowSeconds:te(e,e.window),resetMs:S(L(e.window,e.resetField)),mode:t})}function oe({label:e,pct:t,reset:r,mode:a=u.USED,pacePercent:n=null,paceOver:o=!1}){const s=Math.max(0,Math.min(100,Number(t)||0)),c=a===u.REMAINING?100-s:s,l=Math.round(c),m=c>0&&l===0?Math.max(c,.35):c;let x=String(l);c>0&&l===0&&(x=d("limits.bar.sub_one_percent"));const p=n==null?null:Math.max(0,Math.min(100,n));return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),i.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[i.jsx("div",{className:`${ae(c,a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${m}%`,minWidth:c>0?"3px":0}}),p!=null&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${p}% - 3px)`,width:"6px"}}),i.jsx("div",{className:`absolute top-0 h-full ${o?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${p}% - 1px)`,width:"2px"}})]})]}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[x,"%"]}),r&&i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r})]})}function se(e,t,r){const a=d(e.labelKey),n=r===u.REMAINING,o=l=>n?100-l:l;if(t.expectedPercent==null){const l=Math.round(Math.max(0,Math.min(100,Number(b(e.window,e.pctField))||0)));return n?d("limits.explain.remaining",{label:a,used:o(l)}):d("limits.explain.used",{label:a,used:l})}if(t.paceOver){if(t.runsOutEta)return d("limits.explain.ahead_eta",{label:a,eta:t.runsOutEta});const l=o(t.projectedEnd??100);return d(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:a,pct:l})}const s=Math.round(Math.max(0,Math.min(100,Number(b(e.window,e.pctField))||0))),c=o(t.projectedEnd??s);return d(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:a,pct:c})}function de({rows:e,mode:t}){if(e.length===0)return null;const r=t===u.REMAINING;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:a,pace:n})=>i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:se(a,n,t)},a.key)),i.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:d(r?"limits.explain.body_remaining":"limits.explain.body")})]})}function _({name:e,providerId:t,children:r,expandable:a=!1,expanded:n=!1,onToggle:o}){const s=U(t),c=i.jsxs("div",{className:"flex items-center gap-1.5",children:[s?i.jsx(C,{provider:s,size:14,className:re}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e})]});return a?i.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:o,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),o?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[c,r]}):i.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,r]})}const ce=H;function y({children:e,tone:t="neutral"}){const r=t==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:e})}function me({rows:e,mode:t,extra:r=null}){const a=e.length===0&&!r;return i.jsxs(i.Fragment,{children:[e.map(({spec:n,pace:o})=>i.jsx(oe,{label:d(n.labelKey),pct:b(n.window,n.pctField),reset:ne(L(n.window,n.resetField)),mode:t,pacePercent:o.pacePercent,paceOver:o.paceOver},n.key)),a?i.jsx(y,{children:d("limits.status.no_data")}):null,r]})}function ue(e,t){return e==="kimi_parallel"&&t.parallel_limit?i.jsx(y,{children:d("limits.label.kimi_parallel",{count:t.parallel_limit})}):e==="copilot_otel"&&!t.otel_has_files&&!t.otel_enabled?i.jsx(we,{defaultDir:t.otel_default_dir}):null}function xe(e,t,r,a,n,o){const s=I[e];if(!s)return null;const c=s.windows(t).filter(m=>m.window).map(m=>({spec:m,pace:le(m,a)})),l=ue(s.extra,t);return i.jsxs(_,{name:r,providerId:e,expandable:c.length>0,expanded:n,onToggle:o,children:[i.jsx(me,{mode:a,rows:c,extra:l}),n?i.jsx(de,{rows:c,mode:a}):null]},e)}function pe(e,t,r,a,n){if(!I[e])return null;if(!t?.configured)return i.jsx(_,{name:g(e),providerId:e,children:i.jsx(y,{children:d("limits.status.not_connected")})},e);if(t.error)return i.jsx(_,{name:g(e),providerId:e,children:i.jsx(y,{tone:"error",children:d("shared.error.prefix",{error:t.error})})},e);const o=g(e),s=t.plan_label?`${o} ${t.plan_label}`:o;return xe(e,t,s,r,a,n)}function we({defaultDir:e}){const[t,r]=f.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
`),o=async s=>{s.stopPropagation();try{await navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.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:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:d("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:d("limits.copilot.otelHint.body")}),i.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:n}),i.jsx("button",{type:"button",onClick:o,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:t?d("limits.copilot.otelHint.copied"):d("limits.copilot.otelHint.copy")})]})}function he(e){const[t,r]=f.useState(0);return f.useLayoutEffect(()=>{const a=e.current;if(!a)return;const n=a.querySelectorAll("[data-limit-label]");let o=0;const s=n.length>0?document.createElement("canvas").getContext("2d"):null;if(s){const l=window.getComputedStyle(n[0]);s.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const m of n)o=Math.max(o,s.measureText(m.textContent).width)}const c=Math.ceil(o);r(l=>l===c?l:c)}),t}function fe({claude:e,codex:t,cursor:r,gemini:a,kimi:n,kiro:o,grok:s,antigravity:c,copilot:l,order:m,visibility:x,displayMode:p}){const P={claude:e,codex:t,cursor:r,gemini:a,kimi:n,kiro:o,grok:s,antigravity:c,copilot:l},k=f.useRef(null),j=he(k),[F,O]=f.useState(null),R=Array.isArray(m)&&m.length>0?m:ce,v=p===u.REMAINING?u.REMAINING:u.USED,K=v===u.REMAINING?d("limits.settings.display_mode_remaining"):d("limits.settings.display_mode_used"),N=R.filter(w=>!x||x[w]!==!1).map(w=>pe(w,P[w],v,F===w,()=>O(T=>T===w?null:w))).filter(Boolean);return i.jsx(B,{delay:.15,children:i.jsx(E,{children:i.jsxs("div",{ref:k,className:"flex flex-col gap-3",style:j>0?{"--tt-limits-label-w":`${j}px`}:void 0,children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[d("limits.panel.title"),d("limits.panel.mode_separator"),K]}),N.length>0?N:i.jsx(y,{children:d("limits.status.all_hidden")})]})})})}const ye=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Ee(){const e=$(),{data:t,error:r,isLoading:a}=G(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),n=z();return!ye&&!D()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(V,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:d("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:d("limits.page.subtitle")})]}),i.jsx(A,{to:"/settings","aria-label":d("limits.page.openSettings"),title:d("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:i.jsx(W,{className:"h-4 w-4","aria-hidden":!0})})]}),a?i.jsx(J,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:d("shared.error.prefix",{error:r})}):null,i.jsx(fe,{claude:t?.claude,codex:t?.codex,cursor:t?.cursor,gemini:t?.gemini,kimi:t?.kimi,kiro:t?.kiro,grok:t?.grok,antigravity:t?.antigravity,copilot:t?.copilot,order:n.order,visibility:n.visibility,displayMode:n.displayMode})]})]})})})}export{Ee as LimitsPage};
import{j as e,G as t}from"./main-BbEXIjk8.js";import{A as r}from"./arrow-up-right-DJo_-PxX.js";import{D as o}from"./download-BwsW6vug.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
import{at as p,aJ as w,Y as v,r,G as s,j as e,L as y,_ as j}from"./main-BbEXIjk8.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function k(){const i=p(),[t,u]=w(),{enabled:n,loading:f,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[h,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),m=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&m&&d(s("shared.error.prefix",{error:m}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||f)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,f,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{u(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[u]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[h?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:h}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{k as LoginPage};

Sorry, the diff of this file is too big to display

import{c as we,bx as ge,b5 as Ue,by as Ke,bz as le,bA as We,bB as ne,b3 as me,r as m,bC as J,bD as he,bE as Ee,bF as oe,bG as be,bH as qe,bI as Le,bJ as $,b as z,bK as W,ar as ue,b4 as pe,bL as $e,bM as Te,bN as Qe,d as ze,bO as Je,bP as ve,bQ as q,j as Y,bR as Ze,b9 as Me,b8 as et,bS as tt,bT as nt,bU as ot,bV as st,u as rt,a as He,bW as it,bX as ye,bY as at,bZ as ct,b_ as lt,b$ as ut,be as ft,c0 as dt,bf as pt}from"./main-BbEXIjk8.js";import{b as Ae,c as Be,g as Ce,d as se,P as gt,e as mt,s as ht,F as Et,f as Tt,h as vt,i as Ct,j as Pt,k as bt,l as _e,m as Rt,u as St,n as Ot,p as It,t as Mt,o as yt,I as xt,q as Ft,r as kt,v as wt,w as Lt}from"./useScrollLock-Dm_66oFo.js";import{f as Ht,p as At,g as Bt}from"./DialogTitle--jWfmv_b.js";import{p as _t,q as Dt,r as Nt,t as jt,v as Yt,w as Vt,x as Gt,y as Xt}from"./SelectItemText-GvEnESYK.js";const Ut=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],En=we("chevron-right",Ut);const Kt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tn=we("loader-circle",Kt);function Wt(e,n){return n!=null&&!ge(n)?0:typeof e=="function"?e():e}function Pe(e,n,t){const c=Wt(e,t);return typeof c=="number"?c:c?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function qt(e){return e?.includes("mouse")&&e!=="mousedown"}class Re{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Re}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ne(e,n){const{scopeElement:t,referenceElement:c,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=c,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",c.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function $t(e,n={}){const{enabled:t=!0,closeDelay:c=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),S=o.useState("domReferenceElement"),{dataRef:f}=o.context,r=Ae(),O=Be(),h=je(o),j=We(),l=ne(()=>De(f.current.openEvent?.type,h.interactedInside)),N=ne(()=>qt(f.current.openEvent?.type)),g=ne(()=>{de(h)});me(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),me(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&N()&&J(S)&&E){const F=S,a=E,d=he(E),k=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;k&&(k.style.pointerEvents="");const A=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,T=k!==a?k:null,P=h.handleCloseOptions?.getScope?.()??A??T??F.closest("[data-rootownerid]")??d.body;return Ne(h,{scopeElement:P,referenceElement:F,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,N,r,O,g]),m.useEffect(()=>{if(!t)return;function F(){return!!(r&&O&&Ce(r.nodesRef.current,O).length>0)}function a(b){const M=Pe(c,"close",h.pointerType),_=()=>{o.setOpen(!1,z(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,_):(h.openChangeTimeout.clear(),_())}function d(b){const M=be(b);if(!qe(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function k(){h.openChangeTimeout.clear(),j.clear(),r?.events.off("floating.closed",T),g()}function A(b){if(F()&&r){r.events.on("floating.closed",T);return}if(Le(b.relatedTarget,o.context.triggerElements))return;const M=f.current.floatingContext?.nodeId??i,_=b.relatedTarget;if(!(r&&M&&J(_)&&Ce(r.nodesRef.current,M,!1).some(X=>$(X.context?.elements.floating,_)))){if(h.handler){h.handler(b);return}g(),l()||a(b)}}function T(b){!r||!O||F()||j.start(0,()=>{r.events.off("floating.closed",T),o.setOpen(!1,z(W,b)),r.events.emit("floating.closed",b)})}const P=E;return Ee(P&&oe(P,"mouseenter",k),P&&oe(P,"mouseleave",A),P&&oe(P,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",T)})},[t,E,o,f,c,i,l,g,h,r,O,j])}const Qt={current:null};function zt(e,n={}){const{enabled:t=!0,delay:c=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=Qt,externalTree:f,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:j}=n,l="rootStore"in e?e.rootStore:e,{dataRef:N,events:g}=l.context,F=Ae(f),a=je(l),d=m.useRef(!1),k=se(i),A=se(c),T=se(p),P=se(t),b=se(j),M=se(h),_=ne(()=>De(N.current.openEvent?.type,a.interactedInside)),G=ne(()=>b.current?.()!==!1),X=ne((s,v,H)=>{const R=l.context.triggerElements;if(R.hasElement(v))return!s||!$(s,v);if(!J(H))return!1;const u=H;return R.hasMatchingElement(B=>$(B,u))&&(!s||!$(s,u))}),D=ne(()=>{if(!a.handler)return;he(l.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),L=ne(()=>{de(a)});return r&&(a.handleCloseOptions=k.current?.__options),m.useEffect(()=>D,[D]),m.useEffect(()=>{if(!t)return;function s(v){v.open?d.current=!1:(d.current=v.reason===W,D(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,D]),m.useEffect(()=>{if(!t)return;function s(u,B=!0){const y=Pe(A.current,"close",a.pointerType);y?a.openChangeTimeout.start(y,()=>{l.setOpen(!1,z(W,u)),F?.events.emit("floating.closed",u)}):B&&(a.openChangeTimeout.clear(),l.setOpen(!1,z(W,u)),F?.events.emit("floating.closed",u))}const v=S.current??(r?l.select("domReferenceElement"):null);if(!J(v))return;function H(u){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!ge(a.pointerType))return;const B=xe(T.current),y=Pe(A.current,"open",a.pointerType),V=be(u),U=u.currentTarget??null,I=l.select("domReferenceElement");let w=U;if(J(V)&&!l.context.triggerElements.hasElement(V)){for(const Ie of l.context.triggerElements.elements())if($(Ie,V)){w=Ie;break}}J(U)&&J(I)&&!l.context.triggerElements.hasElement(U)&&$(U,I)&&(w=I);const C=w==null?!1:X(I,w,V),Q=l.select("open"),Z=M.current?.()??l.select("transitionStatus")==="ending",K=!Q&&Z&&d.current,ee=!C&&J(w)&&J(I)&&$(I,w)&&K,te=B>0&&!y,Xe=C&&(Q||K)||ee,Oe=!Q||C;if(Xe){G()&&l.setOpen(!0,z(W,u,w));return}te||(y?a.openChangeTimeout.start(y,()=>{Oe&&G()&&l.setOpen(!0,z(W,u,w))}):Oe&&G()&&l.setOpen(!0,z(W,u,w)))}function R(u){if(_()){L();return}D();const B=l.select("domReferenceElement"),y=he(B);a.restTimeout.clear(),a.restTimeoutPending=!1;const V=N.current.floatingContext??O?.();if(Le(u.relatedTarget,l.context.triggerElements))return;if(k.current&&V){l.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=k.current({...V,tree:F,x:u.clientX,y:u.clientY,onClose(){L(),D(),P.current&&!_()&&I===l.select("domReferenceElement")&&s(u,!0)}}),y.addEventListener("mousemove",a.handler),a.handler(u);return}(a.pointerType!=="touch"||!$(l.select("floatingElement"),u.relatedTarget))&&s(u)}return E?Ee(oe(v,"mousemove",H,{once:!0}),oe(v,"mouseenter",H),oe(v,"mouseleave",R)):Ee(oe(v,"mouseenter",H),oe(v,"mouseleave",R))},[D,L,N,A,l,t,k,a,r,X,_,o,E,T,S,F,P,O,M,G]),m.useMemo(()=>{if(!t)return;function s(v){a.pointerType=v.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(v){const{nativeEvent:H}=v,R=v.currentTarget,u=l.select("domReferenceElement"),B=l.select("open"),y=X(u,R,v.target);if(o&&!ge(a.pointerType))return;if(B&&y&&a.handleCloseOptions?.blockPointerEvents){const I=l.select("floatingElement");if(I){const w=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;Ne(a,{scopeElement:w,referenceElement:R,floatingElement:I})}}const V=xe(T.current);if(B&&!y||V===0||!y&&a.restTimeoutPending&&v.movementX**2+v.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,_())return;const I=l.select("open");!a.blockMouseMove&&(!I||y)&&G()&&l.setOpen(!0,z(W,H,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):y&&B?U():(a.restTimeoutPending=!0,a.restTimeout.start(V,U))}}},[t,a,_,X,o,l,T,G])}const Fe=.1,Jt=Fe*Fe,x=.5;function ie(e,n,t,c,i,o){return c>=n!=o>=n&&e<=(i-t)*(n-c)/(o-c)+t}function ae(e,n,t,c,i,o,p,E,S,f){let r=!1;return ie(e,n,t,c,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,S,f)&&(r=!r),ie(e,n,S,f,t,c)&&(r=!r),r}function Zt(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,c,i,o){const p=Math.min(t,i),E=Math.max(t,i),S=Math.min(c,o),f=Math.max(c,o);return e>=p&&e<=E&&n>=S&&n<=f}function en(e={}){const{blockPointerEvents:n=!1}=e,t=new le,c=({x:i,y:o,placement:p,elements:E,onClose:S,nodeId:f,tree:r})=>{const O=p?.split("-")[0];let h=!1,j=null,l=null,N=typeof performance<"u"?performance.now():0;function g(a,d){const k=performance.now(),A=k-N;if(j===null||l===null||A===0)return j=a,l=d,N=k,!1;const T=a-j,P=d-l,b=T*T+P*P,M=A*A*Jt;return j=a,l=d,N=k,b<M}function F(){t.clear(),S()}return function(d){t.clear();const k=E.domReference,A=E.floating;if(!k||!A||O==null||i==null||o==null)return;const{clientX:T,clientY:P}=d,b=be(d),M=d.type==="mouseleave",_=$(A,b),G=$(k,b);if(_&&(h=!0,!M))return;if(G&&(h=!1,!M)){h=!0;return}if(M&&J(d.relatedTarget)&&$(A,d.relatedTarget))return;function X(){return!!(r&&Ce(r.nodesRef.current,f).length>0)}function D(){X()||F()}if(X())return;const L=k.getBoundingClientRect(),s=A.getBoundingClientRect(),v=i>s.right-s.width/2,H=o>s.bottom-s.height/2,R=s.width>L.width,u=s.height>L.height,B=(R?L:s).left,y=(R?L:s).right,V=(u?L:s).top,U=(u?L:s).bottom;if(O==="top"&&o>=L.bottom-1||O==="bottom"&&o<=L.top+1||O==="left"&&i>=L.right-1||O==="right"&&i<=L.left+1){D();return}let I=!1;switch(O){case"top":I=ce(T,P,B,L.top+1,y,s.bottom-1);break;case"bottom":I=ce(T,P,B,s.top+1,y,L.bottom-1);break;case"left":I=ce(T,P,s.right-1,U,L.left+1,V);break;case"right":I=ce(T,P,L.right-1,U,s.left+1,V);break}if(I)return;if(h&&!Zt(T,P,L)){D();return}if(!M&&g(T,P)){D();return}let w=!1;switch(O){case"top":{const C=R?x/2:x*4,Q=R||v?i+C:i-C,Z=R?i-C:v?i+C:i-C,K=o+x+1,ee=v||R?s.bottom-x:s.top,te=v?R?s.bottom-x:s.top:s.bottom-x;w=ae(T,P,Q,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const C=R?x/2:x*4,Q=R||v?i+C:i-C,Z=R?i-C:v?i+C:i-C,K=o-x,ee=v||R?s.top+x:s.bottom,te=v?R?s.top+x:s.bottom:s.top+x;w=ae(T,P,Q,K,Z,K,s.left,ee,s.right,te);break}case"left":{const C=u?x/2:x*4,Q=u||H?o+C:o-C,Z=u?o-C:H?o+C:o-C,K=i+x+1,ee=H||u?s.right-x:s.left,te=H?u?s.right-x:s.left:s.right-x;w=ae(T,P,ee,s.top,te,s.bottom,K,Q,K,Z);break}case"right":{const C=u?x/2:x*4,Q=u||H?o+C:o-C,Z=u?o-C:H?o+C:o-C,K=i-x,ee=H||u?s.left+x:s.right,te=H?u?s.left+x:s.right:s.left+x;w=ae(T,P,K,Q,K,Z,ee,s.top,te,s.bottom);break}}w?h||t.start(40,D):D()}};return c.__options={...e,blockPointerEvents:n},c}const Ye=m.createContext(void 0);function re(e){const n=m.useContext(Ye);if(n===void 0&&!e)throw new Error(pe(47));return n}function tn(){return{...Bt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const nn={...At,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class Se extends $e{constructor(n,t,c=!1){const i={...tn(),...n},o=new gt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Ht(o,t,c),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},nn)}setOpen=(n,t)=>{const c=t.reason===W,i=t.reason===Te&&t.event.detail===0,o=!n&&(t.reason===Qe||t.reason==null);t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)};const p=this.select("activeTriggerId");if(!n&&t.reason===ze&&t.trigger==null&&p!=null&&(t.trigger=this.context.triggerElements.getById(p)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const E=()=>{const S={open:n,openChangeReason:t.reason};ht(S,n,t.trigger),this.update(S)};c?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Je,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(E)):E(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===ve?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:c,internalStore:i}=mt(n,(o,p)=>new Se(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),c}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:c=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:S,defaultTriggerId:f=null}=e,r=Se.useStore(E?.store,{modal:p,open:c,openProp:t,activeTriggerId:f,triggerIdProp:S});Tt(()=>{t===void 0&&r.state.open===!1&&c===!0&&r.update({open:!0,activeTriggerId:f})}),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",S);const O=r.useState("open"),h=r.useState("mounted"),j=r.useState("payload"),l=Be()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),vt(r,O),Ct(r);const{forceUnmount:N}=Pt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:l}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,z(Ze))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:N,close:g}),[N,g]);const F=O||h,a=m.useMemo(()=>({store:r}),[r]);return Y.jsxs(Ye.Provider,{value:a,children:[F&&Y.jsx(on,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function vn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Et,{children:Y.jsx(ke,{props:e})})}function on({store:e,modal:n}){const t=e.useState("floatingRootContext"),c=bt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=c.reference??Me,o=c.trigger??Me,p=m.useMemo(()=>et(_e,c.floating),[c.floating]);return Rt(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const sn=300;function rn(e,n){const t=m.useRef(null);function c(o){ue.flushSync(()=>{e.setOpen(!1,z(ve,o.nativeEvent,o.currentTarget))}),st(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&tt(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,z(ve,o.nativeEvent,o.currentTarget))});let E=nt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&$(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:c,handleFocusTargetFocus:i}}const Cn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:S,payload:f,openOnHover:r=!1,delay:O=sn,closeDelay:h=0,id:j,...l}=n,N=re(!0),g=S?.store??N?.store;if(!g)throw new Error(pe(74));const F=St(j),a=g.useState("isTriggerActive",F),d=g.useState("floatingRootContext"),k=g.useState("isOpenedByTrigger",F),A=g.useState("triggerPopupId",F),T=m.useRef(null),{registerTrigger:P,isMountedByThisTrigger:b}=Ot(F,T,g,{payload:f,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),_=g.useState("stickIfOpen"),G=g.useState("openMethod"),X=g.useState("focusManagerModal"),D=zt(d,{enabled:d!=null&&r&&(G!=="touch"||M!==Te),mouseOnly:!0,move:!1,handleClose:en(),restMs:O,delay:{close:h},triggerElementRef:T,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),L=_t(d,{enabled:d!=null,stickIfOpen:_}),s=Dt(()=>g.select("open"),w=>{g.set("openMethod",w)}),v=g.useState("triggerProps",b),{getButtonProps:H,buttonRef:R}=rt({disabled:p,native:E}),u={open(w){return w&&M===Te?It.open(w):Mt.open(w)}},{preFocusGuardRef:B,handlePreFocusGuardFocus:y,handleFocusTargetFocus:V}=rn(g,T),I=He("button",n,{state:{disabled:p,open:k},ref:[R,t,P,T],props:[L.reference,D,v,s,{[it]:"",id:F,"aria-haspopup":"dialog","aria-expanded":k,"aria-controls":A},l,H],stateAttributesMapping:u});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:B,onFocus:y}),Y.jsx(m.Fragment,{children:I},F),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:V})]}):Y.jsx(m.Fragment,{children:I},F)}),Ve=m.createContext(void 0);function an(){const e=m.useContext(Ve);if(e===void 0)throw new Error(pe(45));return e}const Pn=m.forwardRef(function(n,t){const{keepMounted:c=!1,...i}=n,{store:o}=re();return o.useState("mounted")||c?Y.jsx(Ve.Provider,{value:c,children:Y.jsx(at,{ref:t,...i})}):null}),Ge=m.createContext(void 0);function cn(){const e=m.useContext(Ge);if(!e)throw new Error(pe(46));return e}const bn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,anchor:p,positionMethod:E="absolute",side:S="bottom",align:f="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:j=5,arrowPadding:l=5,sticky:N=!1,disableAnchorTracking:g=!1,collisionAvoidance:F=ct,...a}=n,{store:d}=re(),k=an(),A=yt(),T=d.useState("floatingRootContext"),P=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),_=d.useState("activeTriggerElement"),G=d.useState("modal"),X=d.useState("openMethod"),D=d.useState("positionerElement"),L=d.useState("instantType"),s=d.useState("transitionStatus"),v=d.useState("hasViewport"),H=m.useRef(null),R=lt(D,!1,!1),u=Nt({anchor:p,floatingRootContext:T,positionMethod:E,mounted:P,side:S,sideOffset:r,align:f,alignOffset:O,arrowPadding:l,collisionBoundary:h,collisionPadding:j,sticky:N,disableAnchorTracking:g,keepMounted:k,nodeId:A,collisionAvoidance:F,adaptiveOrigin:v?Vt:void 0}),B=T.useState("domReferenceElement");me(()=>{const I=B,w=H.current;if(I&&(H.current=I),w&&I&&I!==w){d.set("instantType",void 0);const C=new AbortController;return R(()=>{d.set("instantType","trigger-change")},C.signal),()=>{C.abort()}}},[B,R,d]),jt(b&&G===!0&&M!==W,X==="touch",D,_);const y=m.useCallback(I=>{d.set("positionerElement",I)},[d]),V={open:b,side:u.side,align:u.align,anchorHidden:u.anchorHidden,instant:L},U=Yt(n,V,{styles:u.positionerStyles,transitionStatus:s,props:a,refs:[t,y],hidden:!P,inert:!b});return Y.jsxs(Ge.Provider,{value:u,children:[P&&G===!0&&M!==W&&Y.jsx(xt,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:_}),Y.jsx(Ft,{id:A,children:U})]})}),ln=m.createContext(void 0);function un(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function fn(e){const{value:n,children:t}=e;return Y.jsx(ln.Provider,{value:n,children:t})}const dn={...Lt,...pt},Rn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:f}=re(),r=cn(),O=Gt()!=null,{context:h,hasClosePart:j}=un(),l=f.useState("open"),N=f.useState("openMethod"),g=f.useState("instantType"),F=f.useState("transitionStatus"),a=f.useState("popupProps"),d=f.useState("titleElementId"),k=f.useState("descriptionElementId"),A=f.useState("modal"),T=f.useState("mounted"),P=f.useState("openChangeReason"),b=f.useState("activeTriggerElement"),M=f.useState("floatingRootContext"),_=M.useState("floatingId"),G=f.useState("disabled"),X=f.useState("openOnHover"),D=f.useState("closeDelay"),L=S.id??_;ft({open:l,ref:f.context.popupRef,onComplete(){l&&f.context.onOpenChangeComplete?.(!0)}}),$t(M,{enabled:X&&!G,closeDelay:D});function s(y){return y==="touch"?f.context.popupRef.current:!0}const v=p===void 0?s:p,H=A!==!1&&j;f.useSyncedValue("focusManagerModal",H);const R=m.useCallback(y=>{f.set("popupElement",y)},[f]),u={open:l,side:r.side,align:r.align,instant:g,transitionStatus:F},B=He("div",n,{state:u,ref:[t,f.context.popupRef,R],props:[a,{id:L,role:"dialog",..._e,"aria-labelledby":d,"aria-describedby":k,onKeyDown(y){O&&wt.has(y.key)&&y.stopPropagation()}},Xt(F),S],stateAttributesMapping:dn});return Y.jsx(kt,{context:M,openInteractionType:N,modal:H,disabled:!T||P===W,initialFocus:v,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:f.context.triggerFocusTargetRef,beforeContentFocusGuardRef:f.context.beforeContentFocusGuardRef,children:Y.jsx(fn,{value:h,children:B})})});export{En as C,Tn as L,vn as P,Cn as a,Pn as b,bn as c,Rn as d};
import{aJ as d,Y as m,r as t,j as e,L as l,G as o,_ as x}from"./main-BbEXIjk8.js";function n(s,a){for(const r of a){const i=s.get(r);if(typeof i=="string"&&i.trim())return i.trim()}return""}function u(){const[s]=d(),{enabled:a}=m(),r=t.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),i=t.useMemo(()=>n(s,["email"]),[s]),c=t.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:r?"reset_confirm":"reset_email",tokenFromUrl:r,initialEmail:i,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:o("login.cloud_only")})})]})}export{u as ResetPasswordPage};
import{r as v,b2 as l,bB as w,a as k,j as e,V as x}from"./main-BbEXIjk8.js";import{u as j,z as N,s as i,L as C,A as E,S as I,h as R,i as T,C as A,j as L,k as P,l as V,m as _,o as z,n as B}from"./SelectItemText-GvEnESYK.js";import{C as D}from"./useScrollLock-Dm_66oFo.js";const G=v.forwardRef(function(t,s){const{render:n,className:p,style:o,...c}=t,{store:r,scrollHandlerRef:d}=j(),{alignItemWithTriggerActive:g}=N(),u=l(r,i.hasScrollArrows),h=l(r,i.openMethod),a=l(r,i.multiple),m={id:`${l(r,i.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(b){d.current?.(b.currentTarget)},...g&&{style:C},className:u&&h!=="touch"?E.className:void 0},S=w(b=>{r.set("listElement",b)});return k("div",t,{ref:[s,S],props:[m,c]})}),M="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function U({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:p,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(I,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(R,{id:p,"aria-label":n,className:x(M,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c,e.jsx(T,{className:"truncate"})]}),e.jsx(A,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(V,{className:x("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(G,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:f,disabled:m})=>x("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",f?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",m&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(z,{children:e.jsx(D,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(B,{children:a.label})})]},String(a.value)))})})})})]})}export{U as S};

Sorry, the diff of this file is too big to display

import{c as y,r as l,ao as X,ai as q,aL as L,j as n,m as O,U as ee,V as v,G as s,Y as te,av as ne,aM as ae,az as ie,aA as se,aB as P,aN as oe,aO as re,W as le,R as ce,S as ue,T as de,a2 as ge,aP as he,aQ as pe,aR as me,aS as be,K as fe,aT as xe,aU as ye,aV as ve,aW as je,aX as ke,aY as Ne,aZ as Se,ag as we}from"./main-BbEXIjk8.js";import{b as G,l as A,u as Ce,L as E}from"./use-limits-display-prefs-BUrvvpbW.js";import{S as j,T as k,a as b,b as _,u as T}from"./use-native-settings-SsQX6gzC.js";import{C as Le}from"./useScrollLock-Dm_66oFo.js";import{u as Ge}from"./useCurrency-CVVJYL2V.js";import{S as D}from"./Select-D3gMIEdB.js";import{I as Ae}from"./info-C-aAjjA6.js";import{D as Ee}from"./download-BwsW6vug.js";import"./Card-CJiPCvnj.js";import"./SelectItemText-GvEnESYK.js";const Ie=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Oe=y("activity",Ie);const Pe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],_e=y("copy",Pe);const Te=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],De=y("grip-vertical",Te);const Me=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Ue=y("languages",Me);const Re=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Fe=y("log-out",Re);const He=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],$e=y("pencil",He),Be=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach(Be);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const ze=l.createContext(null);function Ve(){const e=l.useRef(!1);return X(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function We(){const e=Ve(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>q.postRender(i),[i]),t]}const M=e=>e===!0,Ze=e=>M(e===!0)||e==="id",Ke=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(ze),[r,c]=We(),u=l.useRef(null),g=i.id||o;u.current===null&&(Ze(a)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:M(a)&&i.group||I()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:h,children:e})},Ye="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Je({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:v("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:v("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Qe({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},m=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},x=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Ke,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const p=a[d]!==!1,N=r===d;return n.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:f,onDrop:x,className:v("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[n.jsx(De,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),G(d)?n.jsx(ee,{provider:G(d),size:18,className:v("pointer-events-none",Ye)}):null,n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:A(d)}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx(Je,{checked:p,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${A(d)}`})})]},d)})})})}function Xe(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function qe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function et(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function tt(e,t,a){const[i,o]=l.useState(()=>ne()),r=t&&a&&ae(),c=l.useCallback(async()=>{const u=!i;if(ie(u),o(u),!!u)try{await se(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function nt(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[f,x]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[H,C]=l.useState(""),[$,B]=l.useState(""),[z,V]=l.useState(!1),[W,Z]=l.useState(null),K=l.useMemo(()=>Xe(e),[e]),Y=l.useMemo(()=>qe(e),[e]),J=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:h,displayName:K,editingGithub:z,editingName:f,email:Y,githubError:W,githubInput:$,githubUrl:H,loadSetters:Q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:V,setEditingName:x,setGithubError:Z,setGithubInput:B,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:N,userId:J}}function at(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await P({getAccessToken:e});if(!i||!o)return;const r=await oe({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function it(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await P({getAccessToken:e});if(!c)return!1;const u=await re({accessToken:c,...a});return r?.(u),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function st(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function ot(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function rt(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function lt(e,t,a){const i=l.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await t({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),a?.()}})},[t,e,a]),o=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function ct(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=et(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function ut(){const e=te(),t=nt(e.user),a=tt(e.getAccessToken,e.enabled,e.signedIn);at(e.getAccessToken,e.signedIn,t.loadSetters);const i=it(e.getAccessToken,t),o=rt(t,i),r=lt(t,i,e.refreshDisplayName),c=ct(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:t.userId,name:st(t,{...o,...r}),github:ot(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function U({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),n.jsx("button",{type:"button",onClick:t,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function dt({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),n.jsx(U,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function gt({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&a(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),n.jsx(U,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function R({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function F({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function ht({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function pt({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:f,startEditingName:x}=e,d=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(F,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(dt,{nameInput:u,setEditingName:m,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:n.jsx(ht,{name:e})})}function mt({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f,showGithubOn:x,startEditingGithub:d}=e;return n.jsx(F,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(gt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{label:s("settings.account.edit"),onClick:d}),n.jsx(k,{checked:x,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function bt(){const{openLoginModal:e}=le();return n.jsx(j,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function ft({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(pt,{name:e}),n.jsx(mt,{github:t})]})}function xt(){const e=ut();return e.enabled?e.signedIn?n.jsxs(j,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(vt,{onSignOut:e.signOut}),children:[n.jsx(yt,{userId:e.userId}),n.jsx(jt,{settings:e}),n.jsx(kt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(Nt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(bt,{}):null}function yt({userId:e}){const[t,a]=ce.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),a(!0),globalThis.setTimeout(()=>a(!1),1200)}catch{a(!1)}};return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),n.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":s("settings.account.copyUserId"),children:[t?n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}):n.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t?s("settings.account.copied"):s("settings.account.copy")]})]})}function vt({onSignOut:e}){return n.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[n.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function jt({settings:e}){return e.showLocalCloudSync?n.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function kt({checked:e,disabled:t,onChange:a}){return n.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function Nt({visible:e,name:t,github:a}){return n.jsx(ue,{initial:!1,children:e?n.jsx(O.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:n.jsx(ft,{name:t,github:a})},"public-profile-fields"):null})}function St(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:he},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:pe},{value:"system",label:s("settings.appearance.theme.system"),Icon:me}]}function wt(){return[{value:xe,label:s("settings.appearance.language.system")},{value:ye,label:s("settings.appearance.language.english")},{value:ve,label:s("settings.appearance.language.chinese")},{value:je,label:s("settings.appearance.language.traditional_chinese")},{value:ke,label:s("settings.appearance.language.japanese")},{value:Ne,label:s("settings.appearance.language.korean")}]}function Ct(e){if(!e)return null;try{const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString()}catch{return null}}function Lt(e,t){const a=s(`settings.appearance.currency.rate_source.${e}`),i=Ct(t),o=i?s("settings.appearance.currency.rate_updated",{when:i}):s("settings.appearance.currency.rate_never");return`${a} · ${o}`}function Gt({locale:e,setLocale:t}){const a=wt();return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:n.jsx(Ue,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function At({currency:e,setCurrency:t}){const a=be().map(i=>({value:i.code,label:s(i.labelKey)}));return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Et({currency:e,rate:t,rateSource:a,rateFetchedAt:i}){if(e===fe)return n.jsx(n.Fragment,{children:s("settings.appearance.currency.hint")});const o=Lt(a,i);return n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{children:`1 USD = ${t.toFixed(4)} ${e}`}),n.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:n.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function It(){const{theme:e,setTheme:t}=de(),{locale:a,setLocale:i}=ge(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ge();return n.jsxs(j,{title:s("settings.section.appearance"),children:[n.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(_,{options:St(),value:e,onChange:t})}),n.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(Gt,{locale:a,setLocale:i})}),n.jsx(b,{label:s("settings.appearance.currency.label"),hint:n.jsx(Et,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:n.jsx(At,{currency:o,setCurrency:g})})]})}function Ot(){const{available:e,settings:t,setSetting:a,runAction:i}=T();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,u=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(j,{title:s("settings.section.menubar"),children:[r?n.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Se,{className:v("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Pt(){const{available:e,settings:t,runAction:a}=T(),i=e&&t?.version;return n.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[i?n.jsxs(n.Fragment,{children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),n.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,n.jsxs("a",{href:we,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[n.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function _t({prefs:e}){return n.jsx(_,{options:[{value:E.USED,label:s("limits.settings.display_mode_used")},{value:E.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Vt(){const e=Ce();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(It,{}),n.jsx(Ot,{}),n.jsx(xt,{}),n.jsx(j,{title:s("settings.section.limits"),action:n.jsx(_t,{prefs:e}),children:n.jsx(Qe,{prefs:e})})]}),n.jsx(Pt,{})]})})})}export{Vt as SettingsPage};
import{c as Oe,r as n,a as ea,j as e,M as U,V as W,b2 as nt,X as Se,G as s,b3 as da,b4 as Pa,b5 as ot,u as lt,b6 as xa,b7 as dt,b8 as ct,b9 as ut,ba as pa,bb as gt,bc as mt,b as ht,bd as xt,be as pt,bf as yt,S as ft,e as bt,m as ya,ad as kt,I as wt,U as ye,bg as vt,bh as jt,bi as Nt,bj as Ct,bk as St,bl as _t,i as Pt,aZ as Rt,bm as ca,R as Lt,bn as It,bo as fa,bp as Ce,bq as ba,br as ka,bs as Dt,bt as wa,bu as va,bv as $t,bw as Et}from"./main-BbEXIjk8.js";import{L as Bt}from"./LocalOnlyNotice-CBRDpg-i.js";import{C as Mt}from"./Card-CJiPCvnj.js";import{u as Tt,D as Ot,a as Ut,b as zt,c as Ft,d as At,e as Kt}from"./DialogTitle--jWfmv_b.js";import{u as Qe,t as Vt,a as qt,C as _e}from"./useScrollLock-Dm_66oFo.js";import{I as Ra}from"./info-C-aAjjA6.js";import{u as Ht}from"./useCurrency-CVVJYL2V.js";import{L as ae,P as La,a as Ia,b as Da,c as $a,d as Ea,C as Gt}from"./PopoverPopup-DMl0dwMU.js";import{u as Wt,s as Qt,f as Ba,a as Xt,b as Yt,c as Jt,d as Zt,e as er,g as ar,S as Ma,h as Ta,i as Oa,C as ga,j as Ua,k as za,l as Fa,m as Xe,n as Ye,o as Je}from"./SelectItemText-GvEnESYK.js";import{D as Aa}from"./download-BwsW6vug.js";import"./arrow-up-right-DJo_-PxX.js";const tr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Ka=Oe("circle-arrow-up",tr);const rr=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ua=Oe("external-link",rr);const sr=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],ir=Oe("flame",sr);const nr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Va=Oe("plus",nr);const or=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ma=Oe("trash-2",or),lr=n.forwardRef(function(r,o){const{render:g,className:c,style:x,id:u,...m}=r,{store:h}=Tt(),y=Qe(u);return h.useSyncedValueWithCleanup("descriptionElementId",y),ea("p",r,{ref:o,props:[{id:y},m]})});function ja({open:a,title:r,description:o,confirmLabel:g,cancelLabel:c,destructive:x=!1,busy:u=!1,onConfirm:m,onCancel:h}){return e.jsx(Ot,{open:a,onOpenChange:y=>{!y&&!u&&h?.()},children:e.jsxs(Ut,{children:[e.jsx(zt,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsx(Ft,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(At,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[e.jsx(Kt,{className:"text-base font-semibold text-oai-black dark:text-white",children:r}),o?e.jsx(lr,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:o}):null,e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"secondary",size:"sm",disabled:u,onClick:()=>h?.(),children:c}),e.jsx(U,{type:"button",size:"sm",disabled:u,onClick:()=>m?.(),className:W(x&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:g})]})]})})]})})}function ha({id:a,value:r,onChange:o,placeholder:g,disabled:c=!1,type:x="text",label:u,error:m,className:h="",...y}){const l=n.useId(),k=a||l,C=m?`${k}-error`:void 0,N=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${c?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${m?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${h}`;return e.jsxs("div",{className:"w-full",children:[u&&e.jsx("label",{htmlFor:k,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:u}),e.jsx("input",{id:k,type:x,value:r,onChange:o,placeholder:g,disabled:c,"aria-invalid":m?!0:void 0,"aria-describedby":C,className:N,...y}),m&&e.jsx("p",{id:C,className:"mt-1.5 text-sm text-oai-error",children:m})]})}const qa=n.forwardRef(function(r,o){const{render:g,className:c,style:x,...u}=r,{store:m}=Wt(),y={open:nt(m,Qt.open)};return ea("span",r,{state:y,ref:o,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:Vt})}),dr="tt:hint:dismissed:";function Ha(a){return dr+a}function cr(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ha(a))==="1"}catch{return!1}}function ur({id:a,children:r,className:o,ariaLabel:g}){const[c,x]=n.useState(()=>cr(a)),u=n.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(Ha(a),"1")}catch{}x(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":g||s("hint.dismissible_aria"),className:W("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",o),children:[e.jsx("button",{type:"button",onClick:u,"aria-label":s("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(Ra,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:r})]})]})}function gr(a){if(!a)return null;for(const r of a.elements){const o=r.tagName;if(o==="BUTTON"||o==="INPUT"){const g=r;if(g.type==="submit")return g}}return null}let Na=(function(a){return a.checked="data-checked",a.unchecked="data-unchecked",a.indeterminate="data-indeterminate",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a})({});function Ga(a){return n.useMemo(()=>({checked(r){return a.indeterminate?{}:r?{[Na.checked]:""}:{[Na.unchecked]:""}},...Ba}),[a.indeterminate])}const mr=n.createContext({disabled:!1});function hr(){return n.useContext(mr)}function xr(a,r,o,g=!0,c){const[x,u]=n.useState(),m=Qe(c?`${c}-label`:void 0),h=a??r??x;return da(()=>{const y=a||r||!g?void 0:pr(o.current,m);x!==y&&u(y)}),h}function pr(a,r){const o=yr(a);if(o)return!o.id&&r&&(o.id=r),o.id||void 0}function yr(a){if(!a)return;const r=a.parentElement;if(r&&r.tagName==="LABEL")return r;const o=a.id;if(o){const c=a.nextElementSibling;if(c&&c.htmlFor===o)return c}const g=a.labels;return g&&g[0]}const fr=n.createContext(void 0);function br(a=!0){const r=n.useContext(fr);if(r===void 0&&!a)throw new Error(Pa(3));return r}const Wa=n.createContext(void 0);function kr(){const a=n.useContext(Wa);if(a===void 0)throw new Error(Pa(14));return a}const wr="data-parent",vr=n.forwardRef(function(r,o){const{checked:g,className:c,defaultChecked:x=!1,"aria-labelledby":u,disabled:m=!1,form:h,id:y,indeterminate:l=!1,inputRef:k,name:C,onCheckedChange:w,parent:v=!1,readOnly:f=!1,render:N,required:D=!1,uncheckedValue:z,value:Q,nativeButton:F=!1,style:de,...j}=r,{clearErrors:te}=Xt(),{disabled:$,name:H,setDirty:X,setFilled:re,setFocused:A,setTouched:fe,state:be,validationMode:Ue,validityData:Pe,shouldValidateOnChange:ze,validation:Fe}=Yt(),M=hr(),{labelId:se,controlId:Re,registerControlId:Y,getDescriptionProps:ke}=Jt(),S=br(),ie=S?.parent,ne=ie&&S.allValues,J=$||M.disabled||S?.disabled||m,Z=H??C,P=Q??Z,xe=Qe(),aa=Qe();let G=Re;ne?G=v?aa:`${ie.id}-${P}`:y&&(G=y);let we={};ne&&(v?we=S.parent.getParentProps():P&&(we=S.parent.getChildProps(P)));const{checked:ve=g,indeterminate:ce=l,onCheckedChange:je,...Ne}=we,T=S?.value,pe=S?.setValue,ue=S?.defaultValue,ge=n.useRef(null),oe=ot(()=>Symbol("checkbox-control")),Le=n.useRef(!1),{getButtonProps:Ae,buttonRef:Ke}=lt({disabled:J,native:F}),I=S?.validation??Fe,[E,ta]=Zt({controlled:P&&T&&!v?T.includes(P):ve,default:P&&ue&&!v?ue.includes(P):x,name:"Checkbox",state:"checked"});da(()=>{Y!==xa&&(Le.current=!0,Y(oe.current,G))},[G,Y,oe]),n.useEffect(()=>{const b=oe.current;return()=>{!Le.current||Y===xa||(Le.current=!1,Y(b,void 0))}},[Y,oe]),er(ge,xe,E,void 0,!S);const le=n.useRef(null),Ve=dt(k,le,I.inputRef),Ie=xr(u,se,le,!F,G??void 0);da(()=>{le.current&&(le.current.indeterminate=ce,E&&re(!0))},[E,ce,re]),ar(E,()=>{S&&!v||(te(Z),re(E),X(E!==Pe.initialValue),ze()?I.commit(E):I.commit(E,!0))});const ra=ct({checked:E,disabled:J,form:h,name:v?void 0:Z,id:F?void 0:G??void 0,required:D,ref:Ve,style:Z?gt:mt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(f){b.preventDefault();return}const K=b.currentTarget.checked,me=ht(xt,b.nativeEvent);if(je?.(K,me),w?.(K,me),!me.isCanceled&&(ta(K),P&&T&&pe&&!v&&!ne)){const R=K?[...T,P]:T.filter(V=>V!==P);pe(R,me)}},onFocus(){ge.current?.focus()}},Q!==void 0?{value:(S?E&&Q:Q)||""}:ut,ke,S?I.getValidationProps:I.getInputValidationProps),De=ne?!!ve:E,qe=ne&&ce||l;n.useEffect(()=>{if(!ie||!P)return;const b=ie.disabledStatesRef.current;return b.set(P,J),()=>{b.delete(P)}},[ie,J,P]);const $e=n.useMemo(()=>({...be,checked:De,disabled:J,readOnly:f,required:D,indeterminate:qe}),[be,De,J,f,D,qe]),sa=Ga($e),ia=ea("span",r,{state:$e,ref:[Ke,ge,o,S?.registerControlRef],props:[{id:F?G??void 0:xe,role:"checkbox","aria-checked":ce?"mixed":E,"aria-readonly":f||void 0,"aria-required":D||void 0,"aria-labelledby":Ie,[wr]:v?"":void 0,onFocus(){A(!0)},onBlur(){const b=le.current;b&&(fe(!0),A(!1),Ue==="onBlur"&&I.commit(S?T:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const K=le.current?.form??null,me=b.currentTarget,R=b.nativeEvent,V=b.preventDefault,Ee=R.preventDefault;let Be=!1;b.preventDefault=()=>{Be=!0,V.call(b)},R.preventDefault=()=>{Be=!0,Ee.call(R)},Ee.call(R),pa(me).queueMicrotask(()=>{b.preventDefault=V,R.preventDefault=Ee,Be||gr(K)?.click()})},onClick(b){if(f||J)return;b.preventDefault();const K=le.current;K&&K.dispatchEvent(new(pa(K)).PointerEvent("click",{bubbles:!0,shiftKey:b.shiftKey,ctrlKey:b.ctrlKey,altKey:b.altKey,metaKey:b.metaKey}))}},ke,I.getValidationProps,j,Ne,Ae],stateAttributesMapping:sa});return e.jsxs(Wa.Provider,{value:$e,children:[ia,!E&&!S&&Z&&!v&&z!==void 0&&e.jsx("input",{type:"hidden",form:h,name:Z,value:z}),e.jsx("input",{...ra,suppressHydrationWarning:!0})]})}),jr=n.forwardRef(function(r,o){const{render:g,className:c,style:x,keepMounted:u=!1,...m}=r,h=kr(),y=h.checked||h.indeterminate,{mounted:l,transitionStatus:k,setMounted:C}=qt(y),w=n.useRef(null),v={...h,transitionStatus:k};pt({open:y,ref:w,onComplete(){y||C(!1)}});const N={...Ga(h),...yt,...Ba},D=u||l,z=ea("span",r,{ref:[o,w],state:v,stateAttributesMapping:N,props:m});return D?z:null});function Nr(a,r){return`target:${a}:${r}`}function Cr(a){return`remove:${a.id||a.directory}`}function Qa(a){if(!a)return null;const r=new Date(a).getTime();return Number.isFinite(r)?Math.floor((Date.now()-r)/864e5):null}function Sr(a){const r=Qa(a);if(r==null)return null;if(r<=0)return s("skills.usage.today");if(r<30)return s("skills.usage.days_ago",{days:r});const o=Math.max(1,Math.floor(r/30));return s("skills.usage.months_ago",{months:o})}function _r(a){const r=Qa(a);return r==null?"bg-oai-gray-300 dark:bg-oai-gray-600":r<=7?"bg-emerald-500":r<=30?"bg-amber-500":"bg-oai-gray-300 dark:bg-oai-gray-600"}function oa({label:a,children:r}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[e.jsx("dt",{className:"flex items-center gap-1 text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"text-right font-medium tabular-nums text-oai-black dark:text-white",children:r})]})}function Pr({skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:x,onUpdate:u,onClose:m,onToggleTarget:h,onRemove:y}){return e.jsx(ft,{children:a?e.jsx(Rr,{skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:x,onUpdate:u,onClose:m,onToggleTarget:h,onRemove:y},a.id||a.directory):null})}function Rr({skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:x,onUpdate:u,onClose:m,onToggleTarget:h,onRemove:y}){const l=bt(),{currency:k,rate:C}=Ht(),w=n.useRef(null);n.useEffect(()=>{const j=$=>{$.key==="Escape"&&($.stopPropagation(),m?.())},te=$=>{const H=$.target;H instanceof Element&&(w.current?.contains(H)||H.closest('[data-skill-row="1"]')||m?.())};return document.addEventListener("keydown",j),document.addEventListener("mousedown",te),()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousedown",te)}},[m]);const v=a.name||a.directory,f=!!(a.repoOwner&&a.repoName),N=f?`https://github.com/${a.repoOwner}/${a.repoName}`:null,D=new Set(a.targets||[]),z=o===Cr(a),Q=Sr(g?.lastUsedAt),F=!!(g&&g.invocations>0),de=l?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(ya.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:l?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:l?0:.15},onClick:m,"aria-hidden":!0}),e.jsxs(ya.aside,{ref:w,role:"complementary","aria-label":v,initial:l?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:l?{opacity:0}:{opacity:0,x:24,scale:.98},transition:de,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[e.jsxs("header",{className:"flex items-center gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:v,children:v}),f?e.jsxs("a",{href:N,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:N,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(ua,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==v?e.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:a.directory,children:a.directory}):null]}),e.jsx("button",{type:"button",onClick:m,"aria-label":s("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[c?e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-xl bg-sky-50/80 px-3 py-2.5 ring-1 ring-sky-200 dark:bg-sky-950/30 dark:ring-sky-800/60",children:[e.jsx(Ka,{className:"h-4 w-4 shrink-0 text-sky-600 dark:text-sky-300","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 text-xs text-sky-800 dark:text-sky-200",children:s("skills.update.available")}),e.jsxs("button",{type:"button",onClick:()=>u?.(a),disabled:x,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-md bg-sky-600 px-2.5 text-xs font-semibold text-white transition hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-400/40 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-sky-500 dark:hover:bg-sky-400",children:[x?e.jsx(ae,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,s("skills.update.action")]})]}):null,a.description?e.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a.description}):null,e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.usage.section_title")}),e.jsxs("dl",{className:"divide-y divide-oai-gray-200/60 dark:divide-white/[0.06]",children:[e.jsx(oa,{label:s("skills.usage.invocations"),children:kt(g?.invocations||0)}),e.jsx(oa,{label:s("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:W("h-1.5 w-1.5 rounded-full",_r(g?.lastUsedAt)),"aria-hidden":!0}),F?Q||s("skills.usage.unknown"):s("skills.usage.never")]})}),e.jsx(oa,{label:e.jsxs(e.Fragment,{children:[s("skills.usage.cost"),e.jsx("span",{title:s("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(Ra,{className:"h-3 w-3","aria-label":s("skills.usage.disclaimer")})})]}),children:wt(g?.cost||0,{currency:k,rate:C})})]}),F?null:e.jsx("p",{className:"mt-2 text-[11px] leading-4 text-oai-gray-400 dark:text-oai-gray-500",children:s("skills.usage.unused")})]}),e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.detail.sync_section_title")}),e.jsx("div",{children:(r||[]).map(j=>{const te=D.has(j.id),$=o===Nr(a.id,j.id),H=`skill-detail-sync-${a.id||a.directory}-${j.id}`;return e.jsxs("label",{htmlFor:H,className:"-mx-2 flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-sm text-oai-black transition-colors hover:bg-oai-gray-100/70 dark:text-white dark:hover:bg-white/[0.05]",children:[e.jsx(vr,{id:H,checked:te,disabled:$,onCheckedChange:X=>h?.(a,j.id,!!X),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:e.jsx(jr,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(_e,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center","aria-hidden":!0,children:e.jsx(ye,{provider:j.id,size:16})}),e.jsx("span",{className:"flex-1",children:j.label}),$?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},j.id)})})]})]}),e.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[e.jsxs("button",{type:"button",onClick:()=>y?.(a),disabled:z,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[z?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("skills.detail.remove_button")]}),e.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.detail.remove_confirm_hint")})]})]})]})}const Lr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),la=["claude","codex"],O="popular",Ir={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},he="all",B="skillssh";function Ze(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Xa(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function Dr(a){return Xa(a).split("/").filter(Boolean).pop()||""}function $r(a){if(a.repoOwner||a.repoName)return"";const r=Xa(a.directory);return!r||r.includes("/")?"":`dir:${r}`}function Ca(a){const r=Dr(a.directory);return r?`dir:${r}`:""}function Sa(a){const r=new Set([Ze(a).toLowerCase()]);a.repoOwner&&a.repoName&&r.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const o=$r(a);return o&&r.add(o),r}function We(a){return`install:${Ze(a)}`}function _a(a){return`remove:${a.id||a.directory}`}function Ya(a,r){return`target:${a}:${r}`}function Er({target:a,state:r,busy:o,onToggle:g}){const c=r==="synced",x=r==="orphan",u=x?s("skills.dot.orphan_aria",{agent:a.label}):c?s("skills.dot.synced_aria",{agent:a.label}):s("skills.dot.off_aria",{agent:a.label});return e.jsxs("button",{type:"button",title:u,"aria-label":u,"aria-pressed":c,disabled:o,onClick:m=>{m.stopPropagation(),g?.(a.id,!c)},className:"relative flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/40 disabled:cursor-not-allowed dark:hover:bg-oai-gray-800/60",children:[o?e.jsx(ae,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:W("flex h-[18px] w-[18px] items-center justify-center transition",c&&Ir[a.id],!c&&!x&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(ye,{provider:a.id,size:18})}),x&&!o?e.jsx("span",{className:"absolute -bottom-px -right-px h-2 w-2 rounded-full bg-amber-500 ring-2 ring-oai-white dark:ring-oai-gray-900","aria-hidden":!0}):null]})}function Br({skill:a,targets:r,onToggleTarget:o,busyKey:g}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:r.map(c=>e.jsx(Er,{target:c,state:a.targetStates?.[c.id]||"off",busy:g===Ya(a.id,c.id),onToggle:(x,u)=>o?.(a,x,u)},c.id))})}function Mr({skill:a,targets:r,selected:o,onSelect:g,selectable:c,checked:x,onToggleSelect:u,onToggleTarget:m,hasUpdate:h,busyKey:y}){const l=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,k=l?`${a.directory} · ${l}`:a.directory,C=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),g?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":o,"aria-label":s("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>g?.(a),onKeyDown:C,className:W("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",o?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":x?"bg-oai-gray-50 dark:bg-oai-gray-900/40":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[c?e.jsx("label",{className:"flex shrink-0 items-center",onClick:w=>w.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:x,onChange:w=>u?.(a,w.target.checked),"aria-label":s("skills.select.row_aria",{name:a.name||a.directory}),className:"h-4 w-4 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white"})}):null,e.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-oai-black dark:text-white",title:k,children:a.name||a.directory}),h?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-sky-50 px-1.5 py-0.5 text-[10px] font-semibold text-sky-700 ring-1 ring-sky-200 dark:bg-sky-950/40 dark:text-sky-300 dark:ring-sky-800/60",children:[e.jsx(Ka,{className:"h-2.5 w-2.5","aria-hidden":!0}),s("skills.update.badge")]}):null,e.jsx(Br,{skill:a,targets:r,onToggleTarget:m,busyKey:y}),e.jsx(Gt,{className:W("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",o&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]}),a.description?e.jsx("p",{className:W("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",c&&"pl-7"),children:a.description}):null]})}function Tr({agentFilter:a,agentOptions:r,onAgentFilter:o,filteredCount:g,totalCount:c,anyFilter:x,onClearFilters:u,searchQuery:m,onSearchQuery:h,searchPlaceholder:y}){return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsxs(Ma,{value:a,onValueChange:o,children:[e.jsxs(Ta,{"aria-label":s("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[s("skills.filter.agent_label"),":"]}),e.jsx(Oa,{children:l=>l==="all"?s("skills.filter.agent_all"):r.find(k=>k.id===l)?.label||l}),e.jsx(qa,{className:"text-oai-gray-400",children:e.jsx(ga,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ua,{children:e.jsx(za,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Fa,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Xe,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Ye,{children:s("skills.filter.agent_all")}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),r.map(l=>e.jsxs(Xe,{value:l.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{provider:l.id,size:14}),e.jsx(Ye,{children:l.label})]}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},l.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(ca,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ha,{type:"search",value:m,onChange:l=>h(l.target.value),onKeyDown:l=>{l.key==="Escape"&&m&&(l.preventDefault(),h(""))},"aria-label":s("skills.action.search_aria"),placeholder:y,className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:l=>l.preventDefault(),onClick:()=>h(""),"aria-label":s("skills.action.search_clear"),"aria-hidden":!m,tabIndex:m?0:-1,className:W("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out before:absolute before:-inset-1.5 before:content-[''] hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 motion-reduce:transition-none dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",m?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{role:"status","aria-live":"polite",className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.filter.result_count",{filtered:g,total:c})}),x?e.jsxs("button",{type:"button",onClick:u,className:"shrink-0 inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),s("skills.filter.clear")]}):null]})}function Or({count:a,targets:r,busy:o,onBulkSync:g,onBulkRemove:c,onClear:x}){return e.jsxs("div",{role:"toolbar","aria-label":s("skills.select.toolbar_aria"),className:"mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/50",children:[e.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200","aria-live":"polite",children:s("skills.select.count",{count:a})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs(La,{children:[e.jsxs(Ia,{disabled:o,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:[e.jsx(Aa,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("skills.select.bulk_sync"),e.jsx(ga,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Da,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Ea,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.select.bulk_sync_hint")}),r.map(u=>e.jsxs("button",{type:"button",onClick:()=>g(u.id),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx(ye,{provider:u.id,size:16}),e.jsx("span",{className:"flex-1",children:u.label})]},u.id))]})})})]}),e.jsxs(U,{type:"button",variant:"ghost",size:"sm",disabled:o,onClick:c,children:[e.jsx(ma,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:x,className:"inline-flex h-7 items-center gap-1 rounded-full px-2 text-[11px] font-medium text-oai-gray-500 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),s("skills.select.clear")]})]})]})}function Ur({items:a,totalCount:r,targets:o,agentOptions:g,agentFilter:c,onAgentFilter:x,anyFilter:u,onClearFilters:m,searchQuery:h,onSearchQuery:y,searchPlaceholder:l,selectedId:k,onSelect:C,onToggleTarget:w,busyKey:v,updates:f,selectedIds:N,onToggleSelect:D,onClearSelection:z,onBulkSync:Q,onBulkRemove:F}){const de=N.size;return e.jsxs("div",{children:[de>0?e.jsx(Or,{count:de,targets:o,busy:v==="batch",onBulkSync:Q,onBulkRemove:F,onClear:z}):e.jsx(Tr,{agentFilter:c,agentOptions:g,onAgentFilter:x,filteredCount:a.length,totalCount:r,anyFilter:u,onClearFilters:m,searchQuery:h,onSearchQuery:y,searchPlaceholder:l}),a.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:s("skills.empty.no_match")}),e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:m,children:s("skills.filter.clear")})]}):e.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(j=>e.jsx(Mr,{skill:j,targets:o,selected:k===(j.id||j.directory),onSelect:C,selectable:!0,checked:N.has(j.id),onToggleSelect:D,onToggleTarget:w,hasUpdate:!!(j.id&&f?.[j.id]),busyKey:v},j.id||j.key))})]})}const zr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Fr=Lt.memo(function({skill:r,installed:o,installing:g,allTargets:c,defaultTargets:x,onInstall:u,onManage:m}){const[h,y]=n.useState(()=>(x||[]).filter(f=>c.some(N=>N.id===f))),l=f=>{y(N=>N.includes(f)?N.filter(D=>D!==f):[...N,f])},k=r.repoOwner&&r.repoName?`${r.repoOwner}/${r.repoName}`:null,C=k?`https://github.com/${r.repoOwner}/${r.repoName}`:null,w=r.installs!=null?s("skills.card.installs",{count:Number(r.installs||0).toLocaleString()}):null,v=h.length?h.map(f=>c.find(N=>N.id===f)?.label||f).join(", "):s("skills.action.choose_targets");return e.jsxs(Mt,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[r.readmeUrl?e.jsxs("a",{href:r.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:r.readmeUrl,children:[e.jsx("span",{className:"truncate",children:r.name||r.directory}),e.jsx(ua,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:r.name||r.directory}),k||w?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[C?e.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",onClick:f=>f.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:C,children:[e.jsx("span",{className:"truncate",children:k}),e.jsx(ua,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,k&&w?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,w?e.jsx("span",{className:"truncate",children:w}):null]}):null]})}),r.description?e.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:r.description}):null,e.jsx("div",{className:"mt-auto pt-5",children:o?e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>m?.(r),className:"w-full",children:[e.jsx(_e,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-500 dark:text-emerald-400","aria-hidden":!0}),s("skills.card.manage")]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.card.targets_prefix")}),e.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:h.length?v:s("skills.target.none")}),e.jsxs(La,{children:[e.jsx(Ia,{disabled:g,"aria-label":s("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:s("skills.card.targets_change")}),e.jsx(Da,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Ea,{className:"min-w-[220px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.target.menu_label")}),c.map(f=>{const N=h.includes(f.id);return e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:N,onChange:()=>l(f.id)}),e.jsx(ye,{provider:f.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:f.label})]},f.id)})]})})})]})]}),e.jsxs(U,{type:"button",size:"sm",onClick:()=>u(r,h),disabled:g||h.length===0,className:"w-full",children:[g?e.jsx(ae,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Aa,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("skills.action.install")]})]})})]})});function Ar({repos:a,repoInput:r,onRepoInput:o,busyKey:g,onAdd:c,onRemove:x}){return e.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx(ha,{value:r,onChange:u=>o(u.target.value),placeholder:s("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(U,{type:"button",variant:"secondary",size:"md",onClick:c,disabled:g==="repo:add",className:"shrink-0 whitespace-nowrap",children:[g==="repo:add"?e.jsx(ae,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Va,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),s("skills.repo.add")]})]}),a.length?e.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(u=>{const m=g===`repo:${u.owner}/${u.name}`;return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[u.owner,"/",u.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:u.branch})]}),e.jsxs(U,{type:"button",variant:"ghost",size:"sm",disabled:m,onClick:()=>x(u),className:"shrink-0",children:[m?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:s("skills.repo.remove")})]})]},`${u.owner}/${u.name}`)})}):null]})}function Kr(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function as(){const[a,r]=n.useState(Kr),[o,g]=n.useState({skills:[],targets:[]}),[c,x]=n.useState([]),[u,m]=n.useState([]),[h,y]=n.useState([]),[l,k]=n.useState(he),[C,w]=n.useState(""),[v,f]=n.useState(""),[N,D]=n.useState(""),[z,Q]=n.useState(""),[F,de]=n.useState(""),[j,te]=n.useState(!1),[$,H]=n.useState("all"),[X,re]=n.useState(null),[A,fe]=n.useState(""),[be,Ue]=n.useState(!0),[Pe,ze]=n.useState(!1),[Fe,M]=n.useState(""),[se,Re]=n.useState(null),[Y,ke]=n.useState(null),[S,ie]=n.useState(()=>new Set),[ne,J]=n.useState({}),[Z,P]=n.useState({}),[xe,aa]=n.useState([]),[G,we]=n.useState(!1),ve=n.useRef(!1),ce=n.useMemo(()=>{const t=new Set;for(const i of o.skills||[])for(const d of Sa(i))t.add(d);return t},[o.skills]),je=n.useCallback(async()=>{const t=await vt();g({skills:t.skills||[],targets:t.targets||[]})},[]),Ne=n.useCallback(async()=>{const t=await jt();y(t.repos||[])},[]),T=n.useCallback(async({force:t=!1}={})=>{ze(!0);try{const i=await Nt({force:t});x(i.skills||[])}finally{ze(!1)}},[]),pe=n.useCallback(async({force:t=!1}={})=>{we(!0);try{const i=await Ct({force:t});aa(i.skills||[])}finally{we(!1)}},[]),ue=n.useCallback(async()=>{try{const t=await St();J(t?.updates||{})}catch{J({})}},[]),ge=n.useCallback(async()=>{try{const t=await _t(),i={};for(const d of t?.skills||[])d.installed&&(d.directory&&(i[String(d.directory).toLowerCase()]=d),i[String(d.skill).toLowerCase()]=d);P(i)}catch{P({})}},[]),oe=n.useCallback(async()=>{Ue(!0),M("");try{await Promise.all([je(),Ne()])}catch(t){M(t?.message||s("skills.error.generic"))}finally{Ue(!1)}},[je,Ne]),Le=n.useCallback(async()=>{await oe();const t=i=>M(i?.message||s("skills.error.generic"));a==="my"?(ue(),ge()):l===O?pe({force:!0}).catch(t):l!==B&&T({force:!0}).catch(t)},[T,oe,pe,ue,ge,l,a]);n.useEffect(()=>{oe()},[oe]),n.useEffect(()=>{if(ve.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("skill");if(!i){ve.current=!0;return}const d=o.skills||[];if(!d.length)return;const p=d.find(_=>_.directory===i||_.id===i);p&&(r("my"),re(p.id||p.directory)),ve.current=!0,t.delete("skill");const L=t.toString();window.history.replaceState({},"",`${window.location.pathname}${L?`?${L}`:""}${window.location.hash}`)},[o.skills]),n.useEffect(()=>{a==="browse"&&(l===B||l===O||c.length===0&&T().catch(t=>M(t?.message||s("skills.error.generic"))))},[c.length,T,l,a]),n.useEffect(()=>{a!=="browse"||l!==O||xe.length===0&&pe().catch(t=>M(t?.message||s("skills.error.generic")))},[pe,xe.length,l,a]);const Ae=Object.keys(ne).length>0,Ke=Object.keys(Z).length>0;if(n.useEffect(()=>{a==="my"&&(Ae||ue(),Ke||ge())},[a,Ae,Ke,ue,ge]),n.useEffect(()=>{const t=setTimeout(()=>f(C),200);return()=>clearTimeout(t)},[C]),n.useEffect(()=>{const t=setTimeout(()=>Q(N),120);return()=>clearTimeout(t)},[N]),n.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("tab");if(a==="my"){if(!i)return;t.delete("tab")}else{if(i===a)return;t.set("tab",a)}const d=t.toString(),p=`${window.location.pathname}${d?`?${d}`:""}${window.location.hash}`;window.history.replaceState({},"",p)},[a]),!Lr&&!Pt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(Bt,{})});const I=async(t,i)=>{fe(t),M("");try{await i(),await je()}catch(d){M(d?.message||s("skills.error.generic"))}finally{fe("")}},E=(t,i)=>{const d=(i&&i.length?i:la).filter(p=>(o.targets||[]).some(L=>L.id===p));I(We(t),async()=>{await fa(t,d);const p=d.map(L=>(o.targets||[]).find(_=>_.id===L)?.label||L).join(", ");Ce({title:s("skills.toast.installed",{name:t.name||t.directory,targets:p||s("skills.target.none")}),timeout:4e3})})},ta=t=>{Re(t)},le=()=>{const t=se;t&&(Re(null),I(_a(t),async()=>{let i=null;t.managed?i=await ba(t.id):await ka(t.directory,t.targets||[]);const d=!!(i?.trashed&&t.managed&&t.id);Ce({title:s("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:d?{onUndo:async()=>{try{await Dt(t.id),await je()}catch(p){M(p?.message||s("skills.error.generic"))}}}:void 0})}))},Ve=(t,i,d)=>I(Ya(t.id,i),async()=>{const p=new Set(t.targets||[]);d?p.add(i):p.delete(i),t.managed?await wa(t.id,Array.from(p)):await va(t.directory,Array.from(p));const L={name:t.name||t.directory,agent:De(i)};Ce({title:d?s("skills.toast.synced_one",L):s("skills.toast.unsynced_one",L),timeout:3e3})}),Ie=n.useCallback(()=>ie(new Set),[]),ra=n.useCallback((t,i)=>{ie(d=>{const p=new Set(d);return i?p.add(t.id):p.delete(t.id),p})},[]),De=t=>(o.targets||[]).find(i=>i.id===t)?.label||t,qe=t=>{const i=(o.skills||[]).filter(d=>S.has(d.id));i.length&&I("batch",async()=>{for(const d of i){const p=new Set(d.targets||[]);p.add(t),d.managed?await wa(d.id,Array.from(p)):await va(d.directory,Array.from(p))}Ie(),Ce({title:s("skills.toast.bulk_synced",{count:i.length,agent:De(t)}),timeout:4e3})})},$e=()=>{const t=(o.skills||[]).filter(i=>S.has(i.id));t.length&&ke(t)},sa=()=>{const t=Y;t&&(ke(null),I("batch",async()=>{for(const i of t)i.managed?await ba(i.id):await ka(i.directory,i.targets||[]);Ie(),Ce({title:s("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},ia=t=>{!t?.repoOwner||!t?.repoName||I(We(t),async()=>{await fa({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:la),await ue(),Ce({title:s("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},b=async()=>{const t=C.trim();if(!(t.length<2)){fe("search"),M("");try{const i=await It(t);m(i.skills||[])}catch(i){M(i?.message||s("skills.error.generic"))}finally{fe("")}}},K=async()=>{const t=F.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[i,d]=t.split("/");if(!i||!d){M(s("skills.repo.invalid"));return}await I("repo:add",async()=>{await Et({owner:i,name:d,branch:"main",enabled:!0}),de(""),await Ne(),await T()})},me=async t=>{await I(`repo:${t.owner}/${t.name}`,async()=>{await $t(t.owner,t.name),await Ne(),await T()})},R=o.targets||[],V=o.skills||[],Ee=n.useMemo(()=>{const t=$==="all"?V:V.filter(d=>(d.targets||[]).includes($)),i=z.trim().toLowerCase();return i?t.filter(d=>(d.name||"").toLowerCase().includes(i)||(d.directory||"").toLowerCase().includes(i)||(d.description||"").toLowerCase().includes(i)):t},[V,$,z]),Be=$!=="all",ee=n.useMemo(()=>X&&V.find(t=>(t.id||t.directory)===X)||null,[V,X]),Ja=n.useCallback(()=>{H("all"),D("")},[]),Za=n.useCallback(t=>{re(i=>{const d=t?.id||t?.directory||null;return i===d?null:d})},[]),et=n.useCallback(()=>re(null),[]),at=n.useCallback(t=>{const i=Ze(t).toLowerCase(),d=Ca(t),p=(o.skills||[]).find(L=>{const _=Sa(L);return _.has(i)||d&&_.has(d)});p&&re(p.id||p.directory)},[o.skills]);n.useEffect(()=>{a!=="my"&&S.size&&ie(new Set)},[a,S.size]),n.useEffect(()=>{X&&!ee&&re(null)},[ee,X]);const Me=n.useMemo(()=>{const t=l===B?u:l===O?xe:c,d=l===B||l===O||l===he?t:t.filter(_=>`${_.repoOwner}/${_.repoName}`===l),p=v.trim().toLowerCase();return(l===B||!p?d:d.filter(_=>(_.name||"").toLowerCase().includes(p)||(_.directory||"").toLowerCase().includes(p)||(_.description||"").toLowerCase().includes(p))).map(_=>{const na=Ze(_).toLowerCase(),q=Ca(_);return{..._,installed:ce.has(na)||q&&ce.has(q)}})},[v,c,ce,xe,u,l]),tt=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(ae,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),rt=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(ae,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.browse.loading_hint")})]}),He=(t,i=null)=>e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:s(t)}),i]});let Ge;if(be)Ge=tt;else if(a==="my")Ge=V.length?e.jsx(Ur,{items:Ee,totalCount:V.length,targets:R,agentOptions:R,agentFilter:$,onAgentFilter:H,anyFilter:Be,onClearFilters:Ja,searchQuery:N,onSearchQuery:D,searchPlaceholder:s("skills.my.placeholder"),selectedId:X,onSelect:Za,onToggleTarget:Ve,busyKey:A,updates:ne,selectedIds:S,onToggleSelect:ra,onClearSelection:Ie,onBulkSync:qe,onBulkRemove:$e}):e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[R.length>0?e.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...R,...R].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ye,{provider:t.id,size:30})},`b-${i}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...R,...R].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ye,{provider:t.id,size:30})},`c-${i}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.empty.my")}),e.jsx(U,{type:"button",size:"sm",onClick:()=>r("browse"),children:s("skills.empty.my_cta")})]});else{const t=l===B,i=l===O,d=h.length===0&&!t&&!i,p=Pe&&!t&&!i||i&&G,L=!t&&!i&&(v.trim()!==""||l!==he),_=()=>{w(""),k(he)},na=!d&&!p&&(Me.length>0||L)?e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:s("skills.filter.result_count_browse",{count:Me.length})}),L?e.jsxs("button",{type:"button",onClick:_,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),s("skills.filter.clear")]}):null]}):null;let q;d?q=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:s("skills.browse.empty_sources")})}):p?q=rt:t&&C.trim().length<2?q=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:s("skills.browse.hint_skillssh")}):Me.length?q=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Me.map(Te=>e.jsx("div",{style:zr,children:e.jsx(Fr,{skill:Te,installed:!!Te.installed,installing:A===We(Te),allTargets:R,defaultTargets:la,onInstall:E,onManage:at})},Te.id||Te.key))}):L?q=He("skills.empty.no_match",e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:_,children:s("skills.filter.clear")})):t?q=He("skills.empty.search"):i?q=He("skills.empty.popular"):q=He("skills.empty.browse");const st=d||j?e.jsx("div",{className:"mb-5",children:e.jsx(Ar,{repos:h,repoInput:F,onRepoInput:de,busyKey:A,onAdd:K,onRemove:me})}):null,it=!j&&!t&&!i&&h.length<=1&&Me.length>0?e.jsx(ur,{id:"skills-browse-intro",className:"mt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{children:s("skills.browse.add_repo_hint")}),e.jsx("button",{type:"button",onClick:()=>te(!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;Ge=e.jsxs(e.Fragment,{children:[st,na,q,it]})}return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("skills.page.title")}),e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:Le,disabled:be||Pe||G,children:[e.jsx(Rt,{className:W("mr-1.5 h-3.5 w-3.5",(be||Pe||G)&&"animate-spin"),"aria-hidden":!0}),s("skills.action.refresh")]})]}),e.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",s("skills.tab.my")],["browse",s("skills.tab.browse")]].map(([t,i])=>e.jsx("button",{type:"button","aria-pressed":a===t,onClick:()=>r(t),className:W("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",a===t?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:i},t))}),Fe?e.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:Fe}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("div",{role:"tablist","aria-label":s("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",s("skills.mode.repo"),l!==B&&l!==O],["popular",s("skills.mode.popular"),l===O],["skillssh",s("skills.mode.skillssh"),l===B]].map(([t,i,d])=>e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>{t==="skillssh"?k(B):t==="popular"?k(O):(l===B||l===O)&&k(he)},className:W("inline-flex items-center gap-1.5 rounded px-3 py-1 text-sm font-medium transition-colors",d?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:[t==="popular"?e.jsx(ir,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,i]},t))}),l!==B&&l!==O?e.jsxs(Ma,{value:l,onValueChange:k,children:[e.jsxs(Ta,{"aria-label":s("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Oa,{children:t=>t===he?s("skills.source.all"):t}),e.jsx(qa,{className:"text-oai-gray-400",children:e.jsx(ga,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsx(Ua,{children:e.jsx(za,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Fa,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Xe,{value:he,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Ye,{children:s("skills.source.all")}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),h.map(t=>{const i=`${t.owner}/${t.name}`;return e.jsxs(Xe,{value:i,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Ye,{children:i}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},i)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ca,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ha,{type:"search",value:C,onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Enter"&&l===B&&b()},"aria-label":s("skills.action.search_aria"),placeholder:l===B?s("skills.browse.placeholder_skillssh"):l===O?s("skills.browse.placeholder_popular"):l===he?s("skills.browse.placeholder_all"):s("skills.browse.placeholder_repo",{repo:l}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),l===B?e.jsxs(U,{type:"button",onClick:b,disabled:C.trim().length<2||A==="search",className:"focus:!ring-oai-gray-400/30",children:[A==="search"?e.jsx(ae,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(ca,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),s("skills.action.search")]}):l===O?null:e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>te(t=>!t),"aria-expanded":j,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("skills.browse.manage_sources"),e.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:h.length})]})]}):null,Ge,e.jsx(Pr,{skill:ee,targets:R,busyKey:A,usage:ee&&(Z[String(ee.directory||"").toLowerCase()]||Z[String(ee.name||"").toLowerCase()])||null,hasUpdate:!!(ee?.id&&ne?.[ee.id]),updating:ee?A===We(ee):!1,onUpdate:ia,onClose:et,onToggleTarget:Ve,onRemove:ta})]})}),e.jsx(ja,{open:!!se,title:s("skills.confirm.remove_title",{name:se?.name||se?.directory||""}),description:se?se.managed?s("skills.confirm.remove_managed"):s("skills.confirm.remove_local"):"",confirmLabel:s("skills.action.remove"),cancelLabel:s("shared.action.cancel"),destructive:!0,busy:A===_a(se||{}),onCancel:()=>Re(null),onConfirm:le}),e.jsx(ja,{open:!!Y,title:s("skills.confirm.bulk_remove_title",{count:Y?.length||0}),description:s("skills.confirm.bulk_remove_desc"),confirmLabel:s("skills.action.remove"),cancelLabel:s("shared.action.cancel"),destructive:!0,busy:A==="batch",onCancel:()=>ke(null),onConfirm:sa})]})}export{as as SkillsPage};
import{G as u,r as a,a_ as M,a$ as j,b0 as G,b1 as J}from"./main-BbEXIjk8.js";const B=["claude","codex","cursor","gemini","kimi","kiro","grok","copilot","antigravity"],q={claude:"CLAUDE",codex:"CODEX",cursor:"CURSOR",gemini:"GEMINI",kimi:"KIMI",kiro:"KIRO",grok:"GROK",copilot:"COPILOT",antigravity:"ANTIGRAVITY"};function se(e){return q[e]||null}function ae(e){switch(e){case"claude":return u("limits.provider.claude");case"codex":return u("limits.provider.codex");case"cursor":return u("limits.provider.cursor");case"gemini":return u("limits.provider.gemini");case"kimi":return u("limits.provider.kimi");case"kiro":return u("limits.provider.kiro");case"grok":return u("limits.provider.grok");case"copilot":return u("limits.provider.copilot");case"antigravity":return u("limits.provider.antigravity");default:return String(e||"")}}const y=B,A="tt.limits.providerOrder",E="tt.limits.providerVisibility",h="tt.limits.displayMode",O="tt.limits.updatedAt",V="limitsPreferences",F="limitsDisplayMode",v=Object.freeze({USED:"used",REMAINING:"remaining"}),g=new Set(Object.values(v)),L=new Set([A,E,h,O]);function I(){return[...y]}function b(){return Object.fromEntries(y.map(e=>[e,!0]))}function _(e){const r=[];if(Array.isArray(e))for(const n of e)y.includes(n)&&!r.includes(n)&&r.push(n);for(const n of y)r.includes(n)||r.push(n);return r}function N(e){const r=b();if(!e||typeof e!="object"||Array.isArray(e))return r;for(const n of y)typeof e[n]=="boolean"&&(r[n]=e[n]);return r}function X(e){return g.has(e)?e:v.USED}function m(e){if(e!=null){if(typeof e=="number")return Number.isSafeInteger(e)?e:void 0;if(typeof e=="string"){const r=e.trim();if(r==="")return;const n=Number(r);return Number.isSafeInteger(n)?n:void 0}}}function w(e={}){const r=e&&typeof e=="object"?e:{};return{displayMode:X(r.displayMode),providerOrder:_(r.providerOrder),providerVisibility:N(r.providerVisibility),updatedAt:m(r.updatedAt)}}function $(){if(typeof window>"u")return I();try{const e=window.localStorage.getItem(A);return _(e?JSON.parse(e):void 0)}catch{return I()}}function H(){if(typeof window>"u")return b();try{const e=window.localStorage.getItem(E);return N(e?JSON.parse(e):void 0)}catch{return b()}}function Q(){if(typeof window>"u")return v.USED;try{const e=window.localStorage.getItem(h);return g.has(e)?e:v.USED}catch{return v.USED}}function W(){if(!(typeof window>"u"))try{return m(window.localStorage.getItem(O))}catch{return}}function Z(){if(typeof window>"u")return!1;try{for(const e of L)if(window.localStorage.getItem(e)!==null)return!0}catch{return!1}return!1}function S(){return w({displayMode:Q(),providerOrder:$(),providerVisibility:H(),updatedAt:W()})}function ee(e){if(typeof window>"u")return;const r=w(e);try{window.localStorage.setItem(A,JSON.stringify(r.providerOrder)),window.localStorage.setItem(E,JSON.stringify(r.providerVisibility)),window.localStorage.setItem(h,r.displayMode),r.updatedAt===void 0?window.localStorage.removeItem(O):window.localStorage.setItem(O,String(r.updatedAt))}catch(n){console.warn("[tokentracker] limits preferences localStorage write failed:",n)}}function re(e){const r=w(e);return{displayMode:r.displayMode,providerOrder:[...r.providerOrder],providerVisibility:{...r.providerVisibility},updatedAt:r.updatedAt??null}}function te(...e){let r;for(const s of e){const l=m(s);l!==void 0&&(r=r===void 0?l:Math.max(r,l))}const n=Date.now();return r!==void 0&&n<=r?r+1:n}function ie(e,r){return e.length===r.length&&e.every((n,s)=>n===r[s])}function ne(e,r){return y.every(n=>e[n]===r[n])}function R(e,r){return e.displayMode===r.displayMode&&ie(e.providerOrder,r.providerOrder)&&ne(e.providerVisibility,r.providerVisibility)}function oe(e,r){return R(e,r)&&m(e.updatedAt)===m(r.updatedAt)}function k(e,r){const n=m(e.updatedAt),s=m(r.updatedAt);return n!==void 0&&(s===void 0||n>s)}function ce(){const[e,r]=a.useState(S),n=a.useRef(e),s=a.useCallback((o,t={})=>{const i=w(o);return n.current=i,r(i),t.writeLocal&&ee(i),i},[]),l=a.useCallback(o=>{M()&&j(V,re(o))},[]),c=a.useCallback(o=>{const t=S(),i=k(t,n.current)?s(t):n.current,d=w(o(i));if(R(i,d))return;const f=te(t.updatedAt,i.updatedAt),p=s({...d,updatedAt:f},{writeLocal:!0});l(p)},[s,l]),P=a.useCallback(o=>{g.has(o)&&c(t=>({...t,displayMode:o}))},[c]),D=a.useCallback(o=>{if(!g.has(o))return;const t=S();if(t.updatedAt!==void 0){s(t);return}s({...t,displayMode:o,updatedAt:void 0},{writeLocal:!0})},[s]);a.useEffect(()=>{if(!M())return;const o=G(t=>{const i=t?.[V];if(i&&typeof i=="object"){const d=w(i);if(!Z()){s(d,{writeLocal:!0});return}const f=S();if(k(d,f))s(d,{writeLocal:!0});else{const p=s(f);oe(d,f)||l(p)}return}D(t?.[F])});return J(),o},[D,s,l]),a.useEffect(()=>{if(typeof window>"u")return;const o=t=>{(t.key===null||L.has(t.key))&&s(S())};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[s]);const x=a.useCallback(o=>{y.includes(o)&&c(t=>({...t,providerVisibility:{...t.providerVisibility,[o]:!t.providerVisibility[o]}}))},[c]),C=a.useCallback(o=>{c(t=>{const i=t.providerOrder.indexOf(o);if(i<=0)return t;const d=[...t.providerOrder];return[d[i-1],d[i]]=[d[i],d[i-1]],{...t,providerOrder:d}})},[c]),U=a.useCallback(o=>{c(t=>{const i=t.providerOrder.indexOf(o);if(i<0||i>=t.providerOrder.length-1)return t;const d=[...t.providerOrder];return[d[i],d[i+1]]=[d[i+1],d[i]],{...t,providerOrder:d}})},[c]),T=a.useCallback((o,t)=>{o!==t&&c(i=>{const d=i.providerOrder.indexOf(o),f=i.providerOrder.indexOf(t);if(d<0||f<0)return i;const p=[...i.providerOrder],[z]=p.splice(d,1);return p.splice(f,0,z),{...i,providerOrder:p}})},[c]),Y=a.useCallback(()=>{c(()=>({displayMode:v.USED,providerOrder:I(),providerVisibility:b()}))},[c]),K=a.useMemo(()=>e.providerOrder.filter(o=>e.providerVisibility[o]!==!1),[e.providerOrder,e.providerVisibility]);return{order:e.providerOrder,visibility:e.providerVisibility,displayMode:e.displayMode,setDisplayMode:P,visibleOrdered:K,toggle:x,moveUp:C,moveDown:U,moveToward:T,reset:Y}}export{v as L,B as a,se as b,ae as l,ce as u};
import{j as a,V as x,r as n,aD as g,c4 as m,b0 as b,b1 as u,a$ as f,c3 as h}from"./main-BbEXIjk8.js";import{C as y}from"./Card-CJiPCvnj.js";function k({checked:s,onChange:t,disabled:e,ariaLabel:i}){return a.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":i,onClick:t,disabled:e,className:x("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",s?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:a.jsx("span",{className:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",s?"translate-x-[18px]":"translate-x-[3px]")})})}function p({label:s,hint:t,control:e}){return a.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s}),t?a.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),a.jsx("div",{className:"shrink-0",children:e})]})}function N({title:s,subtitle:t,action:e,children:i}){return a.jsxs(y,{children:[a.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:s}),t?a.jsx("p",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),e?a.jsx("div",{className:"shrink-0",children:e}):null]}),a.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:i})]})}function w({options:s,value:t,onChange:e}){return a.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 bg-oai-gray-50 p-0.5 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:s.map(({value:i,label:d,Icon:l})=>{const r=t===i;return a.jsxs("button",{type:"button",onClick:()=>e(i),"aria-pressed":r,className:x("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors",r?"bg-white text-oai-black shadow-sm dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[l?a.jsx(l,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,a.jsx("span",{children:d})]},i)})})}function S(){const[s,t]=n.useState(null),e=g()&&m();n.useEffect(()=>{if(!e)return;const r=b(o=>t(o));return u(),r},[e]);const i=n.useCallback((r,o)=>{e&&(t(c=>c&&{...c,[r]:o}),f(r,o))},[e]),d=n.useCallback(r=>{e&&h(r)},[e]),l=n.useCallback(()=>{e&&u()},[e]);return{available:e,settings:s,setSetting:i,runAction:d,refresh:l}}export{N as S,k as T,p as a,w as b,S as u};
import{r as a,ab as w,aI as c}from"./main-BbEXIjk8.js";function v(i){const o=!!i?.initialState,[b,l]=a.useState(()=>o?i?.initialState?.data??null:null),[m,s]=a.useState(()=>o?i?.initialState?.error??null:null),[y,g]=a.useState(!o),u=!!i?.initialRefresh,f=!!i?.publishToPreloadCache,r=a.useCallback((e,t)=>{!f||!e||typeof e!="object"||w(e,{source:t})},[f]),S=a.useCallback(async()=>{try{const e=await c({refresh:!0}),t=e&&typeof e=="object"?e:null;l(t),s(null),r(t,"manual-refresh")}catch(e){s(e?.message||String(e))}},[r]),d=a.useCallback(async()=>{try{const e=await c(),t=e&&typeof e=="object"?e:null;l(t),s(null),r(t,"page-load")}catch(e){s(e?.message||String(e))}},[r]);return a.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const e=15e3;let t=Date.now();const n=()=>{if(document.visibilityState!=="visible")return;const h=Date.now();h-t<e||(t=h,d())};return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[d]),a.useEffect(()=>{if(o&&!u)return;let e=!1;return(async()=>{try{const t=await c();if(e)return;const n=t&&typeof t=="object"?t:null;l(n),s(null),r(n,"page-load")}catch(t){if(e)return;s(t?.message||String(t))}finally{e||g(!1)}})(),()=>{e=!0}},[o,u,r]),{data:b,error:m,isLoading:y,refresh:S}}export{v as u};
import{r as e,c1 as t,c2 as r,K as c}from"./main-BbEXIjk8.js";const s=Object.freeze({currency:c,rate:1,symbol:"$",rates:{...r},rateSource:"default",rateFetchedAt:null,setCurrency:()=>{}});function a(){return e.useContext(t)??s}export{a as u};
import{c as _t,b5 as St,b3 as G,b6 as Tt,bD as D,d9 as vt,cz as Ot,j as Te,cF as ze,r as f,bB as U,cH as ot,da as Bt,b7 as ct,bA as Ae,c5 as Gt,cG as it,db as wt,bF as x,bE as xe,c0 as Ee,dc as $e,dd as le,cL as ae,bJ as C,bK as Kt,d3 as Ct,cX as Dt,cY as Xt,d6 as xt,c6 as Vt,bX as ut,bS as lt,bU as Ut,de as $t,cM as qt,bG as Re,bW as jt,c_ as zt,b as Me,bP as Jt,df as Je,ba as We,dg as Qt,dh as He,bM as Zt,di as en,bz as Ne,bN as tn,cE as nn,bC as Ce,cv as _e,cu as rn,dj as sn,cs as on,bL as cn,dk as un,bQ as Se,dl as ye,be as ln,b9 as Be,dm as an,dn as at,d0 as fn,cA as Qe}from"./main-BbEXIjk8.js";const dn=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],jn=_t("check",dn);function Ie(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Ie(e,s.id,n)])}function ft(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(c=>c.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function Ge(e){const t=St(pn,e).current;return t.next=e,G(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let Fe=0;function Ke(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(Fe);function c(){s&&!s()||e?.focus({preventScroll:n})}if(r)return c(),Tt;const o=requestAnimationFrame(c);return Fe=o,()=>{Fe===o&&(cancelAnimationFrame(o),Fe=0)}}const De={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",qe={inert:new WeakSet,"aria-hidden":new WeakSet};let we=new WeakMap,Xe=0;function gn(e){return qe[e]}function It(e){return e?vt(e)?e.host:It(e.parentNode):null}const Ve=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=It(n);return e.contains(r)?r:null}).filter(n=>n!=null),pt=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},gt=(e,t,n)=>{const r=[],s=c=>{!c||n.has(c)||Array.from(c.children).forEach(o=>{Ot(o)!=="script"&&(t.has(o)?s(o):r.push(o))})};return s(e),r};function hn(e,t,n,r,{mark:s=!0,markerIgnoreElements:c=[]}){const o=r?"inert":n?"aria-hidden":null;let u=null,v=null;const M=Ve(t,e),O=s?Ve(t,c):[],A=new Set(O),z=s?gt(t,pt(M),new Set(M)).filter(m=>!A.has(m)):[],w=[],k=[];if(o){const m=De[o],y=gn(o);v=y,u=m;const b=Ve(t,Array.from(t.querySelectorAll("[aria-live]"))),E=M.concat(b);gt(t,pt(E),new Set(E)).forEach(N=>{const Y=N.getAttribute(o),J=Y!==null&&Y!=="false",I=(m.get(N)||0)+1;m.set(N,I),w.push(N),I===1&&J&&y.add(N),J||N.setAttribute(o,o==="inert"?"":"true")})}return s&&z.forEach(m=>{const y=(we.get(m)||0)+1;we.set(m,y),k.push(m),y===1&&m.setAttribute(dt,"")}),Xe+=1,()=>{u&&w.forEach(m=>{const b=(u.get(m)||0)-1;u.set(m,b),b||(!v?.has(m)&&o&&m.removeAttribute(o),v?.delete(m))}),s&&k.forEach(m=>{const y=(we.get(m)||0)-1;we.set(m,y),y||m.removeAttribute(dt)}),Xe-=1,Xe||(De.inert=new WeakMap,De["aria-hidden"]=new WeakMap,qe.inert=new WeakSet,qe["aria-hidden"]=new WeakSet,we=new WeakMap)}}function ht(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0,markerIgnoreElements:c=[]}=t,o=D(e[0]).body;return hn(e,o,n,r,{mark:s,markerIgnoreElements:c})}function kt(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class mn{nodesRef={current:[]};events=kt();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Pt=f.createContext(null),Ft=f.createContext(null),Ze=()=>f.useContext(Pt)?.id||null,et=e=>{const t=f.useContext(Ft);return e??t};function zn(e){const t=ze(),n=et(e),r=Ze();return G(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function Jn(e){const{children:t,id:n}=e,r=Ze();return Te.jsx(Pt.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Qn(e){const{children:t,externalTree:n}=e,r=St(()=>n??new mn).current;return Te.jsx(Ft.Provider,{value:r,children:t})}function bn(e,t){const n=We(Re(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const mt=20;let fe=[];function tt(){fe=fe.filter(e=>e.deref()?.isConnected)}function En(e){tt(),e&&Ot(e)!=="body"&&(fe.push(new WeakRef(e)),fe.length>mt&&(fe=fe.slice(-mt)))}function Ue(){return tt(),fe[fe.length-1]?.deref()}function yn(e){return e?Je(e)?e:wt(e)[0]||e:null}function bt(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=Qt(e).filter(c=>{const o=c.getAttribute("data-tabindex")||"";return Je(c)||c.hasAttribute("data-tabindex")&&!o.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Zn(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:c=!0,restoreFocus:o=!1,modal:u=!0,closeOnFocusOut:v=!0,openInteractionType:M="",nextFocusableElement:O,previousFocusableElement:A,beforeContentFocusGuardRef:z,externalTree:w,getInsideElements:k}=e,m="rootStore"in t?t.rootStore:t,y=m.useState("open"),b=m.useState("domReferenceElement"),E=m.useState("floatingElement"),{events:Z,dataRef:N}=m.context,Y=U(()=>N.current.floatingContext?.nodeId),J=s===!1,I=ot(b)&&J,ee=f.useRef(["content"]),se=Ge(s),P=Ge(c),ie=Ge(M),j=et(w),p=Bt(),$=f.useRef(!1),Q=f.useRef(!1),de=f.useRef(!1),oe=f.useRef(null),te=f.useRef(""),pe=f.useRef(""),ge=f.useRef(null),he=f.useRef(null),ke=ct(ge,z,p?.beforeInsideRef),R=ct(he,p?.afterInsideRef),q=Ae(),ce=Ae(),me=Gt(),Pe=p!=null,g=it(E),K=U((a=g)=>a?wt(a):[]),ne=U(()=>k?.().filter(a=>a!=null)??[]);f.useEffect(()=>{if(r||!u)return;function a(H){H.key==="Tab"&&C(g,ae(D(g)))&&K().length===0&&!I&&qt(H)}const W=D(g);return x(W,"keydown",a)},[r,g,u,I,K]),f.useEffect(()=>{if(r||!y)return;const a=D(g);function W(){de.current=!1}function H(S){const h=Re(S),F=ne(),d=C(E,h)||C(b,h)||C(p?.portalNode,h)||F.some(_=>_===h||C(_,h));de.current=!d,pe.current=S.pointerType||"keyboard",h?.closest(`[${jt}]`)&&(Q.current=!0)}function L(){pe.current="keyboard"}return xe(x(a,"pointerdown",H,!0),x(a,"pointerup",W,!0),x(a,"pointercancel",W,!0),x(a,"keydown",L,!0))},[r,E,b,g,y,p,ne]),f.useEffect(()=>{if(r||!v)return;const a=D(g);function W(){Q.current=!0,ce.start(0,()=>{Q.current=!1})}function H(F){const d=Re(F);Je(d)&&(oe.current=d)}function L(F){const d=F.relatedTarget,_=F.currentTarget,X=Re(F);queueMicrotask(()=>{const be=Y(),V=m.context.triggerElements,Le=ne(),i=d?.hasAttribute($e("focus-guard"))&&[ge.current,he.current,p?.beforeInsideRef.current,p?.afterInsideRef.current,p?.beforeOutsideRef.current,p?.afterOutsideRef.current,le(A),le(O)].includes(d),l=!(C(b,d)||C(E,d)||C(d,E)||C(p?.portalNode,d)||Le.some(T=>T===d||C(T,d))||d!=null&&V.hasElement(d)||V.hasMatchingElement(T=>C(T,d))||i||j&&(Ie(j.nodesRef.current,be).find(T=>C(T.context?.elements.floating,d)||C(T.context?.elements.domReference,d))||ft(j.nodesRef.current,be).find(T=>[T.context?.elements.floating,it(T.context?.elements.floating)].includes(d)||T.context?.elements.domReference===d)));if(_===b&&g&&bt(g,ee),o&&_!==b&&!zt(X)&&ae(a)===a.body){if(Ee(g)&&(g.focus(),o==="popup")){me.request(()=>{g.focus()});return}const T=K(),B=oe.current,ue=(B&&T.includes(B)?B:null)||T[T.length-1]||g;Ee(ue)&&ue.focus()}if(N.current.insideReactTree){N.current.insideReactTree=!1;return}(I||!u)&&d&&l&&!Q.current&&(I||d!==Ue())&&($.current=!0,m.setOpen(!1,Me(Jt,F)))})}function S(){de.current||(N.current.insideReactTree=!0,q.start(0,()=>{N.current.insideReactTree=!1}))}const h=Ee(b)?b:null;if(!(!E&&!h))return xe(h&&x(h,"focusout",L),h&&x(h,"pointerdown",W),E&&x(E,"focusin",H),E&&x(E,"focusout",L),E&&p&&x(E,"focusout",S,!0))},[r,b,E,g,u,j,p,m,v,o,K,I,Y,ee,N,q,ce,me,O,A,ne]),f.useEffect(()=>{if(r||!E||!y)return;const a=Array.from(p?.portalNode?.querySelectorAll(`[${$e("portal")}]`)||[]),H=(j?ft(j.nodesRef.current,Y()):[]).find(_=>ot(_.context?.elements.domReference||null))?.context?.elements.domReference,S=[...[E,...a,ge.current,he.current,p?.beforeOutsideRef.current,p?.afterOutsideRef.current,...ne()],H,le(A),le(O),I?b:null].filter(_=>_!=null),h=ht(S,{ariaHidden:u||I,mark:!1}),F=[E,...a].filter(_=>_!=null),d=ht(F);return()=>{d(),h()}},[y,r,b,E,u,p,I,j,Y,O,A,ne]),G(()=>{if(!y||r||!Ee(g))return;const a=D(g),W=ae(a);queueMicrotask(()=>{const H=se.current,L=typeof H=="function"?H(ie.current||""):H;if(L===void 0||L===!1||C(g,W))return;let h=null;const F=()=>(h==null&&(h=K(g)),h[0]||g);let d;L===!0||L===null?d=F():d=le(L),d=d||F();const _=C(g,ae(a));Ke(d,{preventScroll:d===g,shouldFocus(){if(_)return!0;const X=ae(a);return!(X!==d&&C(g,X))}})})},[r,y,g,K,se,ie]),G(()=>{if(r||!g)return;const a=D(g),W=ae(a);En(W);function H(S){if(S.open||(te.current=bn(S.nativeEvent,pe.current)),S.reason===Kt&&S.nativeEvent.type==="mouseleave"&&($.current=!0),S.reason===Ct)if(S.nested)$.current=!1;else if(Dt(S.nativeEvent)||Xt(S.nativeEvent))$.current=!1;else{let h=!1;D(g).createElement("div").focus({get preventScroll(){return h=!0,!1}}),h?$.current=!1:$.current=!0}}Z.on("openchange",H);function L(){const S=P.current;let h=typeof S=="function"?S(te.current):S;if(h===void 0||h===!1)return null;if(h===null&&(h=!0),typeof h=="boolean")return b?.isConnected?b:Ue()||null;const F=b?.isConnected?b:Ue();return le(h)||F||null}return()=>{Z.off("openchange",H);const S=ae(a),h=ne(),F=C(E,S)||h.some(X=>X===S||C(X,S))||j&&Ie(j.nodesRef.current,Y(),!1).some(X=>C(X.context?.elements.floating,S)),d=P.current,_=L();queueMicrotask(()=>{const X=yn(_),be=typeof d!="boolean";d&&!$.current&&Ee(X)&&(!(!be&&X!==S&&S!==a.body)||F)&&X.focus({preventScroll:!0}),$.current=!1})}},[r,E,g,P,Z,j,b,Y,ne]),G(()=>{if(!xt||y||!E)return;const a=ae(D(E));!Ee(a)||!Vt(a)||C(E,a)&&a.blur()},[y,E]),G(()=>{if(!(r||!p))return p.setFocusManagerState({modal:u,closeOnFocusOut:v,open:y,onOpenChange:m.setOpen,domReference:b}),()=>{p.setFocusManagerState(null)}},[r,p,u,y,m,v,b]),G(()=>{if(!(r||!g))return bt(g,ee),()=>{queueMicrotask(tt)}},[r,g,ee]);const ve=!r&&(u?!I:!0)&&(Pe||u);return Te.jsxs(f.Fragment,{children:[ve&&Te.jsx(ut,{"data-type":"inside",ref:ke,onFocus:a=>{if(u){const W=K();Ke(W[W.length-1])}else p?.portalNode&&($.current=!1,lt(a,p.portalNode)?Ut(b)?.focus():le(A??p.beforeOutsideRef)?.focus())}}),n,ve&&Te.jsx(ut,{"data-type":"inside",ref:R,onFocus:a=>{u?Ke(K()[0]):p?.portalNode&&(v&&($.current=!0),lt(a,p.portalNode)?$t(b)?.focus():le(O??p.afterOutsideRef)?.focus())}})]})}const Rn={intentional:"onClick",sloppy:"onPointerDown"};function Sn(){return!1}function Tn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function er(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:c="sloppy",referencePress:o=Sn,referencePressEvent:u="sloppy",bubbles:v,externalTree:M}=t,O="rootStore"in e?e.rootStore:e,A=O.useState("open"),z=O.useState("floatingElement"),{dataRef:w}=O.context,k=et(M),m=U(typeof s=="function"?s:()=>!1),y=typeof s=="function"?m:s,b=y!==!1,E=U(()=>c),{escapeKey:Z,outsidePress:N}=Tn(v),Y=f.useRef(!1),J=f.useRef(!1),I=f.useRef(!1),ee=f.useRef(!1),se=f.useRef(""),P=f.useRef(null),ie=Ae(),j=Ae(),p=U(()=>{j.clear(),w.current.insideReactTree=!1}),$=U(R=>{const q=w.current.floatingContext?.nodeId;return(k?Ie(k.nodesRef.current,q):[]).some(me=>me.context?.open&&!me.context.dataRef.current[R])}),Q=U(R=>He(R,O.select("floatingElement"))||He(R,O.select("domReferenceElement"))),de=U(R=>{o()&&O.setOpen(!1,Me(Zt,R.nativeEvent))}),oe=U(R=>{if(!A||!n||!r||R.key!=="Escape"||ee.current||!Z&&$("__escapeKeyBubbles"))return;const q=en(R)?R.nativeEvent:R,ce=Me(tn,q);O.setOpen(!1,ce),ce.isCanceled||R.preventDefault(),!Z&&!ce.isPropagationAllowed&&R.stopPropagation()}),te=U(()=>{w.current.insideReactTree=!0,j.start(0,p)}),pe=U(R=>{if(!A||!n||R.button!==0)return;const q=Re(R.nativeEvent);C(O.select("floatingElement"),q)&&(Y.current||(Y.current=!0,J.current=!1))}),ge=U(R=>{!A||!n||(R.defaultPrevented||R.nativeEvent.defaultPrevented)&&Y.current&&(J.current=!0)});f.useEffect(()=>{if(!A||!n)return;w.current.__escapeKeyBubbles=Z,w.current.__outsidePressBubbles=N;const R=new Ne,q=new Ne;function ce(){R.clear(),ee.current=!0}function me(){R.start(nn()?5:0,()=>{ee.current=!1})}function Pe(){I.current=!0,q.start(0,()=>{I.current=!1})}function g(){Y.current=!1,J.current=!1}function K(){const i=se.current,l=i==="pen"||!i?"mouse":i,T=E(),B=typeof T=="function"?T():T;return typeof B=="string"?B:B[l]}function ne(i){const l=K();return l==="intentional"&&i.type!=="click"||l==="sloppy"&&i.type==="click"}function ve(i){const l=w.current.floatingContext?.nodeId,T=k&&Ie(k.nodesRef.current,l).some(B=>He(i,B.context?.elements.floating));return Q(i)||T}function a(i){if(ne(i)){i.type!=="click"&&!Q(i)&&(q.clear(),I.current=!1),p();return}if(w.current.insideReactTree){p();return}const l=Re(i),T=`[${$e("inert")}]`,B=Ce(l)?l.getRootNode():null,ue=Array.from((vt(B)?B:D(O.select("floatingElement"))).querySelectorAll(T)),rt=O.context.triggerElements;if(l&&(rt.hasElement(l)||rt.hasMatchingElement(re=>C(re,l))))return;let Oe=Ce(l)?l:null;for(;Oe&&!_e(Oe);){const re=rn(Oe);if(_e(re)||!Ce(re))break;Oe=re}if(!(ue.length&&Ce(l)&&!sn(l)&&!C(l,O.select("floatingElement"))&&ue.every(re=>!C(Oe,re)))){if(Ee(l)&&!("touches"in i)){const re=_e(l),Ye=on(l),st=/auto|scroll/,Mt=re||st.test(Ye.overflowX),At=re||st.test(Ye.overflowY),Nt=Mt&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Wt=At&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Lt=Ye.direction==="rtl",Yt=Wt&&(Lt?i.offsetX<=l.offsetWidth-l.clientWidth:i.offsetX>l.clientWidth),Ht=Nt&&i.offsetY>l.clientHeight;if(Yt||Ht)return}if(!ve(i)){if(K()==="intentional"&&I.current){q.clear(),I.current=!1;return}typeof y=="function"&&!y(i)||$("__outsidePressBubbles")||(O.setOpen(!1,Me(Ct,i)),p())}}}function W(i){K()!=="sloppy"||i.pointerType==="touch"||!O.select("open")||!n||Q(i)||a(i)}function H(i){if(K()!=="sloppy"||!O.select("open")||!n||Q(i))return;const l=i.touches[0];l&&(P.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},ie.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function L(i,l){const T=Re(i);if(!T)return;const B=x(T,i.type,()=>{l(i),B()})}function S(i){se.current="touch",L(i,H)}function h(i){ie.clear(),i.type==="pointerdown"&&(se.current=i.pointerType),!(i.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&L(i,l=>{l.type==="pointerdown"?W(l):a(l)})}function F(i){if(!Y.current)return;const l=J.current;if(g(),K()==="intentional"){if(i.type==="pointercancel"){l&&Pe();return}if(!ve(i)){if(l){Pe();return}typeof y=="function"&&!y(i)||(q.clear(),I.current=!0,p())}}}function d(i){if(K()!=="sloppy"||!P.current||Q(i))return;const l=i.touches[0];if(!l)return;const T=Math.abs(l.clientX-P.current.startX),B=Math.abs(l.clientY-P.current.startY),ue=Math.sqrt(T*T+B*B);ue>5&&(P.current.dismissOnTouchEnd=!0),ue>10&&(a(i),ie.clear(),P.current=null)}function _(i){L(i,d)}function X(i){K()!=="sloppy"||!P.current||Q(i)||(P.current.dismissOnTouchEnd&&a(i),ie.clear(),P.current=null)}function be(i){L(i,X)}const V=D(z),Le=xe(r&&xe(x(V,"keydown",oe),x(V,"compositionstart",ce),x(V,"compositionend",me)),b&&xe(x(V,"click",h,!0),x(V,"pointerdown",h,!0),x(V,"pointerup",F,!0),x(V,"pointercancel",F,!0),x(V,"mousedown",h,!0),x(V,"mouseup",F,!0),x(V,"touchstart",S,!0),x(V,"touchmove",_,!0),x(V,"touchend",be,!0)));return()=>{Le(),R.clear(),q.clear(),g(),I.current=!1}},[w,z,r,b,y,A,n,Z,N,oe,p,E,$,Q,k,O,ie]),f.useEffect(p,[y,p]);const he=f.useMemo(()=>({onKeyDown:oe,[Rn[u]]:de,...u!=="intentional"&&{onClick:de}}),[oe,de,u]),ke=f.useMemo(()=>({onKeyDown:oe,onPointerDown:ge,onMouseDown:ge,onClickCapture:te,onMouseDownCapture(R){te(),pe(R)},onPointerDownCapture(R){te(),pe(R)},onMouseUpCapture:te,onTouchEndCapture:te,onTouchMoveCapture:te}),[oe,te,pe,ge]);return f.useMemo(()=>n?{reference:he,floating:ke,trigger:he}:{},[n,he,ke])}const vn={open:Se(e=>e.open),transitionStatus:Se(e=>e.transitionStatus),domReferenceElement:Se(e=>e.domReferenceElement),referenceElement:Se(e=>e.positionReference??e.referenceElement),floatingElement:Se(e=>e.floatingElement),floatingId:Se(e=>e.floatingId)};class On extends cn{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:c,...o}=t;super({...o,positionReference:o.referenceElement,domReferenceElement:o.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:kt(),nested:r,triggerElements:c},vn),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&un(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function wn(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:c,onOpenChange:o}=e,u=t.useState("open"),v=t.useState("activeTriggerElement"),M=t.useState(n?"popupElement":"positionerElement"),O=t.context.triggerElements,A=o,z=f.useRef(null);r===void 0&&z.current===null&&(z.current=new On({open:u,transitionStatus:void 0,referenceElement:v,floatingElement:M,triggerElements:O,onOpenChange:A,floatingId:s,syncOnly:!0,nested:c}));const w=r??z.current;return t.useSyncedValue("floatingId",s),G(()=>{const k={open:u,floatingId:s,referenceElement:v,floatingElement:M};Ce(v)&&(k.domReferenceElement=v),w.state.positionReference===w.state.referenceElement&&(k.positionReference=v),w.update(k)},[u,s,v,M,w]),w.context.onOpenChange=A,w.context.nested=c,w}function Cn(e,t=!1,n=!1){const[r,s]=f.useState(e&&t?"idle":void 0),[c,o]=f.useState(e);return e&&!c&&(o(!0),s("starting")),!e&&c&&r!=="ending"&&!n&&s("ending"),!e&&!c&&r==="ending"&&s(void 0),G(()=>{if(!e&&c&&r!=="ending"&&n){const u=ye.request(()=>{s("ending")});return()=>{ye.cancel(u)}}},[e,c,r,n]),G(()=>{if(!e||t)return;const u=ye.request(()=>{s(void 0)});return()=>{ye.cancel(u)}},[t,e]),G(()=>{if(!e||!t)return;e&&c&&r!=="idle"&&s("starting");const u=ye.request(()=>{s("idle")});return()=>{ye.cancel(u)}},[t,e,c,r]),{mounted:c,setMounted:o,transitionStatus:r}}const tr={tabIndex:-1,[an]:""};function nr(e,t,n=!1){const r=ze(),s=Ze()!=null,c=f.useRef(null);e===void 0&&c.current===null&&(c.current=t(r,s));const o=e??c.current;return wn({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:s,onOpenChange:o.setOpen}),{store:o,internalStore:c.current}}function xn(e,t){const n=f.useRef(null),r=f.useRef(null);return f.useCallback(s=>{if(e===void 0)return;let c=!1;if(n.current!==null){const o=n.current,u=r.current,v=t.context.triggerElements.getById(o);u&&v===u&&(t.context.triggerElements.delete(o),c=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),c=!0),c){const o=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==o&&t.set("triggerCount",o)}},[t,e])}function rr(e,t,n){const r=n?.id??null;(r||t)&&(e.activeTriggerId=r,e.activeTriggerElement=n??null)}function sr(e,t,n,r){const s=n.useState("isMountedByTrigger",e),c=xn(e,n),o=U(u=>{if(c(u),!u)return;const v=n.select("open"),M=n.select("activeTriggerId");if(M===e){n.update({activeTriggerElement:u,...v?r:null});return}M==null&&v&&n.update({activeTriggerId:e,activeTriggerElement:u,...r})});return G(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:s}}function or(e){const t=e.useState("open"),n=e.useState("triggerCount");G(()=>{if(!t){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const r=e.context.triggerElements.size,s={};if(e.state.triggerCount!==r&&(s.triggerCount=r),!e.select("activeTriggerId")&&r===1){const c=e.context.triggerElements.entries().next();if(!c.done){const[o,u]=c.value;s.activeTriggerId=o,s.activeTriggerElement=u}}(s.triggerCount!==void 0||s.activeTriggerId!==void 0)&&e.update(s)},[t,e,n])}function cr(e,t,n){const{mounted:r,setMounted:s,transitionStatus:c}=Cn(e);t.useSyncedValues({mounted:r,transitionStatus:c});const o=U(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),u=t.useState("preventUnmountingOnClose");return ln({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:c}}function ir(e,t){e.useSyncedValues(t),G(()=>()=>{e.update({activeTriggerProps:Be,inactiveTriggerProps:Be,popupProps:Be})},[e])}function ur(e,t){G(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),G(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class lr{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}let nt=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=at.startingStyle]="startingStyle",e[e.endingStyle=at.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),je=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const In={[je.popupOpen]:""},kn={[je.popupOpen]:"",[je.pressed]:""},Pn={[nt.open]:""},Fn={[nt.closed]:""},Mn={[nt.anchorHidden]:""},ar={open(e){return e?In:null}},fr={open(e){return e?kn:null}},dr={open(e){return e?Pn:Fn},anchorHidden(e){return e?Mn:null}};function pr(e){return ze(e,"base-ui")}const An="ArrowUp",Nn="ArrowDown",Wn="ArrowLeft",Ln="ArrowRight",Yn="Home",Hn="End",_n=new Set([Wn,Ln]),Bn=new Set([An,Nn]),Gn=new Set([..._n,...Bn]),gr=new Set([...Gn,Yn,Hn]),hr=f.forwardRef(function(t,n){const{cutout:r,...s}=t;let c;if(r){const o=r.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${o.left}px ${o.top}px,${o.left}px ${o.bottom}px,${o.right}px ${o.bottom}px,${o.right}px ${o.top}px,${o.left}px ${o.top}px)`}return Te.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});function mr(e){const t=f.useRef(!0);t.current&&(t.current=!1,e())}let Et={},yt={},Rt="";function Kn(e){if(typeof document>"u")return!1;const t=D(e);return We(t).innerWidth-t.documentElement.clientWidth>0}function Dn(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=D(e),r=n.documentElement,s=n.body,c=Qe(r)?r:s,o=c.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",c.style.overflowY="scroll";const v=c.offsetWidth;c.style.overflowY="hidden";const M=c.offsetWidth;return c.style.overflowY=o,r.style.scrollbarGutter=u,v===M}function Xn(e){const t=D(e),n=t.documentElement,r=t.body,s=Qe(n)?n:r,c={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,c)}}function Vn(e){const t=D(e),n=t.documentElement,r=t.body,s=We(n);let c=0,o=0,u=!1;const v=ye.create();if(xt&&(s.visualViewport?.scale??1)!==1)return()=>{};function M(){const w=s.getComputedStyle(n),k=s.getComputedStyle(r),b=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=n.scrollTop,o=n.scrollLeft,Et={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Rt=n.style.scrollBehavior,yt={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const E=n.scrollHeight>n.clientHeight,Z=n.scrollWidth>n.clientWidth,N=w.overflowY==="scroll"||k.overflowY==="scroll",Y=w.overflowX==="scroll"||k.overflowX==="scroll",J=Math.max(0,s.innerWidth-r.clientWidth),I=Math.max(0,s.innerHeight-r.clientHeight),ee=parseFloat(k.marginTop)+parseFloat(k.marginBottom),se=parseFloat(k.marginLeft)+parseFloat(k.marginRight),P=Qe(n)?n:r;if(u=Dn(e),u){n.style.scrollbarGutter=b,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:b,overflowY:"hidden",overflowX:"hidden"}),(E||N)&&(n.style.overflowY="scroll"),(Z||Y)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:ee||I?`calc(100dvh - ${ee+I}px)`:"100dvh",width:se||J?`calc(100vw - ${se+J}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=c,r.scrollLeft=o,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function O(){Object.assign(n.style,Et),Object.assign(r.style,yt),u||(n.scrollTop=c,n.scrollLeft=o,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Rt)}function A(){O(),v.request(M)}M();const z=x(s,"resize",A);return()=>{v.cancel(),O(),typeof s.removeEventListener=="function"&&z()}}class Un{lockCount=0;restore=null;timeoutLock=Ne.create();timeoutUnlock=Ne.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=D(t).documentElement,s=We(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=Tt;return}const c=fn||!Kn(t);this.restore=c?Xn(t):Vn(t)}}const $n=new Un;function br(e=!0,t=null){G(()=>{if(e)return $n.acquire(t)},[e,t])}export{nt as A,jn as C,Qn as F,hr as I,lr as P,Cn as a,et as b,Ze as c,Ge as d,nr as e,mr as f,Ie as g,ur as h,or as i,cr as j,er as k,tr as l,ir as m,sr as n,zn as o,fr as p,Jn as q,Zn as r,rr as s,ar as t,pr as u,gr as v,dr as w,On as x,Ke as y,br as z};
import{j as e,G as o,c3 as P,aR as I,r as u,a_ as B,R as D,V as M}from"./main-BbEXIjk8.js";import{S as E}from"./Select-D3gMIEdB.js";import{u as K,T as R}from"./use-native-settings-SsQX6gzC.js";import{F as L,S as G,a as O}from"./FadeIn-BrYhLQwK.js";import{A as $}from"./arrow-up-right-DJo_-PxX.js";import{D as z}from"./download-BwsW6vug.js";import"./SelectItemText-GvEnESYK.js";import"./useScrollLock-Dm_66oFo.js";import"./Card-CJiPCvnj.js";const H=["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:"codexSpark5h",label:"Codex Spark 5h Limit",shortLabel:"Cx Spark 5h",category:"limits"},{id:"codexSpark7d",label:"Codex Spark 7d Limit",shortLabel:"Cx Spark 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"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,a=F,r=2){const i=new Set(a.map(n=>n.id)),l=new Set,s=Array.isArray(t)?t.filter(n=>!i.has(n)||l.has(n)?!1:(l.add(n),!0)):[];return(s.length>0?s:H).slice(0,Math.max(1,Number(r)||2))}const U=264,V=124,h="ui-rounded, -apple-system, system-ui",C=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],X={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Y(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function b({size:t="sm",children:a}){const r=t==="lg",i=r?560:264,l=r?32:22;return e.jsx("div",{className:M("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",r?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:i,aspectRatio:`${U} / ${V}`,borderRadius:l},children:a})})}function Z({size:t="sm"}){const a="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",r=`${a} L264,124 L0,124 Z`,i=`sparkArea-${t}`;return e.jsx(b,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:i,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:h,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:h,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:"$673.61"}),e.jsx("path",{d:r,fill:`url(#${i})`,stroke:"none"}),e.jsx("path",{d:a,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const S=(()=>{const r=[];for(let i=0;i<26;i++)for(let l=0;l<7;l++){const s=Math.sin((i+1)*12.9898+(l+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(s-Math.floor(s))*100);r.push({w:i,d:l,v:c})}return r})();function A(t,a){return t<18?a?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function q(){return e.jsx(b,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:S.map(s=>e.jsx("rect",{x:s.w*(7.5+1.2),y:s.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(s.v,!0)},`d-${s.w}-${s.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:S.map(s=>e.jsx("rect",{x:s.w*(7.5+1.2),y:s.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:A(s.v,!1)},`l-${s.w}-${s.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:h,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function J(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],a=22,r=28,i=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((s,c)=>{const n=r+c*a,g=C[c%C.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:s.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:h,children:s.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:h,children:[s.pct,"%"]}),e.jsx("rect",{x:i,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:g})]},s.name)})})})}function Q(){const t=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],a=22,r=28,i=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((s,c)=>{const n=r+c*a,g=X[s.source],y=Y(s.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:s.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:h,children:s.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:h,children:[s.pct,"%"]}),e.jsx("rect",{x:i,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:i,y:n+4,width:Math.max(l*(s.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},s.label)})})})}function ee(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function te(t,a){switch(t){case"todayTokens":return o("menubar.metric.today_tokens");case"todayCost":return o("menubar.metric.today_cost");case"last7dTokens":return o("menubar.metric.last_7d_tokens");case"totalTokens":return o("menubar.metric.total_tokens");case"totalCost":return o("menubar.metric.total_cost");case"claude5h":return o("menubar.metric.claude_5h");case"claude7d":return o("menubar.metric.claude_7d");case"codex5h":return o("menubar.metric.codex_5h");case"codex7d":return o("menubar.metric.codex_7d");case"codexSpark5h":return o("menubar.metric.codex_spark_5h");case"codexSpark7d":return o("menubar.metric.codex_spark_7d");default:return a}}function ae(t,a){const r=new Set(a.map(l=>l.id)),i=t.filter(l=>r.has(l));for(const l of a){if(i.length>=2)break;i.includes(l.id)||i.push(l.id)}return i.slice(0,2)}function ie({slotConfigs:t,showStats:a}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),a?t.map(({slot:r,item:i},l)=>e.jsxs(D.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:M("flex min-w-[52px] flex-col items-center justify-center py-1.5",l===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:i?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:i?.shortLabel||"Metric"})]})]},r)):null]})})}function se({slot:t,value:a,options:r,disabled:i,onChange:l}){const s=t===0?o("menubar.slot.primary"):o("menubar.slot.secondary");return e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:s}),e.jsx(E,{value:a,disabled:i,ariaLabel:s,onValueChange:c=>l(t,c),options:r.map(c=>({value:c.id,label:c.displayLabel})),matchTriggerWidth:!0,className:"w-full px-3 py-2 text-sm font-medium"})]})}function p({label:t,hint:a,checked:r,disabled:i,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),a?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a}):null]}),e.jsx(R,{checked:r,disabled:i,onChange:l,ariaLabel:t})]})}function re(){const{available:t,settings:a,setSetting:r}=K(),i=u.useMemo(()=>(Array.isArray(a?.menuBarAvailableItems)?a.menuBarAvailableItems:F).map(m=>({...m,displayLabel:te(m.id,m.label),previewValue:ee(m)})),[a?.menuBarAvailableItems]),l=Number(a?.menuBarMaxItems)||2,s=u.useMemo(()=>N(a?.menuBarItems,i,l),[i,l,a?.menuBarItems]),c=u.useMemo(()=>ae(s,i),[i,s]),n=a?.showStats!==!1,g=d=>{r("menuBarItems",N(d,i,l))},y=(d,m)=>{const x=[...c];x[d===0?1:0]!==m&&(x[d]=m,g(x))},k=[0,1].map(d=>{const m=c[d]||i[d]?.id||"",v=c[d===0?1:0],W=i.filter(f=>f.id===m||f.id!==v),T=i.find(f=>f.id===m);return{slot:d,currentValue:m,options:W,item:T}}),w=a?.animatedIcon!==!1,j=a?.confettiOnReset!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(ie,{slotConfigs:k,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:k.map(({slot:d,currentValue:m,options:x})=>e.jsx(se,{slot:d,value:m,options:x,disabled:!t||!n,onChange:y},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(p,{label:o("settings.menubar.showStats"),hint:t?o("settings.menubar.showStatsHint"):o("menubar.native_only"),checked:n,disabled:!t,onChange:()=>r("showStats",!n)}),e.jsx(p,{label:o("settings.menubar.animatedIcon"),hint:o("settings.menubar.animatedIconHint"),checked:w,disabled:!t,onChange:()=>r("animatedIcon",!w)}),e.jsx(p,{label:o("settings.menubar.confettiOnReset"),hint:o("settings.menubar.confettiOnResetHint"),checked:j,disabled:!t,onChange:()=>r("confettiOnReset",!j)})]})]})}function le(){const[t,a]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(B()){a("native");return}const r=(navigator.userAgent||"").toLowerCase(),i=/mac/.test(r)&&!/iphone|ipad/.test(r);a(i?"mac-web":"other")},[]),t}function oe(){const t=le();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>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($,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(z,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(I,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.macos_only")]})}const ne=[{id:"summary",Preview:Z,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:q,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:J,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:Q,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function ce({Preview:t,nameKey:a,descKey:r}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:o(a)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:o(r)})]})]})}function _({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:o(t)})}function pe(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(L,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:o("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(oe,{})})]})}),e.jsx(L,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":o("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(_,{titleKey:"widgets.menubar.section.title"}),e.jsx(re,{})]})}),e.jsxs("section",{"aria-label":o("widgets.gallery.section.title"),children:[e.jsx(_,{titleKey:"widgets.gallery.section.title"}),e.jsx(G,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:ne.map(({id:t,Preview:a,nameKey:r,descKey:i})=>e.jsx(O,{children:e.jsx(ce,{Preview:a,nameKey:r,descKey:i})},t))})})]})]})})})}export{pe as WidgetsPage};
import{r as l,j as e,J as y}from"./main-BbEXIjk8.js";function o(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":y(a,{decimals:2}):"0"}function r({children:a,accent:n=!1,className:i=""}){const c="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",d=n?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${c} ${d} ${i}`,children:a})}function u(){const[a,n]=l.useState(null),[i,c]=l.useState("loading"),[d,g]=l.useState("");if(l.useEffect(()=>{let t=!1;const h=new URLSearchParams(window.location.search).get("year"),p=h?`/functions/tokentracker-wrapped?year=${encodeURIComponent(h)}`:"/functions/tokentracker-wrapped";return fetch(p).then(async s=>{if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}).then(s=>{t||(n(s),c(s.totals&&s.totals.tokens>0?"ready":"empty"))}).catch(s=>{t||(g(String(s?.message||s)),c("error"))}),()=>{t=!0}},[]),i==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:"Loading…"})});if(i==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-red-600 dark:text-red-300",children:["Couldn't load Wrapped: ",d]})})});if(i==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-oai-gray-500",children:["No data for that year yet. Run ",e.jsx("code",{children:"tracker sync"})," first."]})})});const x=t=>`${(t*100).toFixed(0)}%`;return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"TokenTracker Wrapped"}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(r,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:"Total tokens"}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:o(a.totals.tokens)}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:["across ",e.jsx("strong",{children:a.totals.conversations.toLocaleString("en-US")})," conversations,"," ",e.jsx("strong",{children:a.totals.active_days})," active days, and"," ",e.jsx("strong",{children:a.totals.sources})," tools"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top tools"}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[o(t.tokens)," · ",x(t.share)]})]},t.source))})]}),e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top models"}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[o(t.tokens)," · ",x(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Peak hour"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[o(a.peak_hour.tokens)," tokens"]})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Longest streak"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[a.longest_streak.days," days"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top days"}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:o(t.tokens)})]},t.day))})]}),a.highlights.length>0&&e.jsxs(r,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:"Highlights"}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:a.highlights.map((t,m)=>e.jsxs("li",{className:"text-base",children:["· ",t]},m))})]}),e.jsxs("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:["Generated from local queue.jsonl · share with"," ",e.jsx("code",{className:"font-mono",children:"tracker wrapped --json"})]})]})})}export{u as default};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display