codesesh 0.5.0 → 0.6.1

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.
@@ -1,106 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{l as t,t as n,u as r}from"./markdown-CnUlvKkZ.js";import{n as i,r as a,t as o}from"./react-DT3QPCDf.js";import{A as s,C as c,D as l,E as u,M as d,O as f,S as p,T as m,_ as h,a as g,b as _,c as v,d as y,f as b,g as x,h as ee,j as te,k as S,l as ne,m as re,n as ie,o as C,p as ae,r as w,s as oe,t as se,u as ce,v as T,w as E,x as le,y as D}from"./vendor-CWmLg_mG.js";import{C as O,S as ue,_ as de,a as fe,b as pe,c as me,d as k,f as he,g as ge,h as A,i as j,l as _e,m as ve,n as ye,o as be,p as xe,r as Se,s as M,t as N,u as Ce,v as we,x as Te,y as Ee}from"./syntax-DcanuzfQ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var P=e(r(),1),De=e(a(),1),F={agents:{opencode:{name:`OpenCode`,icon:`/icon/agent/opencode.svg`},codex:{name:`Codex`,icon:`/icon/agent/codex.svg`},cursor:{name:`Cursor`,icon:`/icon/agent/cursor.svg`},kimi:{name:`Kimi-Cli`,icon:`/icon/agent/kimi.svg`},claudecode:{name:`Claude Code`,icon:`/icon/agent/claudecode.svg`},kilo:{name:`Kilo Code`,icon:`/icon/agent/kilocode.svg`},antigravity:{name:`Antigravity`,icon:`/icon/agent/antigravity.svg`}},getDefaultAgentKey(){let e=Object.keys(this.agents);return e.length>0?e[0]:null},getAgentName(e){let t=this.agents[e];return t||=this.agents[e.toLowerCase()],t?t.name:e}};async function Oe(){let e=await fetch(`/api/config`);if(!e.ok)throw Error(`Failed to fetch config`);return e.json()}async function ke(){let e=await fetch(`/api/agents`);if(!e.ok)throw Error(`Failed to fetch agents`);return e.json()}async function Ae(e={}){let t=new URLSearchParams;e.agent&&t.set(`agent`,e.agent),e.projectKey&&t.set(`projectKey`,e.projectKey),e.from!=null&&t.set(`from`,new Date(e.from).toISOString()),e.to!=null&&t.set(`to`,new Date(e.to).toISOString());let n=await fetch(`/api/sessions?${t}`);if(!n.ok)throw Error(`Failed to fetch sessions`);return n.json()}async function je(e,t){let n=await fetch(`/api/sessions/${e}/${t}`);if(!n.ok)throw Error(`Failed to fetch session data`);return n.json()}async function Me(e){let t=new URLSearchParams;e?.from!=null&&t.set(`from`,new Date(e.from).toISOString()),e?.to!=null&&t.set(`to`,new Date(e.to).toISOString()),e?.days!=null&&e.days>0&&t.set(`days`,String(e.days));let n=t.toString(),r=await fetch(n?`/api/dashboard?${n}`:`/api/dashboard`);if(!r.ok)throw Error(`Failed to fetch dashboard`);return r.json()}async function Ne(e){let t=new URLSearchParams;t.set(`q`,e);let n=await fetch(`/api/search?${t}`);if(!n.ok)throw Error(`Failed to fetch search results`);return n.json()}async function Pe(){let e=await fetch(`/api/bookmarks`);if(!e.ok)throw Error(`Failed to fetch bookmarks`);return e.json()}async function Fe(e){let t=await fetch(`/api/bookmarks`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`Failed to save bookmark`);return t.json()}async function Ie(e){let t=await fetch(`/api/bookmarks/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`Failed to import bookmarks`);return t.json()}async function Le(e,t){if(!(await fetch(`/api/bookmarks/${e}/${t}`,{method:`DELETE`})).ok)throw Error(`Failed to delete bookmark`)}function I(e,t={}){let n=JSON.stringify({event:e,data:t});try{if(typeof navigator<`u`&&navigator.sendBeacon){let e=new Blob([n],{type:`application/json`});if(navigator.sendBeacon(`/api/logs`,e))return}}catch{}fetch(`/api/logs`,{method:`POST`,headers:{"Content-Type":`application/json`},body:n,keepalive:!0}).catch(()=>{})}function Re(e){let t=new EventSource(`/api/events`);return t.addEventListener(`sessions-updated`,t=>{try{e(JSON.parse(t.data))}catch(e){console.error(`Failed to parse session update event:`,e)}}),t.onerror=()=>{console.error(`Session update stream disconnected`)},()=>{t.close()}}function L(...e){return C(oe(e))}var R=t(),ze={bugfix:`bugfix`,refactoring:`refactoring`,"feature-dev":`feature-dev`,testing:`testing`,docs:`docs`,"git-ops":`git-ops`,"build-deploy":`build-deploy`,exploration:`exploration`,planning:`planning`},z={bugfix:{text:`#B42318`,border:`#FECDCA`,background:`#FEF3F2`,bar:`#F04438`},refactoring:{text:`#6941C6`,border:`#D9D6FE`,background:`#F4F3FF`,bar:`#7A5AF8`},"feature-dev":{text:`#175CD3`,border:`#B2DDFF`,background:`#EFF8FF`,bar:`#2E90FA`},testing:{text:`#027A48`,border:`#ABEFC6`,background:`#ECFDF3`,bar:`#12B76A`},docs:{text:`#B54708`,border:`#FEDF89`,background:`#FFFAEB`,bar:`#F79009`},"git-ops":{text:`#3538CD`,border:`#C7D7FE`,background:`#EEF4FF`,bar:`#444CE7`},"build-deploy":{text:`#C4320A`,border:`#F9DBAF`,background:`#FEF6EE`,bar:`#EF6820`},exploration:{text:`#0E7090`,border:`#A5F0FC`,background:`#ECFDFF`,bar:`#06AED4`},planning:{text:`#C11574`,border:`#FCCEEE`,background:`#FDF2FA`,bar:`#EE46BC`}};function B(e){return z[e]}function Be(e){let t=B(e);return{color:t.text,borderColor:t.border,backgroundColor:t.background}}function Ve({tags:e,limit:t=4,className:n=``}){if(!e||e.length===0)return null;let r=e.slice(0,t),i=e.length-r.length;return(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-1 ${n}`,children:[r.map(e=>(0,R.jsx)(`span`,{className:`console-mono rounded-sm border px-1.5 py-0.5 text-[10px] font-medium`,style:Be(e),children:ze[e]},e)),i>0?(0,R.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:[`+`,i]}):null]})}function He(e,t){return e?Math.abs(e.receiptWidth-t.receiptWidth)>.5||Math.abs(e.receiptHeight-t.receiptHeight)>.5||Math.abs(e.startX-t.startX)>.5||Math.abs(e.startY-t.startY)>.5:!0}var V=18,H=42,Ue=5,U=270,We=500,Ge=2;function Ke(e){return Math.round(e??0).toLocaleString(`en-US`)}function qe(e){return`$${(e??0).toFixed(4)}`}function Je(e){return new Date(e).toLocaleString(`en-US`,{month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function Ye(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Xe(e){let t=e||1;return()=>(t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296)}function Ze(e){let t=[{label:`User`,count:e.counts.user},{label:`Agent Responses`,count:e.counts.agent_message},{label:`Thinking`,count:e.counts.thinking},{label:`Plans`,count:e.counts.plan},{label:`Tools`,count:e.counts.tools_all}].filter(e=>e.count>0),n=e.tools.map(e=>({label:e.label,count:e.count})),r=Math.max(0,9-t.length),i=n.length>r?n.slice(0,Math.max(0,r-1)):n,a=n.slice(i.length).reduce((e,t)=>e+t.count,0);return a>0&&i.push({label:`Other tools`,count:a}),[...t,...i].slice(0,9)}function Qe(e){return!e||e.length===0?`SESSION ACTIVITY RECEIPT`:e.map(e=>ze[e]).join(` / `)}function $e(e,t){let n=e.slug?.split(`/`)[0]||`codesesh`;return{id:e.id,title:e.title||`Untitled session`,agent:n,updatedAt:e.time_updated??e.time_created,tags:e.smart_tags,stats:e.stats,items:Ze(t)}}function et(e,t,n,r,i){let a=t.toUpperCase(),o=n.toUpperCase();e.fillText(a,18,r),e.fillText(o,i-18-e.measureText(o).width,r)}function tt(e,t,n){if(e.measureText(t).width<=n)return t;let r=t;for(;r.length>1&&e.measureText(`${r}...`).width>n;)r=r.slice(0,-1);return`${r}...`}function nt(e,t,n,r){let i=t.toUpperCase().split(/\s+/).filter(Boolean),a=[],o=``;for(let t of i){let i=o?`${o} ${t}`:t;if(e.measureText(i).width<=n){o=i;continue}if(o?(a.push(o),o=t):(a.push(tt(e,t,n)),o=``),a.length===r)break}return a.length<r&&o&&a.push(o),a.length>0&&a.length===r&&(a[a.length-1]=tt(e,a[a.length-1]??``,n)),a.slice(0,r)}function rt(e){let t=document.createElement(`canvas`);t.width=U*Ge,t.height=We*Ge;let n=t.getContext(`2d`);if(!n)return t;n.scale(Ge,Ge);let r=n.createLinearGradient(0,0,U,We);r.addColorStop(0,`#ffffff`),r.addColorStop(.55,`#fafaf6`),r.addColorStop(1,`#f2f2ec`),n.fillStyle=r,n.fillRect(0,0,U,We);let i=Xe(Ye(e.id));n.fillStyle=`rgba(0, 0, 0, 0.035)`;for(let e=0;e<1200;e+=1)n.globalAlpha=.12+i()*.14,n.fillRect(i()*U,i()*We,.7,.7);n.globalAlpha=1,n.fillStyle=`rgba(0, 0, 0, 0.78)`,n.font=`700 18px 'Courier New', monospace`,n.textAlign=`center`,n.fillText(`CODESESH MART`,U/2,34),n.font=`11px 'Courier New', monospace`,n.fillText(tt(n,Qe(e.tags).toUpperCase(),U-36),U/2,51),n.strokeStyle=`rgba(0, 0, 0, 0.5)`,n.lineWidth=1,n.setLineDash([4,4]),n.beginPath(),n.moveTo(18,66),n.lineTo(U-18,66),n.stroke(),n.setLineDash([]),n.textAlign=`left`,n.fillStyle=`rgba(0, 0, 0, 0.74)`,n.font=`11px 'Courier New', monospace`,et(n,`Agent`,e.agent,88,U),et(n,`Updated`,Je(e.updatedAt),104,U),et(n,`Session`,`#${e.id.slice(0,8)}`,120,U),n.setLineDash([2,3]),n.beginPath(),n.moveTo(18,140),n.lineTo(U-18,140),n.stroke(),n.setLineDash([]),n.font=`700 12px 'Courier New', monospace`,n.fillText(`SESSION TOC RECEIPT LIST`,18,163),n.font=`11px 'Courier New', monospace`;let a=185;for(let t of e.items){let e=Ke(t.count);n.fillText(tt(n,t.label,168),18,a),n.fillText(e,U-18-n.measureText(e).width,a),a+=17}return n.strokeStyle=`rgba(0, 0, 0, 0.62)`,n.lineWidth=1.5,n.beginPath(),n.moveTo(18,a+5),n.lineTo(U-18,a+5),n.stroke(),a+=26,et(n,`Input tokens`,Ke(e.stats.total_input_tokens),a,U),a+=16,et(n,`Output tokens`,Ke(e.stats.total_output_tokens),a,U),a+=16,et(n,`Messages`,Ke(e.stats.message_count),a,U),a+=22,n.font=`700 13px 'Courier New', monospace`,et(n,`TOTAL COST`,qe(e.stats.total_cost),a,U),n.strokeStyle=`rgba(0, 0, 0, 0.45)`,n.setLineDash([4,4]),n.beginPath(),n.moveTo(18,a+18),n.lineTo(U-18,a+18),n.stroke(),n.setLineDash([]),n.font=`10px 'Courier New', monospace`,n.textAlign=`center`,n.fillStyle=`rgba(0, 0, 0, 0.62)`,nt(n,e.title,U-36,2).forEach((e,t)=>{n.fillText(e,U/2,a+38+t*13)}),t}function W(e,t){return e*V+t}function it(e){let{receiptWidth:t,receiptHeight:n,startX:r,startY:i}=e,a=t/(V-1),o=n/(H-1),s=[],c=[];for(let e=0;e<H;e+=1)for(let t=0;t<V;t+=1){let n=r+t*a,c=i+e*o;s.push({x:n,y:c,oldX:n,oldY:c,fixedX:e===0?n:null,fixedY:e===0?c:null})}let l=(e,t,n)=>{let r=s[e],i=s[t];!r||!i||c.push({a:e,b:t,length:Math.hypot(i.x-r.x,i.y-r.y),stiffness:n})};for(let e=0;e<H;e+=1)for(let t=0;t<V;t+=1){let n=W(e,t);t<V-1&&l(n,W(e,t+1),.98),e<H-1&&l(n,W(e+1,t),.92),e<H-1&&t<V-1&&(l(n,W(e+1,t+1),.46),l(W(e+1,t),W(e,t+1),.46)),t<V-2&&l(n,W(e,t+2),.35),e<H-2&&l(n,W(e+2,t),.28)}return{particles:s,constraints:c,receiptWidth:t,receiptHeight:n}}function at(e,t){let n=t.receiptWidth/(V-1);for(let r=0;r<V;r+=1){let i=e[r];i&&(i.fixedX=t.startX+r*n,i.fixedY=t.startY)}}function ot(e){for(let t=0;t<V;t+=1){let n=e[t];!n||n.fixedX==null||n.fixedY==null||(n.x=n.fixedX,n.y=n.fixedY,n.oldX=n.fixedX,n.oldY=n.fixedY)}}function st(e,t){let n=e[t.a],r=e[t.b];if(!n||!r)return;let i=r.x-n.x,a=r.y-n.y,o=Math.hypot(i,a);if(o<1e-4)return;let s=(o-t.length)/o*t.stiffness,c=n.fixedX!=null&&n.fixedY!=null,l=r.fixedX!=null&&r.fixedY!=null,u=c?0:l?1:.5,d=l?0:c?1:.5,f=i*s,p=a*s;c||(n.x+=f*u,n.y+=p*u),l||(r.x-=f*d,r.y-=p*d)}function ct(e,t,n,r,i){let a=n[W(r,i)],o=n[W(r,i+1)],s=n[W(r+1,i)],c=n[W(r+1,i+1)];if(!a||!o||!s||!c)return;let l=i/(V-1)*t.width,u=r/(H-1)*t.height,d=t.width/(V-1),f=t.height/(H-1);e.save(),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(o.x,o.y),e.lineTo(c.x,c.y),e.lineTo(s.x,s.y),e.closePath(),e.clip(),e.transform((o.x-a.x)/d,(o.y-a.y)/d,(s.x-a.x)/f,(s.y-a.y)/f,a.x,a.y),e.drawImage(t,l,u,d+1,f+1,0,0,d+1,f+1),e.restore();let p=Math.atan2(o.y-a.y,o.x-a.x),m=Math.hypot(s.x-a.x,s.y-a.y)/(We/(H-1)),h=Math.sin(p)*.08+(m-1)*.16;Math.abs(h)<.01||(e.save(),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(o.x,o.y),e.lineTo(c.x,c.y),e.lineTo(s.x,s.y),e.closePath(),e.fillStyle=h>0?`rgba(255,255,255,${h})`:`rgba(0,0,0,${-h})`,e.fill(),e.restore())}function lt(e,t,n){let r=null,i=44;for(let a=V;a<e.length;a+=1){let o=e[a];if(!o)continue;let s=Math.hypot(o.x-t,o.y-n);s<i&&(i=s,r=a)}return r}function ut({session:e,toc:t}){let n=(0,P.useRef)(null),r=(0,P.useRef)(null),i=(0,P.useRef)(null),a=(0,P.useMemo)(()=>$e(e,t),[e,t]);return(0,P.useLayoutEffect)(()=>{let e=n.current,t=r.current,o=i.current;if(!e||!t||!o)return;let s=e.getContext(`2d`,{alpha:!0});if(!s)return;let c={id:null,x:0,y:0,prevX:0,prevY:0,vx:0,vy:0,grabbedIndex:null},l=rt(a),u=0,d=0,f=0,p=it({receiptWidth:U,receiptHeight:We,startX:0,startY:32}),m=performance.now(),h=null,g=0,_=!1,v=()=>{let e=t.getBoundingClientRect(),n=Math.max(280,e.width||320),r=Math.min(U,n-34);return{receiptWidth:r,receiptHeight:Math.min(We,Math.max(320,f-e.top-42)),startX:e.left+(e.width-r)/2,startY:e.top+32}},y=t=>{_!==t&&(_=t,e.style.visibility=t?`visible`:`hidden`,o.style.visibility=t?`visible`:`hidden`)},b=(e,t=performance.now())=>{p=it(e),h=e,m=t},x=()=>{let t=window.devicePixelRatio||1;d=Math.max(1,window.innerWidth),f=Math.max(1,window.innerHeight),e.width=Math.floor(d*t),e.height=Math.floor(f*t),s.setTransform(t,0,0,t,0,0),g=0,y(!1),b(v())},ee=e=>({x:e.clientX,y:e.clientY}),te=e=>{if(e.button!==0)return;let t=ee(e),n=lt(p.particles,t.x,t.y);n!=null&&(e.preventDefault(),o.setPointerCapture(e.pointerId),c.id=e.pointerId,c.x=t.x,c.y=t.y,c.prevX=t.x,c.prevY=t.y,c.vx=0,c.vy=0,c.grabbedIndex=n)},S=e=>{if(c.id!==e.pointerId)return;let t=ee(e);c.vx=t.x-c.prevX,c.vy=t.y-c.prevY,c.prevX=t.x,c.prevY=t.y,c.x=t.x,c.y=t.y},ne=e=>{if(c.id!==e.pointerId)return;let t=c.grabbedIndex==null?null:p.particles[c.grabbedIndex];t&&(t.oldX=t.x-c.vx*.9,t.oldY=t.y-c.vy*.9),c.id=null,c.grabbedIndex=null},re=e=>{let t=(e-m)/1e3;for(let e=V;e<p.particles.length;e+=1){let n=p.particles[e];if(!n)continue;let r=(n.x-n.oldX)*.985,i=(n.y-n.oldY)*.985;n.oldX=n.x,n.oldY=n.y,n.x+=r+Math.sin(t*1.7+e*.19)*.018,n.y+=i+.22}let n=c.grabbedIndex==null?null:p.particles[c.grabbedIndex];n&&(n.x+=(c.x-n.x)*.72,n.y+=(c.y-n.y)*.72)},ie=()=>{for(let e=0;e<Ue;e+=1){ot(p.particles);for(let e of p.constraints)st(p.particles,e)}ot(p.particles)},C=()=>{let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let i of p.particles)e=Math.min(e,i.x),t=Math.min(t,i.y),n=Math.max(n,i.x),r=Math.max(r,i.y);o.style.transform=`translate3d(${e-20}px, ${t-20}px, 0)`,o.style.width=`${n-e+40}px`,o.style.height=`${r-t+40}px`},ae=()=>{let e=p.particles[0],t=p.particles[V-1],n=p.particles[H*V-1],r=p.particles[(H-1)*V];!e||!t||!n||!r||(s.save(),s.shadowColor=`rgba(0,0,0,0.24)`,s.shadowBlur=24,s.shadowOffsetY=16,s.fillStyle=`rgba(0,0,0,0.14)`,s.beginPath(),s.moveTo(e.x,e.y),s.lineTo(t.x,t.y),s.lineTo(n.x,n.y),s.lineTo(r.x,r.y),s.closePath(),s.fill(),s.restore())},w=()=>{let e=p.particles[0],t=p.particles[V-1];!e||!t||(s.save(),s.strokeStyle=`rgba(0,0,0,0.72)`,s.lineWidth=4,s.lineCap=`round`,s.beginPath(),s.moveTo(e.x-10,e.y-3),s.lineTo(t.x+10,t.y-3),s.stroke(),s.strokeStyle=`rgba(255,255,255,0.55)`,s.lineWidth=1,s.beginPath(),s.moveTo(e.x-8,e.y-5),s.lineTo(t.x+8,t.y-5),s.stroke(),s.restore())},oe=()=>{s.clearRect(0,0,d,f),ae();for(let e=0;e<H-1;e+=1)for(let t=0;t<V-1;t+=1)ct(s,l,p.particles,e,t);w(),C()},se=e=>{let t=v();He(h,t)&&c.id==null?(g=0,y(!1),b(t,e)):(g+=1,h=t),at(p.particles,t),re(e),ie(),oe(),g>=2&&y(!0),u=window.requestAnimationFrame(se)};y(!1),x();let ce=new ResizeObserver(x);return ce.observe(t),window.addEventListener(`resize`,x),o.addEventListener(`pointerdown`,te),o.addEventListener(`pointermove`,S),o.addEventListener(`pointerup`,ne),o.addEventListener(`pointercancel`,ne),u=window.requestAnimationFrame(se),()=>{window.cancelAnimationFrame(u),ce.disconnect(),window.removeEventListener(`resize`,x),o.removeEventListener(`pointerdown`,te),o.removeEventListener(`pointermove`,S),o.removeEventListener(`pointerup`,ne),o.removeEventListener(`pointercancel`,ne)}},[a]),(0,R.jsx)(`aside`,{className:`hidden xl:block`,children:(0,R.jsxs)(`div`,{ref:r,className:`sticky top-4 h-[560px]`,children:[(0,R.jsx)(`canvas`,{ref:n,className:`invisible pointer-events-none fixed inset-0 z-40 block h-screen w-screen touch-none`,"aria-hidden":`true`}),(0,R.jsx)(`div`,{ref:i,className:`invisible fixed left-0 top-0 z-40 cursor-grab touch-none active:cursor-grabbing`,"aria-label":`Interactive thermal receipt with Verlet paper simulation`})]})})}var dt={a:({children:e})=>(0,R.jsx)(`span`,{className:`console-markdown-link`,children:e})};function ft(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function pt(e){let t=e?.trim();if(!t)return null;let n=Array.from(new Set((t.match(/"[^"]+"|\S+/g)??[]).map(e=>e.replace(/^"|"$/g,``).trim()).filter(Boolean).filter(e=>!/^OR$/i.test(e))));return n.length===0?null:RegExp(`(${n.map(ft).join(`|`)})`,`gi`)}function mt({text:e,highlightQuery:t}){let r=(0,P.useRef)(null),i=(0,P.useMemo)(()=>pt(t),[t]);return(0,P.useEffect)(()=>{let e=r.current;if(!e||!i)return;let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(;t.nextNode();){let e=t.currentNode;if(!(e instanceof Text))continue;let r=e.parentElement;r&&(r.closest(`mark, pre, code`)||e.textContent?.trim()&&n.push(e))}for(let e of n){let t=e.textContent??``;if(i.lastIndex=0,!i.test(t))continue;let n=document.createDocumentFragment(),r=0;i.lastIndex=0;for(let e of t.matchAll(i)){let i=e.index??0,a=e[0]??``;i>r&&n.append(t.slice(r,i));let o=document.createElement(`mark`);o.textContent=a,n.append(o),r=i+a.length}r<t.length&&n.append(t.slice(r)),e.parentNode?.replaceChild(n,e)}},[i,e]),(0,R.jsx)(`div`,{ref:r,children:(0,R.jsx)(n,{components:dt,children:e})})}function ht(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e,n=ht(t.text);if(n.trim())return n;let r=ht(t.content);if(r.trim())return r}return``}).filter(Boolean).join(`
2
-
3
- `);if(e&&typeof e==`object`){let t=e,n=ht(t.text);if(n.trim())return n;let r=ht(t.content);if(r.trim())return r}return``}function gt(e){return e.type===`tool`||e.type===`plan`?!0:e.type===`text`||e.type===`reasoning`?!!ht(e.text).trim():!1}function _t(e){return e.reduce((e,t)=>{if(!gt(t))return e;let n=e.at(-1);return t.type!==`plan`&&n?.type===t.type?(n.parts.push(t),e):(e.push({type:t.type,parts:[t]}),e)},[])}function vt(e){return _t(e.parts).length>0}var yt=`<turn_aborted>
4
- The user interrupted the previous turn on purpose. Any running unified exec processes were terminated. If any tools/commands were aborted, they may have partially executed; verify current state before retrying.
5
- </turn_aborted>`;function bt(e){return e.replace(/\r\n/g,`
6
- `).trim()}function xt(e,t){if(t.toLowerCase()!==`codex`||e.role!==`user`||e.parts.length!==1)return!1;let[n]=e.parts;return!n||n.type!==`text`||typeof n.text!=`string`?!1:bt(n.text)===bt(yt)}function St(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Ct(e){return typeof e==`string`?e:``}function wt(e){return e.replace(/\\n/g,`
7
- `)}function Tt(e){let t=St(e),n=Ct(t.type);return n?{type:n,path:Ct(t.path),oldPath:Ct(t.old_path),targetPath:Ct(t.targetPath),content:Ct(t.content)||Ct(St(t.input).content)}:null}function Et(e){return(Array.isArray(e)?e:Array.isArray(St(e).content)?St(e).content:[]).map(e=>Tt(e)).filter(e=>e!=null)}function Dt(e,t,n){return`${e} ${e===1?t:n}`}function Ot(e){let t=e.filter(e=>e.type===`write_file`).length,n=e.filter(e=>e.type===`edit_file`).length,r=e.filter(e=>e.type===`delete_file`).length,i=e.filter(e=>e.type===`move_file`).length,a=[];return t>0&&a.push(Dt(t,`write`,`writes`)),n>0&&a.push(Dt(n,`edit`,`edits`)),r>0&&a.push(Dt(r,`delete`,`deletes`)),i>0&&a.push(Dt(i,`move`,`moves`)),a.join(` · `)}function kt(e){return e.targetPath||e.path||e.oldPath||e.type}function At(e,t){return e.reduce((e,n)=>n.type===`write_file`?(e.push({label:kt(n),operation:`write`,language:t(n.path),isCode:!0,text:wt(n.content)}),e):n.type===`edit_file`?(e.push({label:kt(n),operation:`edit`,language:`diff`,isCode:!0,text:wt(n.content)}),e):n.type===`delete_file`?(e.push({label:kt(n),operation:`edit`,language:`text`,isCode:!1,text:`File deleted.`}),e):(n.type===`move_file`&&e.push({label:kt(n),operation:`edit`,language:`text`,isCode:!1,text:n.targetPath&&n.path?`Moved from ${n.path} to ${n.targetPath}`:n.oldPath?`Moved from ${n.oldPath}`:`File moved.`}),e),[])}function jt(e,t,n){let r=At(e,n);return r.length>0?{kind:`file-sections`,sections:r}:{kind:`plain`,text:t,language:`text`,isCode:!1}}function Mt(e){if(typeof e==`string`)return e.trim();if(Array.isArray(e))return e.map(e=>Mt(e)).filter(Boolean).join(`
8
-
9
- `).trim();if(e&&typeof e==`object`){let t=e,n=Mt(t.text);if(n)return n;let r=Mt(t.content);if(r)return r}return``}function Nt(e){let t=e.approval_status===`fail`?`fail`:`success`,n=Mt(t===`fail`?e.output:e.input);return{title:`plan`,secondaryText:void 0,approvalStatus:t,expandable:!!n,contentLabel:t===`fail`?`Rejected`:`Plan`,contentMarkdown:n}}function Pt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function G(e){return typeof e==`string`?e.trim():``}function Ft(e){return typeof e==`string`?e:``}function It(e){return typeof e==`string`?e.trim():typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?`${e}`:``}function Lt(e){return e.replace(/\\n/g,`
10
- `)}function Rt(e){return e.replace(/\s*\(Recommended\)\s*$/i,``).trim()}function zt(e){let t=e.trim();return{label:Rt(t),recommended:/\(Recommended\)\s*$/i.test(t)}}function Bt(e){return e.replace(/\s+/g,` `).trim()}function Vt(e,t=88){let n=Bt(e);return n?n.length>t?`${n.slice(0,t)}...`:n:``}function Ht(e,t){return Vt([`${t} questions`,...e.filter(Boolean).slice(0,2)].join(` · `),96)}function Ut(e){try{return JSON.parse(e)}catch{return null}}function Wt(e){let t=Lt(e).split(`
11
- `);if(t.length<5||!(/^Chunk ID:\s+\S+/.test(t[0]||``)&&/^Wall time:\s+/.test(t[1]||``)&&/^Process (?:exited with code \d+|running with session ID \d+)/.test(t[2]||``)&&/^Original token count:\s+\d+/.test(t[3]||``)&&/^Output:$/.test(t[4]||``)))return e;let n=5;for(;n<t.length&&t[n]?.trim()===``;)n+=1;let r=t.slice(n).join(`
12
- `);return r.trim()?r:e}function Gt(e,t,n){n.trim()&&e.push({label:t,value:n})}function Kt(e){return e.startsWith(`"`)&&e.endsWith(`"`)||e.startsWith(`'`)&&e.endsWith(`'`)?e.slice(1,-1):e}function qt(e){return e.trim()?!/[|&;<>()$`*?{}[\]\\]/.test(e):!1}function Jt(e){let t=Kt(e.trim());return qt(t)?t:null}function Yt(e){let t=e.trim();if(!t)return null;let n=t.match(/^nl\s+-ba\s+([^\s]+)\s*\|\s*sed\s+-n\s+['"][^'"]+['"]$/);if(n)return Jt(n[1]||``);for(let e of[/^cat\s+([^\s]+)$/,/^sed\s+-n\s+['"][^'"]+['"]\s+([^\s]+)$/,/^head\s+-n\s+\d+\s+([^\s]+)$/,/^tail\s+-n\s+\d+\s+([^\s]+)$/]){let n=t.match(e);if(n)return Jt(n[1]||``)}return null}function Xt(e){let t=e.split(`
13
- `),n=t.filter(e=>e.trim());if(n.length===0)return e;let r=/^\s*\d+(?:\t|\|\s?)/;return n.filter(e=>r.test(e)).length/n.length<.6?e:t.map(e=>e.replace(/^\s*\d+(?:\t|\|\s?)/,``)).join(`
14
- `)}function Zt(e){return/\b(Test Files|Tests|Coverage report|coverage: platform|Ran \d+ tests)\b/.test(e)||/^(PASS|FAIL|stdout\s+\|)/m.test(e)||/\bmodules transformed\b/.test(e)}function Qt(e){let t=e.trim();return!t||Zt(t)?null:(t.startsWith(`{`)||t.startsWith(`[`))&&Ut(t)!=null?`json`:/<(!DOCTYPE html|html\b|body\b|div\b|span\b|main\b|section\b|svg\b|\/[a-z])/i.test(t)?`markup`:[/^#{1,6}\s/m,/^[-*]\s/m,/^\d+\.\s/m,/^```/m].filter(e=>e.test(t)).length>=1&&!/[{};]\s*$/.test(t)?`markdown`:(t.match(/^[A-Za-z0-9_-]+:\s.+$/gm)||[]).length>=2&&!/\b(import|export|const|let|function|class)\b/.test(t)&&!/[{}()[\];]/.test(t)?`yaml`:[/^(from\s+\S+\s+import\s+.+|import\s+\S+)/m,/^def\s+\w+\(/m,/^class\s+\w+[:(]/m].filter(e=>e.test(t)).length>=2||/^(from\s+\S+\s+import\s+.+|import\s+\S+)/m.test(t)&&/^def\s+\w+\(/m.test(t)?`python`:[/\binterface\s+\w+/,/\btype\s+\w+\s*=/,/\bimplements\b/,/\bas const\b/,/:\s*[A-Z][A-Za-z0-9_<>,[\] |&?]+/].filter(e=>e.test(t)).length>=1&&/\b(import|export|const|let|function|class)\b/.test(t)?`typescript`:[/^\s*import\s.+from\s/m,/^\s*export\s/m,/\b(const|let|function|class)\b/].filter(e=>e.test(t)).length>=2?`javascript`:null}function $t(e,t,n){let r=Wt(t),i=Yt(e);if(i){let e=n(i);return{text:Xt(r),language:e,isCode:e!==`text`,sourcePath:i,confidence:`path`}}let a=Qt(r);return a?{text:r,language:a,isCode:!0,confidence:`content`}:{text:r,language:`text`,isCode:!1,confidence:`plain`}}function en(e,t,n){let r=Pt(e),i=G(r.cmd),a=G(r.workdir),o=G(r.sandbox_permissions),s=G(r.justification),c=[];Gt(c,`Command`,i),Gt(c,`Workdir`,a),Gt(c,`Escalation`,o),Gt(c,`Justification`,s);let l=Vt(i);return{secondaryText:s?[s,l].filter(Boolean).join(`
15
- `):l||void 0,details:c,outputAnalysis:$t(i,t,n)}}function tn(e,t,n){let r=Pt(e),i=It(r.session_id),a=Ft(r.chars),o=a?`stdin`:`poll`,s=[];return Gt(s,`Session`,i),s.push({label:`Chars`,value:a||`(empty)`}),{secondaryText:i?`session #${i} · ${o}`:o,details:s,outputAnalysis:$t(``,t,n)}}function nn(e,t){let n=Pt(e),r=Array.isArray(n.questions)?n.questions:null;if(!r||r.length===0)return{secondaryText:void 0,details:[],outputContent:{kind:`plain`,text:t,language:`text`,isCode:!1}};let i=Pt(Ut(t)?.answers),a=r.map(e=>{let t=Pt(e),n=Pt(i[G(t.id)]),r=(Array.isArray(n.answers)?n.answers:[]).map(e=>typeof e==`string`?Rt(e):``).filter(Boolean),a=Array.isArray(t.options)?t.options.map(e=>{let t=Pt(e),n=zt(G(t.label));return n.label?{label:n.label,description:G(t.description)||void 0,recommended:n.recommended||void 0}:null}).filter(e=>e!=null):[],o=G(t.question);return o?{header:G(t.header)||void 0,question:o,options:a,answers:r}:null}).filter(e=>e!=null);return a.length===0?{secondaryText:void 0,details:[],outputContent:{kind:`plain`,text:t,language:`text`,isCode:!1}}:{secondaryText:Ht(a.map(e=>e.header||``),a.length),details:[],outputContent:{kind:`question-list`,questions:a}}}function rn(e){return typeof e.title==`string`&&e.title.trim()?e.title.trim().replace(/^tool:\s*/i,``):typeof e.tool==`string`&&e.tool.trim()?e.tool.trim():`tool`}function an(e){return(typeof e.tool==`string`&&e.tool.trim()?e.tool:rn(e)).trim().toLowerCase()}function on(e,t){let n=an(t),r=`tool:${n}`,i=e.get(n);if(i){i.count+=1;return}e.set(n,{id:r,toolKey:n,label:rn(t),count:1})}function sn(e){let t={user:0,agent_message:0,thinking:0,plan:0,tools_all:0},n=new Set,r=new Map;for(let i of e){let e=_t(i.parts);for(let a of e){if(i.role===`user`){t.user+=1,n.add(`user`);continue}if(a.type===`text`){t.agent_message+=1,n.add(`agent_message`);continue}if(a.type===`reasoning`){t.thinking+=1,n.add(`thinking`);continue}if(a.type===`plan`){t.plan+=1,n.add(`plan`);continue}t.tools_all+=a.parts.length,n.add(`tools_all`);for(let e of a.parts)on(r,e),n.add(`tool:${an(e)}`)}}return{filterIds:n,counts:t,tools:[...r.values()].toSorted((e,t)=>e.label.localeCompare(t.label))}}function cn(e,t){return t.has(`tools_all`)?t.has(`tool:${an(e)}`):!1}function ln(e,t,n){return t.role===`user`?n.has(`user`):e.type===`text`?n.has(`agent_message`):e.type===`reasoning`?n.has(`thinking`):e.type===`plan`?n.has(`plan`):e.parts.some(e=>cn(e,n))}function un(e,t){let n=e.parts.filter(e=>cn(e,t));return n.length===0?null:{...e,parts:n}}function dn(e,t){return e.map(e=>{let n=_t(e.parts).filter(n=>ln(n,e,t)).map(e=>e.type===`tool`?un(e,t):e).filter(e=>e!=null);return n.length===0?null:{msg:e,blocks:n}}).filter(e=>e!=null)}var fn={".bashrc":`bash`,".zshrc":`bash`,".profile":`bash`,dockerfile:`docker`,".env":`ini`},pn={ts:`typescript`,tsx:`tsx`,js:`javascript`,jsx:`jsx`,py:`python`,sql:`sql`,rs:`rust`,go:`go`,java:`java`,c:`c`,h:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,hpp:`cpp`,cs:`csharp`,sh:`bash`,bash:`bash`,zsh:`bash`,html:`html`,css:`css`,yaml:`yaml`,yml:`yaml`,json:`json`,md:`markdown`,toml:`toml`,conf:`ini`,xml:`markup`,svg:`markup`,properties:`ini`,dockerfile:`docker`};function K(e){let t=e.split(`/`).pop()?.toLowerCase()??``;if(!t)return`text`;let n=fn[t];if(n)return n;if(t.startsWith(`.env.`))return`ini`;let r=t.includes(`.`)?t.split(`.`).pop()??``:``;return r&&pn[r]||`text`}O.registerLanguage(`bash`,ue),O.registerLanguage(`c`,Te),O.registerLanguage(`cpp`,pe),O.registerLanguage(`csharp`,Ee),O.registerLanguage(`css`,we),O.registerLanguage(`docker`,de),O.registerLanguage(`go`,ge),O.registerLanguage(`ini`,A),O.registerLanguage(`java`,ve),O.registerLanguage(`javascript`,xe),O.registerLanguage(`jsx`,he),O.registerLanguage(`json`,k),O.registerLanguage(`markdown`,Ce),O.registerLanguage(`markup`,_e),O.registerLanguage(`python`,me),O.registerLanguage(`rust`,M),O.registerLanguage(`sql`,be),O.registerLanguage(`toml`,fe),O.registerLanguage(`tsx`,j),O.registerLanguage(`typescript`,Se),O.registerLanguage(`yaml`,ye);function mn(e){return e===`html`||e===`xml`?`markup`:e}function hn({language:e,text:t}){return(0,R.jsx)(O,{language:mn(e),style:N,customStyle:{margin:0,padding:`0.75rem`,borderRadius:0,background:`transparent`,fontSize:`0.75rem`,lineHeight:1.55},codeTagProps:{className:`console-mono`},wrapLongLines:!0,children:t})}function gn(e,t){return`${e}:${t}`}function _n(e){return/^(Index:|diff\s|===)/.test(e)?`text-[var(--console-text)] bg-[#f3f4f6]`:e.startsWith(`@@`)?`text-[#7c3aed] bg-[#f5f3ff]`:e.startsWith(`+++ `)||e.startsWith(`--- `)?`text-[#1d4ed8] bg-[#eff6ff]`:e.startsWith(`+`)?`text-[#15803d] bg-[#f0fdf4]`:e.startsWith(`-`)?`text-[#b91c1c] bg-[#fef2f2]`:`text-[var(--console-text)]`}function vn({text:e}){let t=e.split(`
16
- `),n=new Map;return(0,R.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre rounded-sm border border-[var(--console-border)] bg-[#fafafa] p-3 text-xs leading-relaxed`,children:t.map(e=>{let t=n.get(e)??0;return n.set(e,t+1),(0,R.jsx)(`span`,{className:`block rounded-[2px] px-1 ${_n(e)}`,children:e||` `},gn(e,t))})})}function yn(e){let t=e.text||`No output captured.`;return!e.isCode||e.language===`text`?(0,R.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre-wrap break-all p-3 text-xs leading-relaxed text-[var(--console-text)]`,children:t}):e.language===`diff`?(0,R.jsx)(vn,{text:t}):(0,R.jsx)(`div`,{className:`max-h-[420px] overflow-auto bg-[#fafafa]`,children:(0,R.jsx)(hn,{language:e.language,text:t})})}function bn({sections:e}){return(0,R.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,R.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[#fafafa]`,children:[(0,R.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-white px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--console-muted)]`,children:e.operation}),(0,R.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:e.label})]})}),yn(e)]},`${e.operation}:${e.label}:${e.language}`))})}function xn({questions:e}){return(0,R.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>(0,R.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[#fafafa]`,children:[(0,R.jsxs)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-2`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.header?(0,R.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-white px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--console-muted)]`,children:e.header}):null,e.answers.length>0?(0,R.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-success)]`,children:`Answered`}):(0,R.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:`Pending`})]}),(0,R.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-[var(--console-text)]`,children:e.question})]}),(0,R.jsx)(`div`,{className:`space-y-2 p-3`,children:e.options.map(t=>{let n=e.answers.includes(t.label);return(0,R.jsxs)(`div`,{className:`rounded-sm border px-3 py-2 ${n?`border-[var(--console-success-border)] bg-[var(--console-success-bg)]`:`border-[var(--console-border)] bg-white`}`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`console-mono text-xs font-semibold ${n?`text-[var(--console-success)]`:`text-[var(--console-text)]`}`,children:t.label}),t.recommended?(0,R.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:`Recommended`}):null,n?(0,R.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-success-border)] bg-white px-1.5 py-0.5 text-[10px] text-[var(--console-success)]`,children:`Selected`}):null]}),t.description?(0,R.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-[var(--console-muted)]`,children:t.description}):null]},`${e.question}:${t.label}`)})})]},`${e.header??`question`}:${e.question}`))})}function Sn(e){return`${e.label}:${e.lines.map(e=>`${e.type}:${e.text}`).join(`
17
- `)}`}function Cn(e){return e===`add`?`text-[#15803d] bg-[#f0fdf4]`:e===`remove`?`text-[#b91c1c] bg-[#fef2f2]`:`text-[var(--console-text)]`}function wn({blocks:e}){return(0,R.jsx)(`div`,{className:`space-y-3`,children:e.map(e=>{let t=new Map;return(0,R.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-[#fafafa]`,children:[(0,R.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,R.jsx)(`span`,{className:`console-mono text-[11px] font-semibold text-[var(--console-muted)]`,children:e.label})}),(0,R.jsx)(`pre`,{className:`console-mono max-h-[280px] overflow-auto whitespace-pre p-3 text-xs leading-relaxed`,children:e.lines.map(e=>{let n=`${e.type}:${e.text}`,r=t.get(n)??0;return t.set(n,r+1),(0,R.jsxs)(`span`,{className:`block rounded-[2px] px-1 ${Cn(e.type)}`,children:[e.type===`add`?`+`:e.type===`remove`?`-`:` `,e.text||` `]},`${n}:${r}`)})})]},Sn(e))})})}function Tn({outputContent:e}){if(e.kind===`structured-diff`)return(0,R.jsx)(wn,{blocks:e.blocks});if(e.kind===`file-sections`)return(0,R.jsx)(bn,{sections:e.sections});if(e.kind===`question-list`)return(0,R.jsx)(xn,{questions:e.questions});let t=e.text||`No output captured.`;return!e.isCode||e.language===`text`?(0,R.jsx)(`pre`,{className:`console-mono max-h-[420px] overflow-auto whitespace-pre-wrap break-all rounded-sm border border-[var(--console-border)] bg-[#fafafa] p-3 text-xs leading-relaxed text-[var(--console-text)]`,children:t}):e.language===`diff`?(0,R.jsx)(vn,{text:t}):(0,R.jsx)(`div`,{className:`max-h-[420px] overflow-auto rounded-sm border border-[var(--console-border)] bg-[#fafafa]`,children:(0,R.jsx)(hn,{language:e.language,text:t})})}var En={completed:{label:`Success`,className:`border-[var(--console-success-border)] bg-[var(--console-success-bg)] text-[var(--console-success)]`,icon:p},error:{label:`Failed`,className:`border-[var(--console-error-border)] bg-[var(--console-error-bg)] text-[var(--console-error)]`,icon:_},running:{label:`Running`,className:`border-[var(--console-warning-border)] bg-[var(--console-warning-bg)] text-[var(--console-warning)]`,icon:re}};function Dn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function On(e){let t=e?.trim();if(!t)return null;let n=Array.from(new Set((t.match(/"[^"]+"|\S+/g)??[]).map(e=>e.replace(/^"|"$/g,``).trim()).filter(Boolean).filter(e=>!/^OR$/i.test(e))));return n.length===0?null:RegExp(`(${n.map(Dn).join(`|`)})`,`gi`)}function kn(e,t){let n=On(t);return n?e.split(n).map((e,t)=>e.match(n)?(0,R.jsx)(`mark`,{children:e},`${e}-${t}`):(0,R.jsx)(`span`,{children:e},`${e}-${t}`)):e}function An({text:e,highlightQuery:t}){return(0,R.jsx)(mt,{text:e,highlightQuery:t})}function jn(e){if(e==null)return``;if(typeof e==`string`){let t=e.trim();if(!t)return``;try{let e=JSON.parse(t);return JSON.stringify(e,null,2)}catch{return e}}try{return JSON.stringify(e,null,2)}catch{return typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?`${e}`:typeof e==`symbol`?e.description?`Symbol(${e.description})`:`Symbol`:typeof e==`function`?`[Function]`:`[Unserializable value]`}}function Mn(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function Nn(e){if(typeof e==`string`)return[e];if(Array.isArray(e))return e.flatMap(e=>Nn(e));if(e&&typeof e==`object`){let t=e;if(typeof t.text==`string`)return[t.text];if(t.content!==void 0)return Nn(t.content)}return[]}function Pn(e){return e.replace(/^<system>/i,``).replace(/<\/system>$/i,``).trim()}function Fn(e,t=!0){let n=Nn(e).map(e=>e.trim()).filter(e=>t?!!e:!!e&&!/^<system>[\s\S]*<\/system>$/i.test(e));return n.length===0?``:n.map(e=>t&&/^<system>[\s\S]*<\/system>$/i.test(e)?Pn(e):e).join(`
18
- `)}function In(e){let t=Mn(e);if(t&&typeof t==`object`){let e=t;if(typeof e.cmd==`string`)return e.cmd;if(typeof e.command==`string`)return e.command}return``}function Ln(e){return typeof e==`string`?e.trim():``}function q(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function J(e){return typeof e==`string`?e.trim():``}function Y(e){return typeof e==`string`?e:``}function Rn(e){return typeof e.title==`string`&&e.title.trim()?e.title.trim().replace(/^tool:\s*/i,``):typeof e.tool==`string`&&e.tool.trim()?e.tool.trim():`tool`}function zn(e){return Rn(e).trim().toLowerCase()}function Bn(e,t){return`tool-${e}-${t}`}function Vn(e){let t=e.trim();return!t||t.length>300||t.includes(`
19
- `)||/^[a-z]+:\/\//i.test(t)||/[<>{}]/.test(t)?!1:t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`~/`)||t.includes(`/`)||t.includes(`\\`)?!0:/^[A-Za-z0-9_.@-]+\.[A-Za-z0-9_-]+$/.test(t)}function Hn(e){let t=e.trim().toLowerCase();return!t||t.includes(`command`)||t.includes(`content`)||t.includes(`text`)||t.includes(`prompt`)||t.includes(`url`)||t.includes(`body`)||t.includes(`title`)||t.includes(`description`)||t===`cwd`||t===`workdir`||t===`directory`?!1:t===`path`||t===`paths`||t.includes(`file`)||t.includes(`path`)}function Un(e,t,n,r=0){if(!(e==null||r>4)){if(typeof e==`string`){Hn(t)&&Vn(e)&&n.add(e.trim());return}if(Array.isArray(e)){for(let i of e)Un(i,t,n,r+1);return}if(typeof e==`object`)for(let[t,i]of Object.entries(e))Un(i,t,n,r+1)}}function Wn(e){let t=new Set;return Un(e,``,t),[...t]}function Gn(e){return e.state?.arguments??e.state?.input??e.input??null}function Kn(e){let t=zn(e);return t===`read`?`read`:t===`edit`||t===`multiedit`||t===`apply_patch`||t===`notebookedit`?`edit`:t===`write`||t===`create_file`||t===`write_file`?`write`:t===`delete`||t===`delete_file`?`delete`:null}function qn(e){let t=new Map;for(let n of e){let e=t.get(n.path);if(e){e.count+=1,e.anchors.push({anchorId:n.anchorId,time:n.time,toolLabel:n.toolLabel}),n.time>=e.latestTime&&(e.latestTime=n.time,e.latestAnchorId=n.anchorId,e.toolLabel=n.toolLabel);continue}t.set(n.path,{path:n.path,count:1,latestTime:n.time,latestAnchorId:n.anchorId,toolLabel:n.toolLabel,anchors:[{anchorId:n.anchorId,time:n.time,toolLabel:n.toolLabel}]})}return[...t.values()].map(e=>({...e,anchors:e.anchors.toSorted((e,t)=>e.time-t.time)})).toSorted((e,t)=>t.latestTime===e.latestTime?e.path.localeCompare(t.path):t.latestTime-e.latestTime)}function Jn(e){let t=new Map,n={read:[],edit:[],write:[],delete:[]};return e.forEach((e,r)=>{let i=0;for(let a of e.parts){if(a.type!==`tool`)continue;let o=Bn(r,i);i+=1,t.set(a,o);let s=Gn(a),c=Rn(a),l=a.time_created??e.time_created,u=Et(s);if(u.length>0){for(let e of u){let t=(e.path||e.oldPath).trim();if(!t)continue;let r=e.type===`write_file`?`write`:e.type===`delete_file`?`delete`:`edit`;n[r].push({kind:r,path:t,anchorId:o,time:l,toolLabel:c})}continue}let d=Kn(a);if(!d)continue;let f=Wn(s);for(let e of f)n[d].push({kind:d,path:e,anchorId:o,time:l,toolLabel:c})}}),{toolAnchorIds:t,summary:{read:qn(n.read),edit:qn(n.edit),write:qn(n.write),delete:qn(n.delete)}}}function Yn(e,t){return e.startsWith(`${t}/`)?e.slice(t.length+1):e}function Xn(e){if(typeof document>`u`)return;let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`center`})}function Zn(e){try{return JSON.parse(e)}catch{return null}}function X(e){return e.replace(/\\n/g,`
20
- `)}function Qn(e){let t=e.trim();return t?t.replace(/^tool:\s*/i,``):``}function $n(e,t=`Tool`){return Qn(J(e.title))||J(e.tool)||t}function er(e){return X(Fn(e)||jn(e))||`No output captured.`}function Z(e){let t=er(e.outputValue);if(t!==`No output captured.`)return t;let n=er(e.errorValue);return n===`No output captured.`?`No output captured.`:n}function tr(e){let t=q(e);return J(t.filePath)||J(t.file_path)||J(t.path)||J(t.targetFile)||J(t.effectiveUri)||J(t.relativeWorkspacePath)||``}function nr(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:typeof e==`string`&&Zn(e)||{}}function rr(e){return e.replace(/\n*<system-reminder>[\s\S]*$/i,``).trimEnd()}function ir(e){let t=Fn(e,!1)||er(e);return t===`No output captured.`?t:rr(t.replace(/^<file>\s*/i,``).replace(/\s*<\/file>\s*$/i,``)).split(`
21
- `).filter(e=>!/^\(End of file - total \d+ lines\)$/.test(e.trim())).map(e=>e.replace(/^\d+\|\s?/,``).replace(/^\s*\d+\t/,``)).join(`
22
- `).trimEnd()||`No output captured.`}function ar(e){let t=Y(nr(e).contents);return t?X(t):`No output captured.`}function or(e){let t=nr(e),n=Array.isArray(t.directories)?t.directories:[];if(n.length===0)return er(e);let r=n.flatMap(e=>{let t=q(e);return[J(t.absPath),...(Array.isArray(t.files)?t.files:[]).map(e=>{let t=q(e);return J(t.relPath)||J(t.absPath)}).filter(Boolean).map(e=>` ${e}`)].filter(Boolean)});return r.length>0?r.join(`
23
- `):`No output captured.`}function sr(e,t,n){return!t.trim()&&!n.trim()?[]:[{label:fr(e),lines:ur(f(X(t),X(n)))}]}function cr(e,t){let n=X(e).split(`
24
- `),r=X(t).split(`
25
- `);return[`@@`,...n.map(e=>`- ${e}`),...r.map(e=>`+ ${e}`)].join(`
26
- `)}function lr(e){let t=X(e),n=t.split(`
27
- `);return t.endsWith(`
28
- `)&&n.pop(),n}function ur(e){return e.flatMap(e=>{let t=e.added?`add`:e.removed?`remove`:`context`;return lr(e.value).map(e=>({type:t,text:e}))})}function dr(e){let t=q(e).edit;return Array.isArray(t)?t:t&&typeof t==`object`?[t]:[]}function fr(e){let t=e.trim();if(!t)return`edit`;let n=t.split(`/`).pop()||t;return n===t?n:`${n} · ${t}`}function pr(e,t){let n=dr(e.inputValue),r=fr(t);return n.map(e=>{let t=q(e),n=Y(t.old),i=Y(t.new);return!n.trim()&&!i.trim()?null:{label:r,lines:ur(f(X(n),X(i)))}}).filter(e=>e!=null&&e.lines.length>0)}function mr(e){let t=Y(q(e.metadataValue).diff);if(t.trim())return X(t);let n=dr(e.inputValue).map(e=>{let t=q(e),n=Y(t.old),r=Y(t.new);return!n.trim()&&!r.trim()?``:cr(n,r)}).filter(Boolean).join(`
29
-
30
- `);return n.trim()?n:Z(e)}function hr(e){let t=q(e.inputValue);if(e.status===`completed`){let e=Y(t.content);if(e.trim())return X(e)}return Z(e)}function gr(e){let t=q(q(e.state).arguments),n=Ln(t.agent_type),r=Ln(e.nickname),i=[Ln(t.model),Ln(t.reasoning_effort)].filter(Boolean).join(`-`);return[[n,r].filter(Boolean).join(` - `),i].filter(Boolean).join(` `)}function _r(e){let t=q(e.state);return Ln(t.prompt)||Ln(q(t.arguments).message)||``}function vr(e){let t=Ln(e.nickname);return e.role===`assistant`&&t?`AGENT (${t})`:e.role===`user`?`USER`:e.role===`tool`?`TOOL`:`AGENT`}function yr(e,t){if(t.toLowerCase()!==`cursor`)return e;let n=[];for(let t of e){if(t.role!==`tool`){n.push({...t,parts:[...t.parts]});continue}let e=n.at(-1);if(e?.role===`assistant`){e.parts.push(...t.parts);continue}n.push({...t,parts:[...t.parts]})}return n}function br(e){let t=e.state||{},n=t.status,r=n===`running`||n===`error`||n===`completed`?n:`completed`,i=t.output??t.result??``,a=t.error??``,o=Mn(t.input??t.arguments??{}),s=t.metadata??{};return{status:r,command:In(o),inputValue:o,outputValue:i,errorValue:a,metadataValue:s,inputText:jn(o)}}function xr(e,t){let n=(t.command||t.inputText||`{}`).replace(/\s+/g,` `).trim(),r=n.length>72?`${n.slice(0,72)}...`:n;return{Icon:y,title:$n(e),secondaryText:r?`(${r})`:void 0,details:[],expandable:!0,showInputPreview:!0,outputContent:{kind:`plain`,text:Z(t),language:`text`,isCode:!1}}}function Sr(e,t,n){let r=J(q(t.inputValue).name);return{...n,Icon:v,title:J(e.tool)||`skill`,secondaryText:r||void 0,expandable:!1,showInputPreview:!1}}function Cr(e,t){let n=xr(e,t),r=(e.tool||``).toLowerCase(),i=q(t.inputValue),a=tr(t.inputValue);if(r===`read`)return{...n,Icon:l,title:`read`,secondaryText:a||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:ir(t.outputValue),language:K(a),isCode:!0}};if(r===`edit`){let e=sr(a,Y(i.old_string),Y(i.new_string));return{...n,Icon:D,title:`edit`,secondaryText:a||void 0,showInputPreview:!1,outputContent:e.length>0?{kind:`structured-diff`,blocks:e}:{kind:`plain`,text:Z(t),language:`text`,isCode:!1}}}return r===`write`?{...n,Icon:b,title:`write`,secondaryText:a||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:hr(t),language:K(a),isCode:!0}}:{...n,title:$n(e)}}function wr(e,t){let n=xr(e,t),r=(e.tool||``).toLowerCase(),i=q(t.inputValue);if(r===`glob`){let r=J(i.pattern);return{...n,Icon:T,title:e.tool||`glob`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:Z(t),language:`text`,isCode:!1}}}if(r===`grep`){let r=[J(i.path),J(i.pattern)].filter(Boolean).join(` · `);return{...n,Icon:T,title:e.tool||`grep`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:Z(t),language:`text`,isCode:!1}}}if(r===`bash`){let r=J(i.description),a=J(i.command),o=r?`${r}${a?` (${a})`:``}`:a?`(${a})`:void 0;return{...n,Icon:y,title:e.tool||`bash`,secondaryText:o,showInputPreview:!1,outputContent:{kind:`plain`,text:Z(t),language:`text`,isCode:!1}}}if(r===`read`){let r=tr(t.inputValue);return{...n,Icon:l,title:e.tool||`read`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:ir(t.outputValue),language:K(r),isCode:!0}}}if(r===`edit`){let r=tr(t.inputValue);return{...n,Icon:D,title:e.tool||`edit`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:mr(t),language:`diff`,isCode:!0}}}if(r===`write`){let r=tr(t.inputValue),i=t.status===`completed`;return{...n,Icon:b,title:e.tool||`write`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:hr(t),language:K(r),isCode:i}}}return r===`skill`?Sr(e,t,n):n}function Tr(e,t){let n=xr(e,t),r=(e.tool||``).toLowerCase(),i=q(t.inputValue);if(r===`glob`){let r=J(i.pattern);return{...n,Icon:T,title:e.title||`glob`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:Z(t),language:`text`,isCode:!1}}}if(r===`grep`){let r=[J(i.path),J(i.pattern)].filter(Boolean).join(` · `);return{...n,Icon:T,title:e.title||`grep`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:Z(t),language:`text`,isCode:!1}}}if(r===`shell`){let r=J(i.command);return{...n,Icon:y,title:e.title||`bash`,secondaryText:r?`(${r})`:void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:Z(t),language:`text`,isCode:!1}}}if(r===`readfile`){let r=tr(t.inputValue);return{...n,Icon:l,title:e.title||`read`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:ir(t.outputValue),language:K(r),isCode:!0}}}if(r===`strreplacefile`){let r=tr(t.inputValue),i=pr(t,r);return{...n,Icon:D,title:e.title||`edit`,secondaryText:r||void 0,showInputPreview:!1,outputContent:i.length>0?{kind:`structured-diff`,blocks:i}:{kind:`plain`,text:mr(t),language:`diff`,isCode:!0}}}if(r===`writefile`){let r=tr(t.inputValue);return{...n,Icon:b,title:e.title||`write`,secondaryText:r||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:hr(t),language:K(r),isCode:t.status===`completed`}}}return n}function Er(e,t){let n=xr(e,t),r=(e.tool||``).toLowerCase();if(r===`skill`)return Sr(e,t,n);if(r===`exec_command`){let e=en(t.inputValue,Z(t),K);return{...n,Icon:y,title:`bash`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,outputContent:{kind:`plain`,text:e.outputAnalysis.text,language:e.outputAnalysis.language,isCode:e.outputAnalysis.isCode}}}if(r===`write_stdin`){let e=tn(t.inputValue,Z(t),K);return{...n,Icon:y,title:`bash`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,outputContent:{kind:`plain`,text:e.outputAnalysis.text,language:e.outputAnalysis.language,isCode:e.outputAnalysis.isCode}}}if(r===`request_user_input`){let e=nn(t.inputValue,Z(t));return{...n,Icon:le,title:`ask`,secondaryText:e.secondaryText,details:e.details,showInputPreview:!1,outputContent:e.outputContent}}if(r===`patch`){let r=Et(t.inputValue),i=Ot(r);return{...n,Icon:D,title:$n(e,`patch`),secondaryText:i||void 0,details:[],showInputPreview:!1,outputContent:jt(r,Z(t),K)}}if(r===`subagent`){let r=_r(e),i=Z(t);return{...n,Icon:u,title:gr(e)||$n(e,`subagent`),secondaryText:void 0,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:r||i,language:`markdown`,isCode:!1}}}return n}function Dr(e,t){let n=xr(e,t),r=(e.tool||``).toLowerCase(),i=q(t.inputValue),a=tr(t.inputValue);if(r===`read_file_v2`){let e=ar(t.outputValue);return{...n,Icon:l,title:`read`,secondaryText:a||void 0,details:e===`No output captured.`?[{label:`Lines`,value:J(nr(t.outputValue).totalLinesInFile)}]:[],showInputPreview:!1,outputContent:{kind:`plain`,text:e,language:K(a),isCode:e!==`No output captured.`}}}if(r===`edit_file_v2`){let e=X(Y(i.streamingContent));return{...n,Icon:D,title:`edit`,secondaryText:a||void 0,showInputPreview:!1,outputContent:{kind:`plain`,text:e||Z(t),language:e?`diff`:`text`,isCode:!!e}}}if(r===`ripgrep_raw_search`){let e=J(i.pattern),r=[J(i.path),e].filter(Boolean).join(` · `);return{...n,Icon:T,title:`grep`,secondaryText:r||void 0,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:Z(t),language:`text`,isCode:!1}}}if(r===`glob_file_search`){let e=J(i.globPattern),r=[J(i.targetDirectory),e].filter(Boolean).join(` · `);return{...n,Icon:T,title:`glob`,secondaryText:r||void 0,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:or(t.outputValue),language:`text`,isCode:!1}}}if(r===`run_terminal_command_v2`){let e=J(i.command),r=J(i.commandDescription),a=r?`${r}${e?` (${e})`:``}`:e?`(${e})`:void 0;return{...n,Icon:y,title:`bash`,secondaryText:a,details:[],showInputPreview:!1,outputContent:{kind:`plain`,text:Z(t),language:`text`,isCode:!1}}}return{...n,title:$n(e)}}function Or(e,t,n){let r=e.toLowerCase();return r===`opencode`?wr(t,n):r===`codex`?Er(t,n):r===`kimi`?Tr(t,n):r===`claudecode`?Cr(t,n):r===`cursor`?Dr(t,n):xr(t,n)}function kr(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Ar(e){if(typeof e==`number`&&e<=0)return`Unknown time`;let t=null;if(typeof e==`number`){let n=e<10**12?e*1e3:e;t=new Date(n)}else if(typeof e==`string`&&e.trim()){let n=Number(e);t=!Number.isNaN(n)&&n>0?new Date(n<10**12?n*1e3:n):new Date(e)}return!t||Number.isNaN(t.getTime())?`Unknown time`:t.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!0})}function jr({session:e,highlightQuery:t}){let n=(e.slug||``).split(`/`)[0]||F.getDefaultAgentKey()||`claudecode`,r=(0,P.useMemo)(()=>yr(e.messages,n),[e.messages,n]),i=(0,P.useMemo)(()=>r.filter(e=>vt(e)),[r]),{toolAnchorIds:a,summary:o}=(0,P.useMemo)(()=>Jn(i),[i]),s=(0,P.useMemo)(()=>sn(i),[i]),[c,l]=(0,P.useState)(()=>new Set(s.filterIds)),u=(0,P.useMemo)(()=>[...s.filterIds].toSorted().join(`|`),[s.filterIds]),d=(0,P.useMemo)(()=>dn(i,c),[i,c]);return(0,P.useEffect)(()=>{l(new Set(s.filterIds))},[u,s.filterIds]),i.length===0?(0,R.jsx)(`div`,{"data-testid":`session-detail`,className:`mx-auto max-w-4xl rounded-sm border border-[var(--console-border)] bg-white p-6 text-sm text-[var(--console-muted)]`,children:`当前会话暂无可展示的消息内容。`}):(0,R.jsxs)(`div`,{"data-testid":`session-detail`,className:`mx-auto w-full max-w-[1440px] space-y-8 px-2 md:px-4 animate-in fade-in slide-in-from-bottom-2 duration-300`,children:[(0,R.jsx)(Lr,{summary:typeof e.summary_files==`string`?e.summary_files:void 0}),(0,R.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[240px_minmax(0,1fr)] xl:grid-cols-[220px_minmax(0,1fr)_320px] lg:items-start`,children:[(0,R.jsx)(Nr,{toc:s,fileChangeSummary:o,baseDirectory:e.directory,selectedFilters:c,onToggle:e=>l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}),(0,R.jsx)(`div`,{className:`flex min-w-0 flex-col gap-8`,children:d.length>0?d.map(({msg:e,blocks:r},i)=>(0,R.jsx)(Rr,{msg:e,blocks:r,toolAnchorIds:a,formatTokens:kr,sessionAgentKey:n,highlightQuery:t},i)):(0,R.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-6 text-sm text-[var(--console-muted)]`,children:`当前筛选条件下暂无可展示的消息内容。`})}),(0,R.jsx)(ut,{session:e,toc:s},e.id)]})]})}var Mr=[{id:`user`,label:`User`},{id:`agent_message`,label:`Agent Responses`},{id:`thinking`,label:`Thinking`},{id:`plan`,label:`Plans`},{id:`tools_all`,label:`Tools`}];function Nr({toc:e,fileChangeSummary:t,baseDirectory:n,selectedFilters:r,onToggle:i}){let a=r.has(`tools_all`);return(0,R.jsx)(`aside`,{className:`console-scrollbar lg:sticky lg:top-4 lg:max-h-[calc(100dvh-14rem)] lg:overflow-y-auto lg:overscroll-contain`,children:(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--console-border)] px-4 py-3`,children:[(0,R.jsx)(x,{className:`size-3.5 text-[var(--console-accent)]`}),(0,R.jsx)(`span`,{className:`console-mono text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:`Session TOC`})]}),(0,R.jsxs)(`div`,{className:`space-y-1 p-3`,children:[Mr.filter(({id:t})=>e.counts[t]>0).map(({id:t,label:n})=>(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 rounded-sm px-2 py-2 transition-colors hover:bg-[var(--console-surface-muted)]`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:r.has(t),onChange:()=>i(t),className:`size-3.5 rounded border-[var(--console-border-strong)] accent-[var(--console-accent-strong)]`}),(0,R.jsx)(`span`,{className:`console-mono min-w-0 flex-1 text-xs text-[var(--console-text)]`,children:n}),(0,R.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.counts[t]})]},t)),e.tools.length>0?(0,R.jsx)(`div`,{className:`space-y-1 border-t border-[var(--console-border)] pt-2`,children:e.tools.map(e=>(0,R.jsxs)(`label`,{className:L(`flex items-center gap-3 rounded-sm px-2 py-2 transition-colors`,a?`cursor-pointer hover:bg-[var(--console-surface-muted)]`:`cursor-not-allowed opacity-50`),children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:a&&r.has(e.id),disabled:!a,onChange:()=>i(e.id),className:`size-3.5 rounded border-[var(--console-border-strong)] accent-[var(--console-accent-strong)]`}),(0,R.jsx)(`span`,{className:`console-mono min-w-0 flex-1 text-xs text-[var(--console-muted)]`,children:e.label}),(0,R.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.count})]},e.id))}):null]})]}),(0,R.jsx)(Pr,{summary:t,baseDirectory:n})]})})}function Pr({summary:e,baseDirectory:t}){let n=[{key:`read`,label:`Read`,Icon:T,items:e.read},{key:`edit`,label:`Edit`,Icon:D,items:e.edit},{key:`write`,label:`Write`,Icon:b,items:e.write},{key:`delete`,label:`Delete`,Icon:_,items:e.delete}].filter(e=>e.items.length>0);return n.length===0?null:(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--console-border)] px-4 py-3`,children:[(0,R.jsx)(h,{className:`size-3.5 text-[var(--console-accent)]`}),(0,R.jsx)(`span`,{className:`console-mono text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:`File Tracker`})]}),(0,R.jsx)(`div`,{className:`space-y-3 p-3`,children:n.map(({key:e,label:n,Icon:r,items:i})=>(0,R.jsx)(Fr,{label:n,Icon:r,items:i,baseDirectory:t},e))})]})}function Fr({label:e,Icon:t,items:n,baseDirectory:r}){let[i,a]=(0,P.useState)(!1);return(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[#fafafa]`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-center gap-2 px-3 py-2 text-left transition-colors hover:bg-[var(--console-surface-muted)]`,children:[(0,R.jsx)(t,{className:`size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,R.jsx)(`span`,{className:`console-mono min-w-0 flex-1 text-[11px] font-semibold uppercase tracking-[0.12em] text-[var(--console-muted)]`,children:e}),(0,R.jsx)(`span`,{className:`console-mono shrink-0 text-[10px] text-[var(--console-muted)]`,children:n.length}),i?(0,R.jsx)(c,{className:`size-3.5 shrink-0 text-[var(--console-muted)]`}):(0,R.jsx)(E,{className:`size-3.5 shrink-0 text-[var(--console-muted)]`})]}),i?(0,R.jsx)(`div`,{className:`space-y-1 border-t border-[var(--console-border)] p-2`,children:n.map(e=>(0,R.jsx)(Ir,{item:e,baseDirectory:r},`${e.path}:${e.latestAnchorId}`))}):null]})}function Ir({item:e,baseDirectory:t}){let[n,r]=(0,P.useState)(0);function i(t){let n=e.anchors.length;if(n===0)return;let i=(t%n+n)%n;r(i);let a=e.anchors[i];a&&Xn(a.anchorId)}return(0,R.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm px-2 py-2 transition-colors hover:bg-[var(--console-surface-muted)]`,children:[(0,R.jsx)(`button`,{type:`button`,title:e.path,onClick:()=>i(n),className:`min-w-0 flex-1 text-left`,children:(0,R.jsx)(`span`,{className:`console-mono block break-all text-xs text-[var(--console-text)]`,children:Yn(e.path,t)})}),e.anchors.length>1?(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,"aria-label":`Previous ${e.path}`,onClick:()=>i(n-1),className:`rounded-sm border border-[var(--console-border)] p-1 text-[var(--console-muted)] transition-colors hover:bg-white`,children:(0,R.jsx)(c,{className:`size-3`})}),(0,R.jsxs)(`span`,{className:`console-mono text-[10px] text-[var(--console-muted)]`,children:[n+1,`/`,e.anchors.length]}),(0,R.jsx)(`button`,{type:`button`,"aria-label":`Next ${e.path}`,onClick:()=>i(n+1),className:`rounded-sm border border-[var(--console-border)] p-1 text-[var(--console-muted)] transition-colors hover:bg-white`,children:(0,R.jsx)(E,{className:`size-3`})})]}):(0,R.jsx)(`button`,{type:`button`,title:`Jump to tool call`,onClick:()=>i(0),className:`console-mono shrink-0 text-[10px] text-[var(--console-muted)]`,children:e.count})]})}function Lr({summary:e,defaultExpanded:t=!1}){let n=typeof e==`string`?e.trim():``,[r,i]=(0,P.useState)(t);return n?(0,R.jsxs)(`section`,{className:`rounded-sm border border-[var(--console-border)] bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,R.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-4 py-3 text-left`,onClick:()=>i(e=>!e),children:[(0,R.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.16em] text-[var(--console-text)]`,children:[(0,R.jsx)(h,{className:`size-3.5 text-[var(--console-accent)]`}),`Session Summary`]}),r?(0,R.jsx)(c,{className:`size-3.5 text-[var(--console-muted)]`}):(0,R.jsx)(E,{className:`size-3.5 text-[var(--console-muted)]`})]}),r?(0,R.jsx)(`div`,{className:`border-t border-[var(--console-border)] px-4 py-4`,children:(0,R.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:(0,R.jsx)(mt,{text:n})})}):null]}):null}function Rr({msg:e,blocks:t,toolAnchorIds:n,formatTokens:r,sessionAgentKey:i,highlightQuery:a}){let o=e.role===`user`,s=xt(e,i),c=t||_t(e.parts),l=()=>{let e=i.toLowerCase(),t=F.getAgentName(e),n=F.agents[e]?.icon;return(0,R.jsx)(R.Fragment,{children:n?(0,R.jsx)(`img`,{src:n,alt:t,className:`size-4 rounded-sm object-cover`}):(0,R.jsx)(u,{className:`size-4 text-[var(--console-muted)]`})})},d=e.mode?e.mode.toUpperCase():null,f=e.model||null,p=vr(e),m=Ar(e.time_created);return(0,R.jsx)(`article`,{className:`w-full border-l-2 border-[var(--console-thread)] pl-4 pr-3 md:pr-5`,children:(0,R.jsxs)(`div`,{className:`flex gap-4`,children:[(0,R.jsx)(`div`,{className:`shrink-0 pt-1`,children:(0,R.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:o?(0,R.jsx)(ne,{className:`size-4 text-[var(--console-muted)]`}):l()})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,R.jsx)(`span`,{className:`console-mono text-sm font-bold tracking-wide text-[var(--console-text)]`,children:p}),(0,R.jsx)(`time`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:m}),d&&(0,R.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:d}),f&&(0,R.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:f})]}),s?(0,R.jsx)(zr,{}):c.map((e,t)=>e.type===`reasoning`?(0,R.jsx)(Br,{parts:e.parts,highlightQuery:a},t):e.type===`plan`?(0,R.jsx)(Hr,{parts:e.parts,highlightQuery:a},t):e.type===`tool`?(0,R.jsx)(Vr,{parts:e.parts,toolAnchorIds:n,sessionAgentKey:i,highlightQuery:a},t):(0,R.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:(0,R.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:e.parts.map((e,t)=>(0,R.jsx)(An,{text:ht(e.text),highlightQuery:a},t))})},t)),!o&&(e.tokens||e.cost)&&(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.tokens?.input?(0,R.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`INPUT `,r(e.tokens.input)]}):null,e.tokens?.output?(0,R.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`OUTPUT `,r(e.tokens.output)]}):null,e.tokens?.reasoning?(0,R.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[`REASONING `,r(e.tokens.reasoning)]}):null,e.cost?(0,R.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:[e.cost_source===`estimated`?`EST COST`:`COST`,` $`,e.cost.toFixed(4)]}):null]})]})]})})}function zr(){return(0,R.jsx)(`div`,{className:`space-y-2`,children:(0,R.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,R.jsx)(`div`,{className:`w-full rounded-sm border border-[var(--console-border-strong)] bg-white px-3 py-2 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] md:w-[560px]`,children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(ae,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:`abort`})})]})})})})}function Br({parts:e,highlightQuery:t}){let[n,r]=(0,P.useState)(!1),i=e.map(e=>ht(e.text)).filter(Boolean).join(`
31
-
32
- `);return(0,R.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-thinking-border)] bg-[var(--console-thinking-bg)]`,children:[(0,R.jsxs)(`div`,{className:`flex cursor-pointer items-center justify-between bg-[var(--console-surface-muted)] px-3 py-2`,onClick:()=>r(!n),children:[(0,R.jsxs)(`span`,{className:`console-mono flex items-center gap-2 text-xs font-medium text-[var(--console-muted)]`,children:[(0,R.jsx)(ee,{className:`size-3.5`}),`Thinking`]}),(0,R.jsx)(`span`,{className:`text-[var(--console-muted)]`,children:n?(0,R.jsx)(c,{className:`w-4 h-4`}):(0,R.jsx)(E,{className:`w-4 h-4`})})]}),n&&(0,R.jsx)(`div`,{className:`border-t border-dashed border-[var(--console-thinking-border)] px-4 py-3`,children:(0,R.jsx)(`div`,{className:`console-mono whitespace-pre-wrap text-xs leading-relaxed text-[var(--console-muted)]`,children:kn(i,t)})})]})}function Vr({parts:e,toolAnchorIds:t,sessionAgentKey:n,highlightQuery:r}){return(0,R.jsx)(`div`,{className:`space-y-2`,children:(0,R.jsx)(`div`,{className:`space-y-2`,children:e.map((e,i)=>(0,R.jsx)(Wr,{tool:e,anchorId:t.get(e),sessionAgentKey:n,highlightQuery:r},i))})})}function Hr({parts:e,highlightQuery:t}){return(0,R.jsx)(`div`,{className:`space-y-2`,children:e.map((e,n)=>(0,R.jsx)(Ur,{part:e,highlightQuery:t},n))})}function Ur({part:e,highlightQuery:t}){let[n,r]=(0,P.useState)(!1),i=Nt(e),a=i.approvalStatus===`fail`?En.error:En.completed,o=a.icon;return(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,R.jsx)(`div`,{className:`w-full md:w-[560px] rounded-sm border border-[var(--console-border-strong)] bg-white px-3 py-2 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] ${i.expandable?`transition-colors hover:bg-[var(--console-surface-muted)]`:``}`,children:i.expandable?(0,R.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-2 text-left`,onClick:()=>r(!n),children:[(0,R.jsx)(m,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:i.title})}),(0,R.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[var(--console-muted)]`,children:n?(0,R.jsx)(c,{className:`size-3.5`}):(0,R.jsx)(E,{className:`size-3.5`})})]}):(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(m,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:i.title})})]})}),(0,R.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-1 rounded-sm border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider ${a.className}`,children:[(0,R.jsx)(o,{className:`size-3`}),a.label]})]}),i.expandable&&n?(0,R.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,R.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,R.jsx)(`span`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:i.contentLabel})}),(0,R.jsx)(`div`,{className:`p-4`,children:(0,R.jsx)(`div`,{className:`console-markdown text-sm leading-relaxed text-[var(--console-text)]`,children:(0,R.jsx)(An,{text:i.contentMarkdown,highlightQuery:t})})})]}):null]})}function Wr({tool:e,anchorId:t,sessionAgentKey:n,highlightQuery:r}){let[i,a]=(0,P.useState)(!1),o=br(e),s=Or(n,e,o),l=En[o.status],u=l.icon,d=s.Icon;return(0,R.jsxs)(`div`,{id:t,className:`scroll-mt-6 space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,R.jsx)(`div`,{className:`w-full md:w-[560px] rounded-sm border border-[var(--console-border-strong)] bg-white px-3 py-2 text-left shadow-[2px_2px_0_0_rgba(15,23,42,0.05)] ${s.expandable?`transition-colors hover:bg-[var(--console-surface-muted)]`:``}`,children:s.expandable?(0,R.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-2 text-left`,onClick:()=>a(!i),children:[(0,R.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:s.title}),s.secondaryText?(0,R.jsx)(`span`,{className:`console-mono mt-0.5 block whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-muted)]`,children:kn(s.secondaryText,r)}):null]}),(0,R.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[var(--console-muted)]`,children:i?(0,R.jsx)(c,{className:`size-3.5`}):(0,R.jsx)(E,{className:`size-3.5`})})]}):(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0 text-[var(--console-accent)]`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`console-mono block text-xs font-semibold text-[var(--console-text)]`,children:s.title}),s.secondaryText?(0,R.jsx)(`span`,{className:`console-mono mt-0.5 block whitespace-pre-wrap break-words text-xs leading-relaxed text-[var(--console-muted)]`,children:kn(s.secondaryText,r)}):null]})]})}),(0,R.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-1 rounded-sm border px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider ${l.className}`,children:[(0,R.jsx)(u,{className:`size-3 ${o.status===`running`?`animate-spin`:``}`}),l.label]})]}),s.expandable&&i?(0,R.jsxs)(`div`,{className:`overflow-hidden rounded-sm border border-[var(--console-border)] bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:[(0,R.jsx)(`div`,{className:`border-b border-[var(--console-border)] bg-[var(--console-surface-muted)] px-3 py-1.5`,children:(0,R.jsx)(`span`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:`Output`})}),(0,R.jsxs)(`div`,{className:`space-y-3 p-3`,children:[s.details.length>0?(0,R.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[#fafafa] px-3 py-2`,children:(0,R.jsx)(`div`,{className:`space-y-2`,children:s.details.map(e=>(0,R.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-start md:gap-3`,children:[(0,R.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] font-semibold uppercase tracking-wide text-[var(--console-muted)] md:w-24`,children:e.label}),(0,R.jsx)(`span`,{className:`console-mono whitespace-pre-wrap break-all text-xs leading-relaxed text-[var(--console-text)]`,children:kn(e.value,r)})]},`${e.label}:${e.value}`))})}):null,(0,R.jsx)(Tn,{outputContent:s.outputContent})]}),s.showInputPreview?(0,R.jsxs)(`div`,{className:`border-t border-[var(--console-border)] bg-[#fafafa] px-3 py-2`,children:[(0,R.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:`Input Preview`}),(0,R.jsx)(`pre`,{className:`console-mono mt-1 max-h-[200px] overflow-x-auto whitespace-pre-wrap break-all text-xs leading-relaxed text-[var(--console-muted)]`,children:kn(o.inputText||`{}`,r)})]}):null]}):null]})}var Gr=[{id:`1`,roleWidth:`w-14`,timeWidth:`w-20`,bodyWidths:[`w-full`,`w-10/12`,`w-7/12`]},{id:`2`,roleWidth:`w-16`,timeWidth:`w-24`,bodyWidths:[`w-9/12`,`w-7/12`]},{id:`3`,roleWidth:`w-14`,timeWidth:`w-16`,bodyWidths:[`w-full`,`w-11/12`,`w-8/12`,`w-5/12`]},{id:`4`,roleWidth:`w-16`,timeWidth:`w-20`,bodyWidths:[`w-10/12`,`w-8/12`]},{id:`5`,roleWidth:`w-14`,timeWidth:`w-24`,bodyWidths:[`w-full`,`w-10/12`,`w-9/12`]}];function Kr({className:e}){return(0,R.jsx)(`div`,{className:`rounded-sm bg-[var(--console-border)] ${e}`})}function qr(){return(0,R.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-8 px-2 md:px-4`,children:[(0,R.jsx)(`div`,{className:`flex flex-1 flex-col gap-8`,children:Gr.map(e=>(0,R.jsx)(`article`,{className:`w-full border-l-2 border-[var(--console-thread)] pl-4 pr-3 md:pr-5`,children:(0,R.jsxs)(`div`,{className:`flex gap-4`,children:[(0,R.jsx)(`div`,{className:`shrink-0 pt-1`,children:(0,R.jsx)(`div`,{className:`flex size-8 items-center justify-center rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:(0,R.jsx)(`div`,{className:`size-3.5 rounded-sm bg-[var(--console-border-strong)] animate-pulse`})})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(Kr,{className:`${e.roleWidth} h-3 animate-pulse`}),(0,R.jsx)(Kr,{className:`${e.timeWidth} h-2.5 animate-pulse`})]}),(0,R.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 shadow-[0_1px_2px_rgba(15,23,42,0.04)]`,children:(0,R.jsx)(`div`,{className:`space-y-2`,children:e.bodyWidths.map(t=>(0,R.jsx)(Kr,{className:`${t} h-3 animate-pulse`},`${e.id}-${t}`))})})]})]})},e.id))}),(0,R.jsx)(`div`,{className:`min-h-24 flex-1 rounded-sm border border-[var(--console-border)] bg-white/60 animate-pulse`})]})}function Jr({active:e,onToggle:t,className:n=``}){return(0,R.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":e?`取消收藏会话`:`收藏会话`,title:e?`取消收藏`:`收藏`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-sm border transition-colors ${n} ${e?`border-[var(--console-border)] bg-[var(--console-surface-muted)] text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] opacity-70 hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)] hover:text-[var(--console-text)] hover:opacity-100`}`,children:(0,R.jsx)(ce,{className:`size-3`,strokeWidth:1.8,fill:e?`currentColor`:`none`})})}function Yr(e){return e.toLocaleString(`en-US`)}function Xr(e){return e===0?`$0.00`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function Zr(e){if(e===`recorded`)return`recorded`;if(e===`estimated`)return`estimated`}function Qr(e){return e.total_tokens??e.total_input_tokens+e.total_output_tokens}function $r(e){if(!e)return`unknown`;let t=Date.now()-e;if(Number.isNaN(t)||t<0)return`just now`;let n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function ei({label:e,value:t,hint:n}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-wider text-[var(--console-muted)]`,children:e}),(0,R.jsx)(`p`,{className:`console-mono mt-2 text-xl font-semibold text-[var(--console-text)]`,children:t}),n?(0,R.jsx)(`p`,{className:`mt-1 text-xs text-[var(--console-muted)]`,children:n}):null]})}function ti({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] p-3`,children:[(0,R.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-wider text-[var(--console-muted)]`,children:e}),(0,R.jsx)(`p`,{className:`console-mono mt-2 break-all text-sm leading-6 text-[var(--console-text)]`,children:t})]})}function ni({code:e,title:t,description:n,aside:r,iconSrc:i,iconAlt:a}){return(0,R.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border-strong)] bg-white p-5 md:p-6`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-5 md:flex-row md:items-start md:justify-between`,children:[(0,R.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,R.jsx)(`span`,{className:`console-mono inline-flex rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--console-muted)]`,children:e}),(0,R.jsxs)(`div`,{className:`mt-4 flex items-start gap-3`,children:[i?(0,R.jsx)(`img`,{src:i,alt:a||``,className:`mt-1 size-8 shrink-0 object-contain`}):null,(0,R.jsx)(`h2`,{className:`console-mono text-2xl leading-tight font-semibold tracking-tight text-[var(--console-text)] md:text-[2rem]`,children:t})]}),(0,R.jsx)(`p`,{className:`mt-3 max-w-[42rem] text-sm leading-7 text-[var(--console-muted)]`,children:n})]}),(0,R.jsxs)(`div`,{className:`min-w-0 rounded-sm border border-dashed border-[var(--console-border)] bg-[var(--console-surface-muted)] px-4 py-3 md:max-w-xs`,children:[(0,R.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-[0.16em] text-[var(--console-muted)]`,children:`STATUS NOTE`}),(0,R.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-[var(--console-text)]`,children:r})]})]})})}function ri({agentItems:e}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Known Agents`}),(0,R.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` items`]})]}),(0,R.jsx)(`ul`,{className:`grid gap-2 sm:grid-cols-2`,children:e.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(s,{to:`/${e.key}`,className:`flex min-h-11 items-center gap-2 rounded-sm border border-transparent px-3 py-2 transition-colors duration-200 hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--console-accent)]`,children:[(0,R.jsx)(`img`,{src:e.icon,alt:e.name,className:`size-4 object-contain`}),(0,R.jsx)(`span`,{className:`console-mono flex-1 text-xs text-[var(--console-text)]`,children:e.name}),(0,R.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.count})]})},e.key))})]})}function ii({sessions:e,isBookmarked:t,onToggleBookmark:n}){return e.length===0?(0,R.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 text-sm text-[var(--console-muted)]`,children:`No sessions yet`}):(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,R.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Recent Sessions`}),(0,R.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` items`]})]}),(0,R.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>{let r=t(e.agentKey,e.id);return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,R.jsxs)(s,{to:`/${e.fullPath}`,className:`min-w-0 flex-1`,children:[(0,R.jsx)(`p`,{className:`line-clamp-1 text-sm text-[var(--console-text)]`,children:e.title}),(0,R.jsxs)(`p`,{className:`console-mono mt-0.5 text-[11px] text-[var(--console-muted)]`,children:[`/`,e.fullPath,` ·`,` `,$r(e.time_updated||e.time_created)]}),(0,R.jsx)(Ve,{tags:e.smart_tags,className:`mt-1.5`})]}),(0,R.jsx)(Jr,{active:r,onToggle:()=>n(e)})]})},e.id)})})]})}function ai({type:e,sessions:t,agentItems:n,activeAgentKey:r,attemptedAgentKey:i,attemptedSessionSlug:a,isBookmarked:o,onToggleBookmark:c}){let l=t.toSorted((e,t)=>(t.time_updated||t.time_created||0)-(e.time_updated||e.time_created||0)),u=l.slice(0,5),d=t.reduce((e,t)=>e+t.stats.message_count,0),f=t.reduce((e,t)=>e+Qr(t.stats),0),p=t.reduce((e,t)=>e+t.stats.total_cost,0),m=p>0?t.some(e=>e.stats.cost_source===`estimated`)?`estimated`:`recorded`:void 0,h=l[0]?.time_updated||l[0]?.time_created;if(e===`missing-agent`){let e=`/${i||`unknown`}${a?`/${a}`:``}`;return(0,R.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,R.jsx)(ni,{code:`404 / AGENT`,title:`This agent isn't on the roster.`,description:`The path you requested is valid in shape, but there is no matching agent in the current registry. It may not be connected yet, or its name may not match what the system recognizes.`,aside:`Choose one of the available agents to continue.`}),(0,R.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,R.jsx)(ti,{label:`Requested Agent`,value:i||`unknown`}),(0,R.jsx)(ti,{label:`Requested Path`,value:e}),a?(0,R.jsx)(ti,{label:`Requested Session`,value:a}):null]}),(0,R.jsx)(ri,{agentItems:n})]})}if(e===`missing-session`){let e=r||F.getDefaultAgentKey()||`claudecode`,t=F.agents[e],n=t?.name||e,i=t?.icon,s=a||`unknown-session`;return(0,R.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,R.jsx)(ni,{code:`404 / SESSION`,title:`This session isn't in the index.`,description:`${n} is available, but the session you're looking for does not exist in the current index. The slug may be incorrect, or the record may never have been part of this dataset.`,aside:`We checked the current path, but nothing matched. The session list on the left is still available.`,iconSrc:i,iconAlt:n}),(0,R.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] p-3`,children:[(0,R.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-wider text-[var(--console-muted)]`,children:`Agent`}),(0,R.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[i?(0,R.jsx)(`img`,{src:i,alt:n,className:`size-4 shrink-0 object-contain`}):null,(0,R.jsx)(`p`,{className:`console-mono break-all text-sm leading-6 text-[var(--console-text)]`,children:n})]})]}),(0,R.jsx)(ti,{label:`Session`,value:s})]}),(0,R.jsx)(ii,{sessions:u,isBookmarked:o,onToggleBookmark:c})]})}if(e===`global`)return(0,R.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,R.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,R.jsx)(ei,{label:`Total Sessions`,value:Yr(t.length)}),(0,R.jsx)(ei,{label:`Total Messages`,value:Yr(d)}),(0,R.jsx)(ei,{label:`Latest Activity`,value:$r(h),hint:h?new Date(h).toLocaleString(`zh-CN`):void 0})]}),(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsx)(`h3`,{className:`console-mono mb-3 text-xs font-bold uppercase text-[var(--console-text)]`,children:`Agents`}),(0,R.jsx)(`ul`,{className:`grid gap-2 sm:grid-cols-2`,children:n.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(s,{to:`/${e.key}`,className:`flex items-center gap-2 rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,R.jsx)(`img`,{src:e.icon,alt:e.name,className:`size-4 object-contain`}),(0,R.jsx)(`span`,{className:`console-mono flex-1 text-xs text-[var(--console-text)]`,children:e.name}),(0,R.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.count})]})},e.key))})]}),(0,R.jsx)(ii,{sessions:u,isBookmarked:o,onToggleBookmark:c})]});let g=r?F.agents[r]:null,_=g?g.name:`Unknown Agent`;return(0,R.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,R.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g?(0,R.jsx)(`img`,{src:g.icon,alt:_,className:`size-6 object-contain`}):null,(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`console-mono text-sm font-semibold text-[var(--console-text)]`,children:_}),(0,R.jsx)(`p`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:`Select a session from the left to view details`})]})]})}),(0,R.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,R.jsx)(ei,{label:`Sessions`,value:Yr(t.length)}),(0,R.jsx)(ei,{label:`Messages`,value:Yr(d)}),(0,R.jsx)(ei,{label:`Tokens`,value:Yr(f)}),(0,R.jsx)(ei,{label:`Total Cost`,value:Xr(p),hint:Zr(m)})]}),(0,R.jsx)(ii,{sessions:u,isBookmarked:o,onToggleBookmark:c})]})}var oi=`codesesh:bookmarks:v1`;function si(e){return typeof e==`object`&&!!e}function ci(e){return si(e)?typeof e.message_count==`number`&&typeof e.total_input_tokens==`number`&&typeof e.total_output_tokens==`number`&&typeof e.total_cost==`number`&&(e.total_tokens==null||typeof e.total_tokens==`number`):!1}function li(e){return si(e)?typeof e.sessionId==`string`&&typeof e.agentKey==`string`&&typeof e.fullPath==`string`&&typeof e.title==`string`&&typeof e.directory==`string`&&typeof e.time_created==`number`&&(e.time_updated==null||typeof e.time_updated==`number`)&&(e.bookmarked_at==null||typeof e.bookmarked_at==`number`)&&ci(e.stats):!1}function Q(e,t){return`${e}:${t}`}function ui(e,t){return{sessionId:e.id,agentKey:t,fullPath:e.slug,title:e.title,directory:e.directory,time_created:e.time_created,time_updated:e.time_updated,stats:e.stats,bookmarked_at:Date.now()}}function di(){if(typeof window>`u`)return[];try{let e=window.localStorage.getItem(oi);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(li).toSorted(pi):[]}catch{return[]}}function fi(){typeof window>`u`||window.localStorage.removeItem(oi)}function pi(e,t){let n=e.time_updated??e.time_created;return(t.time_updated??t.time_created)-n}function mi(e,t){if(e.length===0||t.length===0)return e;let n=new Map(t.map(e=>{let t=ui(e,e.slug.split(`/`)[0]?.toLowerCase()??`unknown`);return[Q(t.agentKey,t.sessionId),t]})),r=!1,i=e.map(e=>{let t=n.get(Q(e.agentKey,e.sessionId));return!t||t.fullPath===e.fullPath&&t.title===e.title&&t.directory===e.directory&&t.time_created===e.time_created&&t.time_updated===e.time_updated&&t.stats.message_count===e.stats.message_count&&t.stats.total_input_tokens===e.stats.total_input_tokens&&t.stats.total_output_tokens===e.stats.total_output_tokens&&t.stats.total_cost===e.stats.total_cost&&t.stats.total_tokens===e.stats.total_tokens?e:(r=!0,{...t,bookmarked_at:e.bookmarked_at})});return r?i.toSorted(pi):e}var hi={light:``,dark:`.dark`},gi={width:320,height:200},_i=P.createContext(null);function vi(){let e=P.useContext(_i);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function yi({id:e,className:t,children:n,config:r,initialDimension:i=gi,...a}){let o=P.useId(),s=`chart-${e??o.replace(/:/g,``)}`;return(0,R.jsx)(_i.Provider,{value:{config:r},children:(0,R.jsxs)(`div`,{"data-slot":`chart`,"data-chart":s,className:L(`flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden`,t),...a,children:[(0,R.jsx)(bi,{id:s,config:r}),(0,R.jsx)(g,{initialDimension:i,children:n})]})})}var bi=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme??e.color);return n.length?(0,R.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(hi).map(([t,r])=>`
33
- ${r} [data-chart=${e}] {
34
- ${n.map(([e,n])=>{let r=n.theme?.[t]??n.color;return r?` --color-${e}: ${r};`:null}).join(`
35
- `)}
36
- }
37
- `).join(`
38
- `)}}):null},xi=w;function Si({active:e,payload:t,className:n,indicator:r=`dot`,hideLabel:i=!1,hideIndicator:a=!1,label:o,labelFormatter:s,labelClassName:c,formatter:l,color:u,nameKey:d,labelKey:f}){let{config:p}=vi(),m=P.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=Ci(p,e,`${f??e?.dataKey??e?.name??`value`}`),r=!f&&typeof o==`string`?p[o]?.label??o:n?.label;return s?(0,R.jsx)(`div`,{className:L(`font-medium`,c),children:s(r,t)}):r?(0,R.jsx)(`div`,{className:L(`font-medium`,c),children:r}):null},[o,s,t,i,c,p,f]);if(!e||!t?.length)return null;let h=t.length===1&&r!==`dot`;return(0,R.jsxs)(`div`,{className:L(`grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl`,n),children:[h?null:m,(0,R.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=Ci(p,e,`${d??e.name??e.dataKey??`value`}`),i=u??e.payload?.fill??e.color;return(0,R.jsx)(`div`,{className:L(`flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground`,r===`dot`&&`items-center`),children:l&&e?.value!==void 0&&e.name?l(e.value,e.name,e,t,e.payload):(0,R.jsxs)(R.Fragment,{children:[n?.icon?(0,R.jsx)(n.icon,{}):!a&&(0,R.jsx)(`div`,{className:L(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":r===`dot`,"w-1":r===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":r===`dashed`,"my-0.5":h&&r===`dashed`}),style:{"--color-bg":i,"--color-border":i}}),(0,R.jsxs)(`div`,{className:L(`flex flex-1 justify-between leading-none`,h?`items-end`:`items-center`),children:[(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[h?m:null,(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:n?.label??e.name})]}),e.value!=null&&(0,R.jsx)(`span`,{className:`font-mono font-medium text-foreground tabular-nums`,children:typeof e.value==`number`?e.value.toLocaleString():String(e.value)})]})]})},t)})})]})}function Ci(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}function $(e){return e.toLocaleString(`en-US`)}function wi(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:$(e)}function Ti(e){return e===0?`$0.00`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function Ei(e){if(e===`recorded`)return`recorded`;if(e===`estimated`)return`estimated`}function Di(e){if(!e)return`unknown`;let t=Date.now()-e;if(Number.isNaN(t)||t<0)return`just now`;let n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Oi({label:e,value:t,hint:n}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-wider text-[var(--console-muted)]`,children:e}),(0,R.jsx)(`p`,{className:`console-mono mt-2 text-xl font-semibold text-[var(--console-text)]`,children:t}),n?(0,R.jsx)(`p`,{className:`mt-1 text-xs text-[var(--console-muted)]`,children:n}):null]})}function ki(e){return e.length>=10?e.slice(5):e}function Ai({buckets:e}){let[t,n]=(0,P.useState)(null),r=(0,P.useMemo)(()=>Math.max(1,...e.map(e=>e.sessions)),[e]),i=(0,P.useMemo)(()=>e.reduce((e,t)=>e+t.sessions,0),[e]),a=(0,P.useMemo)(()=>{if(e.length===0)return new Set;let t=Math.min(6,e.length);if(t===1)return new Set([0]);let n=new Set;for(let r=0;r<t;r+=1)n.add(Math.round(r*(e.length-1)/(t-1)));return n},[e.length]);return(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Daily Activity`}),(0,R.jsxs)(`p`,{className:`console-mono mt-1 text-[11px] text-[var(--console-muted)]`,children:[`Session activity · last `,e.length,` days`]})]}),(0,R.jsx)(`span`,{className:`console-mono text-right text-[11px] text-[var(--console-muted)]`,children:t?`${t.date} · ${$(t.sessions)} sessions · ${$(t.messages)} msgs`:`${$(i)} in range`})]}),(0,R.jsx)(`div`,{className:`flex h-32 items-end gap-[2px]`,onMouseLeave:()=>n(null),children:e.map(e=>{let i=e.sessions>0?Math.max(Math.round(e.sessions/r*128),4):2,a=`${e.date} · ${e.sessions} sessions · ${e.messages} msgs`,o=t?.date===e.date;return(0,R.jsx)(`div`,{title:a,onMouseEnter:()=>n(e),className:`flex-1 cursor-default rounded-t-[1px] transition-opacity ${e.sessions>0?`bg-[var(--console-accent)]`:`bg-[var(--console-surface-muted)]`} ${o?`opacity-70`:`opacity-100`}`,style:{height:`${i}px`}},e.date)})}),(0,R.jsx)(`div`,{className:`console-mono mt-2 flex text-[10px] text-[var(--console-muted)]`,children:e.map((e,t)=>(0,R.jsx)(`span`,{className:`flex-1 text-center`,children:a.has(t)?ki(e.date):``},e.date))})]})}var ji={input:`#4A9EFF`,output:`#7C5CFF`,cache_read:`#3FB68B`,cache_create:`#E8A23B`},Mi={input:`Input`,output:`Output`,cache_read:`Cache Read`,cache_create:`Cache Create`};function Ni({buckets:e}){let[t,n]=(0,P.useState)(null),r=(0,P.useMemo)(()=>Math.max(1,...e.map(e=>e.input+e.output+e.cache_read+e.cache_create)),[e]),i=(0,P.useMemo)(()=>e.reduce((e,t)=>e+t.input+t.output+t.cache_read+t.cache_create,0),[e]),a=(0,P.useMemo)(()=>{if(e.length===0)return new Set;let t=Math.min(6,e.length);if(t===1)return new Set([0]);let n=new Set;for(let r=0;r<t;r+=1)n.add(Math.round(r*(e.length-1)/(t-1)));return n},[e.length]);return i===0?null:(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Daily Token Activity`}),(0,R.jsxs)(`p`,{className:`console-mono mt-1 text-[11px] text-[var(--console-muted)]`,children:[`Token breakdown · last `,e.length,` days`]})]}),(0,R.jsx)(`span`,{className:`console-mono text-right text-[11px] text-[var(--console-muted)]`,children:t?`${t.date} · ${wi(t.input+t.output+t.cache_read+t.cache_create)} total`:`${wi(i)} in range`})]}),t?(0,R.jsx)(`div`,{className:`mb-2 flex gap-4`,children:[`input`,`output`,`cache_read`,`cache_create`].map(e=>(0,R.jsxs)(`span`,{className:`console-mono flex items-center gap-1.5 text-[10px] text-[var(--console-muted)]`,children:[(0,R.jsx)(`span`,{className:`inline-block size-2 rounded-full`,style:{backgroundColor:ji[e]}}),Mi[e],`: `,wi(t[e])]},e))}):(0,R.jsx)(`div`,{className:`mb-2 flex gap-4`,children:[`input`,`output`,`cache_read`,`cache_create`].map(e=>(0,R.jsxs)(`span`,{className:`console-mono flex items-center gap-1.5 text-[10px] text-[var(--console-muted)]`,children:[(0,R.jsx)(`span`,{className:`inline-block size-2 rounded-full`,style:{backgroundColor:ji[e]}}),Mi[e]]},e))}),(0,R.jsx)(`div`,{className:`flex h-32 items-end gap-[2px]`,onMouseLeave:()=>n(null),children:e.map(e=>{let i=e.input+e.output+e.cache_read+e.cache_create,a=i>0?Math.max(Math.round(i/r*128),4):2,o=t?.date===e.date,s=i>0?[{key:`input`,value:e.input},{key:`output`,value:e.output},{key:`cache_read`,value:e.cache_read},{key:`cache_create`,value:e.cache_create}]:[];return(0,R.jsx)(`div`,{onMouseEnter:()=>n(e),className:`flex flex-1 cursor-default flex-col justify-end overflow-hidden rounded-t-[1px] transition-opacity ${o?`opacity-70`:`opacity-100`}`,style:{height:`${a}px`},children:i>0?s.map(e=>{let t=Math.max(Math.round(e.value/i*a),0);return t===0?null:(0,R.jsx)(`div`,{style:{height:`${t}px`,backgroundColor:ji[e.key]}},e.key)}):(0,R.jsx)(`div`,{className:`h-full bg-[var(--console-surface-muted)]`})},e.date)})}),(0,R.jsx)(`div`,{className:`console-mono mt-2 flex text-[10px] text-[var(--console-muted)]`,children:e.map((e,t)=>(0,R.jsx)(`span`,{className:`flex-1 text-center`,children:a.has(t)?ki(e.date):``},e.date))})]})}var Pi=[`#4A9EFF`,`#7C5CFF`,`#3FB68B`,`#E8A23B`,`#E5484D`,`#5BCEDA`,`#F472B6`,`#A78BFA`,`#FB923C`,`#6EE7B7`];function Fi({entries:e}){let t=(0,P.useMemo)(()=>e.filter(e=>e.tokens>0),[e]),n=(0,P.useMemo)(()=>t.reduce((e,t)=>e+t.tokens,0),[t]);if(t.length===0||n===0)return(0,R.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 text-sm text-[var(--console-muted)]`,children:`No model data yet`});let r=t.map((e,t)=>({...e,chartKey:`model${t}`,fraction:e.tokens/n,fill:Pi[t%Pi.length]})),i=r.reduce((e,t)=>(e[t.chartKey]={label:t.model,color:t.fill},e),{});return(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Model Distribution`}),(0,R.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[t.length,` models`]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-6`,children:[(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center`,children:[(0,R.jsx)(yi,{config:i,className:`aspect-square size-[160px]`,children:(0,R.jsxs)(se,{children:[(0,R.jsx)(xi,{content:(0,R.jsx)(Si,{hideLabel:!0,nameKey:`chartKey`,formatter:e=>(0,R.jsxs)(`span`,{className:`font-mono font-medium text-foreground tabular-nums`,children:[$(Number(e)),` tokens`]})})}),(0,R.jsx)(ie,{data:r,dataKey:`tokens`,nameKey:`chartKey`,outerRadius:70,paddingAngle:1,strokeWidth:0,isAnimationActive:!1})]})}),(0,R.jsxs)(`div`,{className:`console-mono -mt-1 text-center`,children:[(0,R.jsx)(`div`,{className:`text-xs font-semibold text-[var(--console-text)]`,children:wi(n)}),(0,R.jsx)(`div`,{className:`text-[10px] text-[var(--console-muted)]`,children:`tokens`})]})]}),(0,R.jsx)(`ul`,{className:`min-w-0 flex-1 space-y-1.5`,children:r.map(e=>(0,R.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`inline-block size-2.5 shrink-0 rounded-full`,style:{backgroundColor:e.fill}}),(0,R.jsx)(`span`,{className:`console-mono min-w-0 flex-1 truncate text-xs text-[var(--console-text)]`,children:e.model}),(0,R.jsxs)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:[(e.fraction*100).toFixed(1),`%`]})]},e.model))})]})]})}function Ii({perAgent:e}){let t=(0,P.useMemo)(()=>e.reduce((e,t)=>e+t.sessions,0),[e]);return t===0||e.length===0?(0,R.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 text-sm text-[var(--console-muted)]`,children:`No agent data yet`}):(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Agent Distribution`}),(0,R.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` agents`]})]}),(0,R.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>{let n=t>0?e.sessions/t*100:0;return(0,R.jsx)(`li`,{children:(0,R.jsxs)(s,{to:`/${e.name.toLowerCase()}`,className:`block rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon?(0,R.jsx)(`img`,{src:e.icon,alt:e.displayName,className:`size-4 object-contain`}):null,(0,R.jsx)(`span`,{className:`console-mono flex-1 text-xs text-[var(--console-text)]`,children:e.displayName}),(0,R.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[$(e.sessions),` · `,n.toFixed(1),`%`]})]}),(0,R.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-sm bg-[var(--console-surface-muted)]`,children:(0,R.jsx)(`div`,{className:`h-full bg-[var(--console-accent)]`,style:{width:`${n}%`}})}),(0,R.jsxs)(`div`,{className:`console-mono mt-1 flex gap-3 text-[10px] text-[var(--console-muted)]`,children:[(0,R.jsxs)(`span`,{children:[$(e.messages),` msgs`]}),(0,R.jsxs)(`span`,{children:[wi(e.tokens),` tokens`]})]})]})},e.name)})})]})}function Li({sessions:e,onToggleBookmark:t}){return e.length===0?null:(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,R.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Bookmarked Sessions`}),(0,R.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` items`]})]}),(0,R.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>{let n=F.agents[e.agentKey],r=e.time_updated??e.time_created;return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,R.jsxs)(s,{to:`/${e.fullPath}`,className:`flex min-w-0 flex-1 items-start gap-2`,children:[n?.icon?(0,R.jsx)(`img`,{src:n.icon,alt:n.name,className:`mt-0.5 size-3.5 shrink-0 object-contain`}):null,(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`p`,{className:`line-clamp-1 text-sm text-[var(--console-text)]`,children:e.title}),(0,R.jsxs)(`p`,{className:`console-mono mt-0.5 line-clamp-1 text-[11px] text-[var(--console-muted)]`,children:[`/`,e.fullPath,` · `,Di(r)]})]})]}),(0,R.jsx)(Jr,{active:!0,onToggle:()=>t(e)})]})},Q(e.agentKey,e.sessionId))})})]})}function Ri({sessions:e,isBookmarked:t,onToggleBookmark:n}){return e.length===0?(0,R.jsx)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4 text-sm text-[var(--console-muted)]`,children:`No sessions yet`}):(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white p-4`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,R.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:`Recent Activity`}),(0,R.jsxs)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:[e.length,` items`]})]}),(0,R.jsx)(`ul`,{className:`space-y-2`,children:e.map(e=>{let r=e.agentName.toLowerCase(),i=F.agents[r],a=e.time_updated??e.time_created,o=t(r,e.id);return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm border border-transparent px-2 py-1.5 transition-colors hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,R.jsxs)(s,{to:`/${e.slug}`,className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i?.icon?(0,R.jsx)(`img`,{src:i.icon,alt:i.name,className:`size-3.5 shrink-0 object-contain`}):null,(0,R.jsx)(`p`,{className:`line-clamp-1 flex-1 text-sm text-[var(--console-text)]`,children:e.title}),(0,R.jsx)(`span`,{className:`console-mono shrink-0 text-[11px] text-[var(--console-muted)]`,children:Di(a)})]}),(0,R.jsxs)(`p`,{className:`console-mono mt-0.5 line-clamp-1 text-[11px] text-[var(--console-muted)]`,children:[`/`,e.slug]}),(0,R.jsx)(Ve,{tags:e.smart_tags,className:`mt-1.5`})]}),(0,R.jsx)(Jr,{active:o,onToggle:()=>n(e,r)})]})},e.id)})})]})}function zi({data:e,bookmarkedSessions:t,isBookmarked:n,onToggleBookmark:r}){let{totals:i,perAgent:a,dailyActivity:o,dailyTokenActivity:s,modelDistribution:c,recentSessions:l}=e;return(0,R.jsxs)(`div`,{"data-testid":`dashboard`,className:`mx-auto max-w-5xl space-y-4`,children:[(0,R.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-5`,children:[(0,R.jsx)(Oi,{label:`Total Sessions`,value:$(i.sessions)}),(0,R.jsx)(Oi,{label:`Total Messages`,value:$(i.messages)}),(0,R.jsx)(Oi,{label:`Total Tokens`,value:wi(i.tokens)}),(0,R.jsx)(Oi,{label:`Total Cost`,value:Ti(i.cost),hint:Ei(i.cost_source)}),(0,R.jsx)(Oi,{label:`Latest Activity`,value:Di(i.latestActivity),hint:i.latestActivity?new Date(i.latestActivity).toLocaleString(`zh-CN`):void 0})]}),(0,R.jsx)(Ai,{buckets:o}),(0,R.jsx)(Ni,{buckets:s}),(0,R.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,R.jsx)(Fi,{entries:c}),(0,R.jsx)(Ii,{perAgent:a})]}),(0,R.jsx)(Ri,{sessions:l,isBookmarked:n,onToggleBookmark:r}),(0,R.jsx)(Li,{sessions:t,onToggleBookmark:e=>r(e)})]})}var Bi=class extends P.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught error:`,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-error-border)] bg-[var(--console-error-bg)] p-6`,children:[(0,R.jsx)(`h3`,{className:`console-mono mb-2 text-sm font-semibold text-[var(--console-error)]`,children:`Something went wrong`}),(0,R.jsx)(`p`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:this.state.error?.message||`Unknown error`})]}):this.props.children}},Vi=`
39
- [data-type='item'][data-item-type='file'] > [data-item-section='icon'] {
40
- display: none;
41
- }
42
-
43
- [data-type='item'][data-item-type='file'] > [data-item-section='spacing'] {
44
- padding-left: 2px;
45
- }
46
-
47
- [data-type='item'][data-item-type='file'] > [data-item-section='spacing'] > [data-item-section='spacing-item'] {
48
- margin-right: 4px;
49
- }
50
-
51
- [data-type='item'][data-item-type='file'] > [data-item-section='content'] {
52
- flex: 1 1 auto;
53
- }
54
-
55
- [data-type='item'][data-item-type='file'] > [data-item-section='decoration'] {
56
- flex: 0 0 auto;
57
- padding-inline: 8px 6px;
58
- }
59
-
60
- [data-type='item'][data-item-type='file'] > [data-item-section='decoration'] > span {
61
- cursor: pointer;
62
- font-size: 18px;
63
- line-height: 1;
64
- }
65
-
66
- [data-type='item'][data-item-type='file'] [data-truncate-group-container='middle'] {
67
- width: 100%;
68
- }
69
-
70
- [data-type='item'][data-item-type='file']
71
- [data-truncate-group-container='middle']
72
- > div[data-truncate-segment-priority='2'] {
73
- flex: 0 1 auto;
74
- }
75
-
76
- [data-type='item'][data-item-type='file']
77
- [data-truncate-group-container='middle']
78
- > div[data-truncate-segment-priority='1'] {
79
- flex: 1 999999 auto;
80
- }
81
-
82
- [data-type='item'][data-item-type='file']
83
- [data-truncate-group-container='middle']
84
- [data-truncate-container='fruncate']
85
- [data-truncate-grid] {
86
- grid-template-columns: minmax(0, max-content) 0;
87
- }
88
-
89
- [data-type='item'][data-item-type='file']
90
- [data-truncate-group-container='middle']
91
- [data-truncate-container='fruncate']
92
- [data-truncate-content] {
93
- direction: ltr;
94
- }
95
-
96
- [data-type='item'][data-item-type='file']
97
- [data-truncate-group-container='middle']
98
- [data-truncate-container='fruncate']
99
- [data-truncate-marker] {
100
- right: 0;
101
- }
102
-
103
- [data-type='item'][data-item-type='file'] [data-truncate-marker] {
104
- display: none;
105
- }
106
- `;function Hi(e){return e.replaceAll(`/`,`∕`).trim()||`(untitled)`}function Ui(e){return e.replace(/\/+$/,``).split(`/`).at(-1)?.trim()||`(unknown)`}function Wi(e){let t=e.project_identity;if(t)return{key:`${t.kind}:${t.key}`,label:t.displayName||Ui(e.directory)};let n=Ui(e.directory);return{key:n===`(unknown)`?`__unknown__`:`path:${e.directory||n}`,label:n}}function Gi(e){return e.time_updated??e.time_created}function Ki(e,t,n){let r=e.get(t.path)??2**53-1,i=e.get(n.path)??2**53-1;return r===i?t.path.localeCompare(n.path):r-i}function qi(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,s=new Set,c=[],l=new Map;for(let t of e){let{key:e,label:n}=Wi(t),r=l.get(e);r?r.sessions.push(t):l.set(e,{label:n,sessions:[t]})}let u=[...l.entries()].sort(([,e],[,t])=>{if(e.label===`(unknown)`)return 1;if(t.label===`(unknown)`)return-1;let n=Math.max(...e.sessions.map(Gi));return Math.max(...t.sessions.map(Gi))-n}),d=0,f=new Set;for(let[,e]of u){let l=Hi(e.label),u=`${l}/`,p=2;for(;f.has(u);)u=`${l} (${p})/`,p+=1;f.add(u);let m=u.slice(0,-1),h=new Map;t.set(u,d),t.set(m,d),d+=1,a.set(u,`${e.sessions.length}`),a.set(m,`${e.sessions.length}`);for(let t of e.sessions)h.set(t.title,(h.get(t.title)??0)+1);for(let a of e.sessions){let e=(h.get(a.title)??0)>1?`${Hi(a.title)} #${a.id.slice(0,8)}`:Hi(a.title),l=`${u}${e}`,f=2;for(;s.has(l);)l=`${u}${e} (${f})`,f+=1;s.add(l),c.push(l),t.set(l,d),d+=1,n.set(a.id,l),r.set(a.id,u),i.set(l,a.id),o.set(l,a)}}return{paths:c,sortOrderByPath:t,pathBySessionId:n,groupPathBySessionId:r,sessionIdByPath:i,groupCountByPath:a,sessionByPath:o}}function Ji({sessions:e,activeSessionId:t,selectedSessionId:n,onSelectSession:r,bookmarkedSessionIds:a,onToggleBookmark:s}){let c=(0,P.useMemo)(()=>qi(e),[e]),l=(0,P.useRef)(c.sortOrderByPath),u=(0,P.useRef)(c.sessionIdByPath),d=(0,P.useRef)(c.groupCountByPath),f=(0,P.useRef)(c.sessionByPath),p=(0,P.useRef)(a),m=(0,P.useRef)(r),h=(0,P.useRef)(s),g={"--trees-bg-override":`transparent`,"--trees-border-color-override":`var(--console-border)`,"--trees-fg-override":`var(--console-text)`,"--trees-fg-muted-override":`var(--console-muted)`,"--trees-font-family-override":`"JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace`,"--trees-font-size-override":`12px`,"--trees-item-margin-x-override":`0px`,"--trees-item-padding-x-override":`8px`,"--trees-selected-bg-override":`var(--console-surface-muted)`},{model:_}=o({flattenEmptyDirectories:!1,initialExpansion:`closed`,paths:c.paths,sort:(e,t)=>Ki(l.current,e,t),density:`compact`,unsafeCSS:Vi,onSelectionChange(e){let t=u.current.get(e[0]??``);t&&m.current(t)},renderRowDecoration({item:e}){let t=f.current.get(e.path);if(t){let e=p.current.has(t.id);return{text:e?`★`:`☆`,title:e?`Remove bookmark`:`Add bookmark`}}return d.current.get(e.path)?{text:d.current.get(e.path),title:`Sessions`}:null}});(0,P.useEffect)(()=>{l.current=c.sortOrderByPath,u.current=c.sessionIdByPath,d.current=c.groupCountByPath,f.current=c.sessionByPath,_.resetPaths(c.paths)},[_,c]),(0,P.useEffect)(()=>{m.current=r},[r]),(0,P.useEffect)(()=>{p.current=a,_.resetPaths(c.paths)},[a,_,c.paths]),(0,P.useEffect)(()=>{h.current=s},[s]);function v(e){let t=e.nativeEvent.composedPath(),n=t.find(e=>e instanceof HTMLElement&&e.parentElement?.getAttribute(`data-item-section`)===`decoration`),r=t.find(e=>e instanceof HTMLElement&&e.getAttribute(`data-type`)===`item`),i=r?f.current.get(r.getAttribute(`data-item-path`)??``):null;!n||!i||(e.preventDefault(),e.stopPropagation(),h.current(i))}return(0,P.useEffect)(()=>{let e=c.pathBySessionId.get(t??``),r=c.pathBySessionId.get(n??``)??e,i=n??t??``,a=c.groupPathBySessionId.get(i);if(e&&_.getItem(e)?.select(),r&&t){let e=a?_.getItem(a):null;e&&`expand`in e&&e.expand(),_.focusPath(r);return}a&&_.focusPath(a)},[t,_,c,n]),(0,R.jsx)(`div`,{className:`session-tree h-[min(560px,calc(100vh-410px))] min-h-56 overflow-hidden`,style:g,onClickCapture:v,children:(0,R.jsx)(i,{model:_,style:{height:`100%`},"aria-label":`Sessions`})})}function Yi(e,t){let n=e.replace(/^\/+|\/+$/g,``),r=n?n.split(`/`).map(e=>e.trim()).filter(Boolean):[];if(r.length===0)return{mode:`root`,activeAgentKey:null,activeSessionSlug:null};if(r.length===1){let e=r[0].toLowerCase();return t.has(e)?{mode:`agent`,activeAgentKey:e,activeSessionSlug:null}:{mode:`missingAgent`,activeAgentKey:null,activeSessionSlug:null,attemptedKey:e}}if(r.length===2){let e=r[0].toLowerCase(),n=r[1];return t.has(e)&&n?{mode:`session`,activeAgentKey:e,activeSessionSlug:n}:t.has(e)?{mode:`missingSession`,activeAgentKey:e,activeSessionSlug:n,attemptedSessionSlug:n}:{mode:`missingAgent`,activeAgentKey:null,activeSessionSlug:null,attemptedKey:e}}return{mode:`invalidRoute`,activeAgentKey:null,activeSessionSlug:null}}function Xi(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Zi(e){if(!e)return null;let{from:t,to:n,days:r}=e.window;if(t==null)return`All time`;let i=Xi(t),a=Xi(n??Date.now());return r?`Last ${r}d · ${i} → ${a}`:`${i} → ${a}`}function Qi(e){if(!e)return`unknown`;let t=Date.now()-e;if(Number.isNaN(t)||t<0)return`just now`;let n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function $i(e){return e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`"`,`&quot;`).replaceAll(`'`,`&#39;`).replaceAll(`&lt;mark&gt;`,`<mark>`).replaceAll(`&lt;/mark&gt;`,`</mark>`)}var ea=`codesesh.shortcuts-hint-dismissed`,ta=[{title:`Navigation`,items:[{keys:`j / k`,description:`Move through sessions or search results`},{keys:`Enter`,description:`Open the current selection`},{keys:`g / G`,description:`Jump to the first or last item`}]},{title:`Search`,items:[{keys:`/`,description:`Focus the search box`},{keys:`Esc`,description:`Exit search or close the current detail view`}]},{title:`Groups`,items:[{keys:`g / G`,description:`Jump to the first or last session`},{keys:`?`,description:`Open this shortcuts panel`}]}];function na(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||t===`select`||e.isContentEditable}function ra(){let e=d(),[t,n]=(0,P.useState)([]),[r,i]=(0,P.useState)([]),[a,o]=(0,P.useState)([]),[c,l]=(0,P.useState)(!0),[u,f]=(0,P.useState)(null),[p,m]=(0,P.useState)(null),[h,g]=(0,P.useState)(!1),[_,v]=(0,P.useState)(null),[y,b]=(0,P.useState)(null),[x,ee]=(0,P.useState)(null),[S,ne]=(0,P.useState)(null),[re,ie]=(0,P.useState)(``),[C,ae]=(0,P.useState)(``),[w,oe]=(0,P.useState)([]),[se,ce]=(0,P.useState)(!1),[T,E]=(0,P.useState)(null),[le,D]=(0,P.useState)(0),[O,ue]=(0,P.useState)(!1),[de,fe]=(0,P.useState)(!0),pe=(0,P.useRef)(null),me=(0,P.useRef)(new Map);(0,P.useEffect)(()=>{let e=new AbortController,t=performance.now();return I(`app.load.start`,{path:window.location.pathname}),(async()=>{try{let e=await Oe();ne(e);let[r,a,s,c]=await Promise.all([ke(),Ae({from:e.window.from,to:e.window.to}),Me(e.window).catch(e=>(console.error(`Failed to load dashboard:`,e),null)),Pe()]);n(r),i(a.sessions),o(c.bookmarks),s&&ee(s),I(`app.load.done`,{duration_ms:Math.round(performance.now()-t),agents:r.length,sessions:a.sessions.length,dashboard:!!s})}catch(e){console.error(`Failed to load data:`,e),I(`app.load.error`,{duration_ms:Math.round(performance.now()-t),error:e instanceof Error?e.message:String(e)}),f(`Failed to load data. Is the CLI server running?`)}finally{l(!1)}})(),()=>e.abort()},[]);let k=te(),he=(0,P.useMemo)(()=>new Set(t.map(e=>e.name.toLowerCase())),[t]),ge=(0,P.useMemo)(()=>new Map(t.map(e=>[e.name.toLowerCase(),e.displayName])),[t]),A=C.length>0,j=(0,P.useMemo)(()=>Yi(k.pathname,he),[k.pathname,he]);(0,P.useEffect)(()=>{I(`route.change`,{path:k.pathname,mode:j.mode,agent:j.activeAgentKey,session:j.activeSessionSlug})},[k.pathname,j.mode,j.activeAgentKey,j.activeSessionSlug]);let _e=A?C:typeof k.state==`object`&&k.state!==null&&`searchQuery`in k.state&&typeof k.state.searchQuery==`string`?k.state.searchQuery:``,ve=(0,P.useMemo)(()=>{let e={};for(let n of t)e[n.name]=[];for(let t of r){let n=t.slug.split(`/`)[0]?.toLowerCase();n&&e[n]&&e[n].push(t)}for(let t of Object.keys(e))e[t].sort((e,t)=>(t.time_updated??t.time_created)-(e.time_updated??e.time_created));return e},[r,t]);(0,P.useEffect)(()=>{let e=!1;return o(t=>{let n=mi(t,r);return n===t?t:(Ie(n.map(({bookmarked_at:e,...t})=>t)).catch(t=>{e||console.error(`Failed to sync bookmark snapshots:`,t)}),n)}),()=>{e=!0}},[r]),(0,P.useEffect)(()=>{let e=!1;return(async()=>{let t=di();if(t.length!==0)try{let n=await Ie(t.map(({bookmarked_at:e,...t})=>t));if(e)return;o(n.bookmarks),fi()}catch(t){e||console.error(`Failed to migrate legacy bookmarks:`,t)}})(),()=>{e=!0}},[]);let ye=(0,P.useMemo)(()=>new Set(a.map(e=>Q(e.agentKey,e.sessionId))),[a]);function be(e,t){return ye.has(Q(e,t))}function xe(e){let t=Q(e.agentKey,e.sessionId),n=ye.has(t),r=a;o(n?r.filter(e=>Q(e.agentKey,e.sessionId)!==t):[...r,e].toSorted((e,t)=>{let n=e.time_updated??e.time_created;return(t.time_updated??t.time_created)-n})),I(n?`bookmark.delete`:`bookmark.add`,{agent:e.agentKey,session:e.sessionId}),(n?Le(e.agentKey,e.sessionId):Fe({agentKey:e.agentKey,sessionId:e.sessionId,fullPath:e.fullPath,title:e.title,directory:e.directory,time_created:e.time_created,time_updated:e.time_updated,stats:e.stats})).catch(e=>{console.error(`Failed to toggle bookmark:`,e),o(r)})}function Se(e,t){xe(ui(e,t))}let M=j.activeAgentKey,N=(0,P.useMemo)(()=>M?ve[M]??[]:[],[M,ve]),Ce=(0,P.useMemo)(()=>M?new Set(N.filter(e=>ye.has(Q(M,e.id))).map(e=>e.id)):new Set,[M,ye,N]),we=(0,P.useMemo)(()=>a.toSorted((e,t)=>(t.time_updated??t.time_created)-(e.time_updated??e.time_created)),[a]),Te=j.mode===`session`?`${j.activeAgentKey}/${j.activeSessionSlug}`:``,Ee=(0,P.useEffectEvent)(async e=>{try{let[t,r,a,o]=await Promise.all([ke(),Ae({from:S?.window.from,to:S?.window.to}),Me(S?.window).catch(e=>(console.error(`Failed to refresh dashboard:`,e),null)),C?Ne(C).catch(e=>(console.error(`Failed to refresh search results:`,e),{results:[]})):Promise.resolve(null)]);if(n(t),i(r.sessions),a&&ee(a),o&&oe(o.results),j.mode===`session`)try{m(await je(j.activeAgentKey,j.activeSessionSlug)),v(null)}catch{m(null),v(`Session not found`)}e.newSessions>0?b(`发现 ${e.newSessions} 个新会话,列表已自动刷新`):e.updatedSessions>0&&b(`会话内容已同步`)}catch(e){console.error(`Failed to sync live session update:`,e)}});(0,P.useEffect)(()=>{if(!C){oe([]),ce(!1);return}let e=!1;ce(!0);let t=performance.now();return I(`search.start`,{query_length:C.length}),Ne(C).then(n=>{e||(oe(n.results),I(`search.done`,{duration_ms:Math.round(performance.now()-t),results:n.results.length}))}).catch(n=>{e||(console.error(`Failed to load search results:`,n),I(`search.error`,{duration_ms:Math.round(performance.now()-t),error:n instanceof Error?n.message:String(n)}),oe([]))}).finally(()=>{e||ce(!1)}),()=>{e=!0}},[C]),(0,P.useEffect)(()=>{if(j.mode!==`session`){m(null),v(null);return}let e=new AbortController;g(!0),v(null);let t=performance.now();return I(`session.open.start`,{agent:j.activeAgentKey,session:j.activeSessionSlug}),(async()=>{try{let e=await je(j.activeAgentKey,j.activeSessionSlug);m(e),I(`session.open.done`,{agent:j.activeAgentKey,session:j.activeSessionSlug,duration_ms:Math.round(performance.now()-t),messages:e.messages.length})}catch(e){I(`session.open.error`,{agent:j.activeAgentKey,session:j.activeSessionSlug,duration_ms:Math.round(performance.now()-t),error:e instanceof Error?e.message:String(e)}),v(`Session not found`),m(null)}finally{g(!1)}})(),()=>e.abort()},[Te,j.activeAgentKey,j.activeSessionSlug,j.mode]),(0,P.useEffect)(()=>Re(e=>{Ee(e)}),[]),(0,P.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>{b(null)},3500);return()=>{window.clearTimeout(e)}},[y]),(0,P.useEffect)(()=>{try{fe(window.localStorage.getItem(ea)===`1`)}catch{fe(!0)}},[]),(0,P.useEffect)(()=>{if(A){D(e=>w.length===0?0:Math.min(e,w.length-1));return}if(j.mode===`session`){E(j.activeSessionSlug);return}if(j.mode===`agent`){E(null);return}E(null)},[A,w.length,j.mode,j.activeSessionSlug,N]),(0,P.useEffect)(()=>{if(!A)return;let e=w[le];if(!e)return;let t=`${e.agentName}/${e.session.id}`;me.current.get(t)?.scrollIntoView({block:`nearest`})},[A,w,le]);let De=(0,P.useMemo)(()=>r.map(e=>{let t=e.slug.split(`/`)[0]?.toLowerCase()||`unknown`;return{...e,agentKey:t,sessionSlug:e.id,fullPath:e.slug}}),[r]),L=(0,P.useMemo)(()=>t.filter(e=>e.count>0).map(e=>({key:e.name.toLowerCase(),name:e.displayName,icon:e.icon,count:e.count})),[t]),ze=(0,P.useMemo)(()=>t.find(e=>e.name.toLowerCase()===M)??null,[M,t]),z=`CodeSesh`,B=`Select an agent to browse sessions`;if(j.mode===`root`&&(z=A?`Search`:`Dashboard`,B=A?se?`Searching for "${C}"`:`${w.length} matches for "${C}"`:x?`${x.totals.sessions.toLocaleString(`en-US`)} total sessions across ${x.perAgent.length} agents`:`Aggregated view across all agents`),A&&j.mode!==`root`&&(z=`Search`,B=se?`Searching for "${C}"`:`${w.length} matches for "${C}"`),j.mode===`agent`&&M&&(z=ze?.displayName??M,B=`${N.length} sessions`),j.mode===`session`){if(_)z=`Session Not Found`,B=`Requested /${M}/${j.activeSessionSlug}`;else if(p){z=p.title||`Conversation`;let e=p.time_updated??p.time_created;B=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`span`,{children:[`ID: #`,p.id.slice(0,8)]}),(0,R.jsx)(`span`,{children:`·`}),(0,R.jsxs)(`span`,{children:[`Updated `,Qi(e)]}),(0,R.jsx)(Ve,{tags:p.smart_tags,limit:9,className:`inline-flex`})]})}}j.mode===`missingAgent`&&(z=`Agent Not Found`,B=`Requested /${j.attemptedKey}`),j.mode===`missingSession`&&(z=`Session Not Found`,B=`Session not found in /${M}`);let Be=(0,P.useMemo)(()=>{if(A)return[{label:`Search`}];let e={label:`Dashboard`,to:j.mode===`root`?void 0:`/`};if(j.mode===`root`)return[{label:`Dashboard`}];if(j.mode===`missingAgent`)return[e,{label:j.attemptedKey}];let t=ze?.displayName??M??`Unknown Agent`,n={label:t,to:j.mode===`session`?`/${M}`:void 0};return j.mode===`agent`?[e,{label:t}]:j.mode===`missingSession`?[e,n,{label:j.attemptedSessionSlug}]:j.mode===`session`?[e,n,{label:p?.title||j.activeSessionSlug||`Conversation`}]:[e,{label:`Invalid Route`}]},[ze,M,A,p?.title,j]),He;He=c?(0,R.jsx)(qr,{}):A?(0,R.jsx)(ia,{query:C,loading:se,results:w,agentNameMap:ge,onOpenResult:()=>ae(``),selectedIndex:le,registerResultRef:(e,t)=>{t?me.current.set(e,t):me.current.delete(e)}}):u?(0,R.jsx)(`div`,{className:`mx-auto max-w-4xl rounded-sm border border-[var(--console-error-border)] bg-[var(--console-error-bg)] p-6 text-sm text-[var(--console-error)]`,children:u}):j.mode===`root`?x?(0,R.jsx)(zi,{data:x,bookmarkedSessions:we,isBookmarked:be,onToggleBookmark:(e,t)=>{if(`agentName`in e){Se(e,t??e.agentName.toLowerCase());return}xe(e)}}):(0,R.jsx)(ai,{type:`global`,sessions:De,agentItems:L,isBookmarked:be,onToggleBookmark:e=>Se(e,e.agentKey)}):j.mode===`agent`&&M?(0,R.jsx)(ai,{type:`agent`,sessions:De.filter(e=>e.agentKey===M),agentItems:L,activeAgentKey:M,isBookmarked:be,onToggleBookmark:e=>Se(e,e.agentKey)}):j.mode===`session`?h?(0,R.jsx)(qr,{}):_||!p?(0,R.jsx)(ai,{type:`missing-session`,sessions:De.filter(e=>e.agentKey===j.activeAgentKey),agentItems:L,activeAgentKey:j.activeAgentKey,attemptedSessionSlug:j.activeSessionSlug,isBookmarked:be,onToggleBookmark:e=>Se(e,e.agentKey)}):(0,R.jsx)(jr,{session:p,highlightQuery:_e}):j.mode===`missingAgent`?(0,R.jsx)(ai,{type:`missing-agent`,sessions:De,agentItems:L,attemptedAgentKey:j.attemptedKey,isBookmarked:be,onToggleBookmark:e=>Se(e,e.agentKey)}):(0,R.jsx)(`div`,{className:`text-sm text-[var(--console-muted)]`,children:`Invalid route.`});function V(){ae(re.trim())}function H(){fe(!0);try{window.localStorage.setItem(ea,`1`)}catch{}}let Ue=(0,P.useEffectEvent)(t=>{if(t.defaultPrevented||t.metaKey||t.ctrlKey||t.altKey||t.isComposing)return;let n=t.target,r=na(n),i=t.key;if(O){i===`Escape`&&(t.preventDefault(),ue(!1));return}if(r){i===`Escape`&&(t.preventDefault(),n instanceof HTMLElement&&n.blur());return}if(i===`?`){t.preventDefault(),ue(!0),H();return}if(i===`/`){t.preventDefault(),H(),pe.current?.focus(),pe.current?.select();return}if(i===`Escape`){if(t.preventDefault(),C){ae(``),ie(``);return}j.mode===`session`&&j.activeAgentKey&&e(`/${j.activeAgentKey}`);return}if(A){if(w.length===0)return;if(i===`j`){t.preventDefault(),H(),D(e=>Math.min(e+1,w.length-1));return}if(i===`k`){t.preventDefault(),H(),D(e=>Math.max(e-1,0));return}if(i===`g`){t.preventDefault(),H(),D(0);return}if(i===`G`){t.preventDefault(),H(),D(w.length-1);return}if(i===`Enter`){let n=w[le];if(!n)return;t.preventDefault(),H(),ae(``),e(`/${n.agentName.toLowerCase()}/${n.session.id}`,{state:{searchQuery:C}})}return}if(!M||N.length===0)return;let a=e=>{H();let t=N.findIndex(e=>e.id===T),n=t>=0?t:e>=0?-1:N.length;E(N[Math.max(0,Math.min(n+e,N.length-1))]?.id??null)};if(i===`j`){t.preventDefault(),a(1);return}if(i===`k`){t.preventDefault(),a(-1);return}if(i===`g`){t.preventDefault(),H(),E(N[0]?.id??null);return}if(i===`G`){t.preventDefault(),H(),E(N.at(-1)?.id??null);return}if(i===`Enter`){let n=N.find(e=>e.id===T);if(!n)return;t.preventDefault(),H(),e(`/${M}/${n.id}`)}});return(0,P.useEffect)(()=>(window.addEventListener(`keydown`,Ue),()=>window.removeEventListener(`keydown`,Ue)),[]),(0,R.jsxs)(`div`,{className:`console-ui h-screen overflow-hidden bg-[var(--console-bg)] text-[var(--console-text)]`,children:[(0,R.jsx)(`header`,{className:`h-14 shrink-0 border-b border-[var(--console-border)] bg-white/85 backdrop-blur-sm`,children:(0,R.jsxs)(`div`,{className:`grid h-full grid-cols-[auto_1fr_auto] items-center gap-4 px-4`,children:[(0,R.jsxs)(s,{to:`/`,className:`flex items-center gap-2 text-[var(--console-text)]`,children:[(0,R.jsx)(`img`,{src:`/logo.svg?v=3`,alt:`CodeSesh`,className:`h-6 w-6 rounded-sm`}),(0,R.jsx)(`span`,{className:`console-mono text-sm font-semibold uppercase tracking-[0.05em]`,children:`CodeSesh`})]}),(0,R.jsxs)(`form`,{className:`mx-auto flex w-full max-w-[560px] items-center justify-center gap-2`,onSubmit:e=>{e.preventDefault(),V()},children:[(0,R.jsx)(`label`,{className:`flex min-w-0 flex-1 items-center rounded-sm border border-[var(--console-border)] bg-white px-2 py-1`,children:(0,R.jsx)(`input`,{ref:pe,value:re,onChange:e=>ie(e.target.value),placeholder:`Search sessions /`,className:`console-mono w-full min-w-0 bg-transparent text-xs text-[var(--console-text)] outline-none placeholder:text-[var(--console-muted)]`})}),(0,R.jsx)(`button`,{type:`submit`,className:`console-mono rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface-muted)] px-3 py-1 text-xs text-[var(--console-text)] transition-colors hover:bg-white`,children:`Search`})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>{ue(!0),H()},className:`console-mono rounded-sm border border-[var(--console-border)] bg-white px-2 py-1 text-xs text-[var(--console-text)] transition-colors hover:bg-[var(--console-surface-muted)]`,title:`Show keyboard shortcuts`,children:`? Shortcuts`}),Zi(S)?(0,R.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-white px-2 py-1 text-xs text-[var(--console-text)]`,title:`Time window applied to agent counts, dashboard, and session list`,children:Zi(S)}):null,(0,R.jsxs)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-xs text-[var(--console-muted)]`,children:[`v`,`0.5.0`]})]})]})}),(0,R.jsxs)(`div`,{className:`flex h-[calc(100vh-56px)] min-h-0`,children:[(0,R.jsx)(`aside`,{className:`hidden w-64 shrink-0 flex-col border-r border-[var(--console-border)] bg-[var(--console-sidebar-bg)] lg:flex`,children:(0,R.jsxs)(`div`,{className:`console-scrollbar flex-1 space-y-8 overflow-y-auto px-4 py-6`,children:[(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`console-mono mb-3 text-xs font-bold uppercase text-[var(--console-text)]`,children:`NAVIGATION`}),(0,R.jsxs)(`ul`,{className:`space-y-1`,children:[(0,R.jsx)(`li`,{children:(0,R.jsxs)(s,{to:`/`,className:`flex items-center gap-2 rounded-sm border px-3 py-1.5 text-left transition-colors ${j.mode===`root`?`border-[var(--console-border-strong)] bg-white text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`}`,children:[(0,R.jsx)(`img`,{src:`/logo.svg?v=3`,alt:`Dashboard`,className:`size-3.5 rounded-[2px]`}),(0,R.jsx)(`span`,{className:`console-mono line-clamp-1 flex-1 text-xs`,children:`Dashboard`})]})}),t.map(e=>{let t=e.name.toLowerCase(),n=t===M,r=F.agents[t];return(0,R.jsx)(`li`,{children:(0,R.jsxs)(s,{to:`/${t}`,className:`ml-4 flex items-center gap-2 rounded-sm border px-3 py-1.5 text-left transition-colors ${n?`border-[var(--console-border-strong)] bg-white text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`}`,children:[r?.icon&&(0,R.jsx)(`img`,{src:r.icon,alt:e.displayName,className:`size-3.5 object-contain`}),(0,R.jsx)(`span`,{className:`console-mono line-clamp-1 flex-1 text-xs`,children:e.displayName}),(0,R.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.count})]})},e.name)}),t.length===0&&!c&&(0,R.jsx)(`li`,{children:(0,R.jsx)(`span`,{className:`console-mono block rounded-sm px-3 py-1.5 text-xs text-[var(--console-muted)]`,children:`No agents found`})})]})]}),(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`console-mono mb-3 text-xs font-bold uppercase text-[var(--console-text)]`,children:`BOOKMARKS`}),we.length===0?(0,R.jsx)(`span`,{className:`console-mono block rounded-sm px-3 py-1.5 text-xs text-[var(--console-muted)]`,children:`No bookmarks yet`}):(0,R.jsx)(`ul`,{className:`space-y-1`,children:we.map(e=>{let t=j.mode===`session`&&j.activeAgentKey===e.agentKey&&j.activeSessionSlug===e.sessionId,n=F.agents[e.agentKey];return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm border px-2 py-1.5 transition-colors ${t?`border-[var(--console-border-strong)] bg-white text-[var(--console-text)]`:`border-transparent text-[var(--console-muted)] hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`}`,children:[(0,R.jsxs)(s,{to:`/${e.fullPath}`,className:`flex min-w-0 flex-1 items-start gap-2`,children:[n?.icon?(0,R.jsx)(`img`,{src:n.icon,alt:n.name,className:`mt-0.5 size-3.5 shrink-0 object-contain`}):null,(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`console-mono line-clamp-1 block text-xs`,children:e.title}),(0,R.jsx)(`span`,{className:`console-mono mt-0.5 line-clamp-1 block text-[10px] text-[var(--console-muted)]`,children:n?.name??e.agentKey})]})]}),(0,R.jsx)(Jr,{active:!0,onToggle:()=>xe(e)})]})},Q(e.agentKey,e.sessionId))})})]}),(0,R.jsxs)(`section`,{children:[(0,R.jsxs)(`h3`,{className:`console-mono mb-3 text-xs font-bold uppercase text-[var(--console-text)]`,children:[`SESSIONS`,M?(0,R.jsx)(`span`,{className:`ml-2 text-[10px] font-normal text-[var(--console-muted)]`,children:`Navigate j k · Open Enter`}):null]}),M?N.length===0?(0,R.jsx)(`span`,{className:`console-mono block rounded-sm px-3 py-1.5 text-xs text-[var(--console-muted)]`,children:`No sessions yet`}):(0,R.jsx)(Ji,{sessions:N,activeSessionId:j.mode===`session`?j.activeSessionSlug:null,selectedSessionId:T,onSelectSession:t=>{E(t),e(`/${M}/${t}`)},bookmarkedSessionIds:Ce,onToggleBookmark:e=>Se(e,M)}):(0,R.jsx)(`span`,{className:`console-mono block rounded-sm px-3 py-1.5 text-xs text-[var(--console-muted)]`,children:`Select an agent`})]})]})}),(0,R.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,R.jsx)(`section`,{className:`shrink-0 border-b border-[var(--console-border)] bg-white/70 px-4 py-4 backdrop-blur-sm md:px-8`,children:(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`console-mono mb-2 flex flex-wrap items-center gap-1 text-[11px] text-[var(--console-muted)]`,children:Be.map((e,t)=>(0,R.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e.to?(0,R.jsx)(s,{to:e.to,className:`transition-colors hover:text-[var(--console-text)]`,children:e.label}):(0,R.jsx)(`span`,{className:`text-[var(--console-text)]`,children:e.label}),t<Be.length-1?(0,R.jsx)(`span`,{children:`/`}):null]},`${e.label}-${t}`))}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] font-bold uppercase text-[var(--console-muted)]`,children:j.mode===`session`?`Session`:j.mode===`root`?`Dashboard`:`Landing`}),(0,R.jsx)(`h1`,{className:`console-mono text-xl font-semibold tracking-tight text-[var(--console-text)]`,children:z})]}),(0,R.jsx)(`div`,{className:`console-mono mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-[var(--console-muted)]`,children:B}),(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[de?null:(0,R.jsxs)(`div`,{className:`console-mono inline-flex items-center gap-2 rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-text)]`,children:[(0,R.jsx)(`span`,{children:`Keyboard navigation available`}),(0,R.jsx)(`span`,{className:`rounded-sm border border-[var(--console-border)] bg-white px-1`,children:`?`}),(0,R.jsx)(`button`,{type:`button`,onClick:H,className:`text-[var(--console-muted)] transition-colors hover:text-[var(--console-text)]`,"aria-label":`Dismiss keyboard shortcuts hint`,children:`×`})]}),!A&&j.mode===`session`?(0,R.jsx)(`span`,{className:`console-mono inline-flex rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-muted)]`,children:`Esc back`}):null]}),y?(0,R.jsx)(`p`,{className:`console-mono mt-2 inline-flex rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-[11px] text-[var(--console-text)]`,children:y}):null]})}),(0,R.jsx)(`section`,{className:`console-scrollbar bg-grid min-h-0 flex-1 overflow-y-auto px-4 py-6 md:px-8`,children:(0,R.jsx)(Bi,{children:He})})]})]}),O?(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/35 px-4`,onClick:()=>ue(!1),children:(0,R.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Keyboard shortcuts`,className:`w-full max-w-2xl rounded-sm border border-[var(--console-border-strong)] bg-white p-5 shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`console-mono text-[11px] uppercase tracking-[0.16em] text-[var(--console-muted)]`,children:`Keyboard Shortcuts`}),(0,R.jsx)(`h2`,{className:`console-mono mt-2 text-xl font-semibold text-[var(--console-text)]`,children:`Navigate without leaving the keyboard`})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>ue(!1),className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-xs text-[var(--console-text)] transition-colors hover:bg-white`,children:`Esc`})]}),(0,R.jsx)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:ta.map(e=>(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] p-4`,children:[(0,R.jsx)(`h3`,{className:`console-mono text-xs font-bold uppercase text-[var(--console-text)]`,children:e.title}),(0,R.jsx)(`div`,{className:`mt-3 space-y-3`,children:e.items.map(e=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`p`,{className:`console-mono text-xs text-[var(--console-text)]`,children:e.keys}),(0,R.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-[var(--console-muted)]`,children:e.description})]},e.keys))})]},e.title))})]})}):null]})}function ia({query:e,loading:t,results:n,agentNameMap:r,onOpenResult:i,selectedIndex:a,registerResultRef:o}){return t?(0,R.jsx)(`div`,{className:`grid gap-3`,children:Array.from({length:4}).map((e,t)=>(0,R.jsxs)(`div`,{className:`animate-pulse rounded-sm border border-[var(--console-border)] bg-white/80 p-4`,children:[(0,R.jsx)(`div`,{className:`h-3 w-32 rounded bg-[var(--console-surface-muted)]`}),(0,R.jsx)(`div`,{className:`mt-3 h-4 w-2/3 rounded bg-[var(--console-surface-muted)]`}),(0,R.jsx)(`div`,{className:`mt-2 h-3 w-full rounded bg-[var(--console-surface-muted)]`}),(0,R.jsx)(`div`,{className:`mt-1 h-3 w-5/6 rounded bg-[var(--console-surface-muted)]`})]},t))}):n.length===0?(0,R.jsxs)(`div`,{className:`rounded-sm border border-[var(--console-border)] bg-white/80 p-6`,children:[(0,R.jsx)(`h2`,{className:`console-mono text-sm font-semibold text-[var(--console-text)]`,children:`No matches`}),(0,R.jsxs)(`p`,{className:`console-mono mt-2 text-xs text-[var(--console-muted)]`,children:[`Query: `,e]})]}):(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsx)(`div`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:`Navigate j k · Open Enter · Exit Esc`}),n.map((t,n)=>{let c=t.agentName.toLowerCase(),l=r.get(c)??t.agentName,u=`${t.agentName}/${t.session.id}`;return(0,R.jsxs)(s,{ref:e=>o(u,e),to:`/${c}/${t.session.id}`,state:{searchQuery:e},onClick:i,className:`rounded-sm border bg-white/85 p-4 transition-colors hover:border-[var(--console-border-strong)] hover:bg-white ${n===a?`border-[var(--console-border-strong)]`:`border-[var(--console-border)]`}`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-1.5 py-0.5 text-[10px] uppercase text-[var(--console-muted)]`,children:l}),(0,R.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:t.session.directory})]}),(0,R.jsx)(`h2`,{className:`console-mono mt-3 text-sm font-semibold text-[var(--console-text)]`,children:t.session.title}),(0,R.jsx)(`p`,{className:`console-mono mt-2 text-xs leading-6 text-[var(--console-muted)] [&_mark]:bg-[var(--console-accent)] [&_mark]:px-0.5 [&_mark]:text-white`,dangerouslySetInnerHTML:{__html:$i(t.snippet||t.session.title)}})]},u)})]})}De.createRoot(document.getElementById(`root`)).render((0,R.jsx)(P.StrictMode,{children:(0,R.jsx)(S,{children:(0,R.jsx)(ra,{})})}));
@@ -1,2 +0,0 @@
1
- /*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:"Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", -apple-system, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-2xl:42rem;--container-4xl:56rem;--container-5xl:64rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:calc(var(--radius) - 4px);--radius-lg:var(--radius);--radius-xl:.75rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-border:hsl(var(--border));--color-background:hsl(var(--background));--color-foreground:hsl(var(--foreground));--color-muted:hsl(var(--muted));--color-muted-foreground:hsl(var(--muted-foreground));--color-card:hsl(var(--card));--color-card-foreground:hsl(var(--card-foreground))}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:root{--background:0 0% 100%;--foreground:0 0% 3.9%;--card:0 0% 100%;--card-foreground:0 0% 3.9%;--popover:0 0% 100%;--popover-foreground:0 0% 3.9%;--primary:0 0% 9%;--primary-foreground:0 0% 98%;--secondary:0 0% 96.1%;--secondary-foreground:0 0% 9%;--muted:0 0% 96.1%;--muted-foreground:0 0% 45.1%;--accent:0 0% 96.1%;--accent-foreground:0 0% 9%;--destructive:0 84.2% 60.2%;--destructive-foreground:0 0% 98%;--border:0 0% 89.8%;--input:0 0% 89.8%;--ring:0 0% 3.9%;--radius:.5rem;--console-bg:#f7f7f7;--console-sidebar-bg:#fbfbfb;--console-surface-muted:#f5f5f5;--console-border:#e5e5e5;--console-border-strong:#d4d4d4;--console-text:#1a1a1a;--console-muted:#666;--console-accent:#2d2d2d;--console-accent-strong:#1f1f1f;--console-thread:#e8e8e8;--console-thinking-bg:#f9f9f9;--console-thinking-border:#ebebeb;--console-success:#15803d;--console-success-bg:#dcfce7;--console-success-border:#bbf7d0;--console-warning:#b45309;--console-warning-bg:#fef3c7;--console-warning-border:#fde68a;--console-error:#b91c1c;--console-error-bg:#fee2e2;--console-error-border:#fecaca}.dark{--background:0 0% 3.9%;--foreground:0 0% 98%;--card:0 0% 3.9%;--card-foreground:0 0% 98%;--popover:0 0% 3.9%;--popover-foreground:0 0% 98%;--primary:0 0% 98%;--primary-foreground:0 0% 9%;--secondary:0 0% 14.9%;--secondary-foreground:0 0% 98%;--muted:0 0% 14.9%;--muted-foreground:0 0% 63.9%;--accent:0 0% 14.9%;--accent-foreground:0 0% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:0 0% 98%;--border:0 0% 14.9%;--input:0 0% 14.9%;--ring:0 0% 83.1%}*{border-color:var(--color-border)}body{background-color:var(--color-background);color:var(--color-foreground)}}@layer components;@layer utilities{.\@container\/card-header{container:card-header/inline-size}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.fixed{position:fixed}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-4{top:calc(var(--spacing) * 4)}.left-0{left:calc(var(--spacing) * 0)}.z-40{z-index:40}.z-50{z-index:50}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2/span 2}.row-start-1{grid-row-start:1}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.-mt-1{margin-top:calc(var(--spacing) * -1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-4{margin-left:calc(var(--spacing) * 4)}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-\[160px\]{width:160px;height:160px}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-6{height:calc(var(--spacing) * 6)}.h-14{height:calc(var(--spacing) * 14)}.h-32{height:calc(var(--spacing) * 32)}.h-\[560px\]{height:560px}.h-\[calc\(100vh-56px\)\]{height:calc(100vh - 56px)}.h-\[min\(560px\,calc\(100vh-410px\)\)\]{height:min(560px,100vh - 410px)}.h-full{height:100%}.h-screen{height:100vh}.max-h-\[200px\]{max-height:200px}.max-h-\[280px\]{max-height:280px}.max-h-\[420px\]{max-height:420px}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-24{min-height:calc(var(--spacing) * 24)}.min-h-56{min-height:calc(var(--spacing) * 56)}.min-h-full{min-height:100%}.w-0{width:calc(var(--spacing) * 0)}.w-1{width:calc(var(--spacing) * 1)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-2\/3{width:66.6667%}.w-4{width:calc(var(--spacing) * 4)}.w-5\/6{width:83.3333%}.w-5\/12{width:41.6667%}.w-6{width:calc(var(--spacing) * 6)}.w-7\/12{width:58.3333%}.w-8\/12{width:66.6667%}.w-9\/12{width:75%}.w-10\/12{width:83.3333%}.w-11\/12{width:91.6667%}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-64{width:calc(var(--spacing) * 64)}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-\[42rem\]{max-width:42rem}.max-w-\[560px\]{max-width:560px}.max-w-\[1440px\]{max-width:1440px}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[8rem\]{min-width:8rem}.flex-1{flex:1}.shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.scroll-mt-6{scroll-margin-top:calc(var(--spacing) * 6)}.auto-rows-min{grid-auto-rows:min-content}.grid-cols-\[auto_1fr_auto\]{grid-template-columns:auto 1fr auto}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-\[2px\]{gap:2px}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.self-start{align-self:flex-start}.justify-self-end{justify-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[2px\]{border-radius:2px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-\[1px\]{border-top-left-radius:1px;border-top-right-radius:1px}.border{border-style:var(--tw-border-style);border-width:1px}.border-\[1\.5px\]{border-style:var(--tw-border-style);border-width:1.5px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\(--color-border\){border-color:var(--color-border)}.border-\[var\(--console-border\)\]{border-color:var(--console-border)}.border-\[var\(--console-border-strong\)\]{border-color:var(--console-border-strong)}.border-\[var\(--console-error-border\)\]{border-color:var(--console-error-border)}.border-\[var\(--console-success-border\)\]{border-color:var(--console-success-border)}.border-\[var\(--console-thinking-border\)\]{border-color:var(--console-thinking-border)}.border-\[var\(--console-thread\)\]{border-color:var(--console-thread)}.border-\[var\(--console-warning-border\)\]{border-color:var(--console-warning-border)}.border-border\/50{border-color:color-mix(in srgb, hsl(var(--border)) 50%, transparent)}@supports (color:color-mix(in lab, red, red)){.border-border\/50{border-color:color-mix(in oklab, var(--color-border) 50%, transparent)}}.border-transparent{border-color:#0000}.bg-\(--color-bg\){background-color:var(--color-bg)}.bg-\[\#eff6ff\]{background-color:#eff6ff}.bg-\[\#f0fdf4\]{background-color:#f0fdf4}.bg-\[\#f3f4f6\]{background-color:#f3f4f6}.bg-\[\#f5f3ff\]{background-color:#f5f3ff}.bg-\[\#fafafa\]{background-color:#fafafa}.bg-\[\#fef2f2\]{background-color:#fef2f2}.bg-\[var\(--console-accent\)\]{background-color:var(--console-accent)}.bg-\[var\(--console-bg\)\]{background-color:var(--console-bg)}.bg-\[var\(--console-border\)\]{background-color:var(--console-border)}.bg-\[var\(--console-border-strong\)\]{background-color:var(--console-border-strong)}.bg-\[var\(--console-error-bg\)\]{background-color:var(--console-error-bg)}.bg-\[var\(--console-sidebar-bg\)\]{background-color:var(--console-sidebar-bg)}.bg-\[var\(--console-success-bg\)\]{background-color:var(--console-success-bg)}.bg-\[var\(--console-surface-muted\)\]{background-color:var(--console-surface-muted)}.bg-\[var\(--console-thinking-bg\)\]{background-color:var(--console-thinking-bg)}.bg-\[var\(--console-warning-bg\)\]{background-color:var(--console-warning-bg)}.bg-background{background-color:var(--color-background)}.bg-black\/35{background-color:#00000059}@supports (color:color-mix(in lab, red, red)){.bg-black\/35{background-color:color-mix(in oklab, var(--color-black) 35%, transparent)}}.bg-card{background-color:var(--color-card)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/60{background-color:#fff9}@supports (color:color-mix(in lab, red, red)){.bg-white\/60{background-color:color-mix(in oklab, var(--color-white) 60%, transparent)}}.bg-white\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.bg-white\/70{background-color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.bg-white\/80{background-color:#fffc}@supports (color:color-mix(in lab, red, red)){.bg-white\/80{background-color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.bg-white\/85{background-color:#ffffffd9}@supports (color:color-mix(in lab, red, red)){.bg-white\/85{background-color:color-mix(in oklab, var(--color-white) 85%, transparent)}}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing) * 6);line-height:calc(var(--spacing) * 6)}.leading-7{--tw-leading:calc(var(--spacing) * 7);line-height:calc(var(--spacing) * 7)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.05em\]{--tw-tracking:.05em;letter-spacing:.05em}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.16em\]{--tw-tracking:.16em;letter-spacing:.16em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#1d4ed8\]{color:#1d4ed8}.text-\[\#7c3aed\]{color:#7c3aed}.text-\[\#15803d\]{color:#15803d}.text-\[\#b91c1c\]{color:#b91c1c}.text-\[var\(--console-accent\)\]{color:var(--console-accent)}.text-\[var\(--console-error\)\]{color:var(--console-error)}.text-\[var\(--console-muted\)\]{color:var(--console-muted)}.text-\[var\(--console-success\)\]{color:var(--console-success)}.text-\[var\(--console-text\)\]{color:var(--console-text)}.text-\[var\(--console-warning\)\]{color:var(--console-warning)}.text-card-foreground{color:var(--color-card-foreground)}.text-foreground{color:var(--color-foreground)}.text-muted-foreground{color:var(--color-muted-foreground)}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.accent-\[var\(--console-accent-strong\)\]{accent-color:var(--console-accent-strong)}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-100{opacity:1}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_1px_2px_rgba\(15\,23\,42\,0\.04\)\]{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0f172a0a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[2px_2px_0_0_rgba\(15\,23\,42\,0\.05\)\]{--tw-shadow:2px 2px 0 0 var(--tw-shadow-color,#0f172a0d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.fade-in{--tw-enter-opacity:0}.running{animation-play-state:running}.slide-in-from-bottom-2{--tw-enter-translate-y:.5rem}.placeholder\:text-\[var\(--console-muted\)\]::placeholder{color:var(--console-muted)}@media (hover:hover){.hover\:border-\[var\(--console-border\)\]:hover{border-color:var(--console-border)}.hover\:border-\[var\(--console-border-strong\)\]:hover{border-color:var(--console-border-strong)}.hover\:bg-\[var\(--console-surface-muted\)\]:hover{background-color:var(--console-surface-muted)}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:text-\[var\(--console-text\)\]:hover{color:var(--console-text)}.hover\:opacity-100:hover{opacity:1}}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-\[var\(--console-accent\)\]:focus-visible{outline-color:var(--console-accent)}.active\:cursor-grabbing:active{cursor:grabbing}.has-data-\[slot\=card-action\]\:grid-cols-\[1fr_auto\]:has([data-slot=card-action]){grid-template-columns:1fr auto}@media (width>=40rem){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width>=48rem){.md\:w-24{width:calc(var(--spacing) * 24)}.md\:w-\[560px\]{width:560px}.md\:max-w-xs{max-width:var(--container-xs)}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:items-start{align-items:flex-start}.md\:justify-between{justify-content:space-between}.md\:gap-3{gap:calc(var(--spacing) * 3)}.md\:p-6{padding:calc(var(--spacing) * 6)}.md\:px-4{padding-inline:calc(var(--spacing) * 4)}.md\:px-8{padding-inline:calc(var(--spacing) * 8)}.md\:pr-5{padding-right:calc(var(--spacing) * 5)}.md\:text-\[2rem\]{font-size:2rem}}@media (width>=64rem){.lg\:sticky{position:sticky}.lg\:top-4{top:calc(var(--spacing) * 4)}.lg\:flex{display:flex}.lg\:max-h-\[calc\(100dvh-14rem\)\]{max-height:calc(100dvh - 14rem)}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-\[240px_minmax\(0\,1fr\)\]{grid-template-columns:240px minmax(0,1fr)}.lg\:items-start{align-items:flex-start}.lg\:overflow-y-auto{overflow-y:auto}.lg\:overscroll-contain{overscroll-behavior:contain}}@media (width>=80rem){.xl\:block{display:block}.xl\:grid-cols-\[220px_minmax\(0\,1fr\)_320px\]{grid-template-columns:220px minmax(0,1fr) 320px}}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:var(--color-muted-foreground)}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke=\#ccc]{stroke:color-mix(in srgb, hsl(var(--border)) 50%, transparent)}@supports (color:color-mix(in lab, red, red)){.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke=\#ccc]{stroke:color-mix(in oklab, var(--color-border) 50%, transparent)}}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:var(--color-border)}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke=\#fff]{stroke:#0000}.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-layer\]\:outline-hidden .recharts-layer{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke=\#ccc]{stroke:var(--color-border)}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:var(--color-muted)}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke=\#ccc]{stroke:var(--color-border)}.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-sector\]\:outline-hidden .recharts-sector{outline-offset:2px;outline:2px solid #0000}}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke=\#fff]{stroke:#0000}.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.\[\&_\.recharts-surface\]\:outline-hidden .recharts-surface{outline-offset:2px;outline:2px solid #0000}}.\[\&_mark\]\:bg-\[var\(--console-accent\)\] mark{background-color:var(--console-accent)}.\[\&_mark\]\:px-0\.5 mark{padding-inline:calc(var(--spacing) * .5)}.\[\&_mark\]\:text-white mark{color:var(--color-white)}.\[\.border-b\]\:pb-6.border-b{padding-bottom:calc(var(--spacing) * 6)}.\[\.border-t\]\:pt-6.border-t{padding-top:calc(var(--spacing) * 6)}.\[\&\>svg\]\:h-2\.5>svg{height:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:h-3>svg{height:calc(var(--spacing) * 3)}.\[\&\>svg\]\:w-2\.5>svg{width:calc(var(--spacing) * 2.5)}.\[\&\>svg\]\:w-3>svg{width:calc(var(--spacing) * 3)}.\[\&\>svg\]\:text-muted-foreground>svg{color:var(--color-muted-foreground)}.console-ui{font-family:IBM Plex Sans,Avenir Next,PingFang SC,-apple-system,sans-serif}.console-mono{font-family:JetBrains Mono,IBM Plex Mono,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.bg-grid{background-image:linear-gradient(90deg,#0000000a 1px,#0000 1px),linear-gradient(#0000000a 1px,#0000 1px);background-size:40px 40px}}.console-scrollbar::-webkit-scrollbar{width:6px;height:6px}.console-scrollbar::-webkit-scrollbar-track{background:0 0}.console-scrollbar::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:2px}.console-scrollbar::-webkit-scrollbar-thumb:hover{background:#9ca3af}.console-scrollbar{scrollbar-width:thin;scrollbar-color:#d1d5db transparent}.console-markdown>*+*{margin-top:.75rem}.console-markdown p{margin:0}.console-markdown h1,.console-markdown h2,.console-markdown h3,.console-markdown h4,.console-markdown h5,.console-markdown h6{color:var(--console-text);margin:0;font-weight:700;line-height:1.3}.console-markdown h1{letter-spacing:-.02em;font-size:1.5rem}.console-markdown h2{letter-spacing:-.015em;font-size:1.25rem}.console-markdown h3{font-size:1.1rem}.console-markdown h4,.console-markdown h5,.console-markdown h6{font-size:1rem}.console-markdown ul,.console-markdown ol{margin:.5rem 0;padding-left:1.25rem}.console-markdown ul{list-style:outside}.console-markdown ol{list-style:decimal}.console-markdown li+li{margin-top:.25rem}.console-markdown li>p{margin:0}.console-markdown strong{font-weight:700}.console-markdown blockquote{border-left:3px solid var(--console-border-strong);color:var(--console-muted);margin:0;padding-left:.875rem}.console-markdown hr{border:0;border-top:1px solid var(--console-border);margin:1rem 0}.console-markdown a{color:#4f46e5;text-decoration:underline}.console-markdown-link{color:inherit;cursor:text;text-decoration:none}.console-markdown code{background:#f5f5f5;border:1px solid #e5e7eb;border-radius:.125rem;padding:.08rem .32rem;font-family:JetBrains Mono,IBM Plex Mono,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.8rem}.console-markdown pre{background:#fafafa;border:1px solid #e5e7eb;border-radius:.125rem;margin:0;padding:.75rem;overflow-x:auto}.console-markdown pre code{background:0 0;border:none;padding:0}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0), var(--tw-enter-translate-y,0), 0) scale3d(var(--tw-enter-scale,1), var(--tw-enter-scale,1), var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0), var(--tw-exit-translate-y,0), 0) scale3d(var(--tw-exit-scale,1), var(--tw-exit-scale,1), var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}