tokentracker-cli 0.80.2 → 0.80.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{AchievementBadge-lZzUk8UJ.js → AchievementBadge-DX-LggX4.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-Ddht3Szx.js → AchievementsPage-B8wkE9xP.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-Bz9Enx-j.js → AchievementsSection-DtzmIf9I.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-C7QiFDH4.js → BadgeDetailModal-CZqdIWZQ.js} +1 -1
- package/dashboard/dist/assets/{Card-Cs_xyoXz.js → Card-BSUag_Em.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-C1Y6W_Di.js → ClawdAnimated-Dkhj87ak.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-B1VvGpUY.js → CommunityStatsModal-C9mK6lce.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-Cd-fM8lV.js → ConfirmModal-Bjh9H-Vd.js} +1 -1
- package/dashboard/dist/assets/{Controls-D0ULfwWh.js → Controls-BYSv1KGd.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-BjYHD7cb.js +19 -0
- package/dashboard/dist/assets/{DevicePage-BJsSXmi0.js → DevicePage-DHBd7LbW.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-BkG6LVKN.js → DialogClose-Be-pyoVu.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-doJbC76C.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-Do2zDkSF.js → DialogTitle-DeXrE3Jr.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-BlxFR4Uo.js → FadeIn-BIj6T_Ni.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-CsLBMMBv.js → HeaderGithubStar-CVPu84a0.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-Bi1QPsiQ.js → IpCheckPage-2JMGIL_x.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-Ble4Qxzj.js → LandingPage-B42AweLO.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-D2Iqj9VP.js → LeaderboardAvatar-j3c8hJFh.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-DImECEuN.js → LeaderboardPage-cOLb_Ssc.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-BGkNzlpU.js → LeaderboardProfileModal-DvdDUUFU.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-f-E74S02.js → LeaderboardProfilePage-Pg2Sggtd.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-BgTxwSrO.js → LimitsPage-DNMNpIgQ.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-D91Lp2zA.js → LocalOnlyNotice-Bm0n3EVD.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-hbsmEr6V.js → LoginPage-DlZ1jBtd.js} +1 -1
- package/dashboard/dist/assets/{PetPage-CIj7VSZN.js → PetPage-5Qk5nTRF.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-DMgjzzjH.js → PopoverPopup-RoYcoamh.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-Cv1mRgno.js → ResetPasswordPage-PbCAaF56.js} +1 -1
- package/dashboard/dist/assets/{Select-DvneEQak.js → Select-B3plxksi.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-BQlJKuRz.js → SelectItemText-Deyr9uQd.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-DpnL6Jm6.js → SettingsPage-DloJH8fs.js} +1 -1
- package/dashboard/dist/assets/{SkillsPage-Cz7d619N.js → SkillsPage-DHhXoof-.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-BP1zxfmh.js → WidgetsPage-CNGHvVDr.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-2eIams41.js → WrappedPage-2ZN38qnG.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-C0_7FQ0s.js → agent-logos-DApZ1E-T.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-DBYYRxgR.js → arrow-up-right-DMGmqVqe.js} +1 -1
- package/dashboard/dist/assets/check-D1YFQP0r.js +1 -0
- package/dashboard/dist/assets/{copy-BxhpNvJX.js → copy-CvnjBsmb.js} +1 -1
- package/dashboard/dist/assets/{download-DAvxmQ3t.js → download-sDeO57uc.js} +1 -1
- package/dashboard/dist/assets/{flame-DX9uRr7X.js → flame-CyiQUQcA.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-mMtru3Ww.js → format-tokens-DlkEG-2M.js} +1 -1
- package/dashboard/dist/assets/{info-BLfeChk0.js → info-482LCF96.js} +1 -1
- package/dashboard/dist/assets/{link-2-JVAqARKl.js → link-2-DY_0gFgX.js} +1 -1
- package/dashboard/dist/assets/{loader-circle--bezqxUZ.js → loader-circle-xebF61S5.js} +1 -1
- package/dashboard/dist/assets/main-BbNuscIe.css +1 -0
- package/dashboard/dist/assets/{main-8AbVGr5W.js → main-DY9GCwr_.js} +18 -17
- package/dashboard/dist/assets/{provider-display-DUwBv-X6.js → provider-display-B6jUb-Ud.js} +1 -1
- package/dashboard/dist/assets/{trash-2-Z1EIC4PI.js → trash-2-D0iohG1v.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-Dr1q98cg.js → use-community-stats-DPHOiIBu.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-DnacsQ0f.js → use-limits-display-prefs-BfSnFqTR.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-BgBQK2b0.js → use-native-settings-Cx_HZy8t.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-BBs8mEfc.js → use-ordered-list-IRGftZaJ.js} +1 -1
- package/dashboard/dist/assets/{use-quality-per-dollar-pref-BSagz4Mk.js → use-quality-per-dollar-pref-BoE3jESh.js} +1 -1
- package/dashboard/dist/assets/{use-transform-CL6RuAA2.js → use-transform-BJNb33iJ.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-CzNniz6Z.js → use-usage-limits-Dyoqxe1m.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-ByQkX7uG.js → useCurrency-f-244MeL.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-D5wf8_sp.js → useScrollLock-D6X4FH8b.js} +1 -1
- package/dashboard/dist/assets/useTokenFormat-Cz_Gqk4n.js +1 -0
- package/dashboard/dist/assets/{zap-v3s0o4Ig.js → zap-DN1VaJU3.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/commands/sync.js +4 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/DashboardPage-DXbecrQR.js +0 -19
- package/dashboard/dist/assets/DialogDescription-DDDcU_07.js +0 -1
- package/dashboard/dist/assets/check-B1MZEuWp.js +0 -1
- package/dashboard/dist/assets/main-ilWqzAfD.css +0 -1
- package/dashboard/dist/assets/useTokenFormat-BpdwKlbn.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as he,r as i,j as e,E as n,Y as Ie,k as He,G as Ge,X as Oe,aE as qe}from"./main-8AbVGr5W.js";import{u as Ke}from"./useCurrency-ByQkX7uG.js";import{u as Se}from"./useTokenFormat-BpdwKlbn.js";import{I as Ze}from"./info-BLfeChk0.js";const Ve=[["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"}]],Je=he("maximize-2",Ve);const Qe=[["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"}]],et=he("pause",Qe);const tt=[["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"}]],at=he("play",tt);const rt=[["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"}]],ot=he("rotate-ccw",rt);const nt=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],st=he("terminal",nt),te={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 lt(s,x){const h=/^#([0-9a-f]{6})$/i.exec(s);if(!h)return s;const c=parseInt(h[1],16),N=c>>16&255,D=c>>8&255,Y=c&255,R=T=>Math.max(0,Math.min(255,Math.round(T*x)));return`rgb(${R(N)}, ${R(D)}, ${R(Y)})`}function O(s,x,h,c,N){const D=Math.cos(c),Y=Math.sin(c),R=s*D-x*Y,T=s*Y+x*D,S=h,E=Math.cos(N),$=Math.sin(N),q=R,p=T*E-S*$,v=T*$+S*E;return{x:q,y:p,z:v}}function it(s,x,h,c,N){return O(s,x,h,c,N)}function Ae(s,x,h=c=>Number(c).toLocaleString()){const c=h(x);if(s>=4){const N=Math.floor(Math.random()*3)+1;return n(`heatmap.3d.voxel.joke.${N}`,{value:c})}else return s===3?n("heatmap.3d.voxel.level3",{value:c}):s===2?n("heatmap.3d.voxel.level2",{value:c}):s===1?n("heatmap.3d.voxel.level1",{value:c}):n("heatmap.3d.voxel.level0")}function Ee({weeks:s,palette:x="auto",isDark:h=!1,interactive:c=!1,autoRotateInit:N=!1,onResetViewRef:D=null}){const{formatTokens:Y,formatTokensTooltip:R}=Se(),T=te[x]||(x==="auto"?te.emerald:null),S=T?h?T.dark:T.light:Array.isArray(x)?x:h?te.emerald.dark:te.emerald.light,E=T?h?T.gridColor.dark:T.gridColor.light:h?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",$=-.2,q=.88,[p,v]=i.useState({yaw:$,pitch:q}),[ce,K]=i.useState(N),[fe,L]=i.useState(1),C=c?13:10.5,ge=i.useMemo(()=>{const t=[],r=s.length;if(r===0||!c)return[];for(let l=0;l<=7;l++){const o=(l-3.5)*C,d=O(-r/2*C,o,0,p.yaw,p.pitch),u=O(r/2*C,o,0,p.yaw,p.pitch);t.push({d:`M${d.x},${d.y} L${u.x},${u.y}`,key:`horiz-${l}`})}for(let l=0;l<=r;l+=4){const o=(l-r/2)*C,d=O(o,-3.5*C,0,p.yaw,p.pitch),u=O(o,3.5*C,0,p.yaw,p.pitch);t.push({d:`M${d.x},${d.y} L${u.x},${u.y}`,key:`vert-${l}`})}if(r%4!==0){const l=(r-r/2)*C,o=O(l,-3.5*C,0,p.yaw,p.pitch),d=O(l,3.5*C,0,p.yaw,p.pitch);t.push({d:`M${o.x},${o.y} L${d.x},${d.y}`,key:"vert-last"})}return t},[s.length,p,C,c]);i.useEffect(()=>{D&&(D.current={reset:()=>{v({yaw:$,pitch:q}),K(!1),L(1),ve()},toggleAutoRotate:t=>{K(t)}})},[D]);const Z=i.useRef(null),I=i.useRef(null),F=i.useRef(!1),de=i.useRef({x:0,y:0}),V=i.useRef({yaw:$,pitch:q}),U=i.useRef({x:0,y:0}),oe=i.useRef({x:0,y:0,time:0}),ne=i.useRef(null),[ye,be]=i.useState(0),J=i.useRef(null),se=i.useRef(!0);i.useEffect(()=>(se.current=!0,()=>{se.current=!1}),[]);const ve=()=>{J.current&&cancelAnimationFrame(J.current),be(0);const t=performance.now(),r=1200,l=o=>{if(!se.current)return;const d=o-t,u=Math.min(1,d/r),w=1-Math.pow(1-u,3);be(w),u<1?J.current=requestAnimationFrame(l):J.current=null};J.current=requestAnimationFrame(l)};i.useEffect(()=>(ve(),()=>{J.current&&cancelAnimationFrame(J.current)}),[c]),i.useEffect(()=>{if(!ce||F.current||typeof window>"u"||typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let r;const l=()=>{if(typeof document<"u"&&document.visibilityState==="hidden"){r=requestAnimationFrame(l);return}v(o=>({yaw:o.yaw+.002,pitch:o.pitch})),r=requestAnimationFrame(l)};return r=requestAnimationFrame(l),()=>cancelAnimationFrame(r)},[ce]);const me=(t,r)=>{c&&(F.current=!0,de.current={x:t,y:r},V.current={yaw:p.yaw,pitch:p.pitch},U.current={x:0,y:0},oe.current={x:t,y:r,time:performance.now()},ne.current&&cancelAnimationFrame(ne.current))},X=(t,r)=>{if(!F.current)return;const l=t-de.current.x,o=r-de.current.y,d=performance.now(),u=d-oe.current.time;u>0&&(U.current={x:(t-oe.current.x)/u,y:(r-oe.current.y)/u}),oe.current={x:t,y:r,time:d};const w=.005,f=V.current.yaw-l*w,g=Math.PI/2.3,P=Math.max(-g,Math.min(g,V.current.pitch-o*w));v({yaw:f,pitch:P})},ke=()=>{if(!F.current)return;F.current=!1;let t=-U.current.x*12,r=-U.current.y*12;const l=.95,o=()=>{F.current||(t*=l,r*=l,!(Math.abs(t)<.01&&Math.abs(r)<.01)&&(v(d=>{const u=d.yaw+t*.005,w=Math.PI/2.3,f=Math.max(-w,Math.min(w,d.pitch+r*.005));return{yaw:u,pitch:f}}),ne.current=requestAnimationFrame(o)))};ne.current=requestAnimationFrame(o)},[y,xe]=i.useState(null),[Q,pe]=i.useState({x:0,y:0,shiftX:0}),b=i.useRef(null);i.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]),i.useEffect(()=>{if(!c||!I.current)return;const t=l=>{l.preventDefault();const o=-l.deltaY*.0025;L(d=>{const u=d+o;return Math.max(.5,Math.min(3,u))})},r=I.current;return r.addEventListener("wheel",t,{passive:!1}),()=>{r.removeEventListener("wheel",t)}},[c]);const z=i.useMemo(()=>{const t=[];return s.forEach((r,l)=>{(Array.isArray(r)?r:[]).forEach((o,d)=>{o&&t.push({key:o.day||`${l}-${d}`,col:l,row:d,level:o.level||0,value:o.value||0,day:o.day,models:o.models||null})})}),t},[s]),we=C-(c?1.8:1.5),je=c?38:28,ee=t=>Math.max(1.8,Number(t)/4*je),ae=i.useMemo(()=>{if(z.length===0)return[];const t=s.length;return z.map(r=>{const l=ee(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)),u=o/d*.4,w=Math.min(1,Math.max(0,(ye-u)*(1/.6))),f=l*w,g=(r.col-t/2)*C,P=(r.row-3.5)*C,j=we/2,G=[{x:g-j,y:P-j,z:0},{x:g+j,y:P-j,z:0},{x:g+j,y:P+j,z:0},{x:g-j,y:P+j,z:0},{x:g-j,y:P-j,z:f},{x:g+j,y:P-j,z:f},{x:g+j,y:P+j,z:f},{x:g-j,y:P+j,z:f}].map(W=>O(W.x,W.y,W.z,p.yaw,p.pitch)),ue=O(g,P,f/2,p.yaw,p.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]}],Pe=S[Math.min(4,Math.max(0,Number(r.level)||0))],ze=[],De=.35,Ye=-.4,Ue=.83;return Le.forEach(W=>{const Ne=it(W.normal[0],W.normal[1],W.normal[2],p.yaw,p.pitch);if(Ne.z>.001){const Me=G[W.indices[0]],Te=G[W.indices[1]],_e=G[W.indices[2]],$e=G[W.indices[3]],Xe=`M${Me.x},${Me.y} L${Te.x},${Te.y} L${_e.x},${_e.y} L${$e.x},${$e.y} Z`,Be=Ne.x*De+Ne.y*Ye+Ne.z*Ue,We=h?.18:0,Fe=W.scale*(.82+.28*Math.max(0,Be))+We;ze.push({name:W.name,d:Xe,fill:lt(Pe,Fe)})}}),{...r,centerProj:ue,renderedFaces:ze}})},[z,p,S,s.length,ye,C,we,je]),le=i.useMemo(()=>[...ae].sort((t,r)=>t.centerProj.z-r.centerProj.z),[ae]),_=i.useMemo(()=>{if(le.length===0)return{minX:-100,minY:-100,maxX:100,maxY:100};let t=1/0,r=1/0,l=-1/0,o=-1/0;return le.forEach(d=>{const u=C*2,w=d.centerProj.x,f=d.centerProj.y;w-u<t&&(t=w-u),w+u>l&&(l=w+u),f-u<r&&(r=f-u),f+u>o&&(o=f+u)}),{minX:t,minY:r,maxX:l,maxY:o}},[le,C]),A=12,a=_.maxX-_.minX+A*2,m=_.maxY-_.minY+A*2,M=a/fe,k=m/fe,B=_.minX-A+(a-M)/2,H=_.minY-A+(m-k)/2,ie=`${B} ${H} ${M} ${k}`;return z.length===0?e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:n("heatmap.empty")}):e.jsxs("div",{ref:I,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;me(t.clientX,t.clientY);const r=o=>X(o.clientX,o.clientY),l=()=>{ke(),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",l)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",l)},onTouchStart:t=>{!c||t.touches.length===0||me(t.touches[0].clientX,t.touches[0].clientY)},onTouchMove:t=>{!c||t.touches.length===0||X(t.touches[0].clientX,t.touches[0].clientY)},onTouchEnd:()=>{c&&ke()},children:[e.jsxs("svg",{ref:Z,viewBox:ie,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&&ge.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=y&&y.key===t.key;return e.jsxs("g",{onMouseEnter:l=>{if(b.current&&(clearTimeout(b.current),b.current=null),xe(t),c&&Z.current){const o=O((t.col-s.length/2)*C,(t.row-3.5)*C,ee(t.level),p.yaw,p.pitch);let d=0,u=0;const w=Z.current;if(I.current&&typeof w.createSVGPoint=="function"&&typeof w.getScreenCTM=="function")try{const j=w.createSVGPoint();j.x=o.x,j.y=o.y;const re=w.getScreenCTM();if(re){const G=j.matrixTransform(re),ue=I.current.getBoundingClientRect();d=G.x-ue.left,u=G.y-ue.top}}catch{const re=w.getBoundingClientRect(),G=_.maxX-_.minX+A*2,ue=_.maxY-_.minY+A*2;d=(o.x-(_.minX-A))/G*re.width,u=(o.y-(_.minY-A))/ue*re.height}else{const j=w.getBoundingClientRect(),re=_.maxX-_.minX+A*2,G=_.maxY-_.minY+A*2;d=(o.x-(_.minX-A))/re*j.width,u=(o.y-(_.minY-A))/G*j.height}const f=140;let g=0;const P=I.current?I.current.getBoundingClientRect().width:w.getBoundingClientRect().width;d<f?g=f-d:d>P-f&&(g=P-f-d),pe({x:d,y:u,shiftX:g})}},onMouseLeave:()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{xe(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}: ${R(t.value)} tokens`}),t.renderedFaces.map((l,o)=>e.jsx("path",{d:l.d,fill:l.fill,stroke:l.fill,strokeWidth:.25,strokeLinejoin:"round"},o))]},t.key)})]}),c&&y&&e.jsxs("div",{onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{xe(null)},150)},className:"absolute z-[9999] w-0 h-0 transition-all duration-100 ease-out",style:{left:`${Q.x}px`,top:`${Q.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% + ${Q.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:y.day}),(()=>{const t=y.level===0?h?"#9ca3af":"#6b7280":S[y.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 ",y.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{title:R(y.value),className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:Y(y.value)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),y.models&&Object.keys(y.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(y.models).map(([t,r])=>({name:t,val:Number(r)})).sort((t,r)=>r.val-t.val).map(({name:t,val:r})=>{const l=Number(y.value)||1,o=Math.round(r/l*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",{title:R(r),className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:Y(r)}),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:Ae(y.level,y.value,Y)})]})]}),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 ct=12,dt=3,mt=26,xt=["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],ut=["#121212","#065f46","#059669","#10b981","#34d399"];function pt(s){if(typeof s!="string")return null;const x=/^(\d{4})-(\d{2})-(\d{2})$/.exec(s.trim());if(!x)return null;const h=new Date(Date.UTC(Number(x[1]),Number(x[2])-1,Number(x[3])));return Number.isFinite(h.getTime())?h:null}function Re(s,x){return new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()+x))}function ht(s,x){return Math.floor((Date.UTC(x.getUTCFullYear(),x.getUTCMonth(),x.getUTCDate())-Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()))/864e5)}function ft(s,x){const h=x==="mon"?1:0,c=s.getUTCDay();return Re(s,-((c-h+7)%7))}function gt(s,x,h,c){if(!s)return[];const N=pt(x)||new Date,D=[];for(let E=11;E>=0;E-=1)D.push(new Date(Date.UTC(N.getUTCFullYear(),N.getUTCMonth()-E,1)));const Y=ft(N,h),R=Re(Y,-(s-1)*7),T=[],S=new Set;for(const E of D){const $=Math.floor(ht(R,E)/7);$<0||$>=s||S.has($)||(S.add($),T.push({label:c[E.getUTCMonth()],index:$}))}return T}function Nt({heatmap:s,timeZoneLabel:x,timeZoneShortLabel:h,hideLegend:c=!1,embedded:N=!1}){const{resolvedTheme:D}=Ie(),{currency:Y,rate:R}=Ke(),{formatTokens:T,formatTokensTooltip:S}=Se(),E=D==="dark",$=E?ut:xt,q=i.useRef(null),p=i.useRef(null),[v,ce]=i.useState(null),[K,fe]=i.useState({x:0,y:0,shiftX:0,flipY:!1}),L=i.useRef(null);i.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]);const[C,ge]=i.useState(!1),[Z,I]=i.useState(!1),[F,de]=i.useState(!1),V=i.useRef(null),[U,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")],ye=(a,m)=>{if(!m||!m.day)return;L.current&&(clearTimeout(L.current),L.current=null),ce(m);const M=a.currentTarget.getBoundingClientRect(),k=typeof window<"u"?window.innerWidth:1024,B=M.left+M.width/2,H=M.top<300,ie=H?M.bottom:M.top,t=140;let r=0;B<t?r=t-B:B>k-t&&(r=k-t-B),fe({x:B,y:ie,shiftX:r,flipY:H})},be=()=>{L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{ce(null)},150)},J=()=>{I(!1),ge(!0)},se=()=>{I(!0)},ve=a=>{a.target===a.currentTarget&&Z&&(ge(!1),I(!1))};i.useEffect(()=>{if(!C||Z)return;const a=m=>{m.key==="Escape"&&se()};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[C,Z]);const me=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"}}),[]),X=me[U]||me.emerald,ke=te[U]?E?te[U].dark:te[U].light:E?te.emerald.dark:te.emerald.light,[y,xe]=i.useState(()=>{if(N)return"2d";try{return window.localStorage?.getItem("tt:heatmap-view")==="3d"?"3d":"2d"}catch{return"2d"}});i.useEffect(()=>{if(!N)try{window.localStorage?.setItem("tt:heatmap-view",y)}catch{}},[y,N]),i.useEffect(()=>{if(y!=="2d")return;const a=q.current;a&&(a.scrollLeft=a.scrollWidth)},[s?.weeks,y]),i.useEffect(()=>{const a=q.current;if(!a)return;const m=()=>{L.current&&(clearTimeout(L.current),L.current=null),ce(null)};return a.addEventListener("scroll",m),()=>a.removeEventListener("scroll",m)},[]);const Q=s?.week_starts_on==="mon"?"mon":"sun",pe=i.useMemo(()=>{const a=Array.isArray(s?.weeks)?s.weeks:[];if(!a.length)return{weeks:[]};const m=[];for(const M of a)for(const k of Array.isArray(M)?M:[])k?.day&&m.push({day:k.day,total_tokens:k.total_tokens??k.value??0,billable_total_tokens:k.billable_total_tokens??k.value??k.total_tokens??0,models:k.models??null});return He({dailyRows:m,weeks:Math.max(52,a.length),to:s?.to,weekStartsOn:Q})},[s?.to,s?.weeks,Q]),b=pe?.weeks||[],z=i.useMemo(()=>{let a=0,m=0,M={day:"无数据",value:0},k=0,B=0;const H=[];b.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?(m++,k++,k>B&&(B=k)):k=0,g>M.value&&(M={day:f.day,value:g})});const ie=H.length||365,t=(m/ie*100).toFixed(1);let r="heatmap.3d.modal.ai.eval.default",l="heatmap.3d.modal.ai.title.default";a>=15e6?(l="heatmap.3d.modal.ai.title.peak",r="heatmap.3d.modal.ai.eval.peak"):a>=5e6?(l="heatmap.3d.modal.ai.title.heavy",r="heatmap.3d.modal.ai.eval.heavy"):a>=1e6?(l="heatmap.3d.modal.ai.title.core",r="heatmap.3d.modal.ai.eval.core"):a>=2e4&&(l="heatmap.3d.modal.ai.title.steady",r="heatmap.3d.modal.ai.eval.steady");const o=s?.total_cost_usd,d=Number(o),w=o!=null&&(typeof o!="string"||o.trim()!=="")&&Number.isFinite(d)?d:a/15e5;return{totalTokens:a,activeDays:m,activeRate:t,maxSingleDay:M,maxStreak:B,aiEvaluationTitleKey:l,aiEvaluationKey:r,totalCostUsd:w}},[b,s?.total_cost_usd]),Ce=i.useMemo(()=>Ge(z.totalCostUsd,{currency:Y,rate:R}),[z.totalCostUsd,Y,R]),we=Q==="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()}`)),je=i.useMemo(()=>gt(b.length,pe?.to,Q,ne),[pe?.to,b.length,Q,ne]);if(!b.length)return e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:n("heatmap.empty")});const ee=N?10:ct,ae=N?2:dt,le=N?22:mt,_=le+b.length*ee+Math.max(0,b.length-1)*ae,A=`${le}px repeat(${b.length}, ${ee}px)`;return e.jsxs("div",{ref:p,className:N?"relative":"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[!N&&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":y==="2d",onClick:()=>xe("2d"),className:y==="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":y==="3d",onClick:()=>xe("3d"),className:y==="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:h||n("heatmap.legend.utc")})]})]}),y==="3d"&&e.jsxs("div",{onClick:J,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(Ee,{weeks:b,isDark:E,palette:U}),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(Je,{size:9}),n("heatmap.3d.hover_tip")]})})]}),y==="2d"&&e.jsx("div",{ref:q,className:"overflow-x-auto overflow-y-hidden heatmap-scroll-thin",children:e.jsxs("div",{style:{minWidth:_},children:[e.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:A,columnGap:ae},children:[e.jsx("span",{}),je.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:A,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, ${ee}px)`,rowGap:ae},children:we.map(a=>e.jsx("span",{className:"leading-none",children:a},a))}),e.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${ee}px)`,gap:ae},children:b.map((a,m)=>(Array.isArray(a)?a:[]).map((M,k)=>{if(!M)return null;const B=M.day||`e-${m}-${k}`,H=Number(M.level)||0,ie=$[H]||$[0];return e.jsx("span",{onMouseEnter:t=>ye(t,M),onMouseLeave:be,className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10 cursor-pointer",style:{width:ee,height:ee,background:ie}},B)}))})]})]})}),!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:$.map((a,m)=>e.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:a}},m))}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:n("heatmap.legend.more")})]}),C&&e.jsx("div",{onAnimationEnd:ve,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 ${Z?"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 ${Z?"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(Oe,{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:X.rawColor}}),e.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5",style:{backgroundColor:X.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:[S(z.totalTokens)," 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:T(z.totalTokens,{decimals:2})}),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:X.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:Ce})]}),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:[z.activeRate,"% ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",z.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:[z.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:[z.maxSingleDay.value>0?S(z.maxSingleDay.value):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:z.maxSingleDay.day!=="无数据"?z.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:[z.maxSingleDay.value>0?T(z.maxSingleDay.value,{decimals:2}):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:["(",z.maxSingleDay.day!=="无数据"?z.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(st,{size:11,style:{color:X.rawColor}}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono",style:{color:X.rawColor},children:n(z.aiEvaluationTitleKey)})]}),e.jsxs("div",{className:"pl-3.5 border-l-2 relative transition-all duration-300 group",style:{borderColor:X.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:X.rawColor}}),e.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-600 dark:text-zinc-400 font-normal",children:n(z.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.${U}`)})]}),e.jsx("div",{className:"flex gap-1",children:ke.map((a,m)=>e.jsx("div",{className:"flex-1 h-1 rounded-[2px]",style:{backgroundColor:a},title:`Level ${m}`},m))})]})})]}),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:X.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(me).map(a=>{const m=U===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:m&&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=!F;de(a),V.current&&V.current.toggleAutoRotate(a)},title:F?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 ${F?X.accentText:"text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250"}`,children:F?e.jsx(et,{size:12}):e.jsx(at,{size:12})}),e.jsx("button",{type:"button",onClick:()=>{de(!1),V.current&&V.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(ot,{size:12})})]})]}),e.jsx(Ee,{weeks:b,isDark:E,interactive:!0,palette:U,autoRotateInit:F,onResetViewRef:V}),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:X.accentText}),e.jsx("span",{children:n("heatmap.3d.modal.footer.tip")})]})]})]})}),v&&!C&&typeof document<"u"&&qe.createPortal(e.jsxs("div",{className:"fixed z-[9999] w-0 h-0 transition-all duration-100 ease-out pointer-events-none",style:{position:"fixed",left:`${K.x}px`,top:`${K.y}px`},children:[e.jsxs("div",{className:`absolute left-0 ${K.flipY?"top-[10px]":"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% + ${K.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:v.day}),(()=>{const a=v.level===0?E?"#9ca3af":"#6b7280":$[v.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 ",v.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{title:S(v.total_tokens??v.value),className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:T(v.total_tokens??v.value)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),v.models&&Object.keys(v.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(v.models).map(([a,m])=>({name:a,val:Number(m)})).sort((a,m)=>m.val-a.val).map(({name:a,val:m})=>{const M=Number(v.total_tokens??v.value)||1,k=Math.round(m/M*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",{title:S(m),className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:T(m)}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[k,"%"]})]})]}),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:`${k}%`,backgroundColor:$[4],boxShadow:`0 0 4px ${$[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:Ae(v.level,v.total_tokens??v.value,T)})]})]}),e.jsx("div",{className:`absolute left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 shadow-sm ${K.flipY?"top-[6px] border-l border-t":"bottom-[6px] border-r border-b"} border-oai-gray-200/50 dark:border-oai-gray-800/50`,style:K.flipY?{marginTop:"1px"}:{marginBottom:"1px"}})]}),document.body),e.jsx("style",{children:`
|
|
1
|
+
import{c as he,r as i,j as e,E as n,Y as Ie,k as He,G as Ge,X as Oe,aE as qe}from"./main-DY9GCwr_.js";import{u as Ke}from"./useCurrency-f-244MeL.js";import{u as Se}from"./useTokenFormat-Cz_Gqk4n.js";import{I as Ze}from"./info-482LCF96.js";const Ve=[["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"}]],Je=he("maximize-2",Ve);const Qe=[["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"}]],et=he("pause",Qe);const tt=[["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"}]],at=he("play",tt);const rt=[["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"}]],ot=he("rotate-ccw",rt);const nt=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],st=he("terminal",nt),te={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 lt(s,x){const h=/^#([0-9a-f]{6})$/i.exec(s);if(!h)return s;const c=parseInt(h[1],16),N=c>>16&255,D=c>>8&255,Y=c&255,R=T=>Math.max(0,Math.min(255,Math.round(T*x)));return`rgb(${R(N)}, ${R(D)}, ${R(Y)})`}function O(s,x,h,c,N){const D=Math.cos(c),Y=Math.sin(c),R=s*D-x*Y,T=s*Y+x*D,S=h,E=Math.cos(N),$=Math.sin(N),q=R,p=T*E-S*$,v=T*$+S*E;return{x:q,y:p,z:v}}function it(s,x,h,c,N){return O(s,x,h,c,N)}function Ae(s,x,h=c=>Number(c).toLocaleString()){const c=h(x);if(s>=4){const N=Math.floor(Math.random()*3)+1;return n(`heatmap.3d.voxel.joke.${N}`,{value:c})}else return s===3?n("heatmap.3d.voxel.level3",{value:c}):s===2?n("heatmap.3d.voxel.level2",{value:c}):s===1?n("heatmap.3d.voxel.level1",{value:c}):n("heatmap.3d.voxel.level0")}function Ee({weeks:s,palette:x="auto",isDark:h=!1,interactive:c=!1,autoRotateInit:N=!1,onResetViewRef:D=null}){const{formatTokens:Y,formatTokensTooltip:R}=Se(),T=te[x]||(x==="auto"?te.emerald:null),S=T?h?T.dark:T.light:Array.isArray(x)?x:h?te.emerald.dark:te.emerald.light,E=T?h?T.gridColor.dark:T.gridColor.light:h?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",$=-.2,q=.88,[p,v]=i.useState({yaw:$,pitch:q}),[ce,K]=i.useState(N),[fe,L]=i.useState(1),C=c?13:10.5,ge=i.useMemo(()=>{const t=[],r=s.length;if(r===0||!c)return[];for(let l=0;l<=7;l++){const o=(l-3.5)*C,d=O(-r/2*C,o,0,p.yaw,p.pitch),u=O(r/2*C,o,0,p.yaw,p.pitch);t.push({d:`M${d.x},${d.y} L${u.x},${u.y}`,key:`horiz-${l}`})}for(let l=0;l<=r;l+=4){const o=(l-r/2)*C,d=O(o,-3.5*C,0,p.yaw,p.pitch),u=O(o,3.5*C,0,p.yaw,p.pitch);t.push({d:`M${d.x},${d.y} L${u.x},${u.y}`,key:`vert-${l}`})}if(r%4!==0){const l=(r-r/2)*C,o=O(l,-3.5*C,0,p.yaw,p.pitch),d=O(l,3.5*C,0,p.yaw,p.pitch);t.push({d:`M${o.x},${o.y} L${d.x},${d.y}`,key:"vert-last"})}return t},[s.length,p,C,c]);i.useEffect(()=>{D&&(D.current={reset:()=>{v({yaw:$,pitch:q}),K(!1),L(1),ve()},toggleAutoRotate:t=>{K(t)}})},[D]);const Z=i.useRef(null),I=i.useRef(null),F=i.useRef(!1),de=i.useRef({x:0,y:0}),V=i.useRef({yaw:$,pitch:q}),U=i.useRef({x:0,y:0}),oe=i.useRef({x:0,y:0,time:0}),ne=i.useRef(null),[ye,be]=i.useState(0),J=i.useRef(null),se=i.useRef(!0);i.useEffect(()=>(se.current=!0,()=>{se.current=!1}),[]);const ve=()=>{J.current&&cancelAnimationFrame(J.current),be(0);const t=performance.now(),r=1200,l=o=>{if(!se.current)return;const d=o-t,u=Math.min(1,d/r),w=1-Math.pow(1-u,3);be(w),u<1?J.current=requestAnimationFrame(l):J.current=null};J.current=requestAnimationFrame(l)};i.useEffect(()=>(ve(),()=>{J.current&&cancelAnimationFrame(J.current)}),[c]),i.useEffect(()=>{if(!ce||F.current||typeof window>"u"||typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let r;const l=()=>{if(typeof document<"u"&&document.visibilityState==="hidden"){r=requestAnimationFrame(l);return}v(o=>({yaw:o.yaw+.002,pitch:o.pitch})),r=requestAnimationFrame(l)};return r=requestAnimationFrame(l),()=>cancelAnimationFrame(r)},[ce]);const me=(t,r)=>{c&&(F.current=!0,de.current={x:t,y:r},V.current={yaw:p.yaw,pitch:p.pitch},U.current={x:0,y:0},oe.current={x:t,y:r,time:performance.now()},ne.current&&cancelAnimationFrame(ne.current))},X=(t,r)=>{if(!F.current)return;const l=t-de.current.x,o=r-de.current.y,d=performance.now(),u=d-oe.current.time;u>0&&(U.current={x:(t-oe.current.x)/u,y:(r-oe.current.y)/u}),oe.current={x:t,y:r,time:d};const w=.005,f=V.current.yaw-l*w,g=Math.PI/2.3,P=Math.max(-g,Math.min(g,V.current.pitch-o*w));v({yaw:f,pitch:P})},ke=()=>{if(!F.current)return;F.current=!1;let t=-U.current.x*12,r=-U.current.y*12;const l=.95,o=()=>{F.current||(t*=l,r*=l,!(Math.abs(t)<.01&&Math.abs(r)<.01)&&(v(d=>{const u=d.yaw+t*.005,w=Math.PI/2.3,f=Math.max(-w,Math.min(w,d.pitch+r*.005));return{yaw:u,pitch:f}}),ne.current=requestAnimationFrame(o)))};ne.current=requestAnimationFrame(o)},[y,xe]=i.useState(null),[Q,pe]=i.useState({x:0,y:0,shiftX:0}),b=i.useRef(null);i.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]),i.useEffect(()=>{if(!c||!I.current)return;const t=l=>{l.preventDefault();const o=-l.deltaY*.0025;L(d=>{const u=d+o;return Math.max(.5,Math.min(3,u))})},r=I.current;return r.addEventListener("wheel",t,{passive:!1}),()=>{r.removeEventListener("wheel",t)}},[c]);const z=i.useMemo(()=>{const t=[];return s.forEach((r,l)=>{(Array.isArray(r)?r:[]).forEach((o,d)=>{o&&t.push({key:o.day||`${l}-${d}`,col:l,row:d,level:o.level||0,value:o.value||0,day:o.day,models:o.models||null})})}),t},[s]),we=C-(c?1.8:1.5),je=c?38:28,ee=t=>Math.max(1.8,Number(t)/4*je),ae=i.useMemo(()=>{if(z.length===0)return[];const t=s.length;return z.map(r=>{const l=ee(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)),u=o/d*.4,w=Math.min(1,Math.max(0,(ye-u)*(1/.6))),f=l*w,g=(r.col-t/2)*C,P=(r.row-3.5)*C,j=we/2,G=[{x:g-j,y:P-j,z:0},{x:g+j,y:P-j,z:0},{x:g+j,y:P+j,z:0},{x:g-j,y:P+j,z:0},{x:g-j,y:P-j,z:f},{x:g+j,y:P-j,z:f},{x:g+j,y:P+j,z:f},{x:g-j,y:P+j,z:f}].map(W=>O(W.x,W.y,W.z,p.yaw,p.pitch)),ue=O(g,P,f/2,p.yaw,p.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]}],Pe=S[Math.min(4,Math.max(0,Number(r.level)||0))],ze=[],De=.35,Ye=-.4,Ue=.83;return Le.forEach(W=>{const Ne=it(W.normal[0],W.normal[1],W.normal[2],p.yaw,p.pitch);if(Ne.z>.001){const Me=G[W.indices[0]],Te=G[W.indices[1]],_e=G[W.indices[2]],$e=G[W.indices[3]],Xe=`M${Me.x},${Me.y} L${Te.x},${Te.y} L${_e.x},${_e.y} L${$e.x},${$e.y} Z`,Be=Ne.x*De+Ne.y*Ye+Ne.z*Ue,We=h?.18:0,Fe=W.scale*(.82+.28*Math.max(0,Be))+We;ze.push({name:W.name,d:Xe,fill:lt(Pe,Fe)})}}),{...r,centerProj:ue,renderedFaces:ze}})},[z,p,S,s.length,ye,C,we,je]),le=i.useMemo(()=>[...ae].sort((t,r)=>t.centerProj.z-r.centerProj.z),[ae]),_=i.useMemo(()=>{if(le.length===0)return{minX:-100,minY:-100,maxX:100,maxY:100};let t=1/0,r=1/0,l=-1/0,o=-1/0;return le.forEach(d=>{const u=C*2,w=d.centerProj.x,f=d.centerProj.y;w-u<t&&(t=w-u),w+u>l&&(l=w+u),f-u<r&&(r=f-u),f+u>o&&(o=f+u)}),{minX:t,minY:r,maxX:l,maxY:o}},[le,C]),A=12,a=_.maxX-_.minX+A*2,m=_.maxY-_.minY+A*2,M=a/fe,k=m/fe,B=_.minX-A+(a-M)/2,H=_.minY-A+(m-k)/2,ie=`${B} ${H} ${M} ${k}`;return z.length===0?e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:n("heatmap.empty")}):e.jsxs("div",{ref:I,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;me(t.clientX,t.clientY);const r=o=>X(o.clientX,o.clientY),l=()=>{ke(),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",l)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",l)},onTouchStart:t=>{!c||t.touches.length===0||me(t.touches[0].clientX,t.touches[0].clientY)},onTouchMove:t=>{!c||t.touches.length===0||X(t.touches[0].clientX,t.touches[0].clientY)},onTouchEnd:()=>{c&&ke()},children:[e.jsxs("svg",{ref:Z,viewBox:ie,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&&ge.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=y&&y.key===t.key;return e.jsxs("g",{onMouseEnter:l=>{if(b.current&&(clearTimeout(b.current),b.current=null),xe(t),c&&Z.current){const o=O((t.col-s.length/2)*C,(t.row-3.5)*C,ee(t.level),p.yaw,p.pitch);let d=0,u=0;const w=Z.current;if(I.current&&typeof w.createSVGPoint=="function"&&typeof w.getScreenCTM=="function")try{const j=w.createSVGPoint();j.x=o.x,j.y=o.y;const re=w.getScreenCTM();if(re){const G=j.matrixTransform(re),ue=I.current.getBoundingClientRect();d=G.x-ue.left,u=G.y-ue.top}}catch{const re=w.getBoundingClientRect(),G=_.maxX-_.minX+A*2,ue=_.maxY-_.minY+A*2;d=(o.x-(_.minX-A))/G*re.width,u=(o.y-(_.minY-A))/ue*re.height}else{const j=w.getBoundingClientRect(),re=_.maxX-_.minX+A*2,G=_.maxY-_.minY+A*2;d=(o.x-(_.minX-A))/re*j.width,u=(o.y-(_.minY-A))/G*j.height}const f=140;let g=0;const P=I.current?I.current.getBoundingClientRect().width:w.getBoundingClientRect().width;d<f?g=f-d:d>P-f&&(g=P-f-d),pe({x:d,y:u,shiftX:g})}},onMouseLeave:()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{xe(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}: ${R(t.value)} tokens`}),t.renderedFaces.map((l,o)=>e.jsx("path",{d:l.d,fill:l.fill,stroke:l.fill,strokeWidth:.25,strokeLinejoin:"round"},o))]},t.key)})]}),c&&y&&e.jsxs("div",{onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{xe(null)},150)},className:"absolute z-[9999] w-0 h-0 transition-all duration-100 ease-out",style:{left:`${Q.x}px`,top:`${Q.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% + ${Q.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:y.day}),(()=>{const t=y.level===0?h?"#9ca3af":"#6b7280":S[y.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 ",y.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{title:R(y.value),className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:Y(y.value)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),y.models&&Object.keys(y.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(y.models).map(([t,r])=>({name:t,val:Number(r)})).sort((t,r)=>r.val-t.val).map(({name:t,val:r})=>{const l=Number(y.value)||1,o=Math.round(r/l*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",{title:R(r),className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:Y(r)}),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:Ae(y.level,y.value,Y)})]})]}),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 ct=12,dt=3,mt=26,xt=["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],ut=["#121212","#065f46","#059669","#10b981","#34d399"];function pt(s){if(typeof s!="string")return null;const x=/^(\d{4})-(\d{2})-(\d{2})$/.exec(s.trim());if(!x)return null;const h=new Date(Date.UTC(Number(x[1]),Number(x[2])-1,Number(x[3])));return Number.isFinite(h.getTime())?h:null}function Re(s,x){return new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()+x))}function ht(s,x){return Math.floor((Date.UTC(x.getUTCFullYear(),x.getUTCMonth(),x.getUTCDate())-Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()))/864e5)}function ft(s,x){const h=x==="mon"?1:0,c=s.getUTCDay();return Re(s,-((c-h+7)%7))}function gt(s,x,h,c){if(!s)return[];const N=pt(x)||new Date,D=[];for(let E=11;E>=0;E-=1)D.push(new Date(Date.UTC(N.getUTCFullYear(),N.getUTCMonth()-E,1)));const Y=ft(N,h),R=Re(Y,-(s-1)*7),T=[],S=new Set;for(const E of D){const $=Math.floor(ht(R,E)/7);$<0||$>=s||S.has($)||(S.add($),T.push({label:c[E.getUTCMonth()],index:$}))}return T}function Nt({heatmap:s,timeZoneLabel:x,timeZoneShortLabel:h,hideLegend:c=!1,embedded:N=!1}){const{resolvedTheme:D}=Ie(),{currency:Y,rate:R}=Ke(),{formatTokens:T,formatTokensTooltip:S}=Se(),E=D==="dark",$=E?ut:xt,q=i.useRef(null),p=i.useRef(null),[v,ce]=i.useState(null),[K,fe]=i.useState({x:0,y:0,shiftX:0,flipY:!1}),L=i.useRef(null);i.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]);const[C,ge]=i.useState(!1),[Z,I]=i.useState(!1),[F,de]=i.useState(!1),V=i.useRef(null),[U,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")],ye=(a,m)=>{if(!m||!m.day)return;L.current&&(clearTimeout(L.current),L.current=null),ce(m);const M=a.currentTarget.getBoundingClientRect(),k=typeof window<"u"?window.innerWidth:1024,B=M.left+M.width/2,H=M.top<300,ie=H?M.bottom:M.top,t=140;let r=0;B<t?r=t-B:B>k-t&&(r=k-t-B),fe({x:B,y:ie,shiftX:r,flipY:H})},be=()=>{L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{ce(null)},150)},J=()=>{I(!1),ge(!0)},se=()=>{I(!0)},ve=a=>{a.target===a.currentTarget&&Z&&(ge(!1),I(!1))};i.useEffect(()=>{if(!C||Z)return;const a=m=>{m.key==="Escape"&&se()};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[C,Z]);const me=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"}}),[]),X=me[U]||me.emerald,ke=te[U]?E?te[U].dark:te[U].light:E?te.emerald.dark:te.emerald.light,[y,xe]=i.useState(()=>{if(N)return"2d";try{return window.localStorage?.getItem("tt:heatmap-view")==="3d"?"3d":"2d"}catch{return"2d"}});i.useEffect(()=>{if(!N)try{window.localStorage?.setItem("tt:heatmap-view",y)}catch{}},[y,N]),i.useEffect(()=>{if(y!=="2d")return;const a=q.current;a&&(a.scrollLeft=a.scrollWidth)},[s?.weeks,y]),i.useEffect(()=>{const a=q.current;if(!a)return;const m=()=>{L.current&&(clearTimeout(L.current),L.current=null),ce(null)};return a.addEventListener("scroll",m),()=>a.removeEventListener("scroll",m)},[]);const Q=s?.week_starts_on==="mon"?"mon":"sun",pe=i.useMemo(()=>{const a=Array.isArray(s?.weeks)?s.weeks:[];if(!a.length)return{weeks:[]};const m=[];for(const M of a)for(const k of Array.isArray(M)?M:[])k?.day&&m.push({day:k.day,total_tokens:k.total_tokens??k.value??0,billable_total_tokens:k.billable_total_tokens??k.value??k.total_tokens??0,models:k.models??null});return He({dailyRows:m,weeks:Math.max(52,a.length),to:s?.to,weekStartsOn:Q})},[s?.to,s?.weeks,Q]),b=pe?.weeks||[],z=i.useMemo(()=>{let a=0,m=0,M={day:"无数据",value:0},k=0,B=0;const H=[];b.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?(m++,k++,k>B&&(B=k)):k=0,g>M.value&&(M={day:f.day,value:g})});const ie=H.length||365,t=(m/ie*100).toFixed(1);let r="heatmap.3d.modal.ai.eval.default",l="heatmap.3d.modal.ai.title.default";a>=15e6?(l="heatmap.3d.modal.ai.title.peak",r="heatmap.3d.modal.ai.eval.peak"):a>=5e6?(l="heatmap.3d.modal.ai.title.heavy",r="heatmap.3d.modal.ai.eval.heavy"):a>=1e6?(l="heatmap.3d.modal.ai.title.core",r="heatmap.3d.modal.ai.eval.core"):a>=2e4&&(l="heatmap.3d.modal.ai.title.steady",r="heatmap.3d.modal.ai.eval.steady");const o=s?.total_cost_usd,d=Number(o),w=o!=null&&(typeof o!="string"||o.trim()!=="")&&Number.isFinite(d)?d:a/15e5;return{totalTokens:a,activeDays:m,activeRate:t,maxSingleDay:M,maxStreak:B,aiEvaluationTitleKey:l,aiEvaluationKey:r,totalCostUsd:w}},[b,s?.total_cost_usd]),Ce=i.useMemo(()=>Ge(z.totalCostUsd,{currency:Y,rate:R}),[z.totalCostUsd,Y,R]),we=Q==="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()}`)),je=i.useMemo(()=>gt(b.length,pe?.to,Q,ne),[pe?.to,b.length,Q,ne]);if(!b.length)return e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:n("heatmap.empty")});const ee=N?10:ct,ae=N?2:dt,le=N?22:mt,_=le+b.length*ee+Math.max(0,b.length-1)*ae,A=`${le}px repeat(${b.length}, ${ee}px)`;return e.jsxs("div",{ref:p,className:N?"relative":"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[!N&&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":y==="2d",onClick:()=>xe("2d"),className:y==="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":y==="3d",onClick:()=>xe("3d"),className:y==="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:h||n("heatmap.legend.utc")})]})]}),y==="3d"&&e.jsxs("div",{onClick:J,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(Ee,{weeks:b,isDark:E,palette:U}),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(Je,{size:9}),n("heatmap.3d.hover_tip")]})})]}),y==="2d"&&e.jsx("div",{ref:q,className:"overflow-x-auto overflow-y-hidden heatmap-scroll-thin",children:e.jsxs("div",{style:{minWidth:_},children:[e.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:A,columnGap:ae},children:[e.jsx("span",{}),je.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:A,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, ${ee}px)`,rowGap:ae},children:we.map(a=>e.jsx("span",{className:"leading-none",children:a},a))}),e.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${ee}px)`,gap:ae},children:b.map((a,m)=>(Array.isArray(a)?a:[]).map((M,k)=>{if(!M)return null;const B=M.day||`e-${m}-${k}`,H=Number(M.level)||0,ie=$[H]||$[0];return e.jsx("span",{onMouseEnter:t=>ye(t,M),onMouseLeave:be,className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10 cursor-pointer",style:{width:ee,height:ee,background:ie}},B)}))})]})]})}),!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:$.map((a,m)=>e.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:a}},m))}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:n("heatmap.legend.more")})]}),C&&e.jsx("div",{onAnimationEnd:ve,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 ${Z?"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 ${Z?"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(Oe,{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:X.rawColor}}),e.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5",style:{backgroundColor:X.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:[S(z.totalTokens)," 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:T(z.totalTokens,{decimals:2})}),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:X.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:Ce})]}),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:[z.activeRate,"% ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",z.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:[z.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:[z.maxSingleDay.value>0?S(z.maxSingleDay.value):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:z.maxSingleDay.day!=="无数据"?z.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:[z.maxSingleDay.value>0?T(z.maxSingleDay.value,{decimals:2}):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:["(",z.maxSingleDay.day!=="无数据"?z.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(st,{size:11,style:{color:X.rawColor}}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono",style:{color:X.rawColor},children:n(z.aiEvaluationTitleKey)})]}),e.jsxs("div",{className:"pl-3.5 border-l-2 relative transition-all duration-300 group",style:{borderColor:X.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:X.rawColor}}),e.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-600 dark:text-zinc-400 font-normal",children:n(z.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.${U}`)})]}),e.jsx("div",{className:"flex gap-1",children:ke.map((a,m)=>e.jsx("div",{className:"flex-1 h-1 rounded-[2px]",style:{backgroundColor:a},title:`Level ${m}`},m))})]})})]}),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:X.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(me).map(a=>{const m=U===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:m&&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=!F;de(a),V.current&&V.current.toggleAutoRotate(a)},title:F?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 ${F?X.accentText:"text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250"}`,children:F?e.jsx(et,{size:12}):e.jsx(at,{size:12})}),e.jsx("button",{type:"button",onClick:()=>{de(!1),V.current&&V.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(ot,{size:12})})]})]}),e.jsx(Ee,{weeks:b,isDark:E,interactive:!0,palette:U,autoRotateInit:F,onResetViewRef:V}),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:X.accentText}),e.jsx("span",{children:n("heatmap.3d.modal.footer.tip")})]})]})]})}),v&&!C&&typeof document<"u"&&qe.createPortal(e.jsxs("div",{className:"fixed z-[9999] w-0 h-0 transition-all duration-100 ease-out pointer-events-none",style:{position:"fixed",left:`${K.x}px`,top:`${K.y}px`},children:[e.jsxs("div",{className:`absolute left-0 ${K.flipY?"top-[10px]":"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% + ${K.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:v.day}),(()=>{const a=v.level===0?E?"#9ca3af":"#6b7280":$[v.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 ",v.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{title:S(v.total_tokens??v.value),className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:T(v.total_tokens??v.value)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),v.models&&Object.keys(v.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(v.models).map(([a,m])=>({name:a,val:Number(m)})).sort((a,m)=>m.val-a.val).map(({name:a,val:m})=>{const M=Number(v.total_tokens??v.value)||1,k=Math.round(m/M*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",{title:S(m),className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:T(m)}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[k,"%"]})]})]}),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:`${k}%`,backgroundColor:$[4],boxShadow:`0 0 4px ${$[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:Ae(v.level,v.total_tokens??v.value,T)})]})]}),e.jsx("div",{className:`absolute left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 shadow-sm ${K.flipY?"top-[6px] border-l border-t":"bottom-[6px] border-r border-b"} border-oai-gray-200/50 dark:border-oai-gray-800/50`,style:K.flipY?{marginTop:"1px"}:{marginBottom:"1px"}})]}),document.body),e.jsx("style",{children:`
|
|
2
2
|
@keyframes tt-fade-in {
|
|
3
3
|
from { opacity: 0; }
|
|
4
4
|
to { opacity: 1; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./main-
|
|
1
|
+
import{c as a}from"./main-DY9GCwr_.js";const t=[["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"}]],o=a("trash-2",t);export{o as T};
|
package/dashboard/dist/assets/{use-community-stats-Dr1q98cg.js → use-community-stats-DPHOiIBu.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as w,a6 as _,aF as k}from"./main-
|
|
1
|
+
import{r as w,a6 as _,aF as k}from"./main-DY9GCwr_.js";const C=6e3,I=100;function h(t,u){let e;const n=new Promise((s,r)=>{e=setTimeout(()=>r(new Error("landing stats timeout")),u)});return Promise.race([t,n]).finally(()=>{e!=null&&clearTimeout(e)})}const E=6e4;let o=null;function b(){if(o&&Date.now()-o.at<E)return o.promise;const t=Promise.all([_({period:"total",limit:I,offset:0}),k().catch(()=>null)]);return o={at:Date.now(),promise:t},t.catch(()=>{o?.promise===t&&(o=null)}),t}function g({enabled:t=!0}={}){const[u,e]=w.useState({status:"loading",tokenFloor:null,totalEntries:null,top:[]});return w.useEffect(()=>{if(!t)return;let n=!1,s=null,r=null;const m=async()=>{try{const[a,l]=await h(b(),C);if(n)return;const i=Array.isArray(a?.entries)?a.entries:[],p=i.reduce((c,T)=>c+(Number(T?.total_tokens)||0),0),d=Number(l?.total_tokens)||0,f=d>0?d:p;if(!i.length||!(f>0)){e(c=>({...c,status:"error"}));return}const y=Array.isArray(l?.top_models)?l.top_models:[];e({status:"ready",tokenFloor:f,totalEntries:Number(a?.total_entries)||i.length,top:i.slice(0,3),topModels:y})}catch{n||e(l=>({...l,status:"error"}))}};return typeof window<"u"&&"requestIdleCallback"in window?s=window.requestIdleCallback(m,{timeout:1500}):r=setTimeout(m,400),()=>{n=!0,s!=null&&typeof window.cancelIdleCallback=="function"&&window.cancelIdleCallback(s),r!=null&&clearTimeout(r)}},[t]),u}export{g as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as u,r as a,b6 as M,b7 as G,b8 as j,b9 as J}from"./main-
|
|
1
|
+
import{E as u,r as a,b6 as M,b7 as G,b8 as j,b9 as J}from"./main-DY9GCwr_.js";const B=["claude","codex","cursor","gemini","kimi","kiro","grok","copilot","antigravity","zcode","opencodeGo"],q={claude:"CLAUDE",codex:"CODEX",cursor:"CURSOR",gemini:"GEMINI",kimi:"KIMI",kiro:"KIRO",grok:"GROK",copilot:"COPILOT",antigravity:"ANTIGRAVITY",zcode:"ZCODE",opencodeGo:"OPENCODE"};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");case"zcode":return u("limits.provider.zcode");case"opencodeGo":return u("limits.provider.opencode_go");default:return String(e||"")}}const y=B,E="tt.limits.providerOrder",A="tt.limits.providerVisibility",h="tt.limits.displayMode",S="tt.limits.updatedAt",V="limitsPreferences",F="limitsDisplayMode",v=Object.freeze({USED:"used",REMAINING:"remaining"}),g=new Set(Object.values(v)),L=new Set([E,A,h,S]);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 O(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 Z(){if(typeof window>"u")return I();try{const e=window.localStorage.getItem(E);return _(e?JSON.parse(e):void 0)}catch{return I()}}function H(){if(typeof window>"u")return b();try{const e=window.localStorage.getItem(A);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(S))}catch{return}}function $(){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 w(){return O({displayMode:Q(),providerOrder:Z(),providerVisibility:H(),updatedAt:W()})}function ee(e){if(typeof window>"u")return;const r=O(e);try{window.localStorage.setItem(E,JSON.stringify(r.providerOrder)),window.localStorage.setItem(A,JSON.stringify(r.providerVisibility)),window.localStorage.setItem(h,r.displayMode),r.updatedAt===void 0?window.localStorage.removeItem(S):window.localStorage.setItem(S,String(r.updatedAt))}catch(n){console.warn("[tokentracker] limits preferences localStorage write failed:",n)}}function re(e){const r=O(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 C(e,r){return e.displayMode===r.displayMode&&ie(e.providerOrder,r.providerOrder)&&ne(e.providerVisibility,r.providerVisibility)}function oe(e,r){return C(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(w),n=a.useRef(e),s=a.useCallback((o,t={})=>{const i=O(o);return n.current=i,r(i),t.writeLocal&&ee(i),i},[]),l=a.useCallback(o=>{M()&&G(V,re(o))},[]),c=a.useCallback(o=>{const t=w(),i=k(t,n.current)?s(t):n.current,d=O(o(i));if(C(i,d))return;const p=te(t.updatedAt,i.updatedAt),f=s({...d,updatedAt:p},{writeLocal:!0});l(f)},[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=w();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=j(t=>{const i=t?.[V];if(i&&typeof i=="object"){const d=O(i);if(!$()){s(d,{writeLocal:!0});return}const p=w();if(k(d,p))s(d,{writeLocal:!0});else{const f=s(p);oe(d,p)||l(f)}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(w())};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[s]);const R=a.useCallback(o=>{y.includes(o)&&c(t=>({...t,providerVisibility:{...t.providerVisibility,[o]:!t.providerVisibility[o]}}))},[c]),x=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),p=i.providerOrder.indexOf(t);if(d<0||p<0)return i;const f=[...i.providerOrder],[z]=f.splice(d,1);return f.splice(p,0,z),{...i,providerOrder:f}})},[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:R,moveUp:x,moveDown:U,moveToward:T,reset:Y}}export{v as L,B as a,se as b,ae as l,ce as u};
|
package/dashboard/dist/assets/{use-native-settings-BgBQK2b0.js → use-native-settings-Cx_HZy8t.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,aG as b,ce as f,b8 as g,b9 as r,b7 as S,cd as v}from"./main-
|
|
1
|
+
import{r as s,aG as b,ce as f,b8 as g,b9 as r,b7 as S,cd as v}from"./main-DY9GCwr_.js";function d(){const[u,a]=s.useState(null),t=b()&&f();s.useEffect(()=>{if(!t)return;const e=g(n=>a(n));return r(),e},[t]);const c=s.useCallback((e,n)=>{t&&(a(i=>i&&{...i,[e]:n}),S(e,n))},[t]),o=s.useCallback(e=>{t&&v(e)},[t]),l=s.useCallback(()=>{t&&r()},[t]);return{available:t,settings:u,setSetting:c,runAction:o,refresh:l}}export{d as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as c,R as P,aE as Oe}from"./main-
|
|
1
|
+
import{r as c,R as P,aE as Oe}from"./main-DY9GCwr_.js";function In(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function wt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:wt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Vt(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:wt(e)?mt(e)?e:Be(e)||Vt(e)?e.ownerDocument:document:document:document}const Q=tt?c.useLayoutEffect:c.useEffect;function yt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Mn(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ke(e){const t=yt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function ht(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let ct={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=ct[e]==null?0:ct[e]+1;return ct[e]=n,e+"-"+n},[e,t])}function qt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,a)=>{const s=Object.entries(a);for(const[l,u]of s){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=qt(1),ze=qt(-1);function An(e){return"clientX"in e&&"clientY"in e}function xt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function On(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function gt(e){if(On(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return An(e)?{x:e.clientX,y:e.clientY}:null}const _e=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[_e.Translate.toString(e),_e.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Nt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Tn(e){return e.matches(Nt)?e:e.querySelector(Nt)}const Nn={display:"none"};function Ln(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:Nn},n)}function kn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function zn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Gt=c.createContext(null);function Pn(e){const t=c.useContext(Gt);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Bn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[e]),t]}const Fn={draggable:`
|
|
2
2
|
To pick up a draggable item, press the space bar.
|
|
3
3
|
While dragging, use the arrow keys to move the item.
|
|
4
4
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,r as n}from"./main-
|
|
1
|
+
import{c as d,r as n}from"./main-DY9GCwr_.js";const u=[["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"}]],f=d("pencil",u),r="tt.qualityPerDollar.enabled";function o(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(r)==="1"}catch{return!1}}function w(){const[s,l]=n.useState(o);n.useEffect(()=>{if(typeof window>"u")return;const t=e=>{(e.key===null||e.key===r)&&l(o())};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const a=n.useCallback(t=>{const e=!!t;l(e);try{window.localStorage.setItem(r,e?"1":"0")}catch{}},[]),c=n.useCallback(()=>a(!o()),[a]);return{enabled:s,setEnabled:a,toggle:c}}export{f as P,w as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dk as y,dl as l,di as A,r as u,M as h,aO as p,dm as C,f as V,dn as f}from"./main-
|
|
1
|
+
import{dk as y,dl as l,di as A,r as u,M as h,aO as p,dm as C,f as V,dn as f}from"./main-DY9GCwr_.js";function x(...t){const e=!Array.isArray(t[0]),n=e?0:-1,o=t[0+n],s=t[1+n],c=t[2+n],r=t[3+n],a=y(s,c,r);return e?a(o):a}function E(t){const e=l(()=>A(t)),{isStatic:n}=u.useContext(h);if(n){const[,o]=u.useState(t);u.useEffect(()=>e.on("change",o),[])}return e}function d(t,e){const n=E(e()),o=()=>n.set(e());return o(),p(()=>{const s=()=>V.preRender(o,!1,!0),c=t.map(r=>r.on("change",s));return()=>{c.forEach(r=>r()),C(o)}}),n}function L(t){f.current=[],t();const e=d(f.current,t);return f.current=void 0,e}function k(t,e,n,o){if(typeof t=="function")return L(t);const c=typeof e=="function"?e:x(e,n,o),r=Array.isArray(t)?i(t,c):i([t],([m])=>c(m)),a=Array.isArray(t)?void 0:t.accelerate;return a&&!a.isTransformed&&typeof e!="function"&&Array.isArray(n)&&o?.clamp!==!1&&(r.accelerate={...a,times:e,keyframes:n,isTransformed:!0}),r}function i(t,e){const n=l(()=>[]);return d(t,()=>{n.length=0;const o=t.length;for(let s=0;s<o;s++)n[s]=t[s].get();return e(n)})}export{E as a,k as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,ag as w,aL as c}from"./main-
|
|
1
|
+
import{r as a,ag as w,aL as c}from"./main-DY9GCwr_.js";function v(i){const o=!!i?.initialState,[g,l]=a.useState(()=>o?i?.initialState?.data??null:null),[m,s]=a.useState(()=>o?i?.initialState?.error??null:null),[y,b]=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||b(!1)}})(),()=>{e=!0}},[o,u,r]),{data:g,error:m,isLoading:y,refresh:S}}export{v as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,cb as t,cc as r,I as c}from"./main-
|
|
1
|
+
import{r as e,cb as t,cc as r,I as c}from"./main-DY9GCwr_.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dp as Ve,cP as _t,be as Ot,bc as H,bg as wt,bM as K,dq as Ct,cq as $e,j as Se,cv as ze,r as g,bK as X,cx as ot,dr as Dt,bh as it,bJ as We,cf as Gt,cw as ct,ds as xt,bO as x,bN as ke,ca as he,dt as Xe,du as le,cB as ae,bS as C,bT as Ut,cO as It,cS as Je,cg as Kt,c5 as ut,c0 as lt,c2 as Vt,dv as Xt,bP as be,c4 as qt,cJ as jt,bn as Pe,bZ as $t,dw as Ze,bk as Be,dx as zt,dy as He,bV as Jt,bI as Le,bW as Zt,bL as Ie,cm as _e,cl as Qt,dz as en,cj as tn,bU as nn,b_ as Te,dA as me,dB as rn,bo as sn,bp as on,bj as De,dC as at,cM as cn,cr as Qe}from"./main-8AbVGr5W.js";function Fe(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Fe(e,s.id,n)])}function ft(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(o=>o.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function un(e){e.preventDefault(),e.stopPropagation()}function ln(e){return"nativeEvent"in e}function an(e){return e.pointerType===""&&e.isTrusted?!0:Ve&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function fn(e){return _t?!1:!Ve&&e.width===0&&e.height===0||Ve&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function jn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function dn(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Ae(e){const t=Ot(pn,e).current;return t.next=e,H(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let Ne=0;function Ge(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(Ne);function o(){s&&!s()||e?.focus({preventScroll:n})}if(r)return o(),wt;const i=requestAnimationFrame(o);return Ne=i,()=>{Ne===i&&(cancelAnimationFrame(i),Ne=0)}}const Ue={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",qe={inert:new WeakSet,"aria-hidden":new WeakSet};let xe=new WeakMap,Ke=0;function gn(e){return qe[e]}function kt(e){return e?Ct(e)?e.host:kt(e.parentNode):null}const pt=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=kt(n);return e.contains(r)?r:null}).filter(n=>n!=null),gt=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},ht=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{$e(i)!=="script"&&(t.has(i)?s(i):r.push(i))})};return s(e),r};function hn(e,t,n,r,{mark:s=!0}){let o=null;r?o="inert":n&&(o="aria-hidden");let i=null,u=null;const h=pt(t,e),f=s?ht(t,gt(h),new Set(h)):[],k=[],L=[];if(o){const b=Ue[o],T=gn(o);u=T,i=b;const A=pt(t,Array.from(t.querySelectorAll("[aria-live]"))),P=h.concat(A);ht(t,gt(P),new Set(P)).forEach(y=>{const E=y.getAttribute(o),Z=E!==null&&E!=="false",Y=(b.get(y)||0)+1;b.set(y,Y),k.push(y),Y===1&&Z&&T.add(y),Z||y.setAttribute(o,o==="inert"?"":"true")})}return s&&f.forEach(b=>{const T=(xe.get(b)||0)+1;xe.set(b,T),L.push(b),T===1&&b.setAttribute(dt,"")}),Ke+=1,()=>{i&&k.forEach(b=>{const A=(i.get(b)||0)-1;i.set(b,A),A||(!u?.has(b)&&o&&b.removeAttribute(o),u?.delete(b))}),s&&L.forEach(b=>{const T=(xe.get(b)||0)-1;xe.set(b,T),T||b.removeAttribute(dt)}),Ke-=1,Ke||(Ue.inert=new WeakMap,Ue["aria-hidden"]=new WeakMap,qe.inert=new WeakSet,qe["aria-hidden"]=new WeakSet,xe=new WeakMap)}}function mt(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0}=t,o=K(e[0]).body;return hn(e,o,n,r,{mark:s})}function Pt(){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=Pt();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 Ft=g.createContext(null),Mt=g.createContext(null),et=()=>g.useContext(Ft)?.id||null,tt=e=>{const t=g.useContext(Mt);return e??t};function $n(e){const t=ze(),n=tt(e),r=et();return H(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function zn(e){const{children:t,id:n}=e,r=et();return Se.jsx(Ft.Provider,{value:g.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Jn(e){const{children:t,externalTree:n}=e,r=Ot(()=>n??new mn).current;return Se.jsx(Mt.Provider,{value:r,children:t})}function bn(e,t){const n=Be(be(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 bt=20;let fe=[];function nt(){fe=fe.filter(e=>e.deref()?.isConnected)}function Et(e){nt(),e&&$e(e)!=="body"&&(fe.push(new WeakRef(e)),fe.length>bt&&(fe=fe.slice(-bt)))}function yt(){return nt(),fe[fe.length-1]?.deref()}function En(e){return e?Ze(e)?e:xt(e)[0]||e:null}function Rt(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=zt(e).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return Ze(s)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-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:o=!0,restoreFocus:i=!1,modal:u=!0,closeOnFocusOut:h=!0,openInteractionType:f="",nextFocusableElement:k,previousFocusableElement:L,beforeContentFocusGuardRef:b,externalTree:T,getInsideElements:A}=e,P="rootStore"in t?t.rootStore:t,_=P.useState("open"),y=P.useState("domReferenceElement"),E=P.useState("floatingElement"),{events:Z,dataRef:Y}=P.context,q=X(()=>Y.current.floatingContext?.nodeId),J=s===!1,D=ot(y)&&J,se=Ae(s),F=Ae(o),j=Ae(f),ve=Ae(_),N=tt(T),R=Dt(),B=g.useRef(!1),oe=g.useRef(!1),ee=g.useRef(!1),te=g.useRef(null),Ee=g.useRef(""),de=g.useRef(""),pe=g.useRef(null),ye=g.useRef(null),S=it(pe,b,R?.beforeInsideRef),$=it(ye,R?.afterInsideRef),ie=We(),ce=We(),Oe=Gt(),Me=R!=null,p=ct(E),ne=X((m=p)=>m?xt(m):[]),Q=X(()=>A?.().filter(m=>m!=null)??[]);g.useEffect(()=>{if(r||!u)return;function m(W){W.key==="Tab"&&C(p,ae(K(p)))&&ne().length===0&&!D&&un(W)}const I=K(p);return x(I,"keydown",m)},[r,p,u,D,ne]),g.useEffect(()=>{if(r||!_)return;const m=K(p);function I(){ee.current=!1}function W(z){const a=be(z),O=Q(),d=C(E,a)||C(y,a)||C(R?.portalNode,a)||O.some(M=>M===a||C(M,a));ee.current=!d,de.current=z.pointerType||"keyboard",a?.closest(`[${qt}]`)&&(oe.current=!0,ce.start(0,()=>{oe.current=!1}))}function G(){de.current="keyboard"}return ke(x(m,"pointerdown",W,!0),x(m,"pointerup",I,!0),x(m,"pointercancel",I,!0),x(m,"keydown",G,!0),I)},[r,E,y,p,_,R,ce,Q]),g.useEffect(()=>{if(r||!h)return;const m=K(p);function I(){oe.current=!0,ce.start(0,()=>{oe.current=!1})}function W(O){const d=be(O);Ze(d)&&(te.current=d)}function G(O){const d=O.relatedTarget,M=O.currentTarget,U=be(O);u&&d==null&&U!=null&&C(E,U)&&Et(U),queueMicrotask(()=>{const w=q(),Re=P.context.triggerElements,c=Q(),l=d?.hasAttribute(Xe("focus-guard"))&&[pe.current,ye.current,R?.beforeInsideRef.current,R?.afterInsideRef.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,le(L),le(k)].includes(d),V=!(C(y,d)||C(E,d)||C(d,E)||C(R?.portalNode,d)||c.some(v=>v===d||C(v,d))||d!=null&&Re.hasElement(d)||Re.hasMatchingElement(v=>C(v,d))||l||N&&(Fe(N.nodesRef.current,w).find(v=>C(v.context?.elements.floating,d)||C(v.context?.elements.domReference,d))||ft(N.nodesRef.current,w).find(v=>[v.context?.elements.floating,ct(v.context?.elements.floating)].includes(d)||v.context?.elements.domReference===d)));if(M===y&&p&&Rt(p),i&&M!==y&&!jt(U)&&ae(m)===m.body){if(he(p)&&(p.focus(),i==="popup")){Oe.request(()=>{p.focus()});return}const v=ne(),ue=te.current,we=(ue&&v.includes(ue)?ue:null)||v[v.length-1]||p;he(we)&&we.focus()}if(Y.current.insideReactTree){Y.current.insideReactTree=!1;return}(D||!u)&&d&&V&&!oe.current&&(D||d!==yt())&&(B.current=!0,P.setOpen(!1,Pe($t,O)))})}function z(){ee.current||(Y.current.insideReactTree=!0,ie.start(0,()=>{Y.current.insideReactTree=!1}))}const a=he(y)?y:null;if(!(!E&&!a))return ke(a&&x(a,"focusout",G),a&&x(a,"pointerdown",I),E&&x(E,"focusin",W),E&&x(E,"focusout",G),E&&R&&x(E,"focusout",z,!0))},[r,y,E,p,u,N,R,P,h,i,ne,D,q,Y,ie,ce,Oe,k,L,Q]),g.useEffect(()=>{if(r||!E||!_)return;const m=Array.from(R?.portalNode?.querySelectorAll(`[${Xe("portal")}]`)||[]),W=(N?ft(N.nodesRef.current,q()):[]).find(M=>ot(M.context?.elements.domReference||null))?.context?.elements.domReference,z=[...[E,...m,pe.current,ye.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,...Q()],W,le(L),le(k),D?y:null].filter(M=>M!=null),a=mt(z,{ariaHidden:u||D,mark:!1}),O=[E,...m].filter(M=>M!=null),d=mt(O);return()=>{d(),a()}},[_,r,y,E,u,R,D,N,q,k,L,Q]),H(()=>{if(!_||r||!he(p))return;const m=K(p),I=ae(m);queueMicrotask(()=>{const W=se.current,G=typeof W=="function"?W(j.current||""):W;if(G===void 0||G===!1||C(p,I))return;let a=null;const O=()=>(a==null&&(a=ne(p)),a[0]||p);let d;G===!0||G===null?d=O():d=le(G),d=d||O();const M=C(p,ae(m));Ge(d,{preventScroll:d===p,shouldFocus(){if(!ve.current)return!1;if(M)return!0;const U=ae(m);return!(U!==d&&C(p,U))}})})},[r,_,p,ne,se,j,ve]),H(()=>{if(r||!p)return;const m=K(p),I=ae(m),W=j.current==null;Et(I);function G(a){if(a.open||(Ee.current=bn(a.nativeEvent,de.current)),a.reason===Ut&&a.nativeEvent.type==="mouseleave"&&(B.current=!0),a.reason===It)if(a.nested)B.current=!1;else if(an(a.nativeEvent)||fn(a.nativeEvent))B.current=!1;else{let O=!1;K(p).createElement("div").focus({get preventScroll(){return O=!0,!1}}),O?B.current=!1:B.current=!0}}Z.on("openchange",G);function z(){const a=F.current;let O=typeof a=="function"?a(Ee.current):a;if(O===void 0||O===!1)return null;O===null&&(O=!0);const d=y?.isConnected?y:null,M=I?.isConnected&&$e(I)!=="body"?I:null;let U=W?M||d:d||M;return U||(U=yt()||null),typeof O=="boolean"?U:le(O)||U||null}return()=>{Z.off("openchange",G);const a=ae(m),O=Q(),d=C(E,a)||O.some(w=>w===a||C(w,a))||N&&Fe(N.nodesRef.current,q(),!1).some(w=>C(w.context?.elements.floating,a)),M=F.current,U=z();queueMicrotask(()=>{const w=En(U),Re=typeof M!="boolean";M&&!B.current&&he(w)&&(!(!Re&&w!==a&&a!==m.body)||d)&&w.focus({preventScroll:!0}),B.current=!1})}},[r,E,p,F,j,Z,N,y,q,Q]),H(()=>{if(!Je||_||!E)return;const m=ae(K(E));!he(m)||!Kt(m)||C(E,m)&&m.blur()},[_,E]),H(()=>{if(!(r||!R))return R.setFocusManagerState({modal:u,closeOnFocusOut:h,open:_,onOpenChange:P.setOpen,domReference:y}),()=>{R.setFocusManagerState(null)}},[r,R,u,_,P,h,y]),H(()=>{if(!(r||!p))return Rt(p),()=>{queueMicrotask(nt)}},[r,p]);const ge=!r&&(u?!D:!0)&&(Me||u);return Se.jsxs(g.Fragment,{children:[ge&&Se.jsx(ut,{"data-type":"inside",ref:S,onFocus:m=>{if(u){const I=ne();Ge(I[I.length-1])}else R?.portalNode&&(B.current=!1,lt(m,R.portalNode)?Vt(y)?.focus():le(L??R.beforeOutsideRef)?.focus())}}),n,ge&&Se.jsx(ut,{"data-type":"inside",ref:$,onFocus:m=>{u?Ge(ne()[0]):R?.portalNode&&(h&&(B.current=!0),lt(m,R.portalNode)?Xt(y)?.focus():le(k??R.afterOutsideRef)?.focus())}})]})}function yn(){return!1}function Rn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Qn(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:o="sloppy",referencePress:i=yn,bubbles:u,externalTree:h}=t,f="rootStore"in e?e.rootStore:e,k=f.useState("open"),L=f.useState("floatingElement"),{dataRef:b}=f.context,T=tt(h),A=X(typeof s=="function"?s:()=>!1),P=typeof s=="function"?A:s,_=P!==!1,y=X(()=>o),{escapeKey:E,outsidePress:Z}=Rn(u),Y=g.useRef(!1),q=g.useRef(!1),J=g.useRef(!1),D=g.useRef(!1),se=g.useRef(""),F=g.useRef(null),j=We(),ve=We(),N=X(()=>{ve.clear(),b.current.insideReactTree=!1}),R=X(S=>{const $=b.current.floatingContext?.nodeId;return(T?Fe(T.nodesRef.current,$):[]).some(ce=>ce.context?.open&&!ce.context.dataRef.current[S])}),B=X(S=>He(S,f.select("floatingElement"))||He(S,f.select("domReferenceElement"))),oe=X(S=>{i()&&f.setOpen(!1,Pe(Jt,S.nativeEvent))}),ee=X(S=>{if(!k||!n||!r||S.key!=="Escape"||D.current||!E&&R("__escapeKeyBubbles"))return;const $=ln(S)?S.nativeEvent:S,ie=Pe(Zt,$);f.setOpen(!1,ie),ie.isCanceled||S.preventDefault(),!E&&!ie.isPropagationAllowed&&S.stopPropagation()}),te=X(()=>{b.current.insideReactTree=!0,ve.start(0,N)}),Ee=X(S=>{if(!k||!n||S.button!==0)return;const $=be(S.nativeEvent);C(f.select("floatingElement"),$)&&(Y.current||(Y.current=!0,q.current=!1))}),de=X(S=>{!k||!n||(S.defaultPrevented||S.nativeEvent.defaultPrevented)&&Y.current&&(q.current=!0)});g.useEffect(()=>{if(!k||!n)return;b.current.__escapeKeyBubbles=E,b.current.__outsidePressBubbles=Z;const S=new Le,$=new Le;function ie(){S.clear(),D.current=!0}function ce(){S.start(Je?5:0,()=>{D.current=!1})}function Oe(){J.current=!0,$.start(0,()=>{J.current=!1})}function Me(){Y.current=!1,q.current=!1}function p(){const c=se.current,l=c==="pen"||!c?"mouse":c,V=y(),v=typeof V=="function"?V():V;return typeof v=="string"?v:v[l]}function ne(c){const l=p();return l==="intentional"&&c.type!=="click"||l==="sloppy"&&c.type==="click"}function Q(c){const l=b.current.floatingContext?.nodeId,V=T&&Fe(T.nodesRef.current,l).some(v=>He(c,v.context?.elements.floating));return B(c)||V}function ge(c){if(ne(c)){c.type!=="click"&&!B(c)&&($.clear(),J.current=!1),N();return}if(b.current.insideReactTree){N();return}const l=be(c),V=`[${Xe("inert")}]`,v=Ie(l)?l.getRootNode():null,ue=Array.from((Ct(v)?v:K(f.select("floatingElement"))).querySelectorAll(V)),we=f.context.triggerElements;if(l&&(we.hasElement(l)||we.hasMatchingElement(re=>C(re,l))))return;let Ce=Ie(l)?l:null;for(;Ce&&!_e(Ce);){const re=Qt(Ce);if(_e(re)||!Ie(re))break;Ce=re}if(!(ue.length&&Ie(l)&&!en(l)&&!C(l,f.select("floatingElement"))&&ue.every(re=>!C(Ce,re)))){if(he(l)&&!("touches"in c)){const re=_e(l),Ye=tn(l),st=/auto|scroll/,At=re||st.test(Ye.overflowX),Nt=re||st.test(Ye.overflowY),Wt=At&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Lt=Nt&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Bt=Ye.direction==="rtl",Yt=Lt&&(Bt?c.offsetX<=l.offsetWidth-l.clientWidth:c.offsetX>l.clientWidth),Ht=Wt&&c.offsetY>l.clientHeight;if(Yt||Ht)return}if(!Q(c)){if(p()==="intentional"&&J.current){$.clear(),J.current=!1;return}typeof P=="function"&&!P(c)||R("__outsidePressBubbles")||(f.setOpen(!1,Pe(It,c)),N())}}}function m(c){p()!=="sloppy"||c.pointerType==="touch"||!f.select("open")||!n||B(c)||ge(c)}function I(c){if(p()!=="sloppy"||!f.select("open")||!n||B(c))return;const l=c.touches[0];l&&(F.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{F.current&&(F.current.dismissOnTouchEnd=!1,F.current.dismissOnMouseDown=!1)}))}function W(c,l){const V=be(c);if(!V)return;const v=x(V,c.type,()=>{l(c),v()})}function G(c){se.current="touch",W(c,I)}function z(c){j.clear(),c.type==="pointerdown"&&(se.current=c.pointerType),!(c.type==="mousedown"&&F.current&&!F.current.dismissOnMouseDown)&&W(c,l=>{l.type==="pointerdown"?m(l):ge(l)})}function a(c){if(!Y.current)return;const l=q.current;if(Me(),p()==="intentional"){if(c.type==="pointercancel"){l&&Oe();return}if(!Q(c)){if(l){Oe();return}typeof P=="function"&&!P(c)||($.clear(),J.current=!0,N())}}}function O(c){if(p()!=="sloppy"||!F.current||B(c))return;const l=c.touches[0];if(!l)return;const V=Math.abs(l.clientX-F.current.startX),v=Math.abs(l.clientY-F.current.startY),ue=Math.sqrt(V*V+v*v);ue>5&&(F.current.dismissOnTouchEnd=!0),ue>10&&(ge(c),j.clear(),F.current=null)}function d(c){W(c,O)}function M(c){p()!=="sloppy"||!F.current||B(c)||(F.current.dismissOnTouchEnd&&ge(c),j.clear(),F.current=null)}function U(c){W(c,M)}const w=K(L),Re=ke(r&&ke(x(w,"keydown",ee),x(w,"compositionstart",ie),x(w,"compositionend",ce)),_&&ke(x(w,"click",z,!0),x(w,"pointerdown",z,!0),x(w,"pointerup",a,!0),x(w,"pointercancel",a,!0),x(w,"mousedown",z,!0),x(w,"mouseup",a,!0),x(w,"touchstart",G,!0),x(w,"touchmove",d,!0),x(w,"touchend",U,!0)));return()=>{Re(),S.clear(),$.clear(),Me(),J.current=!1}},[b,L,r,_,P,k,n,E,Z,ee,N,y,R,B,T,f,j]),g.useEffect(N,[P,N]);const pe=g.useMemo(()=>({onKeyDown:ee,onPointerDown:oe,onClick:oe}),[ee,oe]),ye=g.useMemo(()=>({onKeyDown:ee,onPointerDown:de,onMouseDown:de,onClickCapture:te,onMouseDownCapture(S){te(),Ee(S)},onPointerDownCapture(S){te(),Ee(S)},onMouseUpCapture:te,onTouchEndCapture:te,onTouchMoveCapture:te}),[ee,te,Ee,de]);return g.useMemo(()=>n?{reference:pe,floating:ye,trigger:pe}:{},[n,pe,ye])}function Tn(e){const t=g.useRef(!0);t.current&&(t.current=!1,e())}const Sn={open:Te(e=>e.open),transitionStatus:Te(e=>e.transitionStatus),domReferenceElement:Te(e=>e.domReferenceElement),referenceElement:Te(e=>e.positionReference??e.referenceElement),floatingElement:Te(e=>e.floatingElement),floatingId:Te(e=>e.floatingId)};class vn extends nn{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:o,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:Pt(),nested:r,triggerElements:o},Sn),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&dn(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 On(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:o,onOpenChange:i}=e,u=t.useState("open"),h=t.useState("activeTriggerElement"),f=t.useState(n?"popupElement":"positionerElement"),k=t.context.triggerElements,L=i,b=g.useRef(null);r===void 0&&b.current===null&&(b.current=new vn({open:u,transitionStatus:void 0,referenceElement:h,floatingElement:f,triggerElements:k,onOpenChange:L,floatingId:s,syncOnly:!0,nested:o}));const T=r??b.current;return t.useSyncedValue("floatingId",s),H(()=>{const A={open:u,floatingId:s,referenceElement:h,floatingElement:f};Ie(h)&&(A.domReferenceElement=h),T.state.positionReference===T.state.referenceElement&&(A.positionReference=h),T.update(A)},[u,s,h,f,T]),T.context.onOpenChange=L,T.context.nested=o,T}function wn(e,t=!1,n=!1){const[r,s]=g.useState(e&&t?"idle":void 0),[o,i]=g.useState(e);return e&&!o&&(i(!0),s("starting")),!e&&o&&r!=="ending"&&!n&&s("ending"),!e&&!o&&r==="ending"&&s(void 0),H(()=>{if(!e&&o&&r!=="ending"&&n){const u=me.request(()=>{s("ending")});return()=>{me.cancel(u)}}},[e,o,r,n]),H(()=>{if(!e||t)return;const u=me.request(()=>{s(void 0)});return()=>{me.cancel(u)}},[t,e]),H(()=>{if(!e||!t)return;e&&o&&r!=="idle"&&s("starting");const u=me.request(()=>{s("idle")});return()=>{me.cancel(u)}},[t,e,o,r]),{mounted:o,setMounted:i,transitionStatus:r}}const er={tabIndex:-1,[rn]:""};function tr(e){return t=>t==="touch"?e.current:!0}function nr(e,t,n=!1){const r=ze(),s=et()!=null,o=g.useRef(null);e===void 0&&o.current===null&&(o.current=t(r,s));const i=e??o.current;return On({popupStore:i,treatPopupAsFloatingElement:n,floatingRootContext:i.state.floatingRootContext,floatingId:r,nested:s,onOpenChange:i.setOpen}),{store:i,internalStore:o.current}}function Cn(e,t){const n=g.useRef(null),r=g.useRef(null);return g.useCallback(s=>{if(e===void 0)return;let o=!1;if(n.current!==null){const i=n.current,u=r.current,h=t.context.triggerElements.getById(i);u&&h===u&&(t.context.triggerElements.delete(i),o=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),o=!0),o){const i=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==i&&t.set("triggerCount",i)}},[t,e])}function rr(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const s=n?.id??null;(s||t)&&(e.activeTriggerId=s,e.activeTriggerElement=n??null)}function sr(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function or(e,t,n,r){Tn(()=>{t===void 0&&e.state.open===!1&&n&&(e.state={...e.state,open:!0,activeTriggerId:r,preventUnmountingOnClose:!1})})}function ir(e,t,n,r){const s=n.useState("isMountedByTrigger",e),o=Cn(e,n),i=X(u=>{if(o(u),!u)return;const h=n.select("open"),f=n.select("activeTriggerId");if(f===e){n.update({activeTriggerElement:u,...h?r:null});return}f==null&&h&&n.update({activeTriggerId:e,activeTriggerElement:u,...r})});return H(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:s}}function cr(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState("open"),s=e.useState("triggerCount");H(()=>{if(!r){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const o=e.context.triggerElements.size,i={};e.state.triggerCount!==o&&(i.triggerCount=o);const u=e.select("activeTriggerId");let h=null;if(u){const f=e.context.triggerElements.getById(u);f?f!==e.state.activeTriggerElement&&(i.activeTriggerElement=f):h=u}if(!h&&!u&&o===1){const f=e.context.triggerElements.entries().next();if(!f.done){const[k,L]=f.value;i.activeTriggerId=k,i.activeTriggerElement=L}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),h&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===h&&!e.context.triggerElements.getById(h)){const f=Pe(sn);e.setOpen(!1,f),f.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,n])}function ur(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=wn(e),i=t.useState("preventUnmountingOnClose"),u=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:o,preventUnmountingOnClose:u});const h=X(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return on({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||h()}}),{forceUnmount:h,transitionStatus:o}}function lr(e,t){e.useSyncedValues(t),H(()=>()=>{e.update({activeTriggerProps:De,inactiveTriggerProps:De,popupProps:De})},[e])}function ar(e,t){H(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),H(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class fr{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 rt=(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 xn={[je.popupOpen]:""},In={[je.popupOpen]:"",[je.pressed]:""},kn={[rt.open]:""},Pn={[rt.closed]:""},Fn={[rt.anchorHidden]:""},dr={open(e){return e?xn:null}},pr={open(e){return e?In:null}},gr={open(e){return e?kn:Pn},anchorHidden(e){return e?Fn:null}};function hr(e){return ze(e,"base-ui")}const Mn="ArrowUp",An="ArrowDown",Nn="ArrowLeft",Wn="ArrowRight",Ln="Home",Bn="End",Yn=new Set([Nn,Wn]),Hn=new Set([Mn,An]),_n=new Set([...Yn,...Hn]),mr=new Set([..._n,Ln,Bn]),br=g.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return Se.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})});let Tt={},St={},vt="";function Dn(e){if(typeof document>"u")return!1;const t=K(e);return Be(t).innerWidth-t.documentElement.clientWidth>0}function Gn(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=K(e),r=n.documentElement,s=n.body,o=Qe(r)?r:s,i=o.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const h=o.offsetWidth;o.style.overflowY="hidden";const f=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=u,h===f}function Un(e){const t=K(e),n=t.documentElement,r=t.body,s=Qe(n)?n:r,o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function Kn(e){const t=K(e),n=t.documentElement,r=t.body,s=Be(n);let o=0,i=0,u=!1;const h=me.create();if(Je&&(s.visualViewport?.scale??1)!==1)return()=>{};function f(){const T=s.getComputedStyle(n),A=s.getComputedStyle(r),y=(T.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Tt={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},vt=n.style.scrollBehavior,St={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,Y=T.overflowY==="scroll"||A.overflowY==="scroll",q=T.overflowX==="scroll"||A.overflowX==="scroll",J=Math.max(0,s.innerWidth-r.clientWidth),D=Math.max(0,s.innerHeight-r.clientHeight),se=parseFloat(A.marginTop)+parseFloat(A.marginBottom),F=parseFloat(A.marginLeft)+parseFloat(A.marginRight),j=Qe(n)?n:r;if(u=Gn(e),u){n.style.scrollbarGutter=y,j.style.overflowY="hidden",j.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(E||Y)&&(n.style.overflowY="scroll"),(Z||q)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:se||D?`calc(100dvh - ${se+D}px)`:"100dvh",width:F||J?`calc(100vw - ${F+J}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function k(){Object.assign(n.style,Tt),Object.assign(r.style,St),u||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=vt)}function L(){k(),h.request(f)}f();const b=x(s,"resize",L);return()=>{h.cancel(),k(),typeof s.removeEventListener=="function"&&b()}}class Vn{lockCount=0;restore=null;timeoutLock=Le.create();timeoutUnlock=Le.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=K(t).documentElement,s=Be(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=wt;return}const o=cn||!Dn(t);this.restore=o?Un(t):Kn(t)}}const Xn=new Vn;function Er(e=!0,t=null){H(()=>{if(e)return Xn.acquire(t)},[e,t])}export{Ge as A,un as B,mr as C,an as D,fn as E,Jn as F,Tn as G,Er as H,br as I,rt as J,fr as P,wn as a,tt as b,et as c,Ae as d,sr as e,nr as f,Fe as g,or as h,jn as i,ar as j,cr as k,ur as l,Qn as m,er as n,lr as o,ir as p,pr as q,$n as r,rr as s,dr as t,hr as u,zn as v,tr as w,Zn as x,gr as y,vn as z};
|
|
1
|
+
import{dp as Ve,cP as _t,be as Ot,bc as H,bg as wt,bM as K,dq as Ct,cq as $e,j as Se,cv as ze,r as g,bK as X,cx as ot,dr as Dt,bh as it,bJ as We,cf as Gt,cw as ct,ds as xt,bO as x,bN as ke,ca as he,dt as Xe,du as le,cB as ae,bS as C,bT as Ut,cO as It,cS as Je,cg as Kt,c5 as ut,c0 as lt,c2 as Vt,dv as Xt,bP as be,c4 as qt,cJ as jt,bn as Pe,bZ as $t,dw as Ze,bk as Be,dx as zt,dy as He,bV as Jt,bI as Le,bW as Zt,bL as Ie,cm as _e,cl as Qt,dz as en,cj as tn,bU as nn,b_ as Te,dA as me,dB as rn,bo as sn,bp as on,bj as De,dC as at,cM as cn,cr as Qe}from"./main-DY9GCwr_.js";function Fe(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Fe(e,s.id,n)])}function ft(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(o=>o.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function un(e){e.preventDefault(),e.stopPropagation()}function ln(e){return"nativeEvent"in e}function an(e){return e.pointerType===""&&e.isTrusted?!0:Ve&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function fn(e){return _t?!1:!Ve&&e.width===0&&e.height===0||Ve&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function jn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function dn(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Ae(e){const t=Ot(pn,e).current;return t.next=e,H(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let Ne=0;function Ge(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(Ne);function o(){s&&!s()||e?.focus({preventScroll:n})}if(r)return o(),wt;const i=requestAnimationFrame(o);return Ne=i,()=>{Ne===i&&(cancelAnimationFrame(i),Ne=0)}}const Ue={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",qe={inert:new WeakSet,"aria-hidden":new WeakSet};let xe=new WeakMap,Ke=0;function gn(e){return qe[e]}function kt(e){return e?Ct(e)?e.host:kt(e.parentNode):null}const pt=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=kt(n);return e.contains(r)?r:null}).filter(n=>n!=null),gt=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},ht=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{$e(i)!=="script"&&(t.has(i)?s(i):r.push(i))})};return s(e),r};function hn(e,t,n,r,{mark:s=!0}){let o=null;r?o="inert":n&&(o="aria-hidden");let i=null,u=null;const h=pt(t,e),f=s?ht(t,gt(h),new Set(h)):[],k=[],L=[];if(o){const b=Ue[o],T=gn(o);u=T,i=b;const A=pt(t,Array.from(t.querySelectorAll("[aria-live]"))),P=h.concat(A);ht(t,gt(P),new Set(P)).forEach(y=>{const E=y.getAttribute(o),Z=E!==null&&E!=="false",Y=(b.get(y)||0)+1;b.set(y,Y),k.push(y),Y===1&&Z&&T.add(y),Z||y.setAttribute(o,o==="inert"?"":"true")})}return s&&f.forEach(b=>{const T=(xe.get(b)||0)+1;xe.set(b,T),L.push(b),T===1&&b.setAttribute(dt,"")}),Ke+=1,()=>{i&&k.forEach(b=>{const A=(i.get(b)||0)-1;i.set(b,A),A||(!u?.has(b)&&o&&b.removeAttribute(o),u?.delete(b))}),s&&L.forEach(b=>{const T=(xe.get(b)||0)-1;xe.set(b,T),T||b.removeAttribute(dt)}),Ke-=1,Ke||(Ue.inert=new WeakMap,Ue["aria-hidden"]=new WeakMap,qe.inert=new WeakSet,qe["aria-hidden"]=new WeakSet,xe=new WeakMap)}}function mt(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0}=t,o=K(e[0]).body;return hn(e,o,n,r,{mark:s})}function Pt(){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=Pt();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 Ft=g.createContext(null),Mt=g.createContext(null),et=()=>g.useContext(Ft)?.id||null,tt=e=>{const t=g.useContext(Mt);return e??t};function $n(e){const t=ze(),n=tt(e),r=et();return H(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function zn(e){const{children:t,id:n}=e,r=et();return Se.jsx(Ft.Provider,{value:g.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Jn(e){const{children:t,externalTree:n}=e,r=Ot(()=>n??new mn).current;return Se.jsx(Mt.Provider,{value:r,children:t})}function bn(e,t){const n=Be(be(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 bt=20;let fe=[];function nt(){fe=fe.filter(e=>e.deref()?.isConnected)}function Et(e){nt(),e&&$e(e)!=="body"&&(fe.push(new WeakRef(e)),fe.length>bt&&(fe=fe.slice(-bt)))}function yt(){return nt(),fe[fe.length-1]?.deref()}function En(e){return e?Ze(e)?e:xt(e)[0]||e:null}function Rt(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=zt(e).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return Ze(s)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-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:o=!0,restoreFocus:i=!1,modal:u=!0,closeOnFocusOut:h=!0,openInteractionType:f="",nextFocusableElement:k,previousFocusableElement:L,beforeContentFocusGuardRef:b,externalTree:T,getInsideElements:A}=e,P="rootStore"in t?t.rootStore:t,_=P.useState("open"),y=P.useState("domReferenceElement"),E=P.useState("floatingElement"),{events:Z,dataRef:Y}=P.context,q=X(()=>Y.current.floatingContext?.nodeId),J=s===!1,D=ot(y)&&J,se=Ae(s),F=Ae(o),j=Ae(f),ve=Ae(_),N=tt(T),R=Dt(),B=g.useRef(!1),oe=g.useRef(!1),ee=g.useRef(!1),te=g.useRef(null),Ee=g.useRef(""),de=g.useRef(""),pe=g.useRef(null),ye=g.useRef(null),S=it(pe,b,R?.beforeInsideRef),$=it(ye,R?.afterInsideRef),ie=We(),ce=We(),Oe=Gt(),Me=R!=null,p=ct(E),ne=X((m=p)=>m?xt(m):[]),Q=X(()=>A?.().filter(m=>m!=null)??[]);g.useEffect(()=>{if(r||!u)return;function m(W){W.key==="Tab"&&C(p,ae(K(p)))&&ne().length===0&&!D&&un(W)}const I=K(p);return x(I,"keydown",m)},[r,p,u,D,ne]),g.useEffect(()=>{if(r||!_)return;const m=K(p);function I(){ee.current=!1}function W(z){const a=be(z),O=Q(),d=C(E,a)||C(y,a)||C(R?.portalNode,a)||O.some(M=>M===a||C(M,a));ee.current=!d,de.current=z.pointerType||"keyboard",a?.closest(`[${qt}]`)&&(oe.current=!0,ce.start(0,()=>{oe.current=!1}))}function G(){de.current="keyboard"}return ke(x(m,"pointerdown",W,!0),x(m,"pointerup",I,!0),x(m,"pointercancel",I,!0),x(m,"keydown",G,!0),I)},[r,E,y,p,_,R,ce,Q]),g.useEffect(()=>{if(r||!h)return;const m=K(p);function I(){oe.current=!0,ce.start(0,()=>{oe.current=!1})}function W(O){const d=be(O);Ze(d)&&(te.current=d)}function G(O){const d=O.relatedTarget,M=O.currentTarget,U=be(O);u&&d==null&&U!=null&&C(E,U)&&Et(U),queueMicrotask(()=>{const w=q(),Re=P.context.triggerElements,c=Q(),l=d?.hasAttribute(Xe("focus-guard"))&&[pe.current,ye.current,R?.beforeInsideRef.current,R?.afterInsideRef.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,le(L),le(k)].includes(d),V=!(C(y,d)||C(E,d)||C(d,E)||C(R?.portalNode,d)||c.some(v=>v===d||C(v,d))||d!=null&&Re.hasElement(d)||Re.hasMatchingElement(v=>C(v,d))||l||N&&(Fe(N.nodesRef.current,w).find(v=>C(v.context?.elements.floating,d)||C(v.context?.elements.domReference,d))||ft(N.nodesRef.current,w).find(v=>[v.context?.elements.floating,ct(v.context?.elements.floating)].includes(d)||v.context?.elements.domReference===d)));if(M===y&&p&&Rt(p),i&&M!==y&&!jt(U)&&ae(m)===m.body){if(he(p)&&(p.focus(),i==="popup")){Oe.request(()=>{p.focus()});return}const v=ne(),ue=te.current,we=(ue&&v.includes(ue)?ue:null)||v[v.length-1]||p;he(we)&&we.focus()}if(Y.current.insideReactTree){Y.current.insideReactTree=!1;return}(D||!u)&&d&&V&&!oe.current&&(D||d!==yt())&&(B.current=!0,P.setOpen(!1,Pe($t,O)))})}function z(){ee.current||(Y.current.insideReactTree=!0,ie.start(0,()=>{Y.current.insideReactTree=!1}))}const a=he(y)?y:null;if(!(!E&&!a))return ke(a&&x(a,"focusout",G),a&&x(a,"pointerdown",I),E&&x(E,"focusin",W),E&&x(E,"focusout",G),E&&R&&x(E,"focusout",z,!0))},[r,y,E,p,u,N,R,P,h,i,ne,D,q,Y,ie,ce,Oe,k,L,Q]),g.useEffect(()=>{if(r||!E||!_)return;const m=Array.from(R?.portalNode?.querySelectorAll(`[${Xe("portal")}]`)||[]),W=(N?ft(N.nodesRef.current,q()):[]).find(M=>ot(M.context?.elements.domReference||null))?.context?.elements.domReference,z=[...[E,...m,pe.current,ye.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,...Q()],W,le(L),le(k),D?y:null].filter(M=>M!=null),a=mt(z,{ariaHidden:u||D,mark:!1}),O=[E,...m].filter(M=>M!=null),d=mt(O);return()=>{d(),a()}},[_,r,y,E,u,R,D,N,q,k,L,Q]),H(()=>{if(!_||r||!he(p))return;const m=K(p),I=ae(m);queueMicrotask(()=>{const W=se.current,G=typeof W=="function"?W(j.current||""):W;if(G===void 0||G===!1||C(p,I))return;let a=null;const O=()=>(a==null&&(a=ne(p)),a[0]||p);let d;G===!0||G===null?d=O():d=le(G),d=d||O();const M=C(p,ae(m));Ge(d,{preventScroll:d===p,shouldFocus(){if(!ve.current)return!1;if(M)return!0;const U=ae(m);return!(U!==d&&C(p,U))}})})},[r,_,p,ne,se,j,ve]),H(()=>{if(r||!p)return;const m=K(p),I=ae(m),W=j.current==null;Et(I);function G(a){if(a.open||(Ee.current=bn(a.nativeEvent,de.current)),a.reason===Ut&&a.nativeEvent.type==="mouseleave"&&(B.current=!0),a.reason===It)if(a.nested)B.current=!1;else if(an(a.nativeEvent)||fn(a.nativeEvent))B.current=!1;else{let O=!1;K(p).createElement("div").focus({get preventScroll(){return O=!0,!1}}),O?B.current=!1:B.current=!0}}Z.on("openchange",G);function z(){const a=F.current;let O=typeof a=="function"?a(Ee.current):a;if(O===void 0||O===!1)return null;O===null&&(O=!0);const d=y?.isConnected?y:null,M=I?.isConnected&&$e(I)!=="body"?I:null;let U=W?M||d:d||M;return U||(U=yt()||null),typeof O=="boolean"?U:le(O)||U||null}return()=>{Z.off("openchange",G);const a=ae(m),O=Q(),d=C(E,a)||O.some(w=>w===a||C(w,a))||N&&Fe(N.nodesRef.current,q(),!1).some(w=>C(w.context?.elements.floating,a)),M=F.current,U=z();queueMicrotask(()=>{const w=En(U),Re=typeof M!="boolean";M&&!B.current&&he(w)&&(!(!Re&&w!==a&&a!==m.body)||d)&&w.focus({preventScroll:!0}),B.current=!1})}},[r,E,p,F,j,Z,N,y,q,Q]),H(()=>{if(!Je||_||!E)return;const m=ae(K(E));!he(m)||!Kt(m)||C(E,m)&&m.blur()},[_,E]),H(()=>{if(!(r||!R))return R.setFocusManagerState({modal:u,closeOnFocusOut:h,open:_,onOpenChange:P.setOpen,domReference:y}),()=>{R.setFocusManagerState(null)}},[r,R,u,_,P,h,y]),H(()=>{if(!(r||!p))return Rt(p),()=>{queueMicrotask(nt)}},[r,p]);const ge=!r&&(u?!D:!0)&&(Me||u);return Se.jsxs(g.Fragment,{children:[ge&&Se.jsx(ut,{"data-type":"inside",ref:S,onFocus:m=>{if(u){const I=ne();Ge(I[I.length-1])}else R?.portalNode&&(B.current=!1,lt(m,R.portalNode)?Vt(y)?.focus():le(L??R.beforeOutsideRef)?.focus())}}),n,ge&&Se.jsx(ut,{"data-type":"inside",ref:$,onFocus:m=>{u?Ge(ne()[0]):R?.portalNode&&(h&&(B.current=!0),lt(m,R.portalNode)?Xt(y)?.focus():le(k??R.afterOutsideRef)?.focus())}})]})}function yn(){return!1}function Rn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Qn(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:o="sloppy",referencePress:i=yn,bubbles:u,externalTree:h}=t,f="rootStore"in e?e.rootStore:e,k=f.useState("open"),L=f.useState("floatingElement"),{dataRef:b}=f.context,T=tt(h),A=X(typeof s=="function"?s:()=>!1),P=typeof s=="function"?A:s,_=P!==!1,y=X(()=>o),{escapeKey:E,outsidePress:Z}=Rn(u),Y=g.useRef(!1),q=g.useRef(!1),J=g.useRef(!1),D=g.useRef(!1),se=g.useRef(""),F=g.useRef(null),j=We(),ve=We(),N=X(()=>{ve.clear(),b.current.insideReactTree=!1}),R=X(S=>{const $=b.current.floatingContext?.nodeId;return(T?Fe(T.nodesRef.current,$):[]).some(ce=>ce.context?.open&&!ce.context.dataRef.current[S])}),B=X(S=>He(S,f.select("floatingElement"))||He(S,f.select("domReferenceElement"))),oe=X(S=>{i()&&f.setOpen(!1,Pe(Jt,S.nativeEvent))}),ee=X(S=>{if(!k||!n||!r||S.key!=="Escape"||D.current||!E&&R("__escapeKeyBubbles"))return;const $=ln(S)?S.nativeEvent:S,ie=Pe(Zt,$);f.setOpen(!1,ie),ie.isCanceled||S.preventDefault(),!E&&!ie.isPropagationAllowed&&S.stopPropagation()}),te=X(()=>{b.current.insideReactTree=!0,ve.start(0,N)}),Ee=X(S=>{if(!k||!n||S.button!==0)return;const $=be(S.nativeEvent);C(f.select("floatingElement"),$)&&(Y.current||(Y.current=!0,q.current=!1))}),de=X(S=>{!k||!n||(S.defaultPrevented||S.nativeEvent.defaultPrevented)&&Y.current&&(q.current=!0)});g.useEffect(()=>{if(!k||!n)return;b.current.__escapeKeyBubbles=E,b.current.__outsidePressBubbles=Z;const S=new Le,$=new Le;function ie(){S.clear(),D.current=!0}function ce(){S.start(Je?5:0,()=>{D.current=!1})}function Oe(){J.current=!0,$.start(0,()=>{J.current=!1})}function Me(){Y.current=!1,q.current=!1}function p(){const c=se.current,l=c==="pen"||!c?"mouse":c,V=y(),v=typeof V=="function"?V():V;return typeof v=="string"?v:v[l]}function ne(c){const l=p();return l==="intentional"&&c.type!=="click"||l==="sloppy"&&c.type==="click"}function Q(c){const l=b.current.floatingContext?.nodeId,V=T&&Fe(T.nodesRef.current,l).some(v=>He(c,v.context?.elements.floating));return B(c)||V}function ge(c){if(ne(c)){c.type!=="click"&&!B(c)&&($.clear(),J.current=!1),N();return}if(b.current.insideReactTree){N();return}const l=be(c),V=`[${Xe("inert")}]`,v=Ie(l)?l.getRootNode():null,ue=Array.from((Ct(v)?v:K(f.select("floatingElement"))).querySelectorAll(V)),we=f.context.triggerElements;if(l&&(we.hasElement(l)||we.hasMatchingElement(re=>C(re,l))))return;let Ce=Ie(l)?l:null;for(;Ce&&!_e(Ce);){const re=Qt(Ce);if(_e(re)||!Ie(re))break;Ce=re}if(!(ue.length&&Ie(l)&&!en(l)&&!C(l,f.select("floatingElement"))&&ue.every(re=>!C(Ce,re)))){if(he(l)&&!("touches"in c)){const re=_e(l),Ye=tn(l),st=/auto|scroll/,At=re||st.test(Ye.overflowX),Nt=re||st.test(Ye.overflowY),Wt=At&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Lt=Nt&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Bt=Ye.direction==="rtl",Yt=Lt&&(Bt?c.offsetX<=l.offsetWidth-l.clientWidth:c.offsetX>l.clientWidth),Ht=Wt&&c.offsetY>l.clientHeight;if(Yt||Ht)return}if(!Q(c)){if(p()==="intentional"&&J.current){$.clear(),J.current=!1;return}typeof P=="function"&&!P(c)||R("__outsidePressBubbles")||(f.setOpen(!1,Pe(It,c)),N())}}}function m(c){p()!=="sloppy"||c.pointerType==="touch"||!f.select("open")||!n||B(c)||ge(c)}function I(c){if(p()!=="sloppy"||!f.select("open")||!n||B(c))return;const l=c.touches[0];l&&(F.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{F.current&&(F.current.dismissOnTouchEnd=!1,F.current.dismissOnMouseDown=!1)}))}function W(c,l){const V=be(c);if(!V)return;const v=x(V,c.type,()=>{l(c),v()})}function G(c){se.current="touch",W(c,I)}function z(c){j.clear(),c.type==="pointerdown"&&(se.current=c.pointerType),!(c.type==="mousedown"&&F.current&&!F.current.dismissOnMouseDown)&&W(c,l=>{l.type==="pointerdown"?m(l):ge(l)})}function a(c){if(!Y.current)return;const l=q.current;if(Me(),p()==="intentional"){if(c.type==="pointercancel"){l&&Oe();return}if(!Q(c)){if(l){Oe();return}typeof P=="function"&&!P(c)||($.clear(),J.current=!0,N())}}}function O(c){if(p()!=="sloppy"||!F.current||B(c))return;const l=c.touches[0];if(!l)return;const V=Math.abs(l.clientX-F.current.startX),v=Math.abs(l.clientY-F.current.startY),ue=Math.sqrt(V*V+v*v);ue>5&&(F.current.dismissOnTouchEnd=!0),ue>10&&(ge(c),j.clear(),F.current=null)}function d(c){W(c,O)}function M(c){p()!=="sloppy"||!F.current||B(c)||(F.current.dismissOnTouchEnd&&ge(c),j.clear(),F.current=null)}function U(c){W(c,M)}const w=K(L),Re=ke(r&&ke(x(w,"keydown",ee),x(w,"compositionstart",ie),x(w,"compositionend",ce)),_&&ke(x(w,"click",z,!0),x(w,"pointerdown",z,!0),x(w,"pointerup",a,!0),x(w,"pointercancel",a,!0),x(w,"mousedown",z,!0),x(w,"mouseup",a,!0),x(w,"touchstart",G,!0),x(w,"touchmove",d,!0),x(w,"touchend",U,!0)));return()=>{Re(),S.clear(),$.clear(),Me(),J.current=!1}},[b,L,r,_,P,k,n,E,Z,ee,N,y,R,B,T,f,j]),g.useEffect(N,[P,N]);const pe=g.useMemo(()=>({onKeyDown:ee,onPointerDown:oe,onClick:oe}),[ee,oe]),ye=g.useMemo(()=>({onKeyDown:ee,onPointerDown:de,onMouseDown:de,onClickCapture:te,onMouseDownCapture(S){te(),Ee(S)},onPointerDownCapture(S){te(),Ee(S)},onMouseUpCapture:te,onTouchEndCapture:te,onTouchMoveCapture:te}),[ee,te,Ee,de]);return g.useMemo(()=>n?{reference:pe,floating:ye,trigger:pe}:{},[n,pe,ye])}function Tn(e){const t=g.useRef(!0);t.current&&(t.current=!1,e())}const Sn={open:Te(e=>e.open),transitionStatus:Te(e=>e.transitionStatus),domReferenceElement:Te(e=>e.domReferenceElement),referenceElement:Te(e=>e.positionReference??e.referenceElement),floatingElement:Te(e=>e.floatingElement),floatingId:Te(e=>e.floatingId)};class vn extends nn{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:o,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:Pt(),nested:r,triggerElements:o},Sn),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&dn(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 On(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:o,onOpenChange:i}=e,u=t.useState("open"),h=t.useState("activeTriggerElement"),f=t.useState(n?"popupElement":"positionerElement"),k=t.context.triggerElements,L=i,b=g.useRef(null);r===void 0&&b.current===null&&(b.current=new vn({open:u,transitionStatus:void 0,referenceElement:h,floatingElement:f,triggerElements:k,onOpenChange:L,floatingId:s,syncOnly:!0,nested:o}));const T=r??b.current;return t.useSyncedValue("floatingId",s),H(()=>{const A={open:u,floatingId:s,referenceElement:h,floatingElement:f};Ie(h)&&(A.domReferenceElement=h),T.state.positionReference===T.state.referenceElement&&(A.positionReference=h),T.update(A)},[u,s,h,f,T]),T.context.onOpenChange=L,T.context.nested=o,T}function wn(e,t=!1,n=!1){const[r,s]=g.useState(e&&t?"idle":void 0),[o,i]=g.useState(e);return e&&!o&&(i(!0),s("starting")),!e&&o&&r!=="ending"&&!n&&s("ending"),!e&&!o&&r==="ending"&&s(void 0),H(()=>{if(!e&&o&&r!=="ending"&&n){const u=me.request(()=>{s("ending")});return()=>{me.cancel(u)}}},[e,o,r,n]),H(()=>{if(!e||t)return;const u=me.request(()=>{s(void 0)});return()=>{me.cancel(u)}},[t,e]),H(()=>{if(!e||!t)return;e&&o&&r!=="idle"&&s("starting");const u=me.request(()=>{s("idle")});return()=>{me.cancel(u)}},[t,e,o,r]),{mounted:o,setMounted:i,transitionStatus:r}}const er={tabIndex:-1,[rn]:""};function tr(e){return t=>t==="touch"?e.current:!0}function nr(e,t,n=!1){const r=ze(),s=et()!=null,o=g.useRef(null);e===void 0&&o.current===null&&(o.current=t(r,s));const i=e??o.current;return On({popupStore:i,treatPopupAsFloatingElement:n,floatingRootContext:i.state.floatingRootContext,floatingId:r,nested:s,onOpenChange:i.setOpen}),{store:i,internalStore:o.current}}function Cn(e,t){const n=g.useRef(null),r=g.useRef(null);return g.useCallback(s=>{if(e===void 0)return;let o=!1;if(n.current!==null){const i=n.current,u=r.current,h=t.context.triggerElements.getById(i);u&&h===u&&(t.context.triggerElements.delete(i),o=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),o=!0),o){const i=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==i&&t.set("triggerCount",i)}},[t,e])}function rr(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const s=n?.id??null;(s||t)&&(e.activeTriggerId=s,e.activeTriggerElement=n??null)}function sr(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function or(e,t,n,r){Tn(()=>{t===void 0&&e.state.open===!1&&n&&(e.state={...e.state,open:!0,activeTriggerId:r,preventUnmountingOnClose:!1})})}function ir(e,t,n,r){const s=n.useState("isMountedByTrigger",e),o=Cn(e,n),i=X(u=>{if(o(u),!u)return;const h=n.select("open"),f=n.select("activeTriggerId");if(f===e){n.update({activeTriggerElement:u,...h?r:null});return}f==null&&h&&n.update({activeTriggerId:e,activeTriggerElement:u,...r})});return H(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:s}}function cr(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState("open"),s=e.useState("triggerCount");H(()=>{if(!r){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const o=e.context.triggerElements.size,i={};e.state.triggerCount!==o&&(i.triggerCount=o);const u=e.select("activeTriggerId");let h=null;if(u){const f=e.context.triggerElements.getById(u);f?f!==e.state.activeTriggerElement&&(i.activeTriggerElement=f):h=u}if(!h&&!u&&o===1){const f=e.context.triggerElements.entries().next();if(!f.done){const[k,L]=f.value;i.activeTriggerId=k,i.activeTriggerElement=L}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),h&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===h&&!e.context.triggerElements.getById(h)){const f=Pe(sn);e.setOpen(!1,f),f.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,n])}function ur(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=wn(e),i=t.useState("preventUnmountingOnClose"),u=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:o,preventUnmountingOnClose:u});const h=X(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return on({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||h()}}),{forceUnmount:h,transitionStatus:o}}function lr(e,t){e.useSyncedValues(t),H(()=>()=>{e.update({activeTriggerProps:De,inactiveTriggerProps:De,popupProps:De})},[e])}function ar(e,t){H(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),H(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class fr{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 rt=(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 xn={[je.popupOpen]:""},In={[je.popupOpen]:"",[je.pressed]:""},kn={[rt.open]:""},Pn={[rt.closed]:""},Fn={[rt.anchorHidden]:""},dr={open(e){return e?xn:null}},pr={open(e){return e?In:null}},gr={open(e){return e?kn:Pn},anchorHidden(e){return e?Fn:null}};function hr(e){return ze(e,"base-ui")}const Mn="ArrowUp",An="ArrowDown",Nn="ArrowLeft",Wn="ArrowRight",Ln="Home",Bn="End",Yn=new Set([Nn,Wn]),Hn=new Set([Mn,An]),_n=new Set([...Yn,...Hn]),mr=new Set([..._n,Ln,Bn]),br=g.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return Se.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})});let Tt={},St={},vt="";function Dn(e){if(typeof document>"u")return!1;const t=K(e);return Be(t).innerWidth-t.documentElement.clientWidth>0}function Gn(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=K(e),r=n.documentElement,s=n.body,o=Qe(r)?r:s,i=o.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const h=o.offsetWidth;o.style.overflowY="hidden";const f=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=u,h===f}function Un(e){const t=K(e),n=t.documentElement,r=t.body,s=Qe(n)?n:r,o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function Kn(e){const t=K(e),n=t.documentElement,r=t.body,s=Be(n);let o=0,i=0,u=!1;const h=me.create();if(Je&&(s.visualViewport?.scale??1)!==1)return()=>{};function f(){const T=s.getComputedStyle(n),A=s.getComputedStyle(r),y=(T.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Tt={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},vt=n.style.scrollBehavior,St={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,Y=T.overflowY==="scroll"||A.overflowY==="scroll",q=T.overflowX==="scroll"||A.overflowX==="scroll",J=Math.max(0,s.innerWidth-r.clientWidth),D=Math.max(0,s.innerHeight-r.clientHeight),se=parseFloat(A.marginTop)+parseFloat(A.marginBottom),F=parseFloat(A.marginLeft)+parseFloat(A.marginRight),j=Qe(n)?n:r;if(u=Gn(e),u){n.style.scrollbarGutter=y,j.style.overflowY="hidden",j.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(E||Y)&&(n.style.overflowY="scroll"),(Z||q)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:se||D?`calc(100dvh - ${se+D}px)`:"100dvh",width:F||J?`calc(100vw - ${F+J}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function k(){Object.assign(n.style,Tt),Object.assign(r.style,St),u||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=vt)}function L(){k(),h.request(f)}f();const b=x(s,"resize",L);return()=>{h.cancel(),k(),typeof s.removeEventListener=="function"&&b()}}class Vn{lockCount=0;restore=null;timeoutLock=Le.create();timeoutUnlock=Le.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=K(t).documentElement,s=Be(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=wt;return}const o=cn||!Dn(t);this.restore=o?Un(t):Kn(t)}}const Xn=new Vn;function Er(e=!0,t=null){H(()=>{if(e)return Xn.acquire(t)},[e,t])}export{Ge as A,un as B,mr as C,an as D,fn as E,Jn as F,Tn as G,Er as H,br as I,rt as J,fr as P,wn as a,tt as b,et as c,Ae as d,sr as e,nr as f,Fe as g,or as h,jn as i,ar as j,cr as k,ur as l,Qn as m,er as n,lr as o,ir as p,pr as q,$n as r,rr as s,dr as t,hr as u,zn as v,tr as w,Zn as x,gr as y,vn as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,b3 as r,ai as a,b4 as n,b5 as s}from"./main-DY9GCwr_.js";const T=Object.freeze({mode:a.COMPACT,setMode:()=>{},formatTokens:(o,t={})=>s(o,t),formatTokensTooltip:(o,t={})=>n(o,t)});function f(){return e.useContext(r)??T}export{f as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./main-
|
|
1
|
+
import{c as a}from"./main-DY9GCwr_.js";const o=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],e=a("zap",o);export{e as Z};
|
|
@@ -249,8 +249,8 @@
|
|
|
249
249
|
]
|
|
250
250
|
}
|
|
251
251
|
</script>
|
|
252
|
-
<script type="module" crossorigin src="/assets/main-
|
|
253
|
-
<link rel="stylesheet" crossorigin href="/assets/main-
|
|
252
|
+
<script type="module" crossorigin src="/assets/main-DY9GCwr_.js"></script>
|
|
253
|
+
<link rel="stylesheet" crossorigin href="/assets/main-BbNuscIe.css">
|
|
254
254
|
</head>
|
|
255
255
|
<body>
|
|
256
256
|
<main class="aeo-seed-content" aria-label="Token Tracker AI-readable summary">
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"description": "Shareable Token Tracker dashboard snapshot."
|
|
76
76
|
}
|
|
77
77
|
</script>
|
|
78
|
-
<script type="module" crossorigin src="/assets/main-
|
|
79
|
-
<link rel="stylesheet" crossorigin href="/assets/main-
|
|
78
|
+
<script type="module" crossorigin src="/assets/main-DY9GCwr_.js"></script>
|
|
79
|
+
<link rel="stylesheet" crossorigin href="/assets/main-BbNuscIe.css">
|
|
80
80
|
</head>
|
|
81
81
|
<body>
|
|
82
82
|
<main class="aeo-seed-content" aria-label="Token Tracker share page summary">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokentracker-cli",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.4",
|
|
4
4
|
"description": "Local-first AI coding token usage and cost tracker for 27 tools, with a dashboard, desktop pet, widgets, achievements, and native macOS/Windows apps.",
|
|
5
5
|
"main": "src/cli.js",
|
|
6
6
|
"bin": {
|
package/src/commands/sync.js
CHANGED
|
@@ -1910,6 +1910,10 @@ async function cmdSync(argv, context = {}) {
|
|
|
1910
1910
|
if (!opts.auto) {
|
|
1911
1911
|
process.stderr.write(`Upload error: ${e?.message || e}\n`);
|
|
1912
1912
|
}
|
|
1913
|
+
// `sync --drain` is the readiness boundary for first-time cloud view:
|
|
1914
|
+
// callers must not treat a swallowed upload failure as a completed
|
|
1915
|
+
// historical backfill and switch away from the intact local data.
|
|
1916
|
+
if (opts.drain) throw e;
|
|
1913
1917
|
}
|
|
1914
1918
|
}
|
|
1915
1919
|
|