remote-codex 0.11.3 → 0.11.5

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.
Files changed (36) hide show
  1. package/README.md +4 -0
  2. package/apps/relay-server/dist/index.js +51 -2
  3. package/apps/supervisor-api/dist/chunk-ZWZQVPDT.js +27893 -0
  4. package/apps/supervisor-api/dist/index.js +4 -25727
  5. package/apps/supervisor-api/dist/worker-index.d.ts +2 -0
  6. package/apps/supervisor-api/dist/worker-index.js +197 -0
  7. package/apps/supervisor-web/dist/assets/index-CbdWtyx0.js +5 -0
  8. package/apps/supervisor-web/dist/assets/index-Di1JBevU.css +1 -0
  9. package/apps/supervisor-web/dist/assets/thread-ui-ICfwCbte.js +3604 -0
  10. package/apps/supervisor-web/dist/assets/ui-vendor-D1uxdi-d.js +430 -0
  11. package/apps/supervisor-web/dist/index.html +6 -7
  12. package/bin/remote-codex.mjs +534 -19
  13. package/package.json +41 -2
  14. package/packages/agent-runtime/src/types.ts +2 -1
  15. package/packages/codex/src/appServerManager.ts +1 -0
  16. package/packages/codex/src/historyItems.test.ts +45 -0
  17. package/packages/codex/src/historyItems.ts +22 -0
  18. package/packages/codex/src/runtimeAdapter.ts +6 -0
  19. package/packages/codex/src/types.ts +2 -1
  20. package/packages/db/migrations/0018_control_plane.sql +129 -0
  21. package/packages/db/migrations/0019_control_plane_projects.sql +19 -0
  22. package/packages/db/migrations/0020_control_workspace_status.sql +1 -0
  23. package/packages/db/migrations/0021_control_sandbox_lifecycle_fields.sql +3 -0
  24. package/packages/db/migrations/0022_control_sandbox_resource_profile.sql +1 -0
  25. package/packages/db/migrations/0023_control_usage_import_state.sql +18 -0
  26. package/packages/db/migrations/0024_control_auth.sql +23 -0
  27. package/packages/db/migrations/0025_control_harness_credentials.sql +29 -0
  28. package/packages/db/migrations/0026_control_harness_usage_events.sql +27 -0
  29. package/packages/db/src/schema.ts +305 -1
  30. package/packages/shared/src/index.ts +32 -0
  31. package/packages/shared/src/tokens.ts +137 -0
  32. package/apps/supervisor-web/dist/assets/index-CBIze1VS.css +0 -1
  33. package/apps/supervisor-web/dist/assets/index-YpGAPjED.js +0 -4
  34. package/apps/supervisor-web/dist/assets/thread-ui-BEieA99i.css +0 -1
  35. package/apps/supervisor-web/dist/assets/thread-ui-CF80LEEN.js +0 -3613
  36. package/apps/supervisor-web/dist/assets/ui-vendor-CW6egZBG.js +0 -430
@@ -0,0 +1,3604 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/core-DIQen2lE.js","assets/markdown-vendor-hBDTCSB-.js","assets/react-vendor-o1Xrx7m4.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/terminal-vendor-CLGgN91S.js","assets/terminal-vendor-Beg8tuEN.css"])))=>i.map(i=>d[i]);
2
+ import{C as Mr,B as Ui,a as Wi,A as Vi,I as qi,T as As,W as Un,b as Ki,S as Xi,c as Yi,F as Zi,d as Ji,e as Qi,P as ka,f as ed,R as td,g as rd,H as nd,h as ad,i as Ms,j as sd,E as od,L as _r,k as or,l as $r,m as _s,n as ld,o as id,p as dd,q as cd,X as $s,M as hd,r as Wn,s as Ds,t as ud,u as lr,v as md,w as pd,x as fd,y as gd,z as xd,D as bd,G as Sr,J as vd,K as kd,N as wd,O as yd,Q as jd,U as Nd,V as Cd,Y as Nn,Z as Sd,_ as Td,$ as Cn,a0 as Ed,a1 as Ld,a2 as Pd,a3 as Tr,a4 as zd,a5 as Bs,a6 as Id,a7 as Gs,a8 as Fs,a9 as Rd,aa as Hs,ab as Ad,ac as Sn,ad as Md,ae as _d,af as $d,ag as Dd,ah as Bd,ai as Os,aj as Gd,ak as Fd,al as Hd,am as Od,an as Ud,ao as Wd,ap as Vd,aq as qd,ar as Kd,as as Xd,at as Yd,au as Zd,av as Jd,aw as Qd,ax as ec,ay as tc,az as rc,aA as nc,aB as ac,aC as sc,aD as oc,aE as lc,aF as ic,aG as dc,aH as cc}from"./ui-vendor-D1uxdi-d.js";import{r as c,R as hc,j as t,a as Dr}from"./react-vendor-o1Xrx7m4.js";import{u as uc,a as mc,H as wa,P as Tt,b as pc,M as Us,R as fc,i as gc,C as xc,B as bc,c as ya,g as Ws}from"./graph-vendor-CGzY-MFv.js";import"./terminal-vendor-CLGgN91S.js";import{M as vc,r as kc,a as wc,b as yc}from"./markdown-vendor-hBDTCSB-.js";const jc="modulepreload",Nc=function(e){return"/"+e},ja={},Be=function(r,n,a){let o=Promise.resolve();if(n&&n.length>0){let l=function(h){return Promise.all(h.map(u=>Promise.resolve(u).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),i=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));o=l(n.map(h=>{if(h=Nc(h),h in ja)return;ja[h]=!0;const u=h.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const m=document.createElement("link");if(m.rel=u?"stylesheet":jc,u||(m.as="script"),m.crossOrigin="",m.href=h,i&&m.setAttribute("nonce",i),document.head.appendChild(m),u)return new Promise((f,g)=>{m.addEventListener("load",f),m.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${h}`)))})}))}function s(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return o.then(l=>{for(const d of l||[])d.status==="rejected"&&s(d.reason);return r().catch(s)})};function Vs(e){var r,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(r=0;r<o;r++)e[r]&&(n=Vs(e[r]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function qs(){for(var e,r,n=0,a="",o=arguments.length;n<o;n++)(e=arguments[n])&&(r=Vs(e))&&(a&&(a+=" "),a+=r);return a}const Cc=(e,r)=>{const n=new Array(e.length+r.length);for(let a=0;a<e.length;a++)n[a]=e[a];for(let a=0;a<r.length;a++)n[e.length+a]=r[a];return n},Sc=(e,r)=>({classGroupId:e,validator:r}),Ks=(e=new Map,r=null,n)=>({nextPart:e,validators:r,classGroupId:n}),Er="-",Na=[],Tc="arbitrary..",Ec=e=>{const r=Pc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return Lc(l);const d=l.split(Er),i=d[0]===""&&d.length>1?1:0;return Xs(d,i,r)},getConflictingClassGroupIds:(l,d)=>{if(d){const i=a[l],h=n[l];return i?h?Cc(h,i):i:h||Na}return n[l]||Na}}},Xs=(e,r,n)=>{if(e.length-r===0)return n.classGroupId;const o=e[r],s=n.nextPart.get(o);if(s){const h=Xs(e,r+1,s);if(h)return h}const l=n.validators;if(l===null)return;const d=r===0?e.join(Er):e.slice(r).join(Er),i=l.length;for(let h=0;h<i;h++){const u=l[h];if(u.validator(d))return u.classGroupId}},Lc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=e.slice(1,-1),n=r.indexOf(":"),a=r.slice(0,n);return a?Tc+a:void 0})(),Pc=e=>{const{theme:r,classGroups:n}=e;return zc(n,r)},zc=(e,r)=>{const n=Ks();for(const a in e){const o=e[a];Vn(o,n,a,r)}return n},Vn=(e,r,n,a)=>{const o=e.length;for(let s=0;s<o;s++){const l=e[s];Ic(l,r,n,a)}},Ic=(e,r,n,a)=>{if(typeof e=="string"){Rc(e,r,n);return}if(typeof e=="function"){Ac(e,r,n,a);return}Mc(e,r,n,a)},Rc=(e,r,n)=>{const a=e===""?r:Ys(r,e);a.classGroupId=n},Ac=(e,r,n,a)=>{if(_c(e)){Vn(e(a),r,n,a);return}r.validators===null&&(r.validators=[]),r.validators.push(Sc(n,e))},Mc=(e,r,n,a)=>{const o=Object.entries(e),s=o.length;for(let l=0;l<s;l++){const[d,i]=o[l];Vn(i,Ys(r,d),n,a)}},Ys=(e,r)=>{let n=e;const a=r.split(Er),o=a.length;for(let s=0;s<o;s++){const l=a[s];let d=n.nextPart.get(l);d||(d=Ks(),n.nextPart.set(l,d)),n=d}return n},_c=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,$c=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,n=Object.create(null),a=Object.create(null);const o=(s,l)=>{n[s]=l,r++,r>e&&(r=0,a=n,n=Object.create(null))};return{get(s){let l=n[s];if(l!==void 0)return l;if((l=a[s])!==void 0)return o(s,l),l},set(s,l){s in n?n[s]=l:o(s,l)}}},Tn="!",Ca=":",Dc=[],Sa=(e,r,n,a,o)=>({modifiers:e,hasImportantModifier:r,baseClassName:n,maybePostfixModifierPosition:a,isExternal:o}),Bc=e=>{const{prefix:r,experimentalParseClassName:n}=e;let a=o=>{const s=[];let l=0,d=0,i=0,h;const u=o.length;for(let x=0;x<u;x++){const k=o[x];if(l===0&&d===0){if(k===Ca){s.push(o.slice(i,x)),i=x+1;continue}if(k==="/"){h=x;continue}}k==="["?l++:k==="]"?l--:k==="("?d++:k===")"&&d--}const p=s.length===0?o:o.slice(i);let m=p,f=!1;p.endsWith(Tn)?(m=p.slice(0,-1),f=!0):p.startsWith(Tn)&&(m=p.slice(1),f=!0);const g=h&&h>i?h-i:void 0;return Sa(s,f,m,g)};if(r){const o=r+Ca,s=a;a=l=>l.startsWith(o)?s(l.slice(o.length)):Sa(Dc,!1,l,void 0,!0)}if(n){const o=a;a=s=>n({className:s,parseClassName:o})}return a},Gc=e=>{const r=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{r.set(n,1e6+a)}),n=>{const a=[];let o=[];for(let s=0;s<n.length;s++){const l=n[s],d=l[0]==="[",i=r.has(l);d||i?(o.length>0&&(o.sort(),a.push(...o),o=[]),a.push(l)):o.push(l)}return o.length>0&&(o.sort(),a.push(...o)),a}},Fc=e=>({cache:$c(e.cacheSize),parseClassName:Bc(e),sortModifiers:Gc(e),postfixLookupClassGroupIds:Hc(e),...Ec(e)}),Hc=e=>{const r=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let a=0;a<n.length;a++)r[n[a]]=!0;return r},Oc=/\s+/,Uc=(e,r)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:o,sortModifiers:s,postfixLookupClassGroupIds:l}=r,d=[],i=e.trim().split(Oc);let h="";for(let u=i.length-1;u>=0;u-=1){const p=i[u],{isExternal:m,modifiers:f,hasImportantModifier:g,baseClassName:x,maybePostfixModifierPosition:k}=n(p);if(m){h=p+(h.length>0?" "+h:h);continue}let b=!!k,y;if(b){const S=x.substring(0,k);y=a(S);const P=y&&l[y]?a(x):void 0;P&&P!==y&&(y=P,b=!1)}else y=a(x);if(!y){if(!b){h=p+(h.length>0?" "+h:h);continue}if(y=a(x),!y){h=p+(h.length>0?" "+h:h);continue}b=!1}const w=f.length===0?"":f.length===1?f[0]:s(f).join(":"),v=g?w+Tn:w,N=v+y;if(d.indexOf(N)>-1)continue;d.push(N);const j=o(y,b);for(let S=0;S<j.length;++S){const P=j[S];d.push(v+P)}h=p+(h.length>0?" "+h:h)}return h},Wc=(...e)=>{let r=0,n,a,o="";for(;r<e.length;)(n=e[r++])&&(a=Zs(n))&&(o&&(o+=" "),o+=a);return o},Zs=e=>{if(typeof e=="string")return e;let r,n="";for(let a=0;a<e.length;a++)e[a]&&(r=Zs(e[a]))&&(n&&(n+=" "),n+=r);return n},Vc=(e,...r)=>{let n,a,o,s;const l=i=>{const h=r.reduce((u,p)=>p(u),e());return n=Fc(h),a=n.cache.get,o=n.cache.set,s=d,d(i)},d=i=>{const h=a(i);if(h)return h;const u=Uc(i,n);return o(i,u),u};return s=l,(...i)=>s(Wc(...i))},qc=[],He=e=>{const r=n=>n[e]||qc;return r.isThemeGetter=!0,r},Js=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Qs=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Kc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Xc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Yc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Zc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Jc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Qc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ft=e=>Kc.test(e),je=e=>!!e&&!Number.isNaN(Number(e)),ct=e=>!!e&&Number.isInteger(Number(e)),an=e=>e.endsWith("%")&&je(e.slice(0,-1)),mt=e=>Xc.test(e),eo=()=>!0,eh=e=>Yc.test(e)&&!Zc.test(e),qn=()=>!1,th=e=>Jc.test(e),rh=e=>Qc.test(e),nh=e=>!ne(e)&&!ae(e),ah=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),sh=e=>kt(e,no,qn),ne=e=>Js.test(e),Nt=e=>kt(e,ao,eh),Ta=e=>kt(e,mh,je),oh=e=>kt(e,oo,eo),lh=e=>kt(e,so,qn),Ea=e=>kt(e,to,qn),ih=e=>kt(e,ro,rh),fr=e=>kt(e,lo,th),ae=e=>Qs.test(e),Kt=e=>It(e,ao),dh=e=>It(e,so),La=e=>It(e,to),ch=e=>It(e,no),hh=e=>It(e,ro),gr=e=>It(e,lo,!0),uh=e=>It(e,oo,!0),kt=(e,r,n)=>{const a=Js.exec(e);return a?a[1]?r(a[1]):n(a[2]):!1},It=(e,r,n=!1)=>{const a=Qs.exec(e);return a?a[1]?r(a[1]):n:!1},to=e=>e==="position"||e==="percentage",ro=e=>e==="image"||e==="url",no=e=>e==="length"||e==="size"||e==="bg-size",ao=e=>e==="length",mh=e=>e==="number",so=e=>e==="family-name",oo=e=>e==="number"||e==="weight",lo=e=>e==="shadow",ph=()=>{const e=He("color"),r=He("font"),n=He("text"),a=He("font-weight"),o=He("tracking"),s=He("leading"),l=He("breakpoint"),d=He("container"),i=He("spacing"),h=He("radius"),u=He("shadow"),p=He("inset-shadow"),m=He("text-shadow"),f=He("drop-shadow"),g=He("blur"),x=He("perspective"),k=He("aspect"),b=He("ease"),y=He("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...v(),ae,ne],j=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto","contain","none"],P=()=>[ae,ne,i],C=()=>[ft,"full","auto",...P()],M=()=>[ct,"none","subgrid",ae,ne],_=()=>["auto",{span:["full",ct,ae,ne]},ct,ae,ne],A=()=>[ct,"auto",ae,ne],te=()=>["auto","min","max","fr",ae,ne],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...P()],de=()=>[ft,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],L=()=>[ft,"screen","full","dvw","lvw","svw","min","max","fit",...P()],Z=()=>[ft,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],R=()=>[e,ae,ne],X=()=>[...v(),La,Ea,{position:[ae,ne]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",ch,sh,{size:[ae,ne]}],V=()=>[an,Kt,Nt],H=()=>["","none","full",h,ae,ne],E=()=>["",je,Kt,Nt],T=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>[je,an,La,Ea],Q=()=>["","none",g,ae,ne],B=()=>["none",je,ae,ne],ce=()=>["none",je,ae,ne],J=()=>[je,ae,ne],se=()=>[ft,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[mt],breakpoint:[mt],color:[eo],container:[mt],"drop-shadow":[mt],ease:["in","out","in-out"],font:[nh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[mt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[mt],shadow:[mt],spacing:["px",je],text:[mt],"text-shadow":[mt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ft,ne,ae,k]}],container:["container"],"container-type":[{"@container":["","normal","size",ae,ne]}],"container-named":[ah],columns:[{columns:[je,ne,ae,d]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:C()}],"inset-x":[{"inset-x":C()}],"inset-y":[{"inset-y":C()}],start:[{"inset-s":C(),start:C()}],end:[{"inset-e":C(),end:C()}],"inset-bs":[{"inset-bs":C()}],"inset-be":[{"inset-be":C()}],top:[{top:C()}],right:[{right:C()}],bottom:[{bottom:C()}],left:[{left:C()}],visibility:["visible","invisible","collapse"],z:[{z:[ct,"auto",ae,ne]}],basis:[{basis:[ft,"full","auto",d,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[je,ft,"auto","initial","none",ne]}],grow:[{grow:["",je,ae,ne]}],shrink:[{shrink:["",je,ae,ne]}],order:[{order:[ct,"first","last","none",ae,ne]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:_()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:_()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:de()}],"inline-size":[{inline:["auto",...L()]}],"min-inline-size":[{"min-inline":["auto",...L()]}],"max-inline-size":[{"max-inline":["none",...L()]}],"block-size":[{block:["auto",...Z()]}],"min-block-size":[{"min-block":["auto",...Z()]}],"max-block-size":[{"max-block":["none",...Z()]}],w:[{w:[d,"screen",...de()]}],"min-w":[{"min-w":[d,"screen","none",...de()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[l]},...de()]}],h:[{h:["screen","lh",...de()]}],"min-h":[{"min-h":["screen","lh","none",...de()]}],"max-h":[{"max-h":["screen","lh",...de()]}],"font-size":[{text:["base",n,Kt,Nt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,uh,oh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",an,ne]}],"font-family":[{font:[dh,lh,r]}],"font-features":[{"font-features":[ne]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ae,ne]}],"line-clamp":[{"line-clamp":[je,"none",ae,Ta]}],leading:[{leading:[s,...P()]}],"list-image":[{"list-image":["none",ae,ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ae,ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...T(),"wavy"]}],"text-decoration-thickness":[{decoration:[je,"from-font","auto",ae,Nt]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[je,"auto",ae,ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"tab-size":[{tab:[ct,ae,ne]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ae,ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ae,ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:X()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ct,ae,ne],radial:["",ae,ne],conic:[ct,ae,ne]},hh,ih]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:E()}],"border-w-x":[{"border-x":E()}],"border-w-y":[{"border-y":E()}],"border-w-s":[{"border-s":E()}],"border-w-e":[{"border-e":E()}],"border-w-bs":[{"border-bs":E()}],"border-w-be":[{"border-be":E()}],"border-w-t":[{"border-t":E()}],"border-w-r":[{"border-r":E()}],"border-w-b":[{"border-b":E()}],"border-w-l":[{"border-l":E()}],"divide-x":[{"divide-x":E()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":E()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...T(),"hidden","none"]}],"divide-style":[{divide:[...T(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-bs":[{"border-bs":R()}],"border-color-be":[{"border-be":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...T(),"none","hidden"]}],"outline-offset":[{"outline-offset":[je,ae,ne]}],"outline-w":[{outline:["",je,Kt,Nt]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",u,gr,fr]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",p,gr,fr]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:E()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[je,Nt]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":E()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",m,gr,fr]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[je,ae,ne]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[je]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[ae,ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":v()}],"mask-image-conic-pos":[{"mask-conic":[je]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:X()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ae,ne]}],filter:[{filter:["","none",ae,ne]}],blur:[{blur:Q()}],brightness:[{brightness:[je,ae,ne]}],contrast:[{contrast:[je,ae,ne]}],"drop-shadow":[{"drop-shadow":["","none",f,gr,fr]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",je,ae,ne]}],"hue-rotate":[{"hue-rotate":[je,ae,ne]}],invert:[{invert:["",je,ae,ne]}],saturate:[{saturate:[je,ae,ne]}],sepia:[{sepia:["",je,ae,ne]}],"backdrop-filter":[{"backdrop-filter":["","none",ae,ne]}],"backdrop-blur":[{"backdrop-blur":Q()}],"backdrop-brightness":[{"backdrop-brightness":[je,ae,ne]}],"backdrop-contrast":[{"backdrop-contrast":[je,ae,ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",je,ae,ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[je,ae,ne]}],"backdrop-invert":[{"backdrop-invert":["",je,ae,ne]}],"backdrop-opacity":[{"backdrop-opacity":[je,ae,ne]}],"backdrop-saturate":[{"backdrop-saturate":[je,ae,ne]}],"backdrop-sepia":[{"backdrop-sepia":["",je,ae,ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ae,ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[je,"initial",ae,ne]}],ease:[{ease:["linear","initial",b,ae,ne]}],delay:[{delay:[je,ae,ne]}],animate:[{animate:["none",y,ae,ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,ae,ne]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:B()}],"rotate-x":[{"rotate-x":B()}],"rotate-y":[{"rotate-y":B()}],"rotate-z":[{"rotate-z":B()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:J()}],"skew-x":[{"skew-x":J()}],"skew-y":[{"skew-y":J()}],transform:[{transform:[ae,ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":["translate-none"],zoom:[{zoom:[ct,ae,ne]}],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ae,ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":R()}],"scrollbar-track-color":[{"scrollbar-track":R()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ae,ne]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[je,Kt,Nt,Ta]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},fh=Vc(ph),Pa=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,za=qs,ir=(e,r)=>n=>{var a;if((r==null?void 0:r.variants)==null)return za(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=r,l=Object.keys(o).map(h=>{const u=n==null?void 0:n[h],p=s==null?void 0:s[h];if(u===null)return null;const m=Pa(u)||Pa(p);return o[h][m]}),d=n&&Object.entries(n).reduce((h,u)=>{let[p,m]=u;return m===void 0||(h[p]=m),h},{}),i=r==null||(a=r.compoundVariants)===null||a===void 0?void 0:a.reduce((h,u)=>{let{class:p,className:m,...f}=u;return Object.entries(f).every(g=>{let[x,k]=g;return Array.isArray(k)?k.includes({...s,...d}[x]):{...s,...d}[x]===k})?[...h,p,m]:h},[]);return za(e,l,i,n==null?void 0:n.class,n==null?void 0:n.className)},Br=c.createContext(null);Br.displayName="PanelGroupContext";const De={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Kn=10,Pt=c.useLayoutEffect,Ia=hc.useId,gh=typeof Ia=="function"?Ia:()=>null;let xh=0;function Xn(e=null){const r=gh(),n=c.useRef(e||r||null);return n.current===null&&(n.current=""+xh++),e??n.current}function io({children:e,className:r="",collapsedSize:n,collapsible:a,defaultSize:o,forwardedRef:s,id:l,maxSize:d,minSize:i,onCollapse:h,onExpand:u,onResize:p,order:m,style:f,tagName:g="div",...x}){const k=c.useContext(Br);if(k===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:b,expandPanel:y,getPanelSize:w,getPanelStyle:v,groupId:N,isPanelCollapsed:j,reevaluatePanelConstraints:S,registerPanel:P,resizePanel:C,unregisterPanel:M}=k,_=Xn(l),A=c.useRef({callbacks:{onCollapse:h,onExpand:u,onResize:p},constraints:{collapsedSize:n,collapsible:a,defaultSize:o,maxSize:d,minSize:i},id:_,idIsFromProps:l!==void 0,order:m});c.useRef({didLogMissingDefaultSizeWarning:!1}),Pt(()=>{const{callbacks:W,constraints:D}=A.current,q={...D};A.current.id=_,A.current.idIsFromProps=l!==void 0,A.current.order=m,W.onCollapse=h,W.onExpand=u,W.onResize=p,D.collapsedSize=n,D.collapsible=a,D.defaultSize=o,D.maxSize=d,D.minSize=i,(q.collapsedSize!==D.collapsedSize||q.collapsible!==D.collapsible||q.maxSize!==D.maxSize||q.minSize!==D.minSize)&&S(A.current,q)}),Pt(()=>{const W=A.current;return P(W),()=>{M(W)}},[m,_,P,M]),c.useImperativeHandle(s,()=>({collapse:()=>{b(A.current)},expand:W=>{y(A.current,W)},getId(){return _},getSize(){return w(A.current)},isCollapsed(){return j(A.current)},isExpanded(){return!j(A.current)},resize:W=>{C(A.current,W)}}),[b,y,w,j,_,C]);const te=v(A.current,o);return c.createElement(g,{...x,children:e,className:r,id:_,style:{...te,...f},[De.groupId]:N,[De.panel]:"",[De.panelCollapsible]:a||void 0,[De.panelId]:_,[De.panelSize]:parseFloat(""+te.flexGrow).toFixed(1)})}const co=c.forwardRef((e,r)=>c.createElement(io,{...e,forwardedRef:r}));io.displayName="Panel";co.displayName="forwardRef(Panel)";let En=null,yr=-1,xt=null;function bh(e,r,n){const a=(r&fo)!==0,o=(r&go)!==0,s=(r&xo)!==0,l=(r&bo)!==0;if(r){if(a)return s?"se-resize":l?"ne-resize":"e-resize";if(o)return s?"sw-resize":l?"nw-resize":"w-resize";if(s)return"s-resize";if(l)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function vh(){xt!==null&&(document.head.removeChild(xt),En=null,xt=null,yr=-1)}function sn(e,r,n){var a,o;const s=bh(e,r);if(En!==s){if(En=s,xt===null&&(xt=document.createElement("style"),document.head.appendChild(xt)),yr>=0){var l;(l=xt.sheet)===null||l===void 0||l.removeRule(yr)}yr=(a=(o=xt.sheet)===null||o===void 0?void 0:o.insertRule(`*{cursor: ${s} !important;}`))!==null&&a!==void 0?a:-1}}function ho(e){return e.type==="keydown"}function uo(e){return e.type.startsWith("pointer")}function mo(e){return e.type.startsWith("mouse")}function Gr(e){if(uo(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(mo(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function kh(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function wh(e,r,n){return e.x<r.x+r.width&&e.x+e.width>r.x&&e.y<r.y+r.height&&e.y+e.height>r.y}function yh(e,r){if(e===r)throw new Error("Cannot compare node with itself");const n={a:Ma(e),b:Ma(r)};let a;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),r=n.b.pop(),a=e;we(a,"Stacking order can only be calculated for elements with a common ancestor");const o={a:Aa(Ra(n.a)),b:Aa(Ra(n.b))};if(o.a===o.b){const s=a.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let d=s.length;for(;d--;){const i=s[d];if(i===l.a)return 1;if(i===l.b)return-1}}return Math.sign(o.a-o.b)}const jh=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Nh(e){var r;const n=getComputedStyle((r=po(e))!==null&&r!==void 0?r:e).display;return n==="flex"||n==="inline-flex"}function Ch(e){const r=getComputedStyle(e);return!!(r.position==="fixed"||r.zIndex!=="auto"&&(r.position!=="static"||Nh(e))||+r.opacity<1||"transform"in r&&r.transform!=="none"||"webkitTransform"in r&&r.webkitTransform!=="none"||"mixBlendMode"in r&&r.mixBlendMode!=="normal"||"filter"in r&&r.filter!=="none"||"webkitFilter"in r&&r.webkitFilter!=="none"||"isolation"in r&&r.isolation==="isolate"||jh.test(r.willChange)||r.webkitOverflowScrolling==="touch")}function Ra(e){let r=e.length;for(;r--;){const n=e[r];if(we(n,"Missing node"),Ch(n))return n}return null}function Aa(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ma(e){const r=[];for(;e;)r.push(e),e=po(e);return r}function po(e){const{parentNode:r}=e;return r&&r instanceof ShadowRoot?r.host:r}const fo=1,go=2,xo=4,bo=8,Sh=kh()==="coarse";let dt=[],Ot=!1,bt=new Map,Fr=new Map;const nr=new Set;function Th(e,r,n,a,o){var s;const{ownerDocument:l}=r,d={direction:n,element:r,hitAreaMargins:a,setResizeHandlerState:o},i=(s=bt.get(l))!==null&&s!==void 0?s:0;return bt.set(l,i+1),nr.add(d),Lr(),function(){var u;Fr.delete(e),nr.delete(d);const p=(u=bt.get(l))!==null&&u!==void 0?u:1;if(bt.set(l,p-1),Lr(),p===1&&bt.delete(l),dt.includes(d)){const m=dt.indexOf(d);m>=0&&dt.splice(m,1),Hr(),o("up",!0,null)}}}function Eh(e){const{target:r}=e,{x:n,y:a}=Gr(e);Ot=!0,Yn({target:r,x:n,y:a}),Lr(),dt.length>0&&(Pr("down",e),Hr(),e.preventDefault(),vo(r)||e.stopImmediatePropagation())}function on(e){const{x:r,y:n}=Gr(e);if(Ot&&e.type!=="pointerleave"&&e.buttons===0&&(Ot=!1,Pr("up",e)),!Ot){const{target:a}=e;Yn({target:a,x:r,y:n})}Pr("move",e),Hr(),dt.length>0&&e.preventDefault()}function ln(e){const{target:r}=e,{x:n,y:a}=Gr(e);Fr.clear(),Ot=!1,dt.length>0&&(e.preventDefault(),vo(r)||e.stopImmediatePropagation()),Pr("up",e),Yn({target:r,x:n,y:a}),Hr(),Lr()}function vo(e){let r=e;for(;r;){if(r.hasAttribute(De.resizeHandle))return!0;r=r.parentElement}return!1}function Yn({target:e,x:r,y:n}){dt.splice(0);let a=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(a=e),nr.forEach(o=>{const{element:s,hitAreaMargins:l}=o,d=s.getBoundingClientRect(),{bottom:i,left:h,right:u,top:p}=d,m=Sh?l.coarse:l.fine;if(r>=h-m&&r<=u+m&&n>=p-m&&n<=i+m){if(a!==null&&document.contains(a)&&s!==a&&!s.contains(a)&&!a.contains(s)&&yh(a,s)>0){let g=a,x=!1;for(;g&&!g.contains(s);){if(wh(g.getBoundingClientRect(),d)){x=!0;break}g=g.parentElement}if(x)return}dt.push(o)}})}function dn(e,r){Fr.set(e,r)}function Hr(){let e=!1,r=!1;dt.forEach(a=>{const{direction:o}=a;o==="horizontal"?e=!0:r=!0});let n=0;Fr.forEach(a=>{n|=a}),e&&r?sn("intersection",n):e?sn("horizontal",n):r?sn("vertical",n):vh()}let cn;function Lr(){var e;(e=cn)===null||e===void 0||e.abort(),cn=new AbortController;const r={capture:!0,signal:cn.signal};nr.size&&(Ot?(dt.length>0&&bt.forEach((n,a)=>{const{body:o}=a;n>0&&(o.addEventListener("contextmenu",ln,r),o.addEventListener("pointerleave",on,r),o.addEventListener("pointermove",on,r))}),bt.forEach((n,a)=>{const{body:o}=a;o.addEventListener("pointerup",ln,r),o.addEventListener("pointercancel",ln,r)})):bt.forEach((n,a)=>{const{body:o}=a;n>0&&(o.addEventListener("pointerdown",Eh,r),o.addEventListener("pointermove",on,r))}))}function Pr(e,r){nr.forEach(n=>{const{setResizeHandlerState:a}=n,o=dt.includes(n);a(e,o,r)})}function Lh(){const[e,r]=c.useState(0);return c.useCallback(()=>r(n=>n+1),[])}function we(e,r){if(!e)throw console.error(r),Error(r)}function zt(e,r,n=Kn){return e.toFixed(n)===r.toFixed(n)?0:e>r?1:-1}function pt(e,r,n=Kn){return zt(e,r,n)===0}function rt(e,r,n){return zt(e,r,n)===0}function Ph(e,r,n){if(e.length!==r.length)return!1;for(let a=0;a<e.length;a++){const o=e[a],s=r[a];if(!rt(o,s,n))return!1}return!0}function Ht({panelConstraints:e,panelIndex:r,size:n}){const a=e[r];we(a!=null,`Panel constraints not found for index ${r}`);let{collapsedSize:o=0,collapsible:s,maxSize:l=100,minSize:d=0}=a;if(zt(n,d)<0)if(s){const i=(o+d)/2;zt(n,i)<0?n=o:n=d}else n=d;return n=Math.min(l,n),n=parseFloat(n.toFixed(Kn)),n}function Jt({delta:e,initialLayout:r,panelConstraints:n,pivotIndices:a,prevLayout:o,trigger:s}){if(rt(e,0))return r;const l=[...r],[d,i]=a;we(d!=null,"Invalid first pivot index"),we(i!=null,"Invalid second pivot index");let h=0;if(s==="keyboard"){{const p=e<0?i:d,m=n[p];we(m,`Panel constraints not found for index ${p}`);const{collapsedSize:f=0,collapsible:g,minSize:x=0}=m;if(g){const k=r[p];if(we(k!=null,`Previous layout not found for panel index ${p}`),rt(k,f)){const b=x-k;zt(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const p=e<0?d:i,m=n[p];we(m,`No panel constraints found for index ${p}`);const{collapsedSize:f=0,collapsible:g,minSize:x=0}=m;if(g){const k=r[p];if(we(k!=null,`Previous layout not found for panel index ${p}`),rt(k,x)){const b=k-f;zt(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}}{const p=e<0?1:-1;let m=e<0?i:d,f=0;for(;;){const x=r[m];we(x!=null,`Previous layout not found for panel index ${m}`);const b=Ht({panelConstraints:n,panelIndex:m,size:100})-x;if(f+=b,m+=p,m<0||m>=n.length)break}const g=Math.min(Math.abs(e),Math.abs(f));e=e<0?0-g:g}{let m=e<0?d:i;for(;m>=0&&m<n.length;){const f=Math.abs(e)-Math.abs(h),g=r[m];we(g!=null,`Previous layout not found for panel index ${m}`);const x=g-f,k=Ht({panelConstraints:n,panelIndex:m,size:x});if(!rt(g,k)&&(h+=g-k,l[m]=k,h.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(Ph(o,l))return o;{const p=e<0?i:d,m=r[p];we(m!=null,`Previous layout not found for panel index ${p}`);const f=m+h,g=Ht({panelConstraints:n,panelIndex:p,size:f});if(l[p]=g,!rt(g,f)){let x=f-g,b=e<0?i:d;for(;b>=0&&b<n.length;){const y=l[b];we(y!=null,`Previous layout not found for panel index ${b}`);const w=y+x,v=Ht({panelConstraints:n,panelIndex:b,size:w});if(rt(y,v)||(x-=v-y,l[b]=v),rt(x,0))break;e>0?b--:b++}}}const u=l.reduce((p,m)=>m+p,0);return rt(u,100)?l:o}function zh({layout:e,panelsArray:r,pivotIndices:n}){let a=0,o=100,s=0,l=0;const d=n[0];we(d!=null,"No pivot index found"),r.forEach((p,m)=>{const{constraints:f}=p,{maxSize:g=100,minSize:x=0}=f;m===d?(a=x,o=g):(s+=x,l+=g)});const i=Math.min(o,100-s),h=Math.max(a,100-l),u=e[d];return{valueMax:i,valueMin:h,valueNow:u}}function ar(e,r=document){return Array.from(r.querySelectorAll(`[${De.resizeHandleId}][data-panel-group-id="${e}"]`))}function ko(e,r,n=document){const o=ar(e,n).findIndex(s=>s.getAttribute(De.resizeHandleId)===r);return o??null}function wo(e,r,n){const a=ko(e,r,n);return a!=null?[a,a+1]:[-1,-1]}function Ih(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function yo(e,r=document){if(Ih(r)&&r.dataset.panelGroupId==e)return r;const n=r.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function Or(e,r=document){const n=r.querySelector(`[${De.resizeHandleId}="${e}"]`);return n||null}function Rh(e,r,n,a=document){var o,s,l,d;const i=Or(r,a),h=ar(e,a),u=i?h.indexOf(i):-1,p=(o=(s=n[u])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null,m=(l=(d=n[u+1])===null||d===void 0?void 0:d.id)!==null&&l!==void 0?l:null;return[p,m]}function Ah({committedValuesRef:e,eagerValuesRef:r,groupId:n,layout:a,panelDataArray:o,panelGroupElement:s,setLayout:l}){c.useRef({didWarnAboutMissingResizeHandle:!1}),Pt(()=>{if(!s)return;const d=ar(n,s);for(let i=0;i<o.length-1;i++){const{valueMax:h,valueMin:u,valueNow:p}=zh({layout:a,panelsArray:o,pivotIndices:[i,i+1]}),m=d[i];if(m!=null){const f=o[i];we(f,`No panel data found for index "${i}"`),m.setAttribute("aria-controls",f.id),m.setAttribute("aria-valuemax",""+Math.round(h)),m.setAttribute("aria-valuemin",""+Math.round(u)),m.setAttribute("aria-valuenow",p!=null?""+Math.round(p):"")}}return()=>{d.forEach((i,h)=>{i.removeAttribute("aria-controls"),i.removeAttribute("aria-valuemax"),i.removeAttribute("aria-valuemin"),i.removeAttribute("aria-valuenow")})}},[n,a,o,s]),c.useEffect(()=>{if(!s)return;const d=r.current;we(d,"Eager values not found");const{panelDataArray:i}=d,h=yo(n,s);we(h!=null,`No group found for id "${n}"`);const u=ar(n,s);we(u,`No resize handles found for group id "${n}"`);const p=u.map(m=>{const f=m.getAttribute(De.resizeHandleId);we(f,"Resize handle element has no handle id attribute");const[g,x]=Rh(n,f,i,s);if(g==null||x==null)return()=>{};const k=b=>{if(!b.defaultPrevented)switch(b.key){case"Enter":{b.preventDefault();const y=i.findIndex(w=>w.id===g);if(y>=0){const w=i[y];we(w,`No panel data found for index ${y}`);const v=a[y],{collapsedSize:N=0,collapsible:j,minSize:S=0}=w.constraints;if(v!=null&&j){const P=Jt({delta:rt(v,N)?S-N:N-v,initialLayout:a,panelConstraints:i.map(C=>C.constraints),pivotIndices:wo(n,f,s),prevLayout:a,trigger:"keyboard"});a!==P&&l(P)}}break}}};return m.addEventListener("keydown",k),()=>{m.removeEventListener("keydown",k)}});return()=>{p.forEach(m=>m())}},[s,e,r,n,a,o,l])}function _a(e,r){if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==r[n])return!1;return!0}function jo(e,r){const n=e==="horizontal",{x:a,y:o}=Gr(r);return n?a:o}function Mh(e,r,n,a,o){const s=n==="horizontal",l=Or(r,o);we(l,`No resize handle element found for id "${r}"`);const d=l.getAttribute(De.groupId);we(d,"Resize handle element has no group id attribute");let{initialCursorPosition:i}=a;const h=jo(n,e),u=yo(d,o);we(u,`No group element found for id "${d}"`);const p=u.getBoundingClientRect(),m=s?p.width:p.height;return(h-i)/m*100}function _h(e,r,n,a,o,s){if(ho(e)){const l=n==="horizontal";let d=0;e.shiftKey?d=100:o!=null?d=o:d=10;let i=0;switch(e.key){case"ArrowDown":i=l?0:d;break;case"ArrowLeft":i=l?-d:0;break;case"ArrowRight":i=l?d:0;break;case"ArrowUp":i=l?0:-d;break;case"End":i=100;break;case"Home":i=-100;break}return i}else return a==null?0:Mh(e,r,n,a,s)}function $h({panelDataArray:e}){const r=Array(e.length),n=e.map(s=>s.constraints);let a=0,o=100;for(let s=0;s<e.length;s++){const l=n[s];we(l,`Panel constraints not found for index ${s}`);const{defaultSize:d}=l;d!=null&&(a++,r[s]=d,o-=d)}for(let s=0;s<e.length;s++){const l=n[s];we(l,`Panel constraints not found for index ${s}`);const{defaultSize:d}=l;if(d!=null)continue;const i=e.length-a,h=o/i;a++,r[s]=h,o-=h}return r}function Dt(e,r,n){r.forEach((a,o)=>{const s=e[o];we(s,`Panel data not found for index ${o}`);const{callbacks:l,constraints:d,id:i}=s,{collapsedSize:h=0,collapsible:u}=d,p=n[i];if(p==null||a!==p){n[i]=a;const{onCollapse:m,onExpand:f,onResize:g}=l;g&&g(a,p),u&&(m||f)&&(f&&(p==null||pt(p,h))&&!pt(a,h)&&f(),m&&(p==null||!pt(p,h))&&pt(a,h)&&m())}})}function xr(e,r){if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=r[n])return!1;return!0}function Dh({defaultSize:e,dragState:r,layout:n,panelData:a,panelIndex:o,precision:s=3}){const l=n[o];let d;return l==null?d=e!=null?e.toFixed(s):"1":a.length===1?d="1":d=l.toFixed(s),{flexBasis:0,flexGrow:d,flexShrink:1,overflow:"hidden",pointerEvents:r!==null?"none":void 0}}function Bh(e,r=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},r)}}function $a(e){try{if(typeof localStorage<"u")e.getItem=r=>localStorage.getItem(r),e.setItem=(r,n)=>{localStorage.setItem(r,n)};else throw new Error("localStorage not supported in this environment")}catch(r){console.error(r),e.getItem=()=>null,e.setItem=()=>{}}}function No(e){return`react-resizable-panels:${e}`}function Co(e){return e.map(r=>{const{constraints:n,id:a,idIsFromProps:o,order:s}=r;return o?a:s?`${s}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((r,n)=>r.localeCompare(n)).join(",")}function So(e,r){try{const n=No(e),a=r.getItem(n);if(a){const o=JSON.parse(a);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function Gh(e,r,n){var a,o;const s=(a=So(e,n))!==null&&a!==void 0?a:{},l=Co(r);return(o=s[l])!==null&&o!==void 0?o:null}function Fh(e,r,n,a,o){var s;const l=No(e),d=Co(r),i=(s=So(e,o))!==null&&s!==void 0?s:{};i[d]={expandToSizes:Object.fromEntries(n.entries()),layout:a};try{o.setItem(l,JSON.stringify(i))}catch(h){console.error(h)}}function Da({layout:e,panelConstraints:r}){const n=[...e],a=n.reduce((s,l)=>s+l,0);if(n.length!==r.length)throw Error(`Invalid ${r.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!rt(a,100)&&n.length>0)for(let s=0;s<r.length;s++){const l=n[s];we(l!=null,`No layout data found for index ${s}`);const d=100/a*l;n[s]=d}let o=0;for(let s=0;s<r.length;s++){const l=n[s];we(l!=null,`No layout data found for index ${s}`);const d=Ht({panelConstraints:r,panelIndex:s,size:l});l!=d&&(o+=l-d,n[s]=d)}if(!rt(o,0))for(let s=0;s<r.length;s++){const l=n[s];we(l!=null,`No layout data found for index ${s}`);const d=l+o,i=Ht({panelConstraints:r,panelIndex:s,size:d});if(l!==i&&(o-=i-l,n[s]=i,rt(o,0)))break}return n}const Hh=100,Qt={getItem:e=>($a(Qt),Qt.getItem(e)),setItem:(e,r)=>{$a(Qt),Qt.setItem(e,r)}},Ba={};function To({autoSaveId:e=null,children:r,className:n="",direction:a,forwardedRef:o,id:s=null,onLayout:l=null,keyboardResizeBy:d=null,storage:i=Qt,style:h,tagName:u="div",...p}){const m=Xn(s),f=c.useRef(null),[g,x]=c.useState(null),[k,b]=c.useState([]),y=Lh(),w=c.useRef({}),v=c.useRef(new Map),N=c.useRef(0),j=c.useRef({autoSaveId:e,direction:a,dragState:g,id:m,keyboardResizeBy:d,onLayout:l,storage:i}),S=c.useRef({layout:k,panelDataArray:[],panelDataArrayChanged:!1});c.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),c.useImperativeHandle(o,()=>({getId:()=>j.current.id,getLayout:()=>{const{layout:z}=S.current;return z},setLayout:z=>{const{onLayout:V}=j.current,{layout:H,panelDataArray:E}=S.current,T=Da({layout:z,panelConstraints:E.map(K=>K.constraints)});_a(H,T)||(b(T),S.current.layout=T,V&&V(T),Dt(E,T,w.current))}}),[]),Pt(()=>{j.current.autoSaveId=e,j.current.direction=a,j.current.dragState=g,j.current.id=m,j.current.onLayout=l,j.current.storage=i}),Ah({committedValuesRef:j,eagerValuesRef:S,groupId:m,layout:k,panelDataArray:S.current.panelDataArray,setLayout:b,panelGroupElement:f.current}),c.useEffect(()=>{const{panelDataArray:z}=S.current;if(e){if(k.length===0||k.length!==z.length)return;let V=Ba[e];V==null&&(V=Bh(Fh,Hh),Ba[e]=V);const H=[...z],E=new Map(v.current);V(e,H,E,k,i)}},[e,k,i]),c.useEffect(()=>{});const P=c.useCallback(z=>{const{onLayout:V}=j.current,{layout:H,panelDataArray:E}=S.current;if(z.constraints.collapsible){const T=E.map(B=>B.constraints),{collapsedSize:K=0,panelSize:O,pivotIndices:Q}=Ct(E,z,H);if(we(O!=null,`Panel size not found for panel "${z.id}"`),!pt(O,K)){v.current.set(z.id,O);const ce=Gt(E,z)===E.length-1?O-K:K-O,J=Jt({delta:ce,initialLayout:H,panelConstraints:T,pivotIndices:Q,prevLayout:H,trigger:"imperative-api"});xr(H,J)||(b(J),S.current.layout=J,V&&V(J),Dt(E,J,w.current))}}},[]),C=c.useCallback((z,V)=>{const{onLayout:H}=j.current,{layout:E,panelDataArray:T}=S.current;if(z.constraints.collapsible){const K=T.map(se=>se.constraints),{collapsedSize:O=0,panelSize:Q=0,minSize:B=0,pivotIndices:ce}=Ct(T,z,E),J=V??B;if(pt(Q,O)){const se=v.current.get(z.id),ue=se!=null&&se>=J?se:J,Ne=Gt(T,z)===T.length-1?Q-ue:ue-Q,Y=Jt({delta:Ne,initialLayout:E,panelConstraints:K,pivotIndices:ce,prevLayout:E,trigger:"imperative-api"});xr(E,Y)||(b(Y),S.current.layout=Y,H&&H(Y),Dt(T,Y,w.current))}}},[]),M=c.useCallback(z=>{const{layout:V,panelDataArray:H}=S.current,{panelSize:E}=Ct(H,z,V);return we(E!=null,`Panel size not found for panel "${z.id}"`),E},[]),_=c.useCallback((z,V)=>{const{panelDataArray:H}=S.current,E=Gt(H,z);return Dh({defaultSize:V,dragState:g,layout:k,panelData:H,panelIndex:E})},[g,k]),A=c.useCallback(z=>{const{layout:V,panelDataArray:H}=S.current,{collapsedSize:E=0,collapsible:T,panelSize:K}=Ct(H,z,V);return we(K!=null,`Panel size not found for panel "${z.id}"`),T===!0&&pt(K,E)},[]),te=c.useCallback(z=>{const{layout:V,panelDataArray:H}=S.current,{collapsedSize:E=0,collapsible:T,panelSize:K}=Ct(H,z,V);return we(K!=null,`Panel size not found for panel "${z.id}"`),!T||zt(K,E)>0},[]),W=c.useCallback(z=>{const{panelDataArray:V}=S.current;V.push(z),V.sort((H,E)=>{const T=H.order,K=E.order;return T==null&&K==null?0:T==null?-1:K==null?1:T-K}),S.current.panelDataArrayChanged=!0,y()},[y]);Pt(()=>{if(S.current.panelDataArrayChanged){S.current.panelDataArrayChanged=!1;const{autoSaveId:z,onLayout:V,storage:H}=j.current,{layout:E,panelDataArray:T}=S.current;let K=null;if(z){const Q=Gh(z,T,H);Q&&(v.current=new Map(Object.entries(Q.expandToSizes)),K=Q.layout)}K==null&&(K=$h({panelDataArray:T}));const O=Da({layout:K,panelConstraints:T.map(Q=>Q.constraints)});_a(E,O)||(b(O),S.current.layout=O,V&&V(O),Dt(T,O,w.current))}}),Pt(()=>{const z=S.current;return()=>{z.layout=[]}},[]);const D=c.useCallback(z=>{let V=!1;const H=f.current;return H&&window.getComputedStyle(H,null).getPropertyValue("direction")==="rtl"&&(V=!0),function(T){T.preventDefault();const K=f.current;if(!K)return()=>null;const{direction:O,dragState:Q,id:B,keyboardResizeBy:ce,onLayout:J}=j.current,{layout:se,panelDataArray:ue}=S.current,{initialLayout:fe}=Q??{},Ne=wo(B,z,K);let Y=_h(T,z,O,Q,ce,K);const G=O==="horizontal";G&&V&&(Y=-Y);const re=ue.map(me=>me.constraints),le=Jt({delta:Y,initialLayout:fe??se,panelConstraints:re,pivotIndices:Ne,prevLayout:se,trigger:ho(T)?"keyboard":"mouse-or-touch"}),ge=!xr(se,le);(uo(T)||mo(T))&&N.current!=Y&&(N.current=Y,!ge&&Y!==0?G?dn(z,Y<0?fo:go):dn(z,Y<0?xo:bo):dn(z,0)),ge&&(b(le),S.current.layout=le,J&&J(le),Dt(ue,le,w.current))}},[]),q=c.useCallback((z,V)=>{const{onLayout:H}=j.current,{layout:E,panelDataArray:T}=S.current,K=T.map(se=>se.constraints),{panelSize:O,pivotIndices:Q}=Ct(T,z,E);we(O!=null,`Panel size not found for panel "${z.id}"`);const ce=Gt(T,z)===T.length-1?O-V:V-O,J=Jt({delta:ce,initialLayout:E,panelConstraints:K,pivotIndices:Q,prevLayout:E,trigger:"imperative-api"});xr(E,J)||(b(J),S.current.layout=J,H&&H(J),Dt(T,J,w.current))},[]),de=c.useCallback((z,V)=>{const{layout:H,panelDataArray:E}=S.current,{collapsedSize:T=0,collapsible:K}=V,{collapsedSize:O=0,collapsible:Q,maxSize:B=100,minSize:ce=0}=z.constraints,{panelSize:J}=Ct(E,z,H);J!=null&&(K&&Q&&pt(J,T)?pt(T,O)||q(z,O):J<ce?q(z,ce):J>B&&q(z,B))},[q]),L=c.useCallback((z,V)=>{const{direction:H}=j.current,{layout:E}=S.current;if(!f.current)return;const T=Or(z,f.current);we(T,`Drag handle element not found for id "${z}"`);const K=jo(H,V);x({dragHandleId:z,dragHandleRect:T.getBoundingClientRect(),initialCursorPosition:K,initialLayout:E})},[]),Z=c.useCallback(()=>{x(null)},[]),R=c.useCallback(z=>{const{panelDataArray:V}=S.current,H=Gt(V,z);H>=0&&(V.splice(H,1),delete w.current[z.id],S.current.panelDataArrayChanged=!0,y())},[y]),X=c.useMemo(()=>({collapsePanel:P,direction:a,dragState:g,expandPanel:C,getPanelSize:M,getPanelStyle:_,groupId:m,isPanelCollapsed:A,isPanelExpanded:te,reevaluatePanelConstraints:de,registerPanel:W,registerResizeHandle:D,resizePanel:q,startDragging:L,stopDragging:Z,unregisterPanel:R,panelGroupElement:f.current}),[P,g,a,C,M,_,m,A,te,de,W,D,q,L,Z,R]),F={display:"flex",flexDirection:a==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return c.createElement(Br.Provider,{value:X},c.createElement(u,{...p,children:r,className:n,id:s,ref:f,style:{...F,...h},[De.group]:"",[De.groupDirection]:a,[De.groupId]:m}))}const Eo=c.forwardRef((e,r)=>c.createElement(To,{...e,forwardedRef:r}));To.displayName="PanelGroup";Eo.displayName="forwardRef(PanelGroup)";function Gt(e,r){return e.findIndex(n=>n===r||n.id===r.id)}function Ct(e,r,n){const a=Gt(e,r),s=a===e.length-1?[a-1,a]:[a,a+1],l=n[a];return{...r.constraints,panelSize:l,pivotIndices:s}}function Oh({disabled:e,handleId:r,resizeHandler:n,panelGroupElement:a}){c.useEffect(()=>{if(e||n==null||a==null)return;const o=Or(r,a);if(o==null)return;const s=l=>{if(!l.defaultPrevented)switch(l.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{l.preventDefault(),n(l);break}case"F6":{l.preventDefault();const d=o.getAttribute(De.groupId);we(d,`No group element found for id "${d}"`);const i=ar(d,a),h=ko(d,r,a);we(h!==null,`No resize element found for id "${r}"`);const u=l.shiftKey?h>0?h-1:i.length-1:h+1<i.length?h+1:0;i[u].focus();break}}};return o.addEventListener("keydown",s),()=>{o.removeEventListener("keydown",s)}},[a,e,r,n])}function Lo({children:e=null,className:r="",disabled:n=!1,hitAreaMargins:a,id:o,onBlur:s,onClick:l,onDragging:d,onFocus:i,onPointerDown:h,onPointerUp:u,style:p={},tabIndex:m=0,tagName:f="div",...g}){var x,k;const b=c.useRef(null),y=c.useRef({onClick:l,onDragging:d,onPointerDown:h,onPointerUp:u});c.useEffect(()=>{y.current.onClick=l,y.current.onDragging=d,y.current.onPointerDown=h,y.current.onPointerUp=u});const w=c.useContext(Br);if(w===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:v,groupId:N,registerResizeHandle:j,startDragging:S,stopDragging:P,panelGroupElement:C}=w,M=Xn(o),[_,A]=c.useState("inactive"),[te,W]=c.useState(!1),[D,q]=c.useState(null),de=c.useRef({state:_});Pt(()=>{de.current.state=_}),c.useEffect(()=>{if(n)q(null);else{const X=j(M);q(()=>X)}},[n,M,j]);const L=(x=a==null?void 0:a.coarse)!==null&&x!==void 0?x:15,Z=(k=a==null?void 0:a.fine)!==null&&k!==void 0?k:5;c.useEffect(()=>{if(n||D==null)return;const X=b.current;we(X,"Element ref not attached");let F=!1;return Th(M,X,v,{coarse:L,fine:Z},(V,H,E)=>{if(!H){A("inactive");return}switch(V){case"down":{A("drag"),F=!1,we(E,'Expected event to be defined for "down" action'),S(M,E);const{onDragging:T,onPointerDown:K}=y.current;T==null||T(!0),K==null||K();break}case"move":{const{state:T}=de.current;F=!0,T!=="drag"&&A("hover"),we(E,'Expected event to be defined for "move" action'),D(E);break}case"up":{A("hover"),P();const{onClick:T,onDragging:K,onPointerUp:O}=y.current;K==null||K(!1),O==null||O(),F||T==null||T();break}}})},[L,v,n,Z,j,M,D,S,P]),Oh({disabled:n,handleId:M,resizeHandler:D,panelGroupElement:C});const R={touchAction:"none",userSelect:"none"};return c.createElement(f,{...g,children:e,className:r,id:o,onBlur:()=>{W(!1),s==null||s()},onFocus:()=>{W(!0),i==null||i()},ref:b,role:"separator",style:{...R,...p},tabIndex:m,[De.groupDirection]:v,[De.groupId]:N,[De.resizeHandle]:"",[De.resizeHandleActive]:_==="drag"?"pointer":te?"keyboard":void 0,[De.resizeHandleEnabled]:!n,[De.resizeHandleId]:M,[De.resizeHandleState]:_})}Lo.displayName="PanelResizeHandle";var Uh=Object.defineProperty,Wh=Object.getOwnPropertyNames,Ae=(e,r)=>function(){return e&&(r=(0,e[Wh(e)[0]])(e=0)),r},Vh=(e,r)=>{for(var n in r)Uh(e,n,{get:r[n],enumerable:!0})};function Ye(...e){return fh(qs(e))}var wt=Ae({"src/components/graph-ui/utils.ts"(){}});function sr({asChild:e=!1,className:r,size:n,variant:a,...o}){const s=e?_s:"button";return t.jsx(s,{"data-slot":"button",className:Ye(Po({variant:a,size:n,className:r})),...o})}var Po,Ur=Ae({"src/components/graph-ui/Button.tsx"(){wt(),Po=ir("inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}})}});function zo(...e){return e.filter(Boolean).join(" ")}function Io({className:e,...r}){return t.jsx(Eo,{"data-slot":"resizable-panel-group",className:zo("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...r})}function zr({...e}){return t.jsx(co,{"data-slot":"resizable-panel",...e})}function Ro({withHandle:e,className:r,...n}){return t.jsx(Lo,{"data-slot":"resizable-handle",className:zo("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",r),...n,children:e?t.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:t.jsx(vd,{className:"size-2.5"})}):null})}var Ao=Ae({"src/components/graph-workspace/GraphResizablePanels.tsx"(){}});function Zn(...e){return e.filter(Boolean).join(" ")}function dr({...e}){return t.jsx(td,{"data-slot":"accordion",...e})}function cr({className:e,...r}){return t.jsx(rd,{"data-slot":"accordion-item",className:Zn("border-b last:border-b-0",e),...r})}function hr({className:e,children:r,...n}){return t.jsx(nd,{className:"flex",children:t.jsxs(ad,{"data-slot":"accordion-trigger",className:Zn("flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium outline-none transition-all hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",e),...n,children:[r,t.jsx(Ms,{className:"pointer-events-none size-4 shrink-0 translate-y-0.5 text-[var(--theme-fg-muted)] transition-transform duration-200"})]})})}function ur({className:e,children:r,...n}){return t.jsx(sd,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:t.jsx("div",{className:Zn("pb-4 pt-0",e),children:r})})}var mr=Ae({"src/components/graph-workspace/GraphAccordion.tsx"(){}});function qh(e){var n;const r=[];for(const a of e.turns)for(const o of a.items)o.kind==="artifact"&&o.artifact&&r.push(o.artifact);for(const a of((n=e.liveItems)==null?void 0:n.items)??[])a.kind==="artifact"&&a.artifact&&r.push(a.artifact);return r}function Kh(e){return e.trim().replace(/^\/+|\/+$/g,"").replace(/[^\w.-]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function pr(e){var r;return((r=e.split(".").pop())==null?void 0:r.toLowerCase())||""}function Xh(e){return e.split("/").filter(Boolean).at(-1)??e}function Mo(e){const r=e.kind==="directory"?"directory":"file";return{id:`workspace:${e.path}`,name:e.name,path:e.path,kind:r,...e.size!==void 0?{size:e.size}:{},workspaceNode:e,children:(e.children??[]).map(Mo)}}function _o(e){if(e.kind==="file")return e;for(const r of e.children){const n=_o(r);if(n)return n}return null}function Ln(e,r){return!e||!r?!1:e.path===r?!0:e.children.some(n=>Ln(n,r))}function Yh(e){if(!e)return null;const r=pr(e.path);return Jn.has(r)?{content:[e.content.endsWith(`
3
+ `)?e.content:`${e.content}
4
+ `],format:r==="extxyz"?"xyz":r,name:e.name,uuid:e.path}:null}function Zh(e){const r=pr(e);return r==="tsx"||r==="jsx"?"tsx":r==="yml"?"yaml":r||"text"}function Jh(e,r){let n=e,a="";for(const o of r){a=a?`${a}/${o}`:o;let s=n.children.find(l=>l.kind==="directory"&&l.name===o);s||(s={id:`dir:${a}`,name:o,path:a,kind:"directory",children:[]},n.children.push(s)),n=s}return n}function Qh(e,r,n){const a=r.split("/").filter(Boolean),o=a.pop()??n.name;Jh(e,a).children.push({...n,name:n.name||o,path:r})}function eu(e,r){return e.kind==="directory"&&r.kind!=="directory"?-1:e.kind!=="directory"&&r.kind==="directory"?1:e.name.localeCompare(r.name)}function $o(e){e.children.sort(eu);for(const r of e.children)$o(r);return e}function Ga(e,r,n,a){var u;const o={id:"root",name:e.workspace.label??"Workspace",path:"",kind:"directory",children:[]},s={id:"artifacts",name:"artifacts",path:"artifacts",kind:"directory",children:[]};for(const p of r){const m=p.title||p.id,f=Kh(m)||p.id;s.children.push({id:`artifact:${p.id}`,name:`${f}.artifact`,path:`artifacts/${f}.artifact`,kind:"artifact",artifact:p,preview:p.summaryText??p.type,detail:JSON.stringify(p.payload,null,2),children:[]})}const l={id:"thread-events",name:"thread-events",path:"thread-events",kind:"directory",children:[]},d={id:"live",name:"live",path:"live",kind:"directory",children:[]};let i=0;const h=(p,m,f=!1)=>{i+=1;const g=m.kind.replace(/([A-Z])/g,"-$1").toLowerCase(),x=`${f?"live":`thread-events/${p}`}/${String(i).padStart(3,"0")}-${g}.json`,k="text"in m&&typeof m.text=="string"?m.text.slice(0,160):m.kind,b=m.kind==="artifact"&&m.artifact?m.artifact:null,y=b&&f?{id:`live-artifact:${b.id}`,name:b.title||b.id,path:x,kind:"live-artifact",artifact:b,item:m,preview:b.summaryText??b.type,detail:JSON.stringify(b.payload,null,2),children:[]}:{id:`event:${m.id}`,name:Xh(x),path:x,kind:"event",item:m,preview:k,detail:JSON.stringify(m,null,2),children:[]};if(f){d.children.push(y);return}Qh(l,x.replace(/^thread-events\//,""),y)};for(const p of e.turns)for(const m of p.items)(m.kind==="commandExecution"||m.kind==="webSearch"||m.kind==="fileRead"||m.kind==="fileChange"||m.kind==="agentToolCall"||m.kind==="skillToolCall"||m.kind==="toolCall"||m.kind==="hook"||m.kind==="plan"||m.kind==="reasoning")&&h(p.id,m);for(const p of((u=e.liveItems)==null?void 0:u.items)??[])h(e.thread.activeTurnId??"live",p,!0);return o.children.push(s,l,d),$o(o)}function tu(e){const r=new Map,n=a=>{r.set(a.id,a);for(const o of a.children)n(o)};return n(e),r}function Do(e){if(e.kind==="artifact"||e.kind==="live-artifact"||e.kind==="event"||e.kind==="file")return e;for(const r of e.children){const n=Do(r);if(n)return n}return null}function Fa(e){const r=e.split("/").filter(Boolean),n=[];for(let a=1;a<=r.length;a+=1)n.push(r.slice(0,a).join("/"));return n}var Jn,Bo,Go,Qn=Ae({"src/components/graph-workspace/workspaceTree.ts"(){Jn=new Set(["xyz","extxyz","cif","pdb"]),Bo=new Set(["png","jpg","jpeg","gif","webp","svg"]),Go=new Set(["pdf"])}});function Ft({label:e,children:r}){return t.jsxs("section",{className:"thread-workspace-card rounded-lg border p-3",children:[t.jsx("p",{className:"text-xs font-medium uppercase tracking-[0.14em] text-[var(--theme-fg-muted)]",children:e}),t.jsx("div",{className:"mt-2 text-sm text-[var(--theme-fg)]",children:r})]})}var Fo=Ae({"src/components/graph-workspace/GraphWorkspaceCards.tsx"(){}});function ru({className:e,decorative:r=!0,orientation:n="horizontal",...a}){return t.jsx(dc,{"data-slot":"separator",decorative:r,orientation:n,className:Ye("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...a})}var nu=Ae({"src/components/graph-ui/Separator.tsx"(){wt()}});function au({className:e,orientation:r,...n}){return t.jsx("div",{role:"group","data-slot":"button-group","data-orientation":r,className:Ye(Ho({orientation:r}),e),...n})}function su({className:e,orientation:r="vertical",...n}){return t.jsx(ru,{"data-slot":"button-group-separator",orientation:r,className:Ye("relative !m-0 self-stretch bg-input data-[orientation=vertical]:h-auto",e),...n})}var Ho,Oo=Ae({"src/components/graph-ui/ButtonGroup.tsx"(){nu(),wt(),Ho=ir("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}})}});function ou({delayDuration:e=0,...r}){return t.jsx(cc,{"data-slot":"tooltip-provider",delayDuration:e,...r})}function lu({...e}){return t.jsx(ou,{children:t.jsx(ac,{"data-slot":"tooltip",...e})})}function iu({...e}){return t.jsx(sc,{"data-slot":"tooltip-trigger",...e})}function du({children:e,className:r,sideOffset:n=0,...a}){return t.jsx(oc,{children:t.jsxs(lc,{"data-slot":"tooltip-content",sideOffset:n,className:Ye("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md bg-foreground px-3 py-1.5 text-balance text-xs text-background animate-in fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",r),...a,children:[e,t.jsx(ic,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}var cu=Ae({"src/components/graph-ui/Tooltip.tsx"(){wt()}});function hu(e){return(e==null?void 0:e.trim().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""))||"molecule"}function Ha(e,r){const n=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(n),o=document.createElement("a");o.href=a,o.download=r,o.click(),URL.revokeObjectURL(a)}function Ge({children:e,disabled:r,label:n,onClick:a}){return t.jsxs(lu,{children:[t.jsx(iu,{asChild:!0,children:t.jsx(sr,{type:"button",variant:"outline",size:"icon",className:"thread-graph-molecule-button size-8",disabled:r,onClick:a,title:n,"aria-label":n,children:e})}),t.jsx(du,{children:t.jsx("p",{children:n})})]})}function Pn({children:e,className:r=""}){return t.jsx(au,{className:`thread-graph-molecule-button-group ${r}`,children:e})}var Uo=Ae({"src/components/graph-workspace/GraphMoleculeViewerControls.tsx"(){Ur(),Oo(),cu()}});function uu({cameraInfo:e,onClearSelection:r,onClearStaged:n,onSendSelection:a,onSendStaged:o,onStageSelection:s,onToggleUnitCell:l,selectedAtomLabels:d,selectedSerials:i,stagedAtoms:h,stagedMolecules:u,unitCellAvailable:p,unitCellVisible:m}){const f=i.length>0,g=h>0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex w-full justify-between gap-2 overflow-x-auto",children:[t.jsxs(Pn,{children:[t.jsx(Ge,{label:"Distance",children:t.jsx(Kd,{className:"size-4"})}),t.jsx(Ge,{label:"Connectivity",children:t.jsx(Xd,{className:"size-4"})}),t.jsx(Ge,{label:"Angle",children:t.jsx(Yd,{className:"size-4"})}),t.jsx(Ge,{label:"Dihedral",children:t.jsx(Zd,{className:"size-4"})}),t.jsx(Ge,{label:"Add dummy atoms",children:t.jsx(Jd,{className:"size-4"})}),t.jsx(Ge,{label:"Delete atoms",children:t.jsx(or,{className:"size-4"})}),t.jsx(Ge,{label:"Rotate",children:t.jsx(Qd,{className:"size-4"})})]}),t.jsxs(Pn,{children:[t.jsx(Ge,{label:m?"Hide unit cell":"Show unit cell",disabled:!p,onClick:l,children:t.jsx(ec,{className:"size-4"})}),t.jsx(Ge,{label:"Clear selection",disabled:!f,onClick:r,children:t.jsx(lr,{className:"size-4"})}),t.jsx(Ge,{label:"Send selection",disabled:!f,onClick:a,children:t.jsx(tc,{className:"size-4"})}),t.jsx(Ge,{label:"Stage current selection",disabled:!f,onClick:s,children:t.jsx(Os,{className:"size-4"})}),t.jsx(Ge,{label:"Clear staged selections",disabled:!g,onClick:n,children:t.jsx(rc,{className:"size-4"})}),t.jsx(Ge,{label:"Send staged selections",disabled:!g,onClick:o,children:t.jsx(nc,{className:"size-4"})})]})]}),e?t.jsxs("div",{className:"thread-graph-molecule-camera",children:[t.jsxs("div",{children:[t.jsx("strong",{children:"XYZ: "}),"x=",e.position.x.toFixed(1)," y=",e.position.y.toFixed(1)," z=",e.position.z.toFixed(1),t.jsx("br",{}),t.jsx("strong",{children:"Quat: "}),"qx=",e.position.qx.toFixed(2)," qy=",e.position.qy.toFixed(2)," qz=",e.position.qz.toFixed(2)," qw=",e.position.qw.toFixed(2)]}),t.jsx("div",{className:"thread-graph-molecule-camera-divider"}),t.jsxs("div",{className:"flex flex-col gap-1 text-[10px]",children:[t.jsxs("div",{children:["Selected atoms:"," ",i.length>0?i.map(x=>`${d[x]??"Atom"}(${x})`).join(", "):"None"]}),t.jsxs("div",{children:["Staged: ",u," molecule(s), ",h," atom(s)"]})]})]}):null]})}var mu=Ae({"src/components/graph-workspace/GraphMoleculeViewerLowerButtonGroup.tsx"(){Uo()}});function pu({currentIndex:e,exportContent:r,moleculeId:n,onScreenshot:a,viewerRef:o,xyzContent:s,xyzFormat:l}){const d=hu(n);async function i(){s&&await navigator.clipboard.writeText(s)}function h(){s&&Ha(s,`${d}_step_${e+1}.${l||"xyz"}`)}function u(){r&&Ha(r,`${d}_trajectory.${l||"xyz"}`)}function p(){o.current&&(o.current.zoom(1.2),o.current.render())}function m(){o.current&&(o.current.zoom(.8),o.current.render())}function f(){o.current&&(o.current.zoomTo(),o.current.setCameraParameters({}),o.current.render())}return t.jsxs(Pn,{className:"ml-auto justify-end",children:[t.jsx(Ge,{label:"Copy current structure",onClick:()=>void i(),disabled:!s,children:t.jsx(Mr,{className:"size-3.5"})}),t.jsx(Ge,{label:"Download current structure",onClick:h,disabled:!s,children:t.jsx(Sn,{className:"size-3.5"})}),t.jsx(Ge,{label:"Download full trajectory",onClick:u,disabled:!r,children:t.jsx(Os,{className:"size-3.5"})}),t.jsx(Ge,{label:"Copy screenshot",onClick:a,disabled:!o.current||!s,children:t.jsx(Gd,{className:"size-3.5"})}),t.jsx(su,{className:"thread-graph-molecule-button-divider"}),t.jsx(Ge,{label:"Zoom in",onClick:p,disabled:!o.current||!s,children:t.jsx(Fd,{className:"size-3.5"})}),t.jsx(Ge,{label:"Zoom out",onClick:m,disabled:!o.current||!s,children:t.jsx(Hd,{className:"size-3.5"})}),t.jsx(Ge,{label:"Reset camera",onClick:f,disabled:!o.current||!s,children:t.jsx(Od,{className:"size-3.5"})})]})}var fu=Ae({"src/components/graph-workspace/GraphMoleculeViewerUpperButtonGroup.tsx"(){Oo(),Uo()}});async function gu(){if(typeof window>"u")throw new Error("3Dmol is only available in a browser environment.");return window["3Dmol"]?window["3Dmol"]:(jr||(jr=new Promise((e,r)=>{const n=document.querySelector('script[data-remote-codex-3dmol="true"]'),a=()=>{if(window["3Dmol"]){e(window["3Dmol"]);return}r(new Error("3Dmol loaded without exposing the expected global."))};if(n){n.addEventListener("load",a,{once:!0}),n.addEventListener("error",()=>r(new Error("Unable to load 3Dmol viewer runtime.")),{once:!0});return}const o=document.createElement("script");o.src="/vendor/3Dmol-min.js",o.async=!0,o.dataset.remoteCodex3dmol="true",o.addEventListener("load",a,{once:!0}),o.addEventListener("error",()=>r(new Error("Unable to load 3Dmol viewer runtime.")),{once:!0}),document.head.appendChild(o)})),jr)}var jr,xu=Ae({"src/components/graph-workspace/load3Dmol.ts"(){jr=null}});function bu({className:e,defaultValue:r,max:n=100,min:a=0,value:o,...s}){const l=c.useMemo(()=>Array.isArray(o)?o:Array.isArray(r)?r:[a,n],[r,n,a,o]);return t.jsxs(Ud,{"data-slot":"slider",...r!==void 0?{defaultValue:r}:{},...o!==void 0?{value:o}:{},min:a,max:n,className:Ye("relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e),...s,children:[t.jsx(Wd,{"data-slot":"slider-track",className:"relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5",children:t.jsx(Vd,{"data-slot":"slider-range",className:"absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"})}),Array.from({length:l.length},(d,i)=>t.jsx(qd,{"data-slot":"slider-thumb",className:"block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:outline-hidden focus-visible:ring-4 disabled:pointer-events-none disabled:opacity-50"},i))]})}var vu=Ae({"src/components/graph-ui/Slider.tsx"(){wt()}});function ku(e){const r=e==null?void 0:e.trim().toLowerCase();return!r||r==="extxyz"?"xyz":r}function wu(e){var o,s;const r=e.replace(/\r\n/g,`
5
+ `).replace(/\r/g,`
6
+ `).split(`
7
+ `),n=[];let a=0;for(;a<r.length;){for(;a<r.length&&((o=r[a])==null?void 0:o.trim())==="";)a+=1;if(a>=r.length)break;const l=Number.parseInt(((s=r[a])==null?void 0:s.trim())??"",10);if(!Number.isFinite(l)||l<0)return[e];const d=l+2;if(a+d>r.length)return[e];n.push(`${r.slice(a,a+d).join(`
8
+ `)}
9
+ `),a+=d}return n.length>0?n:[e]}function Oa(e,r){return r!=="xyz"?e:e.flatMap(n=>wu(n))}function Ua(e){return e.map(r=>`${r.replace(/\s+$/g,"")}
10
+ `).join("")}function yu(e){if(!e)return{format:"xyz",frames:[],exportContent:""};if(typeof e=="string"){const o=Oa([e],"xyz");return{frames:o,format:"xyz",exportContent:Ua(o)}}const r=ku(e.format),n=e.content.filter(o=>o.trim().length>0);return{frames:Oa(n,r),format:r,exportContent:Ua(n)}}var ju=Ae({"src/components/graph-workspace/GraphMoleculeViewerData.ts"(){}});function Nu({className:e="",moleculeId:r=null,onScreenshot:n,onSelectionChange:a,source:o,title:s="PyMOL-style (PDB/CIF)"}){const l=c.useRef(null),d=c.useRef(null),i=c.useRef(null),h=c.useRef(!1),u=c.useRef(!0),[p,m]=c.useState(null),[f,g]=c.useState(0),[x,k]=c.useState(null),[b,y]=c.useState(!1),[w,v]=c.useState({}),[N,j]=c.useState([]),[S,P]=c.useState({}),[C,M]=c.useState(!1),[_,A]=c.useState(!1),[te,W]=c.useState(null),D=c.useMemo(()=>yu(o),[o]),q=D.frames,de=D.format,L=q[f]??null,Z=q.length>0&&f===q.length-1,R=r??"current",X=Object.values(S).reduce((E,T)=>E+T.length,0),F=Object.keys(S).length;c.useEffect(()=>{if(q.length===0){g(0);return}g(q.length-1)},[q.length]),c.useEffect(()=>{if(!b||q.length<=1)return;const E=window.setInterval(()=>{g(T=>T>=q.length-1?(window.clearInterval(E),y(!1),T):T+1)},200);return()=>window.clearInterval(E)},[b,q.length]),c.useEffect(()=>{const E=l.current;if(!E||d.current)return;let T=!1;try{const O=document.createElement("canvas");if(!(O.getContext("webgl2")||O.getContext("webgl")||O.getContext("experimental-webgl"))){W("WebGL is unavailable in this browser environment. Unable to render 3D viewer.");return}}catch{W("WebGL is unavailable in this browser environment. Unable to render 3D viewer.");return}const K=()=>{var O,Q;(O=d.current)==null||O.resize(),(Q=d.current)==null||Q.render()};return gu().then(O=>{if(!(T||d.current))try{const Q=O.createViewer(E,{});d.current=Q,Q.setBackgroundColor("#f8fafc",.8),window.addEventListener("resize",K),window.setTimeout(K,100)}catch(Q){console.error("Failed to initialize 3Dmol viewer:",Q),W("Failed to initialize 3D viewer. Please refresh or try another browser.")}}).catch(O=>{console.error("Failed to load 3Dmol viewer runtime:",O),W("Failed to load 3D viewer runtime. Please refresh or try another browser.")}),()=>{T=!0,window.removeEventListener("resize",K),d.current=null,i.current=null}},[]),c.useEffect(()=>{const E=d.current;if(!(!E||!L))try{E.removeAllModels(),E.removeAllShapes(),E.removeAllLabels();const T=E.addModel(L,de||"xyz");i.current=T,T.setStyle({},{stick:{radius:.2},sphere:{scale:.3}});const K=T.getCrystData(),O=!!(K&&typeof K=="object"&&Object.keys(K).length);M(O),A(O?u.current:!1),j([]),v({});const Q=L.split(`
11
+ `).slice(2).map(B=>B.trim()).filter(Boolean).map(B=>B.split(/\s+/)[0]??"Atom");h.current||(E.zoomTo(),h.current=!0),T.setClickable({},!0,(B,ce,J)=>{const se=B.serial??B.index;if(se===void 0)return;const ue=B.atom||B.elem||Q[se]||"Atom";j(fe=>{const Y=!!(J!=null&&J.shiftKey||J!=null&&J.metaKey||J!=null&&J.ctrlKey)?fe.includes(se)?fe.filter(G=>G!==se):[...fe,se]:fe.length===1&&fe[0]===se?[]:[se];return v(G=>{if(Y.length===0)return{};const re={};return Y.forEach(le=>{re[le]=G[le]||Q[le]||ue}),re}),Y})}),T.setHoverable({},!0,(B,ce,J)=>{!J||!B||k({x:J.clientX,y:J.clientY,label:`${B.atom||B.elem||"Atom"} (${B.serial??B.index??"?"})`,coords:{x:B.x.toFixed(2),y:B.y.toFixed(2),z:B.z.toFixed(2)}})},()=>k(null)),E.render()}catch(T){console.error("Failed to render molecule:",T),W("Unable to render this molecular structure.")}},[L,de]),c.useEffect(()=>{const E=d.current,T=i.current;if(!(!E||!T)){try{E.removeUnitCell(T)}catch{}if(_&&C)try{E.addUnitCell(T,{box:{color:"black",opacity:1,linewidth:5},astyle:{radius:.12,mid:.85,color:"red",opacity:.6},bstyle:{radius:.12,mid:.85,color:"green",opacity:.6},cstyle:{radius:.12,mid:.85,color:"blue",opacity:.6},alabel:"a",blabel:"b",clabel:"c"})}catch{M(!1),A(!1)}E.render()}},[C,_,L,de]),c.useEffect(()=>{const E=d.current,T=i.current;!E||!T||!L||(T.setStyle({},{stick:{radius:.2},sphere:{scale:.3}}),N.length>0&&T.setStyle({serial:N},{stick:{radius:.3,color:"yellow"},sphere:{scale:.4,color:"yellow"}}),E.render(),a==null||a({moleculeId:r,atoms:N}))},[r,a,N,L]),c.useEffect(()=>{if(!L)return;let E=0;const T=()=>{var O,Q;const K=(Q=(O=d.current)==null?void 0:O.getView)==null?void 0:Q.call(O);if(Array.isArray(K)&&K.length>=8){const[B,ce,J,se,ue,fe,Ne,Y]=K;if(typeof B=="number"&&typeof ce=="number"&&typeof J=="number"&&typeof se=="number"&&typeof ue=="number"&&typeof fe=="number"&&typeof Ne=="number"&&typeof Y=="number"){const G=Math.sqrt(ue*ue+fe*fe+Ne*Ne),re=G>0?{x:ue/G,y:fe/G,z:Ne/G}:{x:0,y:0,z:0};m({position:{x:B,y:ce,z:J,qx:ue,qy:fe,qz:Ne,qw:Y},lookAt:re,zoom:se})}}E=window.requestAnimationFrame(T)};return E=window.requestAnimationFrame(T),()=>window.cancelAnimationFrame(E)},[L]);const z=c.useCallback(async()=>{const E=d.current;if(!(E!=null&&E.pngURI))return;E.render();const T=E.pngURI();if(T){try{const O=await(await fetch(T)).blob(),Q=new ClipboardItem({[O.type||"image/png"]:O});await navigator.clipboard.write([Q])}catch{}n==null||n({moleculeId:r,image:T})}},[r,n]);function V(){C&&A(E=>{const T=!E;return u.current=T,T})}function H(){N.length!==0&&P(E=>{const T=E[R]??[];return{...E,[R]:Array.from(new Set([...T,...N]))}})}return t.jsxs("div",{className:`thread-graph-molecule-viewer flex h-full min-h-0 flex-col bg-white ${e}`,children:[t.jsxs("div",{className:"thread-graph-molecule-header flex shrink-0 items-center justify-between gap-3 border-b border-slate-200 px-3 py-2 sm:px-4 sm:py-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"truncate text-sm font-semibold text-slate-900",children:s}),t.jsx("p",{className:"mt-1 hidden text-[11px] text-slate-400 sm:block",children:"cartoon + surface"})]}),t.jsx("span",{className:"shrink-0 text-[11px] text-slate-400",children:"workspace preview"})]}),t.jsxs("div",{className:"thread-graph-molecule-body min-h-0 flex-1",children:[t.jsxs("div",{ref:l,"data-testid":"molecule-viewer",className:"thread-graph-molecule-stage relative min-h-0 flex-1 overflow-hidden",children:[te?t.jsx("div",{"data-testid":"molecule-viewer-error",className:"thread-graph-molecule-error absolute inset-0 flex items-center justify-center bg-red-50 p-4 text-sm text-red-700",children:te}):null,!te&&!L?t.jsx("div",{className:"thread-graph-molecule-empty absolute inset-0 flex items-center justify-center p-4 text-sm text-slate-400",children:"No molecule data available."}):null,x?t.jsxs("div",{className:"thread-graph-molecule-tooltip pointer-events-none fixed z-[1000] rounded-md border border-gray-300 bg-white/95 px-2 py-1.5 text-[10px] text-gray-800 shadow-md",style:{left:x.x-20,top:x.y-50},children:[t.jsx("div",{className:"mb-0.5 font-semibold text-gray-900",children:x.label}),t.jsxs("div",{className:"space-x-2 text-gray-600",children:[t.jsxs("span",{children:["x: ",x.coords.x]}),t.jsxs("span",{children:["y: ",x.coords.y]}),t.jsxs("span",{children:["z: ",x.coords.z]})]})]}):null]}),t.jsxs("div",{className:"thread-graph-molecule-controls shrink-0",children:[t.jsxs("div",{className:"thread-graph-molecule-control-row",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"thread-graph-molecule-control-title",children:"Ball & Stick"}),t.jsx("p",{className:"thread-graph-molecule-control-subtitle",children:"XYZ / PDB / CIF preview"})]}),t.jsx(pu,{currentIndex:f,exportContent:D.exportContent,moleculeId:r,onScreenshot:()=>void z(),viewerRef:d,xyzContent:L,xyzFormat:de})]}),q.length>1?t.jsxs("div",{className:"thread-graph-molecule-trajectory",children:[t.jsxs("div",{className:"mb-2 flex justify-between gap-3 text-xs",children:[t.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:["Trajectory ",f+1," / ",q.length,t.jsx(sr,{type:"button",variant:"ghost",size:"icon",className:"thread-graph-molecule-button h-5 w-5",onClick:()=>{y(E=>{const T=!E;return T&&f===q.length-1&&g(0),T})},"aria-label":b?"Pause trajectory":"Play trajectory",title:b?"Pause trajectory":"Play trajectory",children:b&&f!==q.length-1?t.jsx(Md,{className:"h-3 w-3"}):t.jsx(_d,{className:"h-3 w-3"})})]}),t.jsxs(sr,{type:"button",variant:"ghost",onClick:()=>g(q.length-1),className:"thread-graph-molecule-live-button",children:[t.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${Z?"animate-pulse bg-red-600":"bg-gray-300"}`}),"Live"]})]}),t.jsx(bu,{value:[f],max:q.length-1,step:1,onValueChange:E=>g(E[0]??0),"aria-label":"Trajectory frame"})]}):null,t.jsx(uu,{cameraInfo:p,onClearSelection:()=>j([]),onClearStaged:()=>P({}),onSendSelection:()=>a==null?void 0:a({moleculeId:r,atoms:N}),onSendStaged:()=>{Object.entries(S).forEach(([E,T])=>{a==null||a({moleculeId:E==="current"?r:E,atoms:T})})},onStageSelection:H,onToggleUnitCell:V,selectedAtomLabels:w,selectedSerials:N,stagedAtoms:X,stagedMolecules:F,unitCellAvailable:C,unitCellVisible:_})]})]})]})}var Cu=Ae({"src/components/graph-workspace/GraphMoleculeViewer.tsx"(){mu(),fu(),xu(),Ur(),vu(),ju()}});function Su(e){return e&&(e.node.path||e.node.name)||null}function Tu(e){if(!e)return null;switch(e.kind){case"live-artifact":return{kind:"live-molecule",node:e};case"file":return{kind:"workspace-file",node:e};case"artifact":return{kind:"artifact",node:e};case"event":return{kind:"event",node:e};case"meta":return{kind:"meta",node:e};case"directory":return null}}function Eu({error:e,imageUrl:r,loadingMore:n,onLoadMore:a,onCollapse:o,pdfUrl:s,previewFile:l,previewLoading:d,plugins:i,selectedTarget:h}){const u=(h==null?void 0:h.node)??null,p=u!=null&&u.artifact?i.renderArtifact({artifact:u.artifact,expanded:!0,onToggleExpanded:()=>{}}):null,m=Yh(l??null),f=(l==null?void 0:l.language)||Zh((l==null?void 0:l.path)??""),g=l?pr(l.path):"",x=Su(h),k=l!==null&&Jn.has(g),b=(h==null?void 0:h.kind)==="live-molecule",y=!!(u!=null&&u.artifact&&p),w=!!m||y;return t.jsxs("section",{className:"thread-graph-viewer flex h-full min-h-0 flex-col overflow-hidden rounded-[12px]","data-preview-target-kind":(h==null?void 0:h.kind)??"none",children:[t.jsxs("div",{className:"thread-graph-viewer-header flex h-12 shrink-0 items-center justify-between gap-3 border-b px-3 sm:h-[60px] sm:px-5",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[t.jsx("h2",{className:"text-base font-semibold text-slate-900 sm:text-[18px] dark:text-slate-100",children:"Viewer"}),x?t.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-slate-500 dark:text-slate-400",children:x}):null]}),o?t.jsx("button",{type:"button",onClick:o,"data-testid":"collapse-viewer",className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-slate-500 transition hover:bg-slate-100 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-[#222733] dark:hover:text-slate-100",title:"Collapse workspace","aria-label":"Collapse workspace",children:t.jsx(Sr,{className:"h-4 w-4"})}):null]}),t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[e?t.jsx("div",{className:"border-b border-rose-200 bg-rose-50 px-5 py-3 text-sm text-rose-700 dark:border-rose-400/25 dark:bg-rose-400/10 dark:text-rose-200",children:e}):null,h?h.kind==="workspace-file"&&d?t.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center px-5 text-center text-sm text-slate-400 dark:text-slate-500",children:"Loading file preview..."}):h.kind==="workspace-file"&&m?t.jsx("div",{className:"thread-graph-molecule-preview min-h-0 flex-1 overflow-hidden",children:t.jsx(Nu,{source:m,moleculeId:m.uuid??h.node.path,title:"PyMOL-style (PDB/CIF)"})}):h.kind==="workspace-file"&&r?t.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-auto p-5",children:t.jsx("img",{src:r,alt:h.node.path||h.node.name,className:"max-h-full max-w-full object-contain"})}):h.kind==="workspace-file"&&s?t.jsx("div",{className:"thread-graph-file-preview-frame min-h-0 flex-1 overflow-hidden",children:t.jsx("iframe",{src:s,title:`PDF preview: ${h.node.path||h.node.name}`,className:"h-full w-full border-0"})}):h.kind==="workspace-file"&&l?t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[t.jsxs("div",{className:"thread-graph-file-preview-header border-b px-4 py-3 text-xs uppercase tracking-[0.12em]",children:[k?"molecule":f||g||"text"," |"," ",l.size.toLocaleString()," bytes",l.truncated?t.jsxs("span",{className:"ml-2 text-amber-500",children:["showing ",l.nextOffset.toLocaleString()," bytes"]}):null]}),t.jsx(Nr,{content:l.content}),l.truncated&&a?t.jsx("div",{className:"thread-graph-file-preview-footer flex justify-center border-t px-4 py-3",children:t.jsx("button",{type:"button",onClick:a,disabled:n,className:"thread-graph-load-more-button rounded-md px-4 py-1.5 text-xs disabled:opacity-50",children:n?"Loading...":`Load more (${(l.size-l.nextOffset).toLocaleString()} bytes remaining)`})}):null]}):(h.kind==="live-molecule"||h.kind==="artifact")&&h.node.artifact?t.jsx("div",{className:w||b?"min-h-0 flex-1 overflow-hidden":"min-h-0 flex-1 overflow-auto p-3",children:p}):h.kind==="meta"?t.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-3",children:t.jsx("div",{className:"grid gap-3",children:t.jsx(Ft,{label:"Workspace Data",children:t.jsx(Nr,{content:h.node.detail??""})})})}):t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[t.jsx("div",{className:"thread-graph-file-preview-header border-b px-4 py-3 text-xs uppercase tracking-[0.12em]",children:h.node.kind}),t.jsx(Nr,{content:h.node.detail??h.node.preview??h.node.name})]}):t.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center px-5 text-center text-sm text-slate-400 dark:text-slate-500",children:"Pick a live molecule, workspace file, artifact, or thread event to preview it."})]})]})}var Nr,Lu=Ae({"src/components/graph-workspace/GraphWorkspacePreviewPane.tsx"(){Qn(),Fo(),Cu(),Nr=c.memo(function({content:r}){return t.jsx("div",{className:"thread-graph-code-preview min-h-0 flex-1 overflow-auto",children:t.jsx("pre",{className:"thread-graph-plain-code-preview",children:t.jsx("code",{children:r})})})})}});function Pu({files:e,onCancel:r,onConfirm:n}){return t.jsx("div",{className:"thread-graph-dialog-backdrop fixed inset-0 z-50 flex items-center justify-center bg-black/40 px-4",children:t.jsxs("div",{className:"thread-graph-dialog w-full max-w-sm rounded-xl border bg-[var(--theme-panel)] p-6 shadow-xl",children:[t.jsx("h3",{className:"text-base font-semibold text-[var(--theme-fg)]",children:"Empty garbage?"}),t.jsxs("p",{className:"mt-1 text-sm leading-5 text-[var(--theme-fg-muted)]",children:["Permanently delete all files in the"," ",t.jsx("code",{className:"rounded bg-[var(--theme-muted)] px-1 text-xs text-[var(--theme-fg-soft)]",children:"garbage/"})," ","folder."]}),e.length===0?t.jsx("p",{className:"mt-3 text-sm text-[var(--theme-fg-muted)]",children:"Garbage is empty."}):t.jsx("ul",{className:"mt-3 max-h-40 overflow-y-auto rounded-md border border-[var(--theme-border)] bg-[var(--theme-surface)] p-2 text-xs text-[var(--theme-fg-soft)]",children:e.map(a=>t.jsx("li",{className:"truncate py-0.5",title:a,children:a},a))}),t.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[t.jsx("button",{type:"button",onClick:r,className:"thread-secondary-action rounded-md px-3 py-1.5 text-sm",children:"Cancel"}),e.length>0?t.jsx("button",{type:"button",onClick:n,className:"ui-action-danger rounded-md px-3 py-1.5 text-sm font-medium",children:"Yes, empty garbage"}):null]})]})})}var zu=Ae({"src/components/graph-workspace/GraphEmptyGarbageDialog.tsx"(){}});function Wo(e){return`${qo}${e.workspaceId??"workspace"}:${e.threadId}`}function Iu(e){if(typeof window>"u")return[];try{const r=window.localStorage.getItem(Wo(e));if(!r)return[];const n=JSON.parse(r);return Array.isArray(n)?n.filter(a=>typeof a=="string"):[]}catch{return[]}}function Ru(e,r){if(!(typeof window>"u"))try{window.localStorage.setItem(Wo(e),JSON.stringify([...r]))}catch{}}function Wa(e,r){if(e.kind==="directory")return r?t.jsx(Gs,{className:"h-4 w-4 text-slate-500 dark:text-slate-400"}):t.jsx($d,{className:"h-4 w-4 text-slate-500 dark:text-slate-400"});const n=pr(e.name);return n==="zip"?t.jsx(Dd,{className:"h-4 w-4 text-amber-600"}):e.kind==="file"&&["png","jpg","jpeg","gif","webp","svg"].includes(n)?t.jsx(Fs,{className:"h-4 w-4 text-sky-500"}):e.kind==="artifact"||["xyz","extxyz","cif","pdf","json","ts","tsx","js","jsx","md","yaml","yml","py"].includes(n)?t.jsx(Hs,{className:"h-4 w-4 text-emerald-600"}):t.jsx(Bd,{className:"h-4 w-4 text-slate-400 dark:text-slate-500"})}function Vo({depth:e,expandedPaths:r,node:n,onDownload:a,onSelect:o,onToggle:s,selectedNodeId:l}){const d=n.kind==="directory",i=d&&(n.path===""||r.has(n.path)),h=l===n.id,u=`${e*.75+.5}rem`;return d?t.jsxs("div",{children:[t.jsxs("div",{className:"thread-graph-tree-row group flex items-center text-sm text-slate-600 transition hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-[#222733] dark:hover:text-slate-100",children:[t.jsxs("button",{type:"button",onClick:()=>s(n.path),className:"flex min-h-9 min-w-0 flex-1 items-center gap-2 px-2 py-2 text-left sm:min-h-0 sm:py-1.5",style:{paddingLeft:u},children:[i?t.jsx(Ms,{className:"h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500"}):t.jsx(Ad,{className:"h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500"}),Wa(n,i),t.jsx("span",{className:"truncate",children:n.name})]}),a?t.jsx("button",{type:"button",onClick:()=>a(n),className:"thread-graph-tree-action mr-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-slate-400 transition hover:bg-white hover:text-slate-900 sm:h-7 sm:w-7 sm:opacity-0 sm:group-hover:opacity-100 sm:focus:opacity-100 dark:text-slate-500 dark:hover:bg-[#1d222c] dark:hover:text-slate-100",title:n.path?`Download ${n.name}`:"Download workspace","aria-label":n.path?`Download ${n.name}`:"Download workspace",children:t.jsx(Sn,{className:"h-3.5 w-3.5"})}):null]}),i?t.jsx("div",{children:n.children.map(p=>t.jsx(Vo,{depth:e+1,expandedPaths:r,node:p,...a?{onDownload:a}:{},onSelect:o,onToggle:s,selectedNodeId:l},p.id))}):null]}):t.jsxs("div",{className:`thread-graph-tree-row group flex items-center text-sm transition ${h?"is-selected":"text-slate-600 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-[#222733] dark:hover:text-slate-100"}`,children:[t.jsxs("button",{type:"button",onClick:()=>o(n.id),className:"flex min-h-9 min-w-0 flex-1 items-center gap-2 px-2 py-2 text-left sm:min-h-0 sm:py-1.5",style:{paddingLeft:`${e*.75+2.2}rem`},children:[Wa(n,!1),t.jsx("span",{className:"truncate",children:n.name})]}),a&&n.kind==="file"?t.jsx("button",{type:"button",onClick:()=>a(n),className:`thread-graph-tree-action mr-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-md transition sm:h-7 sm:w-7 sm:opacity-0 sm:group-hover:opacity-100 sm:focus:opacity-100 ${h?"is-selected":"text-slate-400 hover:bg-white hover:text-slate-900 dark:text-slate-500 dark:hover:bg-[#1d222c] dark:hover:text-slate-100"}`,title:`Download ${n.name}`,"aria-label":`Download ${n.name}`,children:t.jsx(Sn,{className:"h-3.5 w-3.5"})}):null]})}function Au({liveNodes:e,onSelect:r,selectedNodeId:n}){return e.length===0?null:t.jsxs("div",{className:"border-b border-slate-200 py-2 dark:border-[#2a2f3a]",children:[t.jsx("div",{className:"thread-graph-workspace-label px-3 pb-1 text-[11px] font-semibold tracking-normal text-slate-500 dark:text-slate-400",children:"Live"}),t.jsx("div",{className:"space-y-0.5",children:e.map(a=>{var s;const o=n===a.id;return t.jsxs("button",{type:"button","data-testid":"live-molecule-item","data-molecule-id":((s=a.artifact)==null?void 0:s.id)??a.id,onClick:()=>r(a.id),className:`thread-graph-tree-row flex min-h-9 w-full items-center gap-2 px-3 py-2 text-left text-sm transition sm:min-h-0 sm:py-1.5 ${o?"is-selected":"text-slate-600 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-[#222733] dark:hover:text-slate-100"}`,children:[t.jsx(Hs,{className:`h-4 w-4 shrink-0 ${o?"text-current":"text-emerald-600 dark:text-emerald-300"}`}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.name})]},a.id)})})]})}function Mu({canEmptyGarbage:e,canUpload:r,onCollapse:n,expandedPaths:a,loading:o,onDownload:s,onEmptyGarbage:l,onRefresh:d,onSelect:i,onToggle:h,onUpload:u,selectedNodeId:p,tree:m,liveNodes:f}){const g=c.useMemo(()=>({...m,children:m.children.filter(x=>x.path!=="live")}),[m]);return t.jsxs("aside",{className:`${Ko} flex flex-col`,children:[t.jsxs("div",{className:Xo,children:[t.jsx("div",{className:"min-w-0",children:t.jsx("h2",{className:Yo,children:"Explorer"})}),t.jsxs("div",{className:"flex items-center gap-1",children:[n?t.jsxs("button",{type:"button","data-testid":"collapse-explorer",onClick:n,className:Zo,title:"Collapse Explorer","aria-label":"Collapse Explorer",children:[t.jsx(Wn,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Collapse Explorer"})]}):null,t.jsx("button",{type:"button",onClick:u,disabled:!r,className:Cr,title:r?"Upload file":"Upload is unavailable for this workspace","aria-label":"Upload file",children:t.jsx(Bs,{className:"h-4 w-4"})}),t.jsx("button",{type:"button",onClick:d,className:Cr,title:"Refresh workspace","aria-label":"Refresh workspace",children:t.jsx(Tr,{className:`h-4 w-4 ${o?"animate-spin":""}`})}),l?t.jsx("button",{type:"button",onClick:l,disabled:!e,className:Cr,title:e?"Empty garbage":"Garbage controls are unavailable","aria-label":"Empty garbage",children:t.jsx(lr,{className:"h-4 w-4"})}):null]})]}),t.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto py-2",children:[t.jsx(Au,{liveNodes:f??[],onSelect:i,selectedNodeId:p}),t.jsx("div",{className:Jo,children:"Workspace"}),o?t.jsx("p",{className:Qo,children:"Loading workspace..."}):null,t.jsx(Vo,{depth:0,expandedPaths:a,node:g,...s?{onDownload:s}:{},onSelect:i,onToggle:h,selectedNodeId:p}),g.children.length===0?t.jsx("p",{className:el,children:"This workspace is empty. Agent tool runs execute inside the thread workspace, so files should appear here as the session works."}):null]})]})}function _u({activeView:e,detail:r,artifacts:n,plugins:a,status:o,workspaceAdapter:s}){const[l,d]=c.useState(null),i=c.useMemo(()=>s&&l?null:Ga(r,n),[e,l,n,r,o,s]),h=l??i??Ga(r,n),u=c.useMemo(()=>tu(h),[h]),p=c.useMemo(()=>{var G;return((G=h.children.find(re=>re.path==="live"))==null?void 0:G.children)??[]},[h]),m=Do(h),[f,g]=c.useState(()=>(m==null?void 0:m.id)??null),[x,k]=c.useState(()=>new Set(["","artifacts","thread-events","live",...Fa((m==null?void 0:m.path)??"")])),[b,y]=c.useState(null),[w,v]=c.useState(null),[N,j]=c.useState(!1),[S,P]=c.useState(!1),[C,M]=c.useState(!1),[_,A]=c.useState(!1),[te,W]=c.useState([]),[D,q]=c.useState(null),[de,L]=c.useState(null),[Z,R]=c.useState(null),[X,F]=c.useState(0),[z,V]=c.useState(!1),H=c.useRef(null),E=c.useRef(null),T=(f?u.get(f):null)??m??null,K={threadId:r.thread.id,workspaceId:r.workspace.id??r.thread.workspaceId??null};c.useEffect(()=>{k(new Set(["","artifacts","thread-events","live",...Iu(K),...Fa((m==null?void 0:m.path)??"")]))},[K.threadId,K.workspaceId]),c.useEffect(()=>()=>{E.current!==null&&window.clearTimeout(E.current)},[]),c.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const G=window.matchMedia("(max-width: 639px)"),re=()=>V(G.matches);return re(),typeof G.addEventListener=="function"?(G.addEventListener("change",re),()=>G.removeEventListener("change",re)):(G.addListener(re),()=>G.removeListener(re))},[]);async function O(G){if(s){j(!0),v(null);try{const re=Mo(await s.listTree(K));d(re);const le=_o(re);g(ge=>{const me=ge?u.get(ge):null;return G&&Ln(re,G)?`workspace:${G}`:me!=null&&me.path&&Ln(re,me.path)?`workspace:${me.path}`:(le==null?void 0:le.id)??ge}),F(ge=>ge+1)}catch(re){v(re instanceof Error?re.message:"Failed to load workspace"),d(null)}finally{j(!1)}}}c.useEffect(()=>{d(null),q(null),L(null),R(null),v(null),O()},[s,r.thread.id,r.workspace.id,r.thread.workspaceId]),c.useEffect(()=>{if(!(s!=null&&s.subscribeWorkspaceChanged))return;const G=s.subscribeWorkspaceChanged(K,()=>{E.current!==null&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{E.current=null,O((T==null?void 0:T.path)??null)},240)});return()=>{E.current!==null&&(window.clearTimeout(E.current),E.current=null),G==null||G()}},[s,K.threadId,K.workspaceId,T==null?void 0:T.path]),c.useEffect(()=>{const G=s&&(T==null?void 0:T.kind)==="file"?T.path:null;if(!G){q(null),L(null),R(null);return}const re=G;let le=!1;async function ge(){var me;if(s){P(!0),v(null),q(null),L(null),R(null);try{const ze=pr(re),Re=(me=s.getRawFileUrl)==null?void 0:me.call(s,{...K,path:re});if(Re&&Bo.has(ze)){le||L(Re);return}if(Re&&Go.has(ze)){le||R(Re);return}const Ee=await s.readFile({...K,path:re,limit:zn});le||q(Ee)}catch(ze){le||v(ze instanceof Error?ze.message:"Failed to read file")}finally{le||P(!1)}}}return ge(),()=>{le=!0}},[s,T==null?void 0:T.id,X]);async function Q(){if(!(!s||!(D!=null&&D.truncated))){M(!0);try{const G=await s.readFile({...K,path:D.path,offset:D.nextOffset,limit:zn});q(re=>re&&{...re,content:re.content+G.content,truncated:G.truncated,nextOffset:G.nextOffset,size:G.size})}finally{M(!1)}}}async function B(G){var le;const re=(le=G.target.files)==null?void 0:le[0];if(G.target.value="",!(!(s!=null&&s.uploadFile)||!re)){j(!0),v(null);try{const ge=await s.uploadFile({...K,path:re.name,file:re}),me=ge.kind==="archive"?ge.paths[0]??null:ge.file.path;await O(me)}catch(ge){v(ge instanceof Error?ge.message:"Failed to upload file")}finally{j(!1)}}}function ce(G){var re;(re=s==null?void 0:s.downloadNode)==null||re.call(s,{...K,path:G.path,kind:G.kind==="directory"?"directory":"file"})}async function J(){if(s!=null&&s.emptyGarbage){if(v(null),!s.listGarbage){W([]),A(!0);return}try{const G=await s.listGarbage(K);W(G.map(re=>`garbage/${re}`))}catch(G){W([]),v(G instanceof Error?G.message:"Failed to list garbage files")}finally{A(!0)}}}async function se(){if(s!=null&&s.emptyGarbage){A(!1),v(null);try{await s.emptyGarbage(K),await O((T==null?void 0:T.path)??null)}catch(G){v(G instanceof Error?G.message:"Failed to empty garbage")}}}const ue={...s!=null&&s.downloadNode?{onDownload:ce}:{},...s!=null&&s.emptyGarbage?{onEmptyGarbage:J}:{},...s?{onRefresh:()=>void O((T==null?void 0:T.path)??null)}:{},...s!=null&&s.uploadFile?{onUpload:()=>{var G;return(G=H.current)==null?void 0:G.click()}}:{}};function fe(G){G&&k(re=>{const le=new Set(re);return le.has(G)?le.delete(G):le.add(G),Ru(K,le),le})}const Ne=t.jsx(Mu,{canEmptyGarbage:!!(s!=null&&s.emptyGarbage),canUpload:!!(s!=null&&s.uploadFile),...z?{}:{onCollapse:()=>y("explorer")},expandedPaths:x,loading:N,...ue,onSelect:G=>{g(G)},onToggle:fe,selectedNodeId:(T==null?void 0:T.id)??null,tree:h,liveNodes:p}),Y=t.jsx(Eu,{error:w,imageUrl:de,loadingMore:C,onLoadMore:Q,...z?{}:{onCollapse:()=>y("viewer")},pdfUrl:Z,previewFile:D,previewLoading:S,plugins:a,selectedTarget:Tu(T)});return b==="explorer"?t.jsxs("div",{"data-testid":"workspace-panel",className:"relative h-full min-h-0 w-full overflow-hidden p-2",children:[t.jsx("button",{type:"button","data-testid":"expand-explorer",onClick:()=>y(null),className:"thread-graph-panel-expand-fab left-3",title:"Expand Explorer","aria-label":"Expand Explorer",children:t.jsx(Sr,{className:"h-4 w-4"})}),Y]}):b==="viewer"?t.jsxs("div",{"data-testid":"workspace-panel",className:"relative h-full min-h-0 w-full overflow-hidden p-2",children:[Ne,t.jsx("button",{type:"button","data-testid":"expand-viewer",onClick:()=>y(null),className:"thread-graph-panel-expand-fab right-3",title:"Expand Viewer","aria-label":"Expand Viewer",children:t.jsx(Wn,{className:"h-4 w-4"})})]}):t.jsxs("div",{"data-testid":"workspace-panel",className:"flex h-full min-h-0 w-full overflow-hidden bg-transparent p-2",children:[_?t.jsx(Pu,{files:te,onCancel:()=>A(!1),onConfirm:()=>void se()}):null,z?t.jsxs("div",{className:"thread-graph-workspace-mobile-stack flex h-full min-h-0 w-full flex-col",children:[t.jsx("div",{className:"thread-graph-workspace-mobile-explorer h-[34%] min-h-[11rem] shrink-0 overflow-hidden border-b",children:Ne}),t.jsx("div",{className:"thread-graph-workspace-mobile-viewer min-h-0 flex-1 overflow-hidden",children:Y})]}):t.jsxs(Io,{direction:"horizontal",className:"thread-graph-workspace-resizable",children:[t.jsx(zr,{defaultSize:33,minSize:20,children:t.jsx("div",{className:"thread-graph-workspace-explorer-pane h-full min-h-0 overflow-hidden",children:Ne})}),t.jsx(Ro,{className:"thread-graph-workspace-resize-handle w-2 bg-transparent after:w-px after:bg-slate-200/80 after:transition-colors hover:after:bg-slate-300 dark:after:bg-[#303642] dark:hover:after:bg-[#475063]"}),t.jsx(zr,{defaultSize:67,minSize:30,children:t.jsx("div",{className:"thread-graph-workspace-viewer-pane h-full min-h-0 overflow-hidden",children:Y})})]}),t.jsx("input",{ref:H,type:"file",className:"hidden",onChange:G=>void B(G)})]})}var zn,qo,Ko,Xo,Yo,Cr,Zo,Jo,Qo,el,$u=Ae({"src/components/graph-workspace/GraphWorkspaceExplorer.tsx"(){Qn(),Lu(),zu(),Ao(),zn=24e3,qo="remote-codex:graphchat:workspace:expanded:",Ko="thread-graph-explorer h-full min-h-0 overflow-hidden rounded-[12px]",Xo="thread-graph-explorer-header flex h-[60px] shrink-0 items-center justify-between border-b px-4",Yo="text-[18px] font-semibold text-slate-900 dark:text-slate-100",Cr="thread-graph-explorer-icon-button flex h-8 w-8 items-center justify-center rounded-lg border shadow-none transition disabled:cursor-not-allowed disabled:opacity-50",Zo="thread-graph-explorer-collapse-button flex h-8 w-8 items-center justify-center rounded-full text-slate-500 transition hover:bg-slate-100 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-[#222733] dark:hover:text-slate-100",Jo="thread-graph-workspace-label px-3 pb-1 pt-2 text-[11px] font-semibold tracking-normal text-slate-500 dark:text-slate-400",Qo="thread-graph-workspace-loading px-4 text-sm text-slate-400 dark:text-slate-500",el="thread-graph-workspace-empty mx-4 mt-3 rounded-lg border border-dashed border-slate-200 bg-slate-50 px-3 py-4 text-sm text-slate-500 dark:border-[#303642] dark:bg-[#1b1f29] dark:text-slate-400"}});function hn({children:e}){return t.jsx("span",{className:"thread-guide-tag inline-flex items-center rounded px-1.5 py-0.5 font-mono text-[10px]",children:e})}function Bt({items:e}){return t.jsx("ul",{className:"space-y-1 text-[12px] text-[var(--theme-fg-muted)]",children:e.map((r,n)=>t.jsxs("li",{className:"flex gap-2",children:[t.jsx("span",{className:"mt-[6px] h-1 w-1 shrink-0 rounded-full bg-[var(--theme-border-contrast)]"}),t.jsx("span",{children:r})]},n))})}function Du({children:e}){return t.jsx("span",{className:"thread-guide-icon flex h-5 w-5 shrink-0 items-center justify-center rounded-md",children:e})}function Xt({value:e,title:r,icon:n,children:a}){return t.jsxs(cr,{value:e,className:"thread-guide-section border-b border-[var(--theme-border)] last:border-b-0",children:[t.jsx(hr,{className:"py-3 hover:no-underline [&[data-state=open]]:pb-2",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-[var(--theme-fg)]",children:[t.jsx(Du,{children:n}),r]})}),t.jsx(ur,{className:"space-y-3 pb-3",children:a})]})}function Bu(){return t.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[t.jsxs("div",{className:"shrink-0 border-b border-[var(--theme-border)] px-4 py-3",children:[t.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wide text-[var(--theme-fg-muted)]",children:"What can I do?"}),t.jsx("p",{className:"mt-0.5 text-[11px] text-[var(--theme-fg-muted)]",children:"Upload files, ask in plain language, get results."})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-6",children:t.jsxs(dr,{type:"multiple",defaultValue:["start","workspace","remote-codex"],className:"space-y-0",children:[t.jsxs(Xt,{value:"start",title:"Getting Started",icon:t.jsx(zd,{className:"h-3 w-3"}),children:[t.jsx("p",{className:"text-[11px] leading-5 text-[var(--theme-fg-muted)]",children:"graphchat connects a language model to your files and a set of tools. Each Remote Codex thread has its own isolated workspace."}),t.jsx(Bt,{items:["Upload data files via the Workspace panel","Type a question or task in plain language","The agent calls tools, writes results to the workspace, and explains what it found","Agent-produced files appear in the workspace automatically when the host reports changes"]})]}),t.jsxs(Xt,{value:"workspace",title:"Workspace Explorer",icon:t.jsx(Gs,{className:"h-3 w-3"}),children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(Bs,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--theme-fg-muted)]"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-medium text-[var(--theme-fg)]",children:"Upload"}),t.jsx("p",{className:"text-[11px] leading-5 text-[var(--theme-fg-muted)]",children:"Upload files through the Workspace panel when the host exposes workspace upload support. Composer attachments stay available for prompt context."})]})]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(Nn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--theme-fg-muted)]"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-medium text-[var(--theme-fg)]",children:"New files and folders"}),t.jsx("p",{className:"text-[11px] leading-5 text-[var(--theme-fg-muted)]",children:"Remote Codex normally creates files through tools and shell commands. They appear in Explorer after workspace refreshes."})]})]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(Id,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--theme-fg-muted)]"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-medium text-[var(--theme-fg)]",children:"Move and organize"}),t.jsx("p",{className:"text-[11px] leading-5 text-[var(--theme-fg-muted)]",children:"Use the agent or terminal to reorganize files. Explorer keeps the GraphChat file tree and preview flow."})]})]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(lr,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-rose-400"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-medium text-[var(--theme-fg)]",children:"Garbage folder"}),t.jsx("p",{className:"text-[11px] leading-5 text-[var(--theme-fg-muted)]",children:"If the host exposes garbage controls, Explorer can permanently empty unwanted workspace files."})]})]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(Tr,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--theme-fg-muted)]"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-medium text-[var(--theme-fg)]",children:"Refresh"}),t.jsx("p",{className:"text-[11px] leading-5 text-[var(--theme-fg-muted)]",children:"Resync the file tree manually after shell commands, external changes, or agent tool runs."})]})]}),t.jsxs("div",{className:"rounded-lg border border-[var(--theme-border)] p-2.5",children:[t.jsx("p",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--theme-fg-muted)]",children:"Preview surfaces"}),t.jsx(Bt,{items:[t.jsxs(t.Fragment,{children:[t.jsx(hn,{children:".xyz .extxyz .cif"})," use the 3D molecule plugin."]}),t.jsxs(t.Fragment,{children:[t.jsx(hn,{children:".png .jpg .gif .svg .webp"})," use inline image preview."]}),t.jsxs(t.Fragment,{children:[t.jsx(hn,{children:".py .json .ts .md .csv"})," use text/code preview."]}),"Large files load in chunks when the workspace adapter supports it."]})]})]}),t.jsxs(Xt,{value:"viewer",title:"Viewer",icon:t.jsx(Fs,{className:"h-3 w-3"}),children:[t.jsx("p",{className:"text-[11px] leading-5 text-[var(--theme-fg-muted)]",children:"Viewer is the GraphChat-style artifact surface. It opens Remote Codex artifacts through the same frontend plugin renderers used in rich message bubbles, and previews workspace files from Explorer."}),t.jsx(Bt,{items:["Expand one artifact at a time for inspection","Fallback JSON preview is available for unknown artifact types","3D molecule artifacts remain interactive when the XYZ plugin is enabled"]})]}),t.jsxs(Xt,{value:"usage",title:"Tool Usage & Chat",icon:t.jsx(Cn,{className:"h-3 w-3"}),children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(Cn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--theme-fg-muted)]"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-medium text-[var(--theme-fg)]",children:"Usage tab"}),t.jsx(Bt,{items:["Bar chart of tool and command counts for this thread","Expandable call log: inspect every input and output","Recent live events appear with persisted history"]})]})]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(Ds,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--theme-fg-muted)]"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-medium text-[var(--theme-fg)]",children:"Chat controls"}),t.jsx(Bt,{items:["New Chat creates a fresh Remote Codex thread with its own workspace","Interrupt, compact, goal controls, and model controls remain in the composer","Shell view stays available when a shell adapter is attached"]})]})]})]}),t.jsx(Xt,{value:"remote-codex",title:"Remote Codex Extras",icon:t.jsx(Rd,{className:"h-3 w-3"}),children:t.jsx(Bt,{items:["Slash toolbox: skills, MCP, hooks, goals, forks, model controls, provider settings","Rich message bubbles: reasoning, commands, searches, file reads, file changes, plans, action requests, artifacts","Plugin surfaces: terminal, XYZ molecule viewer, inline code renderers, and imported plugin panels","Thread metadata stays in the left rail and Workspace tab instead of replacing chat"]})})]})})]})}var Gu=Ae({"src/components/graph-workspace/GraphGuidePanel.tsx"(){mr()}});function Fu(e){if(e==null)return"—";if(typeof e=="string")return e.length>2e3?`${e.slice(0,2e3)}
12
+ ...(truncated)`:e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Va({label:e,value:r}){return t.jsxs("div",{children:[t.jsx("p",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-[var(--theme-fg-muted)]",children:e}),t.jsx("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-[var(--theme-surface-strong)] p-2 text-[11px] leading-relaxed text-[var(--theme-fg-soft)]",children:Fu(r)})]})}function Hu({event:e}){return t.jsxs(cr,{value:e.id,className:"thread-tool-call mb-2 overflow-hidden rounded-lg border border-[var(--theme-border)] last:mb-0",children:[t.jsxs(hr,{className:"px-3 py-2 text-xs font-medium text-[var(--theme-fg)] hover:bg-[var(--theme-hover)] hover:no-underline [&[data-state=open]]:bg-[var(--theme-hover)]",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--theme-accent-strong)]"}),t.jsx("span",{className:"truncate font-mono text-xs font-medium text-[var(--theme-fg)]",children:e.label}),e.status?t.jsx("span",{className:"shrink-0 rounded-full border border-[var(--theme-border)] px-1.5 py-0.5 text-[9px] uppercase tracking-[0.12em] text-[var(--theme-fg-muted)]",children:e.status}):null]}),t.jsx("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:e.turnId?t.jsx("span",{className:"max-w-20 truncate text-[10px] text-[var(--theme-fg-muted)]",children:e.turnId}):null})]}),t.jsx(ur,{className:"px-3 pb-3",children:t.jsxs("div",{className:"space-y-2 px-3 pb-3 pt-1",children:[t.jsx(Va,{label:"Input",value:e.preview}),t.jsx(Va,{label:"Output",value:e.detail})]})})]})}function Ou({formatToolKind:e,toolCounts:r,toolEvents:n,maxToolCount:a}){const[o,s]=c.useState(()=>{var d;return((d=n.at(-1))==null?void 0:d.id)??null}),l=c.useRef(null);return c.useEffect(()=>{s(d=>{var i;return d??((i=n.at(-1))==null?void 0:i.id)??null})},[n]),c.useEffect(()=>{var d;(d=l.current)==null||d.scrollIntoView({behavior:"smooth",block:"nearest"})},[n.length]),r.length?t.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[t.jsxs("div",{className:"shrink-0 border-b border-[var(--theme-border)] p-4",children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[t.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wide text-[var(--theme-fg-muted)]",children:"Calls this session"}),t.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-[var(--theme-fg-muted)] opacity-60",disabled:!0,title:"Remote Codex streams tool history from thread events",children:[t.jsx(Tr,{className:"h-3 w-3"}),"Reload"]})]}),t.jsx("div",{className:"space-y-2",children:r.map(([d,i])=>t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"w-40 shrink-0 truncate text-right font-mono text-[11px] text-[var(--theme-fg-muted)]",title:e(d),children:e(d)}),t.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[t.jsx("div",{className:"relative h-4 flex-1 overflow-hidden rounded-sm bg-[var(--theme-muted)]",children:t.jsx("div",{className:"h-full rounded-sm bg-[var(--theme-accent-strong)] transition-all duration-300",style:{width:`${i/a*100}%`}})}),t.jsx("span",{className:"w-5 shrink-0 text-right text-[11px] font-medium text-[var(--theme-fg-soft)]",children:i})]})]},d))})]}),t.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:[t.jsx("h2",{className:"mb-3 text-xs font-semibold uppercase tracking-wide text-[var(--theme-fg-muted)]",children:"Call log"}),t.jsx(dr,{type:"single",collapsible:!0,value:o??"",onValueChange:d=>s(d||null),className:"space-y-0",children:n.slice(-50).map(d=>t.jsx(Hu,{event:d},d.id))}),t.jsx("div",{ref:l})]})]}):t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 text-sm text-[var(--theme-fg-muted)]",children:[t.jsx("span",{children:"No tool calls yet. Run the agent to see usage."}),t.jsxs("span",{className:"inline-flex items-center gap-1 rounded px-2 py-1 text-xs",children:[t.jsx(Tr,{className:"h-3 w-3"}),"Reload from workspace"]})]})}var Uu=Ae({"src/components/graph-workspace/GraphToolUsagePanel.tsx"(){mr()}});function qa(e,r){const n=Math.max(e.measured.width??1,1),a=Math.max(e.measured.height??1,1),o=e.internals.positionAbsolute,s=r.internals.positionAbsolute,l=Math.max(r.measured.width??1,1),d=Math.max(r.measured.height??1,1),i=n/2,h=a/2,u=o.x+i,p=o.y+h,m=s.x+l/2,f=s.y+d/2,g=(m-u)/(2*i)-(f-p)/(2*h),x=(m-u)/(2*i)+(f-p)/(2*h),k=1/(Math.abs(g)+Math.abs(x)),b=k*g,y=k*x,w=i*(b+y)+u,v=h*(-b+y)+p;return{x:w,y:v}}function Ka(e,r){const n={...e.internals.positionAbsolute,...e},a=Math.round(n.x),o=Math.round(n.y),s=Math.round(r.x),l=Math.round(r.y);return s<=a+1?Tt.Left:s>=a+(e.measured.width??1)-1?Tt.Right:l<=o+1?Tt.Top:l>=n.y+(e.measured.height??1)-1?Tt.Bottom:Tt.Top}function tl(e,r){const n=qa(e,r),a=qa(r,e),o=Ka(e,n),s=Ka(r,a);return{sx:n.x,sy:n.y,tx:a.x,ty:a.y,sourcePos:o,targetPos:s}}function Wu(e,r=900,n=620){if(!e||!Array.isArray(e))return{nodes:[],edges:[]};const a=(i,h,u,p)=>{const m=new Map,f=i.length;i.forEach((g,x)=>{const k=g.id.split("").reduce((b,y)=>{const w=(b<<5)-b+y.charCodeAt(0);return w&w},0);m.set(g.id,{x:Math.abs(k)%u+x*100%u,y:Math.abs(k>>16)%p+x*150%p,vx:0,vy:0})});for(let g=0;g<200;g+=1){for(let x=0;x<f;x+=1)for(let k=x+1;k<f;k+=1){const b=i[x],y=i[k];if(!b||!y)continue;const w=m.get(b.id),v=m.get(y.id);if(!w||!v)continue;const N=w.x-v.x,j=w.y-v.y,S=Math.sqrt(N*N+j*j)||1,C=(200-S)*.5,M=N/S*C,_=j/S*C;w.vx+=M,w.vy+=_,v.vx-=M,v.vy-=_}h.forEach(x=>{const k=m.get(x.source),b=m.get(x.target);if(!k||!b)return;const y=b.x-k.x,w=b.y-k.y,v=Math.sqrt(y*y+w*w)||1,j=(v-120)*.3,S=y/v*j,P=w/v*j;k.vx+=S,k.vy+=P,b.vx-=S,b.vy-=P}),m.forEach(x=>{x.x+=x.vx*.1,x.y+=x.vy*.1,x.vx*=.9,x.vy*=.9,x.x=Math.max(80,Math.min(u-80,x.x)),x.y=Math.max(80,Math.min(p-80,x.y))})}return m},o=new Set(e.map(i=>i.id)),s=[];e.forEach(i=>{if(!i.out_node_id)return;(Array.isArray(i.out_node_id)?i.out_node_id:[i.out_node_id]).forEach(u=>{o.has(u)&&s.push({id:`${i.id}-${u}`,source:i.id,target:u,type:"floating",sourceHandle:null,targetHandle:null,markerEnd:{type:Us.Arrow}})})});const l=a(e,s,r,n);return{nodes:e.map(i=>({id:i.id,type:"styledNode",position:l.get(i.id)??{x:100,y:100},data:{label:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-sm font-semibold",children:i.name}),i.description?t.jsx("div",{className:"mt-1 max-w-32 overflow-hidden text-ellipsis text-xs text-slate-500 dark:text-slate-400",children:i.description}):null]})}})),edges:s}}var ea=Ae({"src/components/graph-chat/FloatingHelper.tsx"(){}});function Vu({toX:e,toY:r,fromPosition:n,toPosition:a,fromNode:o}){if(!o)return null;const s={id:"connection-target",measured:{width:1,height:1},internals:{positionAbsolute:{x:e,y:r}}},{sx:l,sy:d,tx:i,ty:h,sourcePos:u,targetPos:p}=tl(o,s),[m]=Ws({sourceX:l,sourceY:d,sourcePosition:u||n,targetPosition:p||a,targetX:i||e,targetY:h||r});return t.jsxs("g",{children:[t.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:1.5,className:"animated",d:m}),t.jsx("circle",{cx:i||e,cy:h||r,fill:"var(--theme-panel)",r:3,stroke:"currentColor",strokeWidth:1.5})]})}var qu=Ae({"src/components/graph-chat/FloatingConnectionLine.tsx"(){ea()}});function Ku({id:e,source:r,target:n,markerEnd:a,style:o}){const s=ya(r),l=ya(n);if(!s||!l)return null;const{sx:d,sy:i,tx:h,ty:u,sourcePos:p,targetPos:m}=tl(s,l),[f]=Ws({sourceX:d,sourceY:i,sourcePosition:p,targetPosition:m,targetX:h,targetY:u});return t.jsx("path",{id:e,className:"react-flow__edge-path",d:f,markerEnd:a,style:o})}var Xu=Ae({"src/components/graph-chat/FloatingEdge.tsx"(){ea()}});function Yu({nodes:e}){const[r,n,a]=uc([]),[o,s,l]=mc([]),d=c.useMemo(()=>Wu(e),[e]),i=c.useMemo(()=>({floating:Ku}),[]),h=c.useMemo(()=>({styledNode:({data:p,isConnectable:m})=>t.jsxs("div",{className:"thread-graph-flow-node",children:[p.label,t.jsx(wa,{type:"target",position:Tt.Top,isConnectable:m,style:{opacity:0,pointerEvents:"none"}}),t.jsx(wa,{type:"source",position:Tt.Bottom,isConnectable:m,style:{opacity:0,pointerEvents:"none"}})]})}),[]);c.useEffect(()=>{n(d.nodes),s(d.edges)},[d.edges,d.nodes,s,n]);const u=c.useCallback(p=>s(m=>pc({...p,type:"floating",sourceHandle:null,targetHandle:null,markerEnd:{type:Us.Arrow}},m)),[s]);return t.jsx("div",{className:"thread-graph-flow h-full min-h-0",children:t.jsx(fc,{children:t.jsxs(gc,{nodes:r,edges:o,onNodesChange:a,onEdgesChange:l,onConnect:u,fitView:!0,nodeTypes:h,edgeTypes:i,connectionLineComponent:Vu,children:[t.jsx(xc,{}),t.jsx(bc,{gap:16})]})})})}var Zu=Ae({"src/components/graph-chat/GraphVisualization.tsx"(){qu(),Xu(),ea()}});function Ju(e){return{...nl,...e}}function Xa(e,r){const n=a=>{switch(a){case"workspace":return e.workspace;case"tools":return e.toolUsage;case"guide":return e.guide;case"graph":return e.threadGraph;case"extensions":return e.extensions}};return r&&n(r)?r:["workspace","tools","guide","graph","extensions"].find(n)??null}function Qu(e,r){switch(r){case"workspace":return e.workspace;case"tools":return e.toolUsage;case"guide":return e.guide;case"graph":return e.threadGraph;case"extensions":return e.extensions}}function em(e){var o;const r=[],n=new Set(["toolCall","commandExecution","webSearch","fileRead","fileChange","agentToolCall","skillToolCall","hook"]);let a=0;for(const s of e.turns)for(const l of s.items)n.has(l.kind)&&(r.push({id:l.id,kind:l.kind,label:Ir(l.kind),preview:l.previewText??l.text??l.kind,detail:l.detailText??l.text??l.previewText??l.kind,turnId:l.sourceTurnId??s.id,status:l.status??null,sequence:a}),a+=1);for(const s of((o=e.liveItems)==null?void 0:o.items)??[])n.has(s.kind)&&(r.push({id:s.id,kind:s.kind,label:Ir(s.kind),preview:s.previewText??s.text??s.kind,detail:s.detailText??s.text??s.previewText??s.kind,turnId:s.sourceTurnId??null,status:s.status??null,sequence:a}),a+=1);return r}function Ir(e){switch(e){case"toolCall":return"Tool call";case"agentToolCall":return"Agent tool";case"skillToolCall":return"Skill tool";case"commandExecution":return"Command";case"webSearch":return"Search";case"fileRead":return"File read";case"fileChange":return"File change";case"hook":return"Hook";default:return e.replace(/([A-Z])/g," $1").replace(/^./,r=>r.toUpperCase())}}function tm(e){switch(e.kind){case"userMessage":return"User";case"agentMessage":return"Agent";default:return Ir(e.kind)}}function rm(e){return(e.previewText??e.text??e.detailText??e.kind).replace(/\s+/g," ").slice(0,96)}function nm(e,r){const n=[{id:`thread:${e.thread.id}`,name:e.thread.title||"Thread",description:e.thread.model??e.thread.status},{id:`workspace:${e.workspace.id}`,name:e.workspace.label??"Workspace",description:e.workspace.absPath,out_node_id:`thread:${e.thread.id}`}];let a=null;for(const s of e.turns){const l=`turn:${s.id}`;n.push({id:l,name:`Turn ${n.filter(i=>i.id.startsWith("turn:")).length+1}`,description:s.status,out_node_id:a?[`thread:${e.thread.id}`,a]:`thread:${e.thread.id}`}),a=l;let d=null;for(const i of s.items){const h=`item:${i.id}`,u=[l];d&&u.push(d),n.push({id:h,name:tm(i),description:rm(i),out_node_id:u}),d=h,i.kind==="artifact"&&i.artifact&&n.push({id:`artifact:${i.artifact.id}`,name:i.artifact.title||i.artifact.type,description:i.artifact.summaryText??i.artifact.type,out_node_id:h})}}const o=new Set(n.map(s=>s.id));for(const s of r){const l=`tool:${s.id}`;o.has(l)||o.has(`item:${s.id}`)||n.push({id:l,name:s.label,description:s.preview,out_node_id:s.turnId?`turn:${s.turnId}`:`thread:${e.thread.id}`})}return n.slice(0,120)}function rl({detail:e,status:r,plugins:n,workspaceAdapter:a,metaContent:o,settingsContent:s,activeView:l="chat",features:d}){const i=c.useMemo(()=>Ju(d),[d]),h=Xa(i,d==null?void 0:d.defaultTab),[u,p]=c.useState(h),m=c.useMemo(()=>qh(e),[e]),f=c.useMemo(()=>em(e),[e]),g=c.useMemo(()=>{const v=new Map;for(const N of f)v.set(N.kind,(v.get(N.kind)??0)+1);return[...v.entries()].sort((N,j)=>j[1]-N[1])},[f]),x=n.getThreadPanels(),k=Math.max(...g.map(([,v])=>v),1),b=c.useMemo(()=>nm(e,f),[e,f]),y=c.useMemo(()=>{const v=[];return i.workspace&&v.push({id:"workspace",label:"Workspace",icon:null}),i.toolUsage&&v.push({id:"tools",label:"Tool Usage",icon:Cn}),i.guide&&v.push({id:"guide",label:"Guide",icon:Ed}),v},[i.guide,i.toolUsage,i.workspace]),w=c.useMemo(()=>{const v=[];return i.threadGraph&&v.push({id:"graph",label:"Thread graph",icon:Ld}),i.extensions&&v.push({id:"extensions",label:"Remote Codex extensions",icon:Un}),v},[i.extensions,i.threadGraph]);return c.useEffect(()=>{(!u||!Qu(i,u))&&p(Xa(i,d==null?void 0:d.defaultTab))},[u,d==null?void 0:d.defaultTab,i]),u?t.jsxs("div",{className:"thread-graph-right-panel flex h-full min-h-0 flex-col overflow-hidden",children:[t.jsxs("div",{className:"thread-graph-right-tabs flex shrink-0 items-center gap-1 overflow-hidden border-b px-3 py-2",children:[y.map(v=>{const N=v.icon;return t.jsxs("button",{type:"button",onClick:()=>p(v.id),className:`thread-graph-right-tab inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-3 text-xs font-medium transition ${u===v.id?"is-active":""}`,children:[N?t.jsx(N,{className:"h-3.5 w-3.5"}):null,v.label]},v.id)}),w.length?t.jsx("div",{className:"thread-graph-right-tab-secondary ml-auto flex min-w-0 shrink items-center gap-1 border-l pl-2","aria-label":"Remote Codex workspace extensions",children:w.map(v=>{const N=v.icon;return t.jsx("button",{type:"button",onClick:()=>p(v.id),className:`thread-graph-right-tab inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-xs font-medium transition ${u===v.id?"is-active":""}`,title:v.label,"aria-label":v.label,children:t.jsx(N,{className:"h-3.5 w-3.5"})},v.id)})}):null]}),t.jsxs("div",{className:"min-h-0 flex-1 overflow-hidden",children:[u==="workspace"?t.jsx(_u,{activeView:l,detail:e,artifacts:m,plugins:n,status:r,workspaceAdapter:a??null}):null,u==="tools"?t.jsx(Ou,{formatToolKind:Ir,toolCounts:g,toolEvents:f,maxToolCount:k}):null,u==="graph"?t.jsx("div",{className:"thread-graph-visualization-panel h-full min-h-0 p-3",children:t.jsx(Yu,{nodes:b})}):null,u==="extensions"?t.jsx("div",{className:"h-full min-h-0 overflow-y-auto p-3",children:t.jsxs("div",{className:"grid gap-3",children:[t.jsx(Ft,{label:"Plugin Panels",children:x.length?t.jsx("div",{className:"flex flex-wrap gap-2",children:x.map(v=>t.jsx("span",{className:"rounded-full border border-[var(--theme-border)] px-2 py-1 text-xs text-[var(--theme-fg-soft)]",children:v.label},v.id))}):t.jsx("p",{className:"text-[var(--theme-fg-muted)]",children:"No thread panels are enabled."})}),t.jsx(Ft,{label:"Enabled Renderers",children:t.jsx("div",{className:"flex flex-wrap gap-2",children:n.plugins.filter(v=>v.enabled).map(v=>t.jsx("span",{className:"rounded-full border border-[var(--theme-border)] px-2 py-1 text-xs text-[var(--theme-fg-soft)]",children:v.name},v.id))})}),t.jsx(Ft,{label:"Remote Codex Tools",children:t.jsxs("div",{className:"grid gap-2 text-[var(--theme-fg-muted)]",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(As,{className:"mt-0.5 h-4 w-4 shrink-0"}),t.jsx("p",{children:"Terminal stays available when the Terminal plugin and shell adapter are attached."})]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(Pd,{className:"mt-0.5 h-4 w-4 shrink-0"}),t.jsx("p",{children:"Composer attachments, slash panels, hooks, MCP, goals, and fork controls remain part of the chat surface."})]}),t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(lr,{className:"mt-0.5 h-4 w-4 shrink-0"}),t.jsx("p",{children:"Destructive actions stay explicit: delete thread, interrupt, compact, and hook trust controls remain host governed."})]})]})}),o?t.jsx(Ft,{label:"Thread Meta",children:o}):null,s?t.jsx(Ft,{label:"Settings",children:s}):null]})}):null,u==="guide"?t.jsx(Bu,{}):null]})]}):null}var nl,al,am=Ae({"src/components/ThreadGraphWorkspacePanel.tsx"(){$u(),Fo(),Gu(),Uu(),Qn(),Zu(),nl={workspace:!0,toolUsage:!0,guide:!0,threadGraph:!0,extensions:!0},al=c.memo(rl)}}),sl={};Vh(sl,{MemoizedThreadGraphWorkspacePanel:()=>al,ThreadGraphWorkspacePanel:()=>rl});var sm=Ae({"src/workspace-panel.ts"(){am()}});function Wt(e,{insertAt:r}={}){if(!e||typeof document>"u")return;const n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",r==="top"&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}Wt(`.thread-ui-shell,
13
+ .thread-graph-dialog {
14
+ color-scheme: light;
15
+ --radius: 0.625rem;
16
+ --background: oklch(1 0 0);
17
+ --foreground: oklch(0.145 0 0);
18
+ --card: oklch(1 0 0);
19
+ --card-foreground: oklch(0.145 0 0);
20
+ --popover: oklch(1 0 0);
21
+ --popover-foreground: oklch(0.145 0 0);
22
+ --primary: oklch(0.205 0 0);
23
+ --primary-foreground: oklch(0.985 0 0);
24
+ --secondary: oklch(0.97 0 0);
25
+ --secondary-foreground: oklch(0.205 0 0);
26
+ --muted: oklch(0.97 0 0);
27
+ --muted-foreground: oklch(0.556 0 0);
28
+ --accent: oklch(0.97 0 0);
29
+ --accent-foreground: oklch(0.205 0 0);
30
+ --destructive: oklch(0.577 0.245 27.325);
31
+ --border: oklch(0.922 0 0);
32
+ --input: oklch(0.922 0 0);
33
+ --ring: oklch(0.708 0 0);
34
+ --sidebar: oklch(0.985 0 0);
35
+ --sidebar-foreground: oklch(0.145 0 0);
36
+ --sidebar-accent: oklch(0.97 0 0);
37
+ --sidebar-accent-foreground: oklch(0.205 0 0);
38
+ --sidebar-border: oklch(0.922 0 0);
39
+ --thread-gc-bg: #eef2f7;
40
+ --thread-gc-panel: #f8fafc;
41
+ --thread-gc-workspace: #f3f6fb;
42
+ --thread-gc-surface: #edf2f7;
43
+ --thread-gc-muted: #e6edf5;
44
+ --thread-gc-hover: #e8eef6;
45
+ --thread-gc-border: rgb(203 213 225 / 0.82);
46
+ --thread-gc-border-strong: rgb(174 187 204);
47
+ --thread-gc-border-contrast: rgb(123 139 161);
48
+ --thread-gc-fg: rgb(15 23 42);
49
+ --thread-gc-fg-soft: rgb(51 65 85);
50
+ --thread-gc-fg-muted: rgb(148 163 184);
51
+ --thread-gc-primary: rgb(2 6 23);
52
+ --thread-gc-primary-hover: rgb(30 41 59);
53
+ --thread-gc-primary-fg: #f8fafc;
54
+ --thread-gc-accent-soft: rgb(241 245 249);
55
+ --thread-gc-accent-strong: rgb(15 23 42);
56
+ --thread-gc-accent-border: rgb(203 213 225);
57
+ --thread-gc-shadow: 0 10px 30px rgb(15 23 42 / 0.04);
58
+ --theme-bg: var(--thread-gc-bg);
59
+ --theme-panel: var(--thread-gc-panel);
60
+ --theme-surface: var(--thread-gc-workspace);
61
+ --theme-surface-strong: var(--thread-gc-surface);
62
+ --theme-muted: var(--thread-gc-muted);
63
+ --theme-hover: var(--thread-gc-hover);
64
+ --theme-border: var(--thread-gc-border);
65
+ --theme-border-strong: var(--thread-gc-border-strong);
66
+ --theme-border-contrast: var(--thread-gc-border-contrast);
67
+ --theme-fg: var(--thread-gc-fg);
68
+ --theme-fg-soft: var(--thread-gc-fg-soft);
69
+ --theme-fg-muted: var(--thread-gc-fg-muted);
70
+ --theme-accent-solid: var(--thread-gc-primary);
71
+ --theme-accent-solid-hover: var(--thread-gc-primary-hover);
72
+ --theme-accent-solid-fg: var(--thread-gc-primary-fg);
73
+ --theme-accent-soft: var(--thread-gc-accent-soft);
74
+ --theme-accent-strong: var(--thread-gc-accent-strong);
75
+ --theme-accent-border: var(--thread-gc-accent-border);
76
+ --theme-shadow: var(--thread-gc-shadow);
77
+ background: var(--theme-bg);
78
+ color: var(--theme-fg);
79
+ isolation: isolate;
80
+ font-family:
81
+ Inter,
82
+ ui-sans-serif,
83
+ system-ui,
84
+ -apple-system,
85
+ BlinkMacSystemFont,
86
+ "Segoe UI",
87
+ "Noto Sans CJK SC",
88
+ "Noto Sans SC",
89
+ "Microsoft YaHei",
90
+ "PingFang SC",
91
+ "Hiragino Sans GB",
92
+ sans-serif;
93
+ }
94
+ .thread-graph-dialog {
95
+ background: var(--theme-panel);
96
+ color: var(--theme-fg);
97
+ }
98
+ .thread-ui-shell.thread-ui-viewport-constrained {
99
+ height: 100svh;
100
+ max-height: 100svh;
101
+ min-height: 0;
102
+ overflow: hidden;
103
+ overscroll-behavior: none;
104
+ }
105
+ .thread-ui-shell.thread-ui-theme-dark,
106
+ .thread-ui-shell[data-theme-effective=dark],
107
+ :root[data-theme-effective=dark] .thread-ui-shell,
108
+ .thread-ui-shell.dark,
109
+ .thread-ui-shell[data-theme=dark],
110
+ .thread-ui-shell[data-theme-mode=dark],
111
+ .thread-ui-shell[data-theme-mode=system][data-system-theme=dark],
112
+ .thread-graph-dialog[data-theme-effective=dark],
113
+ .thread-graph-dialog[data-theme-mode=dark],
114
+ .thread-graph-dialog[data-theme-mode=system][data-system-theme=dark] {
115
+ color-scheme: dark;
116
+ --background: oklch(0.145 0 0);
117
+ --foreground: oklch(0.985 0 0);
118
+ --card: oklch(0.205 0 0);
119
+ --card-foreground: oklch(0.985 0 0);
120
+ --popover: oklch(0.205 0 0);
121
+ --popover-foreground: oklch(0.985 0 0);
122
+ --primary: oklch(0.922 0 0);
123
+ --primary-foreground: oklch(0.205 0 0);
124
+ --secondary: oklch(0.269 0 0);
125
+ --secondary-foreground: oklch(0.985 0 0);
126
+ --muted: oklch(0.269 0 0);
127
+ --muted-foreground: oklch(0.708 0 0);
128
+ --accent: oklch(0.269 0 0);
129
+ --accent-foreground: oklch(0.985 0 0);
130
+ --destructive: oklch(0.704 0.191 22.216);
131
+ --border: oklch(1 0 0 / 10%);
132
+ --input: oklch(1 0 0 / 15%);
133
+ --ring: oklch(0.556 0 0);
134
+ --sidebar: oklch(0.205 0 0);
135
+ --sidebar-foreground: oklch(0.985 0 0);
136
+ --sidebar-accent: oklch(0.269 0 0);
137
+ --sidebar-accent-foreground: oklch(0.985 0 0);
138
+ --sidebar-border: oklch(1 0 0 / 10%);
139
+ --thread-gc-bg: #101217;
140
+ --thread-gc-panel: #171a22;
141
+ --thread-gc-workspace: #151820;
142
+ --thread-gc-surface: #1d222c;
143
+ --thread-gc-muted: #222733;
144
+ --thread-gc-hover: #222733;
145
+ --thread-gc-border: #2a2f3a;
146
+ --thread-gc-border-strong: #303642;
147
+ --thread-gc-border-contrast: #475063;
148
+ --thread-gc-fg: rgb(241 245 249);
149
+ --thread-gc-fg-soft: rgb(203 213 225);
150
+ --thread-gc-fg-muted: rgb(148 163 184);
151
+ --thread-gc-primary: rgb(241 245 249);
152
+ --thread-gc-primary-hover: rgb(203 213 225);
153
+ --thread-gc-primary-fg: #11141a;
154
+ --thread-gc-accent-soft: #222733;
155
+ --thread-gc-accent-strong: rgb(241 245 249);
156
+ --thread-gc-accent-border: #303642;
157
+ --thread-gc-shadow: 0 18px 40px rgb(0 0 0 / 0.28);
158
+ }
159
+ .thread-ui-shell *,
160
+ .thread-ui-shell *::before,
161
+ .thread-ui-shell *::after {
162
+ box-sizing: border-box;
163
+ }
164
+ .thread-ui-shell .thread-main-panel,
165
+ .thread-ui-shell .thread-detail-surface,
166
+ .thread-ui-shell .thread-sidebar-surface,
167
+ .thread-ui-shell .thread-workspace-panel,
168
+ .thread-ui-shell .thread-workspace-card {
169
+ border-color: var(--theme-border);
170
+ background: var(--theme-panel);
171
+ color: var(--theme-fg);
172
+ }
173
+ .thread-ui-shell .thread-sidebar-surface {
174
+ background: color-mix(in oklch, var(--theme-panel) 92%, var(--theme-surface));
175
+ color: var(--theme-fg);
176
+ }
177
+ .thread-ui-shell .thread-graph-rooms-surface,
178
+ .thread-ui-shell .thread-topbar-surface {
179
+ border-color: var(--theme-border);
180
+ background: var(--theme-panel);
181
+ color: var(--theme-fg);
182
+ }
183
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-rooms-surface,
184
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-rooms-surface,
185
+ :root[data-theme-effective=dark] .thread-ui-shell .thread-graph-rooms-surface,
186
+ .thread-ui-shell.dark .thread-graph-rooms-surface,
187
+ .thread-ui-shell.thread-ui-theme-dark .thread-topbar-surface,
188
+ .thread-ui-shell[data-theme-effective=dark] .thread-topbar-surface,
189
+ :root[data-theme-effective=dark] .thread-ui-shell .thread-topbar-surface,
190
+ .thread-ui-shell.dark .thread-topbar-surface {
191
+ border-color: #2a2f3a;
192
+ background: #171a22;
193
+ color: rgb(241 245 249);
194
+ box-shadow: 0 18px 40px rgb(0 0 0 / 0.28);
195
+ }
196
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-rooms-surface,
197
+ :root[data-theme-effective=light] .thread-ui-shell .thread-graph-rooms-surface,
198
+ .thread-ui-shell[data-theme-effective=light] .thread-topbar-surface,
199
+ :root[data-theme-effective=light] .thread-ui-shell .thread-topbar-surface {
200
+ border-color: rgb(226 232 240 / 0.8);
201
+ background: rgb(255 255 255);
202
+ color: rgb(15 23 42);
203
+ box-shadow: 0 10px 30px rgb(15 23 42 / 0.04);
204
+ }
205
+ .thread-ui-shell[data-theme-effective=dark] .thread-mobile-scrim,
206
+ :root[data-theme-effective=dark] .thread-ui-shell .thread-mobile-scrim,
207
+ .thread-ui-shell.thread-ui-theme-dark .thread-mobile-scrim,
208
+ .thread-ui-shell.dark .thread-mobile-scrim {
209
+ background: rgb(0 0 0 / 0.55);
210
+ }
211
+ .thread-ui-shell .thread-shell-frame {
212
+ display: block;
213
+ height: 100%;
214
+ min-height: 0;
215
+ width: 100%;
216
+ }
217
+ .thread-ui-shell .thread-rooms-rail {
218
+ transform: none;
219
+ translate: -100% 0;
220
+ overflow-x: hidden;
221
+ }
222
+ .thread-ui-shell .thread-rooms-rail.translate-x-0 {
223
+ transform: none;
224
+ translate: 0 0;
225
+ }
226
+ .thread-ui-shell .thread-shell-main {
227
+ height: 100%;
228
+ width: 100%;
229
+ min-width: 0;
230
+ min-height: 0;
231
+ overflow: hidden;
232
+ }
233
+ .thread-ui-shell .thread-shell-card {
234
+ border-color: transparent;
235
+ }
236
+ .thread-ui-shell .thread-desktop-only-flex,
237
+ .thread-ui-shell .thread-desktop-only-inline-flex,
238
+ .thread-ui-shell .thread-mobile-chat-hidden,
239
+ .thread-ui-shell .thread-mobile-workspace-hidden {
240
+ display: none;
241
+ }
242
+ .thread-ui-shell .thread-mobile-only-block {
243
+ display: block;
244
+ }
245
+ .thread-ui-shell .thread-mobile-only-grid {
246
+ display: grid;
247
+ }
248
+ .thread-ui-shell .thread-mobile-only-inline-flex {
249
+ display: inline-flex;
250
+ }
251
+ .thread-ui-shell .thread-main-panel,
252
+ .thread-ui-shell .thread-shell-card {
253
+ height: 100%;
254
+ min-height: 0;
255
+ }
256
+ .thread-ui-shell .thread-topbar-surface {
257
+ min-height: 3.5rem;
258
+ }
259
+ .thread-ui-shell .thread-icon-button,
260
+ .thread-ui-shell .thread-secondary-action {
261
+ border-color: var(--theme-border);
262
+ background: transparent;
263
+ color: var(--theme-fg-soft);
264
+ }
265
+ .thread-ui-shell .thread-icon-button:hover,
266
+ .thread-ui-shell .thread-secondary-action:hover {
267
+ background: var(--theme-hover);
268
+ color: var(--theme-fg);
269
+ }
270
+ .thread-ui-shell .thread-topbar-meta-row {
271
+ color: var(--theme-fg-muted);
272
+ }
273
+ .thread-ui-shell button.thread-topbar-meta-row:hover {
274
+ color: var(--theme-fg);
275
+ }
276
+ .thread-ui-shell .thread-topbar-meta-row[aria-expanded=true] {
277
+ color: var(--theme-fg);
278
+ }
279
+ .thread-ui-shell .thread-topbar-details-trigger {
280
+ border-color: var(--theme-border);
281
+ background: var(--theme-surface);
282
+ color: var(--theme-fg-soft);
283
+ }
284
+ .thread-ui-shell .thread-topbar-details-trigger:hover,
285
+ .thread-ui-shell .thread-topbar-details-trigger[aria-expanded=true] {
286
+ border-color: var(--theme-border-strong);
287
+ background: var(--theme-hover);
288
+ color: var(--theme-fg);
289
+ }
290
+ .thread-ui-shell .thread-topbar-details-popover {
291
+ border-color: var(--theme-border);
292
+ background: var(--theme-panel);
293
+ color: var(--theme-fg);
294
+ box-shadow: var(--theme-shadow);
295
+ }
296
+ .thread-ui-shell .thread-topbar-meta-row .font-mono {
297
+ color: var(--theme-fg-soft);
298
+ }
299
+ .thread-ui-shell button.thread-topbar-meta-row:hover .font-mono {
300
+ color: var(--theme-fg);
301
+ }
302
+ .thread-ui-shell .thread-graph-topbar-actions {
303
+ border-color: var(--theme-border);
304
+ background: var(--theme-surface);
305
+ }
306
+ .thread-ui-shell .thread-graph-topbar-actions > * {
307
+ display: inline-flex;
308
+ align-items: center;
309
+ gap: 0.25rem;
310
+ }
311
+ .thread-ui-shell .thread-graph-topbar-actions button,
312
+ .thread-ui-shell .thread-graph-topbar-actions a {
313
+ min-width: 2rem;
314
+ height: 2rem;
315
+ border-radius: 0.375rem;
316
+ border-color: transparent;
317
+ background: transparent;
318
+ color: var(--theme-fg-soft);
319
+ box-shadow: none;
320
+ }
321
+ .thread-ui-shell .thread-graph-topbar-actions button:hover,
322
+ .thread-ui-shell .thread-graph-topbar-actions a:hover {
323
+ background: var(--theme-hover);
324
+ color: var(--theme-fg);
325
+ }
326
+ .thread-ui-shell .thread-graph-topbar-actions button:disabled,
327
+ .thread-ui-shell .thread-graph-topbar-actions a[aria-disabled=true] {
328
+ cursor: not-allowed;
329
+ opacity: 0.5;
330
+ }
331
+ .thread-ui-shell .thread-graph-dialog,
332
+ .thread-graph-dialog {
333
+ border-color: var(--theme-border);
334
+ color: var(--theme-fg);
335
+ }
336
+ .thread-ui-shell .thread-graph-settings-dialog,
337
+ .thread-graph-settings-dialog,
338
+ .thread-graph-create-thread-dialog {
339
+ border-color: var(--theme-border);
340
+ background: var(--theme-panel);
341
+ color: var(--theme-fg);
342
+ }
343
+ .thread-ui-shell .thread-graph-settings-dialog [data-slot=dialog-description],
344
+ .thread-graph-settings-dialog [data-slot=dialog-description],
345
+ .thread-graph-create-thread-dialog [data-slot=dialog-description] {
346
+ color: var(--theme-fg-muted);
347
+ }
348
+ .thread-ui-shell .thread-graph-settings-dialog [data-slot=dialog-close],
349
+ .thread-graph-settings-dialog [data-slot=dialog-close],
350
+ .thread-graph-create-thread-dialog [data-slot=dialog-close] {
351
+ color: var(--theme-fg-muted);
352
+ }
353
+ .thread-ui-shell .thread-graph-settings-dialog [data-slot=dialog-close]:hover,
354
+ .thread-graph-settings-dialog [data-slot=dialog-close]:hover,
355
+ .thread-graph-create-thread-dialog [data-slot=dialog-close]:hover {
356
+ color: var(--theme-fg);
357
+ }
358
+ .thread-ui-shell .thread-graph-settings-card,
359
+ .thread-ui-shell .thread-graph-theme-mode-group,
360
+ .thread-ui-shell .thread-graph-settings-tabs,
361
+ .thread-graph-settings-dialog .thread-graph-settings-card,
362
+ .thread-graph-settings-dialog .thread-graph-theme-mode-group,
363
+ .thread-graph-settings-dialog .thread-graph-settings-tabs {
364
+ border-color: var(--theme-border);
365
+ background: var(--theme-surface);
366
+ }
367
+ .thread-ui-shell .thread-graph-theme-mode-button,
368
+ .thread-ui-shell .thread-graph-settings-tab-button,
369
+ .thread-graph-settings-dialog .thread-graph-theme-mode-button,
370
+ .thread-graph-settings-dialog .thread-graph-settings-tab-button {
371
+ color: var(--theme-fg-muted);
372
+ }
373
+ .thread-ui-shell .thread-graph-theme-mode-button:hover:not(:disabled),
374
+ .thread-ui-shell .thread-graph-settings-tab-button:hover:not(:disabled),
375
+ .thread-graph-settings-dialog .thread-graph-theme-mode-button:hover:not(:disabled),
376
+ .thread-graph-settings-dialog .thread-graph-settings-tab-button:hover:not(:disabled) {
377
+ background: var(--theme-hover);
378
+ color: var(--theme-fg);
379
+ }
380
+ .thread-ui-shell .thread-graph-theme-mode-button.is-selected,
381
+ .thread-ui-shell .thread-graph-settings-tab-button.is-active,
382
+ .thread-graph-settings-dialog .thread-graph-theme-mode-button.is-selected,
383
+ .thread-graph-settings-dialog .thread-graph-settings-tab-button.is-active {
384
+ background: var(--theme-accent-solid);
385
+ color: var(--theme-accent-solid-fg);
386
+ box-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
387
+ }
388
+ .thread-ui-shell .thread-graph-theme-mode-button:disabled,
389
+ .thread-ui-shell .thread-graph-settings-tab-button:disabled,
390
+ .thread-graph-settings-dialog .thread-graph-theme-mode-button:disabled,
391
+ .thread-graph-settings-dialog .thread-graph-settings-tab-button:disabled {
392
+ cursor: not-allowed;
393
+ opacity: 0.55;
394
+ }
395
+ .thread-graph-settings-dialog .thread-graph-settings-body {
396
+ max-height: min(62vh, 42rem);
397
+ color: var(--theme-fg);
398
+ }
399
+ .thread-graph-settings-dialog .thread-graph-settings-global-content {
400
+ color: var(--theme-fg);
401
+ }
402
+ .thread-graph-settings-dialog .thread-graph-settings-body dt,
403
+ .thread-graph-settings-dialog .thread-graph-settings-body .text-stone-500,
404
+ .thread-graph-settings-dialog .thread-graph-settings-body .text-slate-500,
405
+ .thread-graph-settings-dialog .thread-graph-settings-body .text-stone-400,
406
+ .thread-graph-settings-dialog .thread-graph-settings-body .text-slate-400 {
407
+ color: var(--theme-fg-muted) !important;
408
+ }
409
+ .thread-graph-settings-dialog .thread-graph-settings-body dd,
410
+ .thread-graph-settings-dialog .thread-graph-settings-body .text-stone-100,
411
+ .thread-graph-settings-dialog .thread-graph-settings-body .text-stone-200,
412
+ .thread-graph-settings-dialog .thread-graph-settings-body .text-stone-300,
413
+ .thread-graph-settings-dialog .thread-graph-settings-body .text-slate-100,
414
+ .thread-graph-settings-dialog .thread-graph-settings-body .text-slate-200,
415
+ .thread-graph-settings-dialog .thread-graph-settings-body .text-slate-300 {
416
+ color: var(--theme-fg) !important;
417
+ }
418
+ .thread-graph-settings-dialog .thread-graph-settings-body .bg-stone-950,
419
+ .thread-graph-settings-dialog .thread-graph-settings-body .bg-stone-900,
420
+ .thread-graph-settings-dialog .thread-graph-settings-body .bg-slate-950,
421
+ .thread-graph-settings-dialog .thread-graph-settings-body .bg-slate-900 {
422
+ background: var(--theme-surface-strong) !important;
423
+ }
424
+ .thread-graph-settings-dialog .thread-graph-settings-body .border-stone-800,
425
+ .thread-graph-settings-dialog .thread-graph-settings-body .border-stone-700,
426
+ .thread-graph-settings-dialog .thread-graph-settings-body .border-slate-800,
427
+ .thread-graph-settings-dialog .thread-graph-settings-body .border-slate-700 {
428
+ border-color: var(--theme-border) !important;
429
+ }
430
+ .thread-graph-create-thread-input {
431
+ border-color: var(--theme-border);
432
+ background: var(--theme-surface);
433
+ color: var(--theme-fg);
434
+ }
435
+ .thread-graph-create-thread-input::placeholder {
436
+ color: var(--theme-fg-muted);
437
+ }
438
+ .thread-graph-create-thread-input:focus {
439
+ border-color: var(--theme-border-contrast);
440
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--theme-border-contrast) 18%, transparent);
441
+ }
442
+ .thread-graph-create-thread-submit {
443
+ background: var(--theme-accent-solid);
444
+ color: var(--theme-accent-solid-fg);
445
+ }
446
+ .thread-graph-create-thread-submit:hover:not(:disabled) {
447
+ background: var(--theme-accent-solid-hover);
448
+ }
449
+ .thread-ui-shell .ui-action-danger {
450
+ border: 1px solid color-mix(in oklch, rgb(244 63 94) 48%, var(--theme-border));
451
+ background: color-mix(in oklch, rgb(244 63 94) 18%, var(--theme-panel));
452
+ color: color-mix(in oklch, rgb(254 226 226) 86%, var(--theme-fg));
453
+ }
454
+ .thread-ui-shell .ui-action-danger:hover {
455
+ background: color-mix(in oklch, rgb(244 63 94) 26%, var(--theme-panel));
456
+ color: rgb(254 226 226);
457
+ }
458
+ .thread-ui-shell .thread-mobile-segment {
459
+ background: var(--theme-surface-strong);
460
+ color: var(--theme-fg-soft);
461
+ }
462
+ .thread-ui-shell .thread-mobile-segment:hover {
463
+ background: var(--theme-hover);
464
+ color: var(--theme-fg);
465
+ }
466
+ .thread-ui-shell .thread-mobile-segment.is-active {
467
+ background: var(--theme-accent-solid);
468
+ color: var(--theme-accent-solid-fg);
469
+ }
470
+ .thread-ui-shell .thread-sidebar-card {
471
+ border-color: transparent;
472
+ background: var(--theme-surface-strong);
473
+ color: var(--theme-fg-soft);
474
+ }
475
+ .thread-ui-shell .thread-graph-room-card {
476
+ border-color: rgb(226 232 240 / 0.9);
477
+ background: rgb(248 250 252);
478
+ color: rgb(51 65 85);
479
+ }
480
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-room-card {
481
+ border-color: rgb(226 232 240 / 0.9);
482
+ background: rgb(248 250 252);
483
+ color: rgb(51 65 85);
484
+ }
485
+ .thread-ui-shell .thread-sidebar-card:hover {
486
+ border-color: var(--theme-border);
487
+ background: var(--theme-panel);
488
+ color: var(--theme-fg);
489
+ }
490
+ .thread-ui-shell .thread-graph-room-card:hover {
491
+ border-color: rgb(203 213 225);
492
+ background: rgb(255 255 255);
493
+ color: rgb(15 23 42);
494
+ }
495
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-room-card:hover {
496
+ border-color: rgb(203 213 225);
497
+ background: rgb(255 255 255);
498
+ color: rgb(15 23 42);
499
+ }
500
+ .thread-ui-shell .thread-sidebar-card-active {
501
+ border-color: var(--theme-accent-solid);
502
+ background: var(--theme-accent-solid);
503
+ color: var(--theme-accent-solid-fg);
504
+ box-shadow: 0 12px 30px oklch(0.22 0.024 255 / 0.18);
505
+ }
506
+ .thread-ui-shell .thread-graph-room-card.is-active {
507
+ border-color: rgb(203 213 225);
508
+ background: rgb(241 245 249);
509
+ color: rgb(15 23 42);
510
+ box-shadow: 0 8px 22px rgb(15 23 42 / 0.06);
511
+ }
512
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-room-card.is-active {
513
+ border-color: rgb(203 213 225);
514
+ background: rgb(241 245 249);
515
+ color: rgb(15 23 42);
516
+ box-shadow: 0 8px 22px rgb(15 23 42 / 0.06);
517
+ }
518
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-room-card.is-active,
519
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-room-card.is-active,
520
+ .thread-ui-shell.dark .thread-graph-room-card.is-active {
521
+ border-color: #3c4556;
522
+ background: #262c38;
523
+ color: rgb(241 245 249);
524
+ box-shadow: 0 10px 24px rgb(0 0 0 / 0.18);
525
+ }
526
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-room-card,
527
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-room-card,
528
+ .thread-ui-shell.dark .thread-graph-room-card {
529
+ border-color: transparent;
530
+ background: #1d222c;
531
+ color: rgb(203 213 225);
532
+ }
533
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-room-card:hover,
534
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-room-card:hover,
535
+ .thread-ui-shell.dark .thread-graph-room-card:hover {
536
+ border-color: #343b48;
537
+ background: #222733;
538
+ color: rgb(241 245 249);
539
+ }
540
+ .thread-ui-shell .thread-sidebar-card-icon {
541
+ background: var(--theme-panel);
542
+ color: var(--theme-fg-muted);
543
+ }
544
+ .thread-ui-shell .thread-graph-room-card-icon {
545
+ background: rgb(255 255 255);
546
+ color: rgb(100 116 139);
547
+ }
548
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-room-card-icon {
549
+ background: rgb(255 255 255);
550
+ color: rgb(100 116 139);
551
+ }
552
+ .thread-ui-shell .thread-sidebar-card-icon.is-active {
553
+ background: color-mix(in oklch, var(--theme-accent-solid-fg) 16%, transparent);
554
+ color: var(--theme-accent-solid-fg);
555
+ }
556
+ .thread-ui-shell .thread-graph-room-card-icon.is-active {
557
+ background: rgb(226 232 240);
558
+ color: rgb(15 23 42);
559
+ }
560
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-room-card-icon.is-active {
561
+ background: rgb(226 232 240);
562
+ color: rgb(15 23 42);
563
+ }
564
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-room-card-icon.is-active,
565
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-room-card-icon.is-active,
566
+ .thread-ui-shell.dark .thread-graph-room-card-icon.is-active {
567
+ background: #12151c;
568
+ color: rgb(226 232 240);
569
+ }
570
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-room-card-icon,
571
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-room-card-icon,
572
+ .thread-ui-shell.dark .thread-graph-room-card-icon {
573
+ background: #12151c;
574
+ color: rgb(148 163 184);
575
+ }
576
+ .thread-ui-shell .thread-sidebar-card-active .thread-sidebar-card-title,
577
+ .thread-ui-shell .thread-sidebar-card-active p,
578
+ .thread-ui-shell .thread-sidebar-card-active span,
579
+ .thread-ui-shell .thread-sidebar-card-active button,
580
+ .thread-ui-shell .thread-graph-room-card.is-active .thread-graph-room-card-title,
581
+ .thread-ui-shell .thread-graph-room-card.is-active p,
582
+ .thread-ui-shell .thread-graph-room-card.is-active button {
583
+ color: inherit;
584
+ }
585
+ .thread-ui-shell .thread-card-quiet-button {
586
+ color: var(--theme-fg-muted);
587
+ }
588
+ .thread-ui-shell .thread-card-quiet-button:hover {
589
+ background: color-mix(in oklch, var(--theme-hover) 80%, transparent);
590
+ color: var(--theme-fg);
591
+ }
592
+ .thread-ui-shell .thread-card-session-copy-button {
593
+ opacity: 0;
594
+ }
595
+ .thread-ui-shell .thread-graph-room-card:hover .thread-card-session-copy-button,
596
+ .thread-ui-shell .thread-card-session-copy-button:focus-visible,
597
+ .thread-ui-shell .thread-card-session-copy-button:active {
598
+ opacity: 1;
599
+ }
600
+ .thread-ui-shell .thread-card-danger-button {
601
+ color: oklch(0.62 0.16 25);
602
+ }
603
+ .thread-ui-shell .thread-card-danger-button:hover {
604
+ background: rgb(254 226 226);
605
+ }
606
+ .thread-ui-shell.thread-ui-theme-dark .thread-card-danger-button:hover,
607
+ .thread-ui-shell[data-theme-effective=dark] .thread-card-danger-button:hover,
608
+ .thread-ui-shell.dark .thread-card-danger-button:hover {
609
+ background: rgb(127 29 29 / 0.32);
610
+ }
611
+ .thread-ui-shell .thread-new-thread-button,
612
+ .thread-ui-shell .thread-graph-new-room-button {
613
+ min-width: 0;
614
+ }
615
+ .thread-ui-shell .thread-graph-new-room-strip {
616
+ border-color: var(--theme-border);
617
+ }
618
+ .thread-ui-shell .thread-graph-new-room-button {
619
+ background: var(--theme-accent-solid);
620
+ color: var(--theme-accent-solid-fg);
621
+ transition: background-color 160ms ease, transform 160ms ease;
622
+ }
623
+ .thread-ui-shell .thread-graph-new-room-button:hover {
624
+ background: var(--theme-accent-solid-hover);
625
+ transform: translateY(-1px);
626
+ }
627
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-new-room-button,
628
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-new-room-button,
629
+ .thread-ui-shell.dark .thread-graph-new-room-button {
630
+ border: 1px solid #343b48;
631
+ background: #222733;
632
+ color: rgb(241 245 249);
633
+ }
634
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-new-room-button:hover,
635
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-new-room-button:hover,
636
+ .thread-ui-shell.dark .thread-graph-new-room-button:hover {
637
+ border-color: #465164;
638
+ background: #2b313d;
639
+ }
640
+ `);Wt(`.thread-ui-shell .thread-detail-surface {
641
+ border-color: transparent;
642
+ background: var(--theme-surface);
643
+ box-shadow: none;
644
+ }
645
+ .thread-ui-shell .thread-graph-chat-panel {
646
+ background: var(--theme-surface);
647
+ color: var(--theme-fg);
648
+ }
649
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-chat-panel,
650
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-chat-panel,
651
+ .thread-ui-shell.dark .thread-graph-chat-panel {
652
+ background: var(--theme-surface);
653
+ color: var(--theme-fg);
654
+ }
655
+ .thread-ui-shell .thread-graph-scroll-container {
656
+ background: var(--theme-surface);
657
+ color: var(--theme-fg);
658
+ scrollbar-color: rgb(203 213 225) transparent;
659
+ }
660
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-scroll-container,
661
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-scroll-container,
662
+ .thread-ui-shell.dark .thread-graph-scroll-container {
663
+ background: var(--theme-surface);
664
+ color: var(--theme-fg);
665
+ scrollbar-color: #374151 transparent;
666
+ }
667
+ .thread-ui-shell .thread-graph-scroll-content {
668
+ min-height: 100%;
669
+ padding: 0.75rem 0 max(0rem, var(--thread-graph-chat-scroll-bottom-spacer, 0px));
670
+ }
671
+ .thread-ui-shell .thread-graph-message-list {
672
+ display: flex;
673
+ flex-direction: column;
674
+ gap: 1rem;
675
+ }
676
+ .thread-ui-shell .thread-graph-message-section {
677
+ border-top: 1px solid var(--theme-border);
678
+ }
679
+ .thread-ui-shell .thread-graph-history-control,
680
+ .thread-ui-shell .thread-graph-empty-state {
681
+ color: var(--theme-fg-muted);
682
+ }
683
+ .thread-ui-shell .thread-graph-history-button,
684
+ .thread-ui-shell .thread-graph-turn-index,
685
+ .thread-ui-shell .thread-graph-turn-collapse {
686
+ border-color: var(--theme-border);
687
+ background: var(--theme-panel);
688
+ color: var(--theme-fg-muted);
689
+ }
690
+ .thread-ui-shell .thread-graph-history-button:hover,
691
+ .thread-ui-shell .thread-graph-turn-collapse:hover {
692
+ background: var(--theme-hover);
693
+ color: var(--theme-fg);
694
+ }
695
+ .thread-ui-shell .thread-graph-turn {
696
+ border-radius: 0;
697
+ }
698
+ .thread-ui-shell .thread-graph-turn-header {
699
+ color: var(--theme-fg-muted);
700
+ }
701
+ .thread-ui-shell .thread-graph-turn-time {
702
+ color: var(--theme-fg-muted);
703
+ }
704
+ .thread-ui-shell :where(.text-stone-100, .text-stone-200, .text-stone-300) {
705
+ color: var(--theme-fg) !important;
706
+ }
707
+ .thread-ui-shell :where(.text-stone-400, .text-stone-500, .text-stone-600) {
708
+ color: var(--theme-fg-muted) !important;
709
+ }
710
+ .thread-ui-shell :where(.border-stone-600, .border-stone-700, .border-stone-700\\/90, .border-stone-800, .border-stone-800\\/80) {
711
+ border-color: var(--theme-border) !important;
712
+ }
713
+ .thread-ui-shell :where(.bg-stone-800, .bg-stone-800\\/60, .bg-stone-800\\/80, .bg-stone-900, .bg-stone-900\\/60, .bg-stone-900\\/70, .bg-stone-900\\/72, .bg-stone-900\\/80, .bg-stone-950, .bg-stone-950\\/70, .bg-stone-950\\/90) {
714
+ background: var(--theme-surface-strong) !important;
715
+ }
716
+ .thread-ui-shell[data-theme-effective=light] :where(.text-sky-100, .text-sky-50),
717
+ :root[data-theme-effective=light] .thread-ui-shell :where(.text-sky-100, .text-sky-50) {
718
+ color: rgb(3 105 161);
719
+ }
720
+ .thread-ui-shell[data-theme-effective=light] :where(.text-emerald-100, .text-emerald-50),
721
+ :root[data-theme-effective=light] .thread-ui-shell :where(.text-emerald-100, .text-emerald-50) {
722
+ color: rgb(21 128 61);
723
+ }
724
+ .thread-ui-shell[data-theme-effective=light] :where(.text-rose-100, .text-rose-50),
725
+ :root[data-theme-effective=light] .thread-ui-shell :where(.text-rose-100, .text-rose-50) {
726
+ color: rgb(190 24 93);
727
+ }
728
+ .thread-ui-shell[data-theme-effective=light] :where(.text-amber-100, .text-amber-50, .text-amber-200),
729
+ :root[data-theme-effective=light] .thread-ui-shell :where(.text-amber-100, .text-amber-50, .text-amber-200) {
730
+ color: rgb(120 53 15);
731
+ }
732
+ .thread-ui-shell[data-theme-effective=light] .text-fuchsia-100,
733
+ :root[data-theme-effective=light] .thread-ui-shell .text-fuchsia-100 {
734
+ color: rgb(162 28 175);
735
+ }
736
+ .thread-ui-shell[data-theme-effective=light] .text-violet-100,
737
+ :root[data-theme-effective=light] .thread-ui-shell .text-violet-100 {
738
+ color: rgb(109 40 217);
739
+ }
740
+ .thread-ui-shell[data-theme-effective=light] .text-lime-100,
741
+ :root[data-theme-effective=light] .thread-ui-shell .text-lime-100 {
742
+ color: rgb(77 124 15);
743
+ }
744
+ .thread-ui-shell[data-theme-effective=light] :where(.bg-sky-300\\/10, .bg-sky-300\\/15, .bg-emerald-300\\/10, .bg-emerald-300\\/15, .bg-amber-300\\/10, .bg-amber-300\\/15, .bg-rose-300\\/10, .bg-rose-300\\/15, .bg-fuchsia-300\\/10, .bg-fuchsia-300\\/15, .bg-violet-300\\/10, .bg-violet-300\\/15, .bg-lime-300\\/10, .bg-lime-300\\/15),
745
+ :root[data-theme-effective=light] .thread-ui-shell :where(.bg-sky-300\\/10, .bg-sky-300\\/15, .bg-emerald-300\\/10, .bg-emerald-300\\/15, .bg-amber-300\\/10, .bg-amber-300\\/15, .bg-rose-300\\/10, .bg-rose-300\\/15, .bg-fuchsia-300\\/10, .bg-fuchsia-300\\/15, .bg-violet-300\\/10, .bg-violet-300\\/15, .bg-lime-300\\/10, .bg-lime-300\\/15) {
746
+ filter: saturate(0.72) brightness(0.97);
747
+ }
748
+ .thread-ui-shell .thread-token-popover {
749
+ border-color: var(--theme-border);
750
+ background: var(--theme-panel);
751
+ color: var(--theme-fg);
752
+ }
753
+ .thread-ui-shell .thread-token-popover-row {
754
+ border-color: var(--theme-border);
755
+ background: var(--theme-surface);
756
+ }
757
+ .thread-ui-shell .thread-token-popover-text {
758
+ color: var(--theme-fg-soft);
759
+ }
760
+ .thread-ui-shell .thread-token-popover-strong {
761
+ color: var(--theme-fg);
762
+ }
763
+ .thread-ui-shell .token-badge-in {
764
+ border-color: rgb(22 101 52 / 0.32);
765
+ background: rgb(220 252 231 / 0.72);
766
+ color: rgb(20 83 45);
767
+ }
768
+ .thread-ui-shell .token-badge-cache {
769
+ border-color: rgb(3 105 161 / 0.32);
770
+ background: rgb(224 242 254 / 0.76);
771
+ color: rgb(7 89 133);
772
+ }
773
+ .thread-ui-shell .token-badge-out {
774
+ border-color: rgb(109 40 217 / 0.28);
775
+ background: rgb(237 233 254 / 0.76);
776
+ color: rgb(91 33 182);
777
+ }
778
+ .thread-ui-shell .token-badge-reason {
779
+ border-color: rgb(146 64 14 / 0.28);
780
+ background: rgb(254 243 199 / 0.72);
781
+ color: rgb(120 53 15);
782
+ }
783
+ .thread-ui-shell .token-badge-total {
784
+ border-color: rgb(77 124 15 / 0.3);
785
+ background: rgb(236 252 203 / 0.72);
786
+ color: rgb(63 98 18);
787
+ }
788
+ .thread-ui-shell .token-badge-empty {
789
+ border-color: var(--theme-border-strong);
790
+ background: var(--theme-surface);
791
+ color: var(--theme-fg-soft);
792
+ }
793
+ .thread-ui-shell .thread-token-badge-value {
794
+ color: currentColor;
795
+ }
796
+ .thread-ui-shell[data-theme-effective=dark] .thread-token-popover,
797
+ :root[data-theme-effective=dark] .thread-ui-shell .thread-token-popover,
798
+ .thread-ui-shell.thread-ui-theme-dark .thread-token-popover,
799
+ .thread-ui-shell.dark .thread-token-popover {
800
+ border-color: #303642;
801
+ background: #171a22;
802
+ }
803
+ .thread-ui-shell[data-theme-effective=dark] .thread-token-popover-row,
804
+ :root[data-theme-effective=dark] .thread-ui-shell .thread-token-popover-row,
805
+ .thread-ui-shell.thread-ui-theme-dark .thread-token-popover-row,
806
+ .thread-ui-shell.dark .thread-token-popover-row {
807
+ border-color: #303642;
808
+ background: #1d222c;
809
+ }
810
+ .thread-ui-shell[data-theme-effective=dark] .token-badge-in,
811
+ .thread-ui-shell[data-theme-effective=dark] .token-badge-cache,
812
+ .thread-ui-shell[data-theme-effective=dark] .token-badge-out,
813
+ .thread-ui-shell[data-theme-effective=dark] .token-badge-reason,
814
+ .thread-ui-shell[data-theme-effective=dark] .token-badge-total,
815
+ :root[data-theme-effective=dark] .thread-ui-shell .token-badge-in,
816
+ :root[data-theme-effective=dark] .thread-ui-shell .token-badge-cache,
817
+ :root[data-theme-effective=dark] .thread-ui-shell .token-badge-out,
818
+ :root[data-theme-effective=dark] .thread-ui-shell .token-badge-reason,
819
+ :root[data-theme-effective=dark] .thread-ui-shell .token-badge-total,
820
+ .thread-ui-shell.thread-ui-theme-dark .token-badge-in,
821
+ .thread-ui-shell.thread-ui-theme-dark .token-badge-cache,
822
+ .thread-ui-shell.thread-ui-theme-dark .token-badge-out,
823
+ .thread-ui-shell.thread-ui-theme-dark .token-badge-reason,
824
+ .thread-ui-shell.thread-ui-theme-dark .token-badge-total,
825
+ .thread-ui-shell.dark .token-badge-in,
826
+ .thread-ui-shell.dark .token-badge-cache,
827
+ .thread-ui-shell.dark .token-badge-out,
828
+ .thread-ui-shell.dark .token-badge-reason,
829
+ .thread-ui-shell.dark .token-badge-total {
830
+ background-color: color-mix(in oklch, currentColor 12%, transparent);
831
+ }
832
+ .thread-ui-shell[data-theme-effective=dark] .token-badge-in,
833
+ :root[data-theme-effective=dark] .thread-ui-shell .token-badge-in,
834
+ .thread-ui-shell.thread-ui-theme-dark .token-badge-in,
835
+ .thread-ui-shell.dark .token-badge-in {
836
+ color: rgb(134 239 172);
837
+ }
838
+ .thread-ui-shell[data-theme-effective=dark] .token-badge-cache,
839
+ :root[data-theme-effective=dark] .thread-ui-shell .token-badge-cache,
840
+ .thread-ui-shell.thread-ui-theme-dark .token-badge-cache,
841
+ .thread-ui-shell.dark .token-badge-cache {
842
+ color: rgb(125 211 252);
843
+ }
844
+ .thread-ui-shell[data-theme-effective=dark] .token-badge-out,
845
+ :root[data-theme-effective=dark] .thread-ui-shell .token-badge-out,
846
+ .thread-ui-shell.thread-ui-theme-dark .token-badge-out,
847
+ .thread-ui-shell.dark .token-badge-out {
848
+ color: rgb(196 181 253);
849
+ }
850
+ .thread-ui-shell[data-theme-effective=dark] .token-badge-reason,
851
+ :root[data-theme-effective=dark] .thread-ui-shell .token-badge-reason,
852
+ .thread-ui-shell.thread-ui-theme-dark .token-badge-reason,
853
+ .thread-ui-shell.dark .token-badge-reason {
854
+ color: rgb(252 211 77);
855
+ }
856
+ .thread-ui-shell[data-theme-effective=dark] .token-badge-total,
857
+ :root[data-theme-effective=dark] .thread-ui-shell .token-badge-total,
858
+ .thread-ui-shell.thread-ui-theme-dark .token-badge-total,
859
+ .thread-ui-shell.dark .token-badge-total {
860
+ color: rgb(190 242 100);
861
+ }
862
+ .thread-ui-shell .thread-graph-event,
863
+ .thread-ui-shell .thread-graph-event-card,
864
+ .thread-ui-shell .thread-graph-history-group,
865
+ .thread-ui-shell .thread-graph-history-group-card {
866
+ border-color: var(--theme-border);
867
+ background: var(--theme-panel);
868
+ color: var(--theme-fg);
869
+ }
870
+ .thread-ui-shell .thread-graph-event-card,
871
+ .thread-ui-shell .thread-graph-history-group-card {
872
+ background: var(--theme-surface);
873
+ }
874
+ .thread-ui-shell .thread-graph-event-line,
875
+ .thread-ui-shell .thread-graph-history-group-toggle {
876
+ color: var(--theme-fg);
877
+ }
878
+ .thread-ui-shell .thread-graph-history-group-list {
879
+ border-color: var(--theme-border);
880
+ }
881
+ `);Wt(`.thread-ui-shell .thread-workspace-panel {
882
+ background: var(--theme-panel);
883
+ }
884
+ .thread-ui-shell .thread-workspace-card {
885
+ background: var(--theme-surface);
886
+ }
887
+ .thread-ui-shell .thread-workspace-collapse-tab,
888
+ .thread-ui-shell .thread-workspace-small-toggle,
889
+ .thread-ui-shell .thread-workspace-expand-fab,
890
+ .thread-ui-shell .thread-graph-panel-expand-fab {
891
+ align-items: center;
892
+ justify-content: center;
893
+ width: 2rem;
894
+ height: 2rem;
895
+ border: 1px solid var(--theme-border);
896
+ border-radius: 999px;
897
+ background: color-mix(in oklch, var(--theme-panel) 92%, transparent);
898
+ color: var(--theme-fg-soft);
899
+ box-shadow: 0 10px 26px color-mix(in oklch, var(--theme-bg) 62%, transparent);
900
+ transition:
901
+ background-color 160ms ease,
902
+ border-color 160ms ease,
903
+ color 160ms ease,
904
+ transform 160ms ease,
905
+ box-shadow 160ms ease;
906
+ }
907
+ .thread-ui-shell .thread-workspace-collapse-tab:hover,
908
+ .thread-ui-shell .thread-workspace-small-toggle:hover,
909
+ .thread-ui-shell .thread-workspace-expand-fab:hover,
910
+ .thread-ui-shell .thread-graph-panel-expand-fab:hover {
911
+ border-color: var(--theme-border-strong);
912
+ background: var(--theme-hover);
913
+ color: var(--theme-fg);
914
+ box-shadow: 0 14px 30px color-mix(in oklch, var(--theme-bg) 72%, transparent);
915
+ }
916
+ .thread-ui-shell .thread-workspace-collapse-tab {
917
+ position: absolute;
918
+ left: -1rem;
919
+ top: 50%;
920
+ z-index: 30;
921
+ transform: translateY(-50%);
922
+ }
923
+ .thread-ui-shell .thread-workspace-collapse-tab:hover {
924
+ transform: translateY(-50%) translateX(-1px);
925
+ }
926
+ .thread-ui-shell .thread-workspace-expand-fab {
927
+ position: absolute;
928
+ right: 0.75rem;
929
+ top: 50%;
930
+ z-index: 30;
931
+ transform: translateY(-50%);
932
+ }
933
+ .thread-ui-shell .thread-workspace-expand-fab:hover {
934
+ transform: translateY(-50%) translateX(-1px);
935
+ }
936
+ .thread-ui-shell .thread-chat-usage-footer {
937
+ background: var(--theme-surface);
938
+ color: rgb(148 163 184);
939
+ }
940
+ .thread-ui-shell.thread-ui-theme-dark .thread-chat-usage-footer,
941
+ .thread-ui-shell[data-theme-effective=dark] .thread-chat-usage-footer,
942
+ .thread-ui-shell.dark .thread-chat-usage-footer {
943
+ background: var(--theme-surface);
944
+ color: rgb(100 116 139);
945
+ }
946
+ .thread-ui-shell .thread-graph-composer-host {
947
+ border-top: 1px solid rgb(226 232 240);
948
+ background: var(--theme-surface);
949
+ padding: 0.5rem 0.75rem calc(env(safe-area-inset-bottom) + 0.5rem);
950
+ }
951
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-host,
952
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-host,
953
+ .thread-ui-shell.dark .thread-graph-composer-host {
954
+ border-top-color: #2a2f3a;
955
+ background: var(--theme-surface);
956
+ }
957
+ .thread-ui-shell .thread-graph-composer-host > .thread-composer-layer,
958
+ .thread-ui-shell .thread-graph-composer-host > .thread-graph-composer-layer {
959
+ width: 100%;
960
+ }
961
+ .thread-ui-shell .thread-split-chat-pane,
962
+ .thread-ui-shell .thread-split-workspace-pane {
963
+ width: 100%;
964
+ min-height: 0;
965
+ }
966
+ .thread-ui-shell .thread-split-chat-pane {
967
+ min-width: 0;
968
+ }
969
+ .thread-ui-shell .thread-split-region,
970
+ .thread-ui-shell .thread-split-container {
971
+ height: 100%;
972
+ min-height: 0;
973
+ overflow: hidden;
974
+ }
975
+ .thread-ui-shell .thread-graph-shell-desktop-split {
976
+ display: none !important;
977
+ }
978
+ .thread-ui-shell .thread-graph-shell-mobile-split {
979
+ display: block !important;
980
+ }
981
+ .thread-ui-shell[data-thread-layout=desktop] .thread-graph-shell-desktop-split {
982
+ display: flex !important;
983
+ }
984
+ .thread-ui-shell[data-thread-layout=desktop] .thread-graph-shell-mobile-split {
985
+ display: none !important;
986
+ }
987
+ .thread-ui-shell[data-thread-layout=desktop] .thread-graph-shell-desktop-split .thread-split-chat-pane,
988
+ .thread-ui-shell[data-thread-layout=desktop] .thread-graph-shell-desktop-split .thread-split-workspace-pane,
989
+ .thread-ui-shell .thread-graph-shell-desktop-split .thread-split-chat-pane,
990
+ .thread-ui-shell .thread-graph-shell-desktop-split .thread-split-workspace-pane {
991
+ min-width: 0;
992
+ height: 100%;
993
+ }
994
+ .thread-ui-shell[data-thread-layout=desktop] .thread-graph-shell-desktop-split .thread-split-chat-pane,
995
+ .thread-ui-shell[data-thread-layout=desktop] .thread-graph-shell-desktop-split .thread-split-workspace-pane {
996
+ flex: 1 1 0;
997
+ min-width: 0;
998
+ width: auto;
999
+ }
1000
+ .thread-ui-shell[data-thread-layout=desktop] {
1001
+ padding: 0.5rem;
1002
+ }
1003
+ .thread-ui-shell[data-thread-layout=desktop].thread-ui-viewport-constrained {
1004
+ height: 100svh;
1005
+ max-height: 100svh;
1006
+ }
1007
+ .thread-ui-shell[data-thread-layout=desktop] .thread-shell-frame {
1008
+ display: grid;
1009
+ grid-template-columns: 264px minmax(0, 1fr);
1010
+ gap: 0.5rem;
1011
+ height: 100%;
1012
+ min-height: 0;
1013
+ }
1014
+ .thread-ui-shell[data-thread-layout=desktop] .thread-desktop-only-flex {
1015
+ display: flex !important;
1016
+ }
1017
+ .thread-ui-shell[data-thread-layout=desktop] .thread-desktop-only-inline-flex {
1018
+ display: inline-flex !important;
1019
+ }
1020
+ .thread-ui-shell[data-thread-layout=desktop] .thread-mobile-only-block,
1021
+ .thread-ui-shell[data-thread-layout=desktop] .thread-mobile-only-grid,
1022
+ .thread-ui-shell[data-thread-layout=desktop] .thread-mobile-only-inline-flex {
1023
+ display: none !important;
1024
+ }
1025
+ .thread-ui-shell[data-thread-layout=desktop] .thread-mobile-chat-hidden,
1026
+ .thread-ui-shell[data-thread-layout=desktop] .thread-mobile-workspace-hidden {
1027
+ display: block !important;
1028
+ }
1029
+ .thread-ui-shell[data-thread-layout=desktop] .thread-desktop-collapsed-hidden {
1030
+ display: none;
1031
+ }
1032
+ .thread-ui-shell[data-thread-layout=desktop] .thread-shell-frame.is-rail-collapsed {
1033
+ grid-template-columns: 56px minmax(0, 1fr);
1034
+ }
1035
+ .thread-ui-shell[data-thread-layout=desktop] .thread-rooms-rail {
1036
+ position: static;
1037
+ z-index: auto;
1038
+ width: auto;
1039
+ min-width: 0;
1040
+ height: 100%;
1041
+ transform: none;
1042
+ translate: 0 0;
1043
+ pointer-events: auto;
1044
+ border: 1px solid var(--theme-border);
1045
+ border-radius: 12px;
1046
+ box-shadow: var(--theme-shadow);
1047
+ }
1048
+ .thread-ui-shell[data-thread-layout=desktop] .thread-rooms-rail-header {
1049
+ height: 4rem;
1050
+ align-items: center;
1051
+ padding-bottom: 0;
1052
+ }
1053
+ .thread-ui-shell[data-thread-layout=desktop] .thread-shell-card {
1054
+ border: 1px solid var(--theme-border);
1055
+ border-radius: 12px;
1056
+ }
1057
+ .thread-ui-shell[data-thread-layout=desktop] .thread-topbar-row {
1058
+ min-height: 4rem;
1059
+ padding-left: 1.25rem;
1060
+ padding-right: 1.25rem;
1061
+ }
1062
+ .thread-ui-shell[data-thread-layout=desktop] .thread-mobile-view-switch {
1063
+ display: none !important;
1064
+ }
1065
+ .thread-ui-shell[data-thread-layout=desktop] .thread-split-region {
1066
+ padding: 0.5rem;
1067
+ }
1068
+ .thread-ui-shell[data-thread-layout=desktop] .thread-split-container.has-workspace {
1069
+ display: flex;
1070
+ align-items: stretch;
1071
+ min-width: 0;
1072
+ min-height: 0;
1073
+ }
1074
+ .thread-ui-shell[data-thread-layout=desktop] .thread-split-chat-pane {
1075
+ flex: 0 0 var(--thread-chat-percent, 54%);
1076
+ min-width: min(31rem, 100%);
1077
+ width: auto;
1078
+ height: 100%;
1079
+ display: block;
1080
+ }
1081
+ .thread-ui-shell[data-thread-layout=desktop] .thread-split-workspace-pane {
1082
+ flex: 0 0 var(--thread-workspace-percent, 46%);
1083
+ min-width: 19rem;
1084
+ width: auto;
1085
+ height: 100%;
1086
+ display: block;
1087
+ }
1088
+ .thread-ui-shell[data-thread-layout=desktop] .thread-resize-handle {
1089
+ display: flex !important;
1090
+ }
1091
+ @media (min-width: 640px) {
1092
+ .thread-ui-shell:not([data-thread-layout=mobile]) {
1093
+ padding: 0.5rem;
1094
+ }
1095
+ .thread-ui-shell:not([data-thread-layout=mobile]).thread-ui-viewport-constrained {
1096
+ height: 100svh;
1097
+ max-height: 100svh;
1098
+ }
1099
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-shell-frame {
1100
+ display: grid;
1101
+ grid-template-columns: 264px minmax(0, 1fr);
1102
+ gap: 0.5rem;
1103
+ height: 100%;
1104
+ min-height: 0;
1105
+ }
1106
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-desktop-only-flex {
1107
+ display: flex !important;
1108
+ }
1109
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-desktop-only-inline-flex {
1110
+ display: inline-flex !important;
1111
+ }
1112
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-mobile-only-block,
1113
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-mobile-only-grid,
1114
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-mobile-only-inline-flex {
1115
+ display: none !important;
1116
+ }
1117
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-mobile-chat-hidden,
1118
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-mobile-workspace-hidden {
1119
+ display: block !important;
1120
+ }
1121
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-desktop-collapsed-hidden {
1122
+ display: none;
1123
+ }
1124
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-shell-frame.is-rail-collapsed {
1125
+ grid-template-columns: 56px minmax(0, 1fr);
1126
+ }
1127
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-rooms-rail {
1128
+ position: static;
1129
+ z-index: auto;
1130
+ width: auto;
1131
+ min-width: 0;
1132
+ height: 100%;
1133
+ transform: none;
1134
+ translate: 0 0;
1135
+ pointer-events: auto;
1136
+ border: 1px solid var(--theme-border);
1137
+ border-radius: 12px;
1138
+ box-shadow: var(--theme-shadow);
1139
+ }
1140
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-rooms-rail-header {
1141
+ height: 4rem;
1142
+ align-items: center;
1143
+ padding-bottom: 0;
1144
+ }
1145
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-shell-card {
1146
+ border: 1px solid var(--theme-border);
1147
+ border-radius: 12px;
1148
+ }
1149
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-topbar-row {
1150
+ min-height: 4rem;
1151
+ padding-left: 1.25rem;
1152
+ padding-right: 1.25rem;
1153
+ }
1154
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-mobile-view-switch {
1155
+ display: none !important;
1156
+ }
1157
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-split-region {
1158
+ padding: 0.5rem;
1159
+ }
1160
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-split-container.has-workspace {
1161
+ display: flex;
1162
+ align-items: stretch;
1163
+ min-width: 0;
1164
+ min-height: 0;
1165
+ }
1166
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-split-chat-pane {
1167
+ flex: 0 0 var(--thread-chat-percent, 54%);
1168
+ min-width: min(31rem, 100%);
1169
+ width: auto;
1170
+ height: 100%;
1171
+ display: block;
1172
+ }
1173
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-split-workspace-pane {
1174
+ flex: 0 0 var(--thread-workspace-percent, 46%);
1175
+ min-width: 19rem;
1176
+ width: auto;
1177
+ height: 100%;
1178
+ display: block;
1179
+ }
1180
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-resize-handle {
1181
+ display: flex !important;
1182
+ }
1183
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-graph-shell-desktop-split {
1184
+ display: flex !important;
1185
+ }
1186
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-graph-shell-mobile-split {
1187
+ display: none !important;
1188
+ }
1189
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-graph-shell-desktop-split .thread-split-chat-pane,
1190
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-graph-shell-desktop-split .thread-split-workspace-pane {
1191
+ flex: 1 1 0;
1192
+ min-width: 0;
1193
+ width: auto;
1194
+ }
1195
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-graph-shell-desktop-split .thread-split-chat-pane {
1196
+ min-width: 0;
1197
+ }
1198
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-graph-shell-desktop-split .thread-split-workspace-pane {
1199
+ min-width: 0;
1200
+ }
1201
+ }
1202
+ .thread-ui-shell .thread-resize-handle span {
1203
+ background: var(--theme-border);
1204
+ }
1205
+ .thread-ui-shell .thread-resize-handle:hover span,
1206
+ .thread-ui-shell .thread-resize-handle:focus-visible span {
1207
+ background: var(--theme-border-strong);
1208
+ box-shadow: 0 0 0 3px color-mix(in oklch, var(--theme-accent-border) 24%, transparent);
1209
+ }
1210
+ .thread-ui-shell .thread-graph-right-tabs {
1211
+ border-color: var(--theme-border);
1212
+ background: var(--theme-surface);
1213
+ }
1214
+ .thread-ui-shell .thread-graph-right-tab-secondary {
1215
+ border-color: var(--theme-border);
1216
+ }
1217
+ .thread-ui-shell .thread-workspace-tab,
1218
+ .thread-ui-shell .thread-graph-right-tab {
1219
+ color: var(--theme-fg-muted);
1220
+ }
1221
+ .thread-ui-shell .thread-workspace-tab:hover,
1222
+ .thread-ui-shell .thread-graph-right-tab:hover {
1223
+ background: var(--theme-hover);
1224
+ color: var(--theme-fg);
1225
+ }
1226
+ .thread-ui-shell .thread-workspace-tab.is-active,
1227
+ .thread-ui-shell .thread-graph-right-tab.is-active {
1228
+ background: var(--theme-surface-strong);
1229
+ color: var(--theme-fg);
1230
+ }
1231
+ .thread-ui-shell .thread-graph-visualization-panel {
1232
+ background: var(--theme-surface);
1233
+ color: var(--theme-fg);
1234
+ }
1235
+ .thread-ui-shell .thread-graph-flow {
1236
+ overflow: hidden;
1237
+ border: 1px solid var(--theme-border);
1238
+ border-radius: 12px;
1239
+ background: var(--theme-surface);
1240
+ }
1241
+ .thread-ui-shell .thread-graph-flow-node {
1242
+ position: relative;
1243
+ min-width: 8rem;
1244
+ max-width: 12rem;
1245
+ border: 1px solid var(--theme-border-strong);
1246
+ border-radius: 8px;
1247
+ background: var(--theme-panel);
1248
+ padding: 0.85rem 1rem;
1249
+ color: var(--theme-fg);
1250
+ text-align: center;
1251
+ box-shadow: var(--theme-shadow);
1252
+ }
1253
+ .thread-ui-shell .thread-graph-flow .react-flow {
1254
+ background: var(--theme-surface);
1255
+ color: var(--theme-fg);
1256
+ }
1257
+ .thread-ui-shell .thread-graph-flow .react-flow__edge-path {
1258
+ stroke: var(--theme-border-contrast);
1259
+ }
1260
+ .thread-ui-shell .thread-graph-flow .react-flow__background {
1261
+ background: var(--theme-surface);
1262
+ }
1263
+ .thread-ui-shell .thread-graph-flow .react-flow__controls {
1264
+ overflow: hidden;
1265
+ border: 1px solid var(--theme-border);
1266
+ border-radius: 8px;
1267
+ box-shadow: var(--theme-shadow);
1268
+ }
1269
+ .thread-ui-shell .thread-graph-flow .react-flow__controls-button {
1270
+ border-bottom-color: var(--theme-border);
1271
+ background: var(--theme-panel);
1272
+ color: var(--theme-fg-soft);
1273
+ }
1274
+ .thread-ui-shell .thread-graph-flow .react-flow__controls-button:hover {
1275
+ background: var(--theme-hover);
1276
+ color: var(--theme-fg);
1277
+ }
1278
+ .thread-ui-shell .thread-graph-flow .react-flow__controls-button svg {
1279
+ fill: currentColor;
1280
+ }
1281
+ .thread-ui-shell .thread-guide-section {
1282
+ color: var(--theme-fg);
1283
+ }
1284
+ .thread-ui-shell .thread-guide-icon,
1285
+ .thread-ui-shell .thread-guide-tag {
1286
+ background: var(--theme-surface-strong);
1287
+ color: var(--theme-fg-muted);
1288
+ }
1289
+ .thread-ui-shell .thread-graph-workspace-mobile-tabs,
1290
+ .thread-ui-shell .thread-graph-workspace-mobile-explorer {
1291
+ border-color: var(--theme-border);
1292
+ background: var(--theme-surface);
1293
+ }
1294
+ .thread-ui-shell .thread-graph-workspace-mobile-stack,
1295
+ .thread-ui-shell .thread-graph-workspace-mobile-viewer {
1296
+ background: var(--theme-surface);
1297
+ color: var(--theme-fg);
1298
+ }
1299
+ .thread-ui-shell .thread-graph-workspace-resizable {
1300
+ height: 100%;
1301
+ min-width: 0;
1302
+ }
1303
+ .thread-ui-shell .thread-graph-workspace-explorer-pane {
1304
+ min-width: 0;
1305
+ }
1306
+ .thread-ui-shell .thread-graph-workspace-viewer-pane {
1307
+ min-width: 0;
1308
+ }
1309
+ .thread-ui-shell .thread-graph-workspace-resize-handle::after {
1310
+ background: var(--theme-border);
1311
+ }
1312
+ .thread-ui-shell .thread-graph-workspace-resize-handle:hover::after,
1313
+ .thread-ui-shell .thread-graph-workspace-resize-handle:focus-visible::after {
1314
+ background: var(--theme-border-contrast);
1315
+ }
1316
+ .thread-ui-shell .thread-graph-explorer,
1317
+ .thread-ui-shell .thread-graph-viewer {
1318
+ border-color: var(--theme-border);
1319
+ background: var(--theme-surface);
1320
+ color: var(--theme-fg);
1321
+ }
1322
+ .thread-ui-shell .thread-graph-explorer-header,
1323
+ .thread-ui-shell .thread-graph-viewer-header {
1324
+ border-color: var(--theme-border);
1325
+ background: var(--theme-surface);
1326
+ color: var(--theme-fg);
1327
+ }
1328
+ .thread-ui-shell .thread-graph-explorer h2,
1329
+ .thread-ui-shell .thread-graph-viewer h2 {
1330
+ color: var(--theme-fg);
1331
+ }
1332
+ .thread-ui-shell .thread-graph-explorer-icon-button,
1333
+ .thread-ui-shell .thread-graph-explorer-collapse-button,
1334
+ .thread-ui-shell .thread-graph-viewer-header button {
1335
+ border-color: var(--theme-border);
1336
+ background: var(--theme-surface-strong);
1337
+ color: var(--theme-fg-soft);
1338
+ }
1339
+ .thread-ui-shell .thread-graph-explorer-icon-button:hover,
1340
+ .thread-ui-shell .thread-graph-explorer-collapse-button:hover,
1341
+ .thread-ui-shell .thread-graph-viewer-header button:hover {
1342
+ border-color: var(--theme-border-strong);
1343
+ background: var(--theme-hover);
1344
+ color: var(--theme-fg);
1345
+ }
1346
+ .thread-ui-shell .thread-graph-panel-expand-fab {
1347
+ position: absolute;
1348
+ top: 50%;
1349
+ z-index: 30;
1350
+ display: inline-flex;
1351
+ transform: translateY(-50%);
1352
+ }
1353
+ `);Wt(`} .thread-ui-shell .thread-graph-panel-expand-fab.left-3 {
1354
+ left: 0.75rem;
1355
+ }
1356
+ .thread-ui-shell .thread-graph-panel-expand-fab.right-3 {
1357
+ right: 0.75rem;
1358
+ }
1359
+ .thread-ui-shell .thread-graph-panel-expand-fab:hover {
1360
+ transform: translateY(-50%) scale(1.04);
1361
+ }
1362
+ .thread-ui-shell .thread-graph-workspace-label,
1363
+ .thread-ui-shell .thread-graph-workspace-loading,
1364
+ .thread-ui-shell .thread-graph-workspace-empty,
1365
+ .thread-ui-shell .thread-graph-file-preview-header,
1366
+ .thread-ui-shell .thread-graph-file-preview-footer {
1367
+ color: var(--theme-fg-muted);
1368
+ }
1369
+ .thread-ui-shell .thread-graph-file-preview-header,
1370
+ .thread-ui-shell .thread-graph-file-preview-footer {
1371
+ border-color: var(--theme-border);
1372
+ }
1373
+ .thread-ui-shell .thread-graph-file-preview-footer,
1374
+ .thread-ui-shell .thread-graph-file-preview-frame {
1375
+ background: var(--theme-bg);
1376
+ }
1377
+ .thread-ui-shell .thread-graph-workspace-empty {
1378
+ border-color: var(--theme-border);
1379
+ background: var(--theme-surface-strong);
1380
+ }
1381
+ .thread-ui-shell .thread-graph-explorer button,
1382
+ .thread-ui-shell .thread-graph-viewer button {
1383
+ color: inherit;
1384
+ }
1385
+ .thread-ui-shell .thread-graph-tree-row {
1386
+ color: var(--theme-fg-soft);
1387
+ }
1388
+ .thread-ui-shell .thread-graph-tree-row:hover {
1389
+ background: var(--theme-hover);
1390
+ color: var(--theme-fg);
1391
+ }
1392
+ .thread-ui-shell .thread-graph-tree-row.is-selected {
1393
+ background: color-mix(in oklch, var(--theme-accent-solid) 13%, var(--theme-panel));
1394
+ color: var(--theme-fg);
1395
+ box-shadow: inset 3px 0 0 color-mix(in oklch, var(--theme-accent-solid) 72%, transparent);
1396
+ }
1397
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-tree-row.is-selected,
1398
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-tree-row.is-selected,
1399
+ .thread-ui-shell.dark .thread-graph-tree-row.is-selected {
1400
+ background: color-mix(in oklch, var(--theme-accent-solid) 18%, var(--theme-panel));
1401
+ color: var(--theme-fg);
1402
+ box-shadow: inset 3px 0 0 color-mix(in oklch, var(--theme-accent-solid) 72%, transparent);
1403
+ }
1404
+ .thread-ui-shell .thread-graph-tree-row.is-selected svg {
1405
+ color: currentColor;
1406
+ }
1407
+ .thread-ui-shell .thread-graph-tree-row.is-selected .thread-graph-tree-action,
1408
+ .thread-ui-shell .thread-graph-tree-action.is-selected {
1409
+ color: var(--theme-fg-muted);
1410
+ }
1411
+ .thread-ui-shell .thread-graph-tree-row.is-selected .thread-graph-tree-action:hover,
1412
+ .thread-ui-shell .thread-graph-tree-action.is-selected:hover {
1413
+ background: color-mix(in oklch, var(--theme-accent-solid) 12%, transparent);
1414
+ color: var(--theme-fg);
1415
+ }
1416
+ .thread-ui-shell .thread-graph-tree-action {
1417
+ color: var(--theme-fg-muted);
1418
+ }
1419
+ .thread-ui-shell .thread-graph-tree-action:hover {
1420
+ background: var(--theme-surface-strong);
1421
+ color: var(--theme-fg);
1422
+ }
1423
+ .thread-ui-shell .thread-graph-molecule-preview {
1424
+ background: var(--theme-surface);
1425
+ }
1426
+ .thread-ui-shell .thread-graph-molecule-viewer {
1427
+ background: var(--theme-surface);
1428
+ color: var(--theme-fg);
1429
+ }
1430
+ .thread-ui-shell .thread-graph-molecule-header,
1431
+ .thread-ui-shell .thread-graph-molecule-controls {
1432
+ border-color: var(--theme-border);
1433
+ background: var(--theme-surface);
1434
+ color: var(--theme-fg);
1435
+ }
1436
+ .thread-ui-shell .thread-graph-molecule-body {
1437
+ display: flex;
1438
+ min-height: 0;
1439
+ flex: 1;
1440
+ flex-direction: column;
1441
+ overflow: hidden;
1442
+ }
1443
+ .thread-ui-shell .thread-graph-molecule-header h2 {
1444
+ color: var(--theme-fg);
1445
+ }
1446
+ .thread-ui-shell .thread-graph-molecule-header p,
1447
+ .thread-ui-shell .thread-graph-molecule-header span,
1448
+ .thread-ui-shell .thread-graph-molecule-trajectory {
1449
+ color: var(--theme-fg-muted);
1450
+ }
1451
+ .thread-ui-shell .thread-graph-molecule-controls {
1452
+ border-top: 1px solid var(--theme-border);
1453
+ display: flex;
1454
+ flex-direction: column;
1455
+ gap: 0.75rem;
1456
+ max-height: min(42%, 18rem);
1457
+ overflow: auto;
1458
+ padding: 0.75rem;
1459
+ }
1460
+ .thread-ui-shell .thread-graph-molecule-control-row {
1461
+ display: flex;
1462
+ align-items: flex-start;
1463
+ justify-content: space-between;
1464
+ gap: 0.75rem;
1465
+ }
1466
+ .thread-ui-shell .thread-graph-molecule-control-title {
1467
+ color: var(--theme-fg);
1468
+ font-size: 0.875rem;
1469
+ font-weight: 600;
1470
+ line-height: 1.25rem;
1471
+ }
1472
+ .thread-ui-shell .thread-graph-molecule-control-subtitle {
1473
+ margin-top: 0.125rem;
1474
+ color: var(--theme-fg-muted);
1475
+ font-size: 0.6875rem;
1476
+ line-height: 1rem;
1477
+ }
1478
+ .thread-ui-shell .thread-graph-molecule-button-group {
1479
+ display: inline-flex;
1480
+ align-items: center;
1481
+ gap: 0.125rem;
1482
+ border: 1px solid var(--theme-border);
1483
+ border-radius: 0.5rem;
1484
+ background: var(--theme-surface);
1485
+ padding: 0.125rem;
1486
+ }
1487
+ .thread-ui-shell .thread-graph-molecule-button {
1488
+ display: inline-flex;
1489
+ min-width: 1.75rem;
1490
+ height: 1.75rem;
1491
+ align-items: center;
1492
+ justify-content: center;
1493
+ border: 1px solid transparent;
1494
+ border-radius: 0.375rem;
1495
+ background: transparent;
1496
+ color: var(--theme-fg-soft);
1497
+ transition:
1498
+ background-color 140ms ease,
1499
+ border-color 140ms ease,
1500
+ color 140ms ease,
1501
+ opacity 140ms ease;
1502
+ }
1503
+ .thread-ui-shell .thread-graph-molecule-button:hover:not(:disabled) {
1504
+ border-color: var(--theme-border);
1505
+ background: var(--theme-hover);
1506
+ color: var(--theme-fg);
1507
+ }
1508
+ .thread-ui-shell .thread-graph-molecule-button:disabled {
1509
+ cursor: not-allowed;
1510
+ color: var(--theme-fg-subtle);
1511
+ opacity: 0.45;
1512
+ }
1513
+ .thread-ui-shell .thread-graph-molecule-button-divider {
1514
+ width: 1px;
1515
+ align-self: stretch;
1516
+ margin-inline: 0.25rem;
1517
+ background: var(--theme-border);
1518
+ }
1519
+ .thread-ui-shell .thread-graph-molecule-stage {
1520
+ background: var(--theme-bg);
1521
+ }
1522
+ .thread-ui-shell .thread-graph-molecule-error {
1523
+ background: color-mix(in oklch, #ef4444 12%, var(--theme-surface));
1524
+ color: var(--theme-danger);
1525
+ }
1526
+ .thread-ui-shell .thread-graph-molecule-empty {
1527
+ color: var(--theme-fg-muted);
1528
+ }
1529
+ .thread-ui-shell .thread-graph-molecule-tooltip {
1530
+ border-color: var(--theme-border);
1531
+ background: color-mix(in oklch, var(--theme-surface) 96%, transparent);
1532
+ color: var(--theme-fg);
1533
+ box-shadow: 0 10px 28px color-mix(in oklch, var(--theme-bg) 72%, transparent);
1534
+ }
1535
+ .thread-ui-shell .thread-graph-molecule-tooltip div,
1536
+ .thread-ui-shell .thread-graph-molecule-tooltip span {
1537
+ color: inherit;
1538
+ }
1539
+ .thread-ui-shell .thread-graph-molecule-trajectory input {
1540
+ accent-color: var(--theme-accent-solid);
1541
+ }
1542
+ .thread-ui-shell .thread-graph-molecule-live-button {
1543
+ display: inline-flex;
1544
+ align-items: center;
1545
+ gap: 0.25rem;
1546
+ border: 1px solid var(--theme-border);
1547
+ border-radius: 0.375rem;
1548
+ background: var(--theme-surface);
1549
+ padding: 0.125rem 0.5rem;
1550
+ color: var(--theme-fg-muted);
1551
+ transition: background-color 140ms ease, color 140ms ease;
1552
+ }
1553
+ .thread-ui-shell .thread-graph-molecule-live-button:hover {
1554
+ background: var(--theme-hover);
1555
+ color: var(--theme-fg);
1556
+ }
1557
+ .thread-ui-shell .thread-graph-molecule-camera {
1558
+ margin-top: 0.75rem;
1559
+ border: 1px solid var(--theme-border);
1560
+ border-radius: 0.5rem;
1561
+ padding: 0.5rem;
1562
+ color: var(--theme-fg-muted);
1563
+ font-size: 0.625rem;
1564
+ }
1565
+ .thread-ui-shell .thread-graph-molecule-camera-divider {
1566
+ width: 100%;
1567
+ height: 1px;
1568
+ margin-block: 0.5rem;
1569
+ background: var(--theme-border);
1570
+ }
1571
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin {
1572
+ height: 100%;
1573
+ min-height: 0;
1574
+ border: 0;
1575
+ border-radius: 0;
1576
+ background: var(--theme-surface);
1577
+ color: var(--theme-fg);
1578
+ }
1579
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__header {
1580
+ min-height: 60px;
1581
+ border-color: var(--theme-border);
1582
+ background: var(--theme-surface);
1583
+ padding: 0.75rem 1.25rem;
1584
+ }
1585
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__header h2 {
1586
+ color: var(--theme-fg);
1587
+ font-size: 0.875rem;
1588
+ font-weight: 650;
1589
+ }
1590
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__header p,
1591
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__header span {
1592
+ color: var(--theme-fg-muted);
1593
+ }
1594
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__toolbar {
1595
+ border-color: var(--theme-border);
1596
+ background: var(--theme-surface);
1597
+ padding: 0.5rem 0.625rem;
1598
+ }
1599
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__toolbar button,
1600
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__timeline button {
1601
+ border-color: var(--theme-border);
1602
+ background: var(--theme-surface-strong);
1603
+ color: var(--theme-fg-soft);
1604
+ }
1605
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__toolbar button:hover,
1606
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__timeline button:hover {
1607
+ border-color: var(--theme-border-strong);
1608
+ background: var(--theme-hover);
1609
+ color: var(--theme-fg);
1610
+ }
1611
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__toolbar button:disabled,
1612
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__timeline button:disabled {
1613
+ color: var(--theme-fg-subtle);
1614
+ }
1615
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__toolbar-divider {
1616
+ background: var(--theme-border);
1617
+ }
1618
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__stage {
1619
+ min-height: 0;
1620
+ background: var(--theme-bg);
1621
+ }
1622
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__error {
1623
+ background: color-mix(in oklch, #ef4444 12%, var(--theme-surface));
1624
+ color: var(--theme-danger);
1625
+ }
1626
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__empty {
1627
+ color: var(--theme-fg-muted);
1628
+ }
1629
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__tooltip {
1630
+ border-color: var(--theme-border);
1631
+ background: color-mix(in oklch, var(--theme-surface) 96%, transparent);
1632
+ color: var(--theme-fg);
1633
+ box-shadow: 0 10px 28px color-mix(in oklch, var(--theme-bg) 72%, transparent);
1634
+ }
1635
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__tooltip span {
1636
+ color: var(--theme-fg-soft);
1637
+ }
1638
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__timeline,
1639
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__status {
1640
+ border-color: var(--theme-border);
1641
+ background: var(--theme-surface);
1642
+ color: var(--theme-fg-muted);
1643
+ }
1644
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__timeline input {
1645
+ accent-color: var(--theme-accent-solid);
1646
+ }
1647
+ .thread-ui-shell .thread-graph-molecule-preview .xyz-viewer-plugin__timeline button.is-live {
1648
+ color: var(--theme-danger);
1649
+ }
1650
+ .thread-ui-shell .thread-graph-file-preview-header,
1651
+ .thread-ui-shell .thread-graph-file-preview-footer {
1652
+ border-color: var(--theme-border);
1653
+ background: var(--theme-surface);
1654
+ color: var(--theme-fg-muted);
1655
+ }
1656
+ .thread-ui-shell .thread-graph-load-more-button {
1657
+ border: 1px solid var(--theme-border);
1658
+ background: color-mix(in oklch, var(--theme-accent-solid) 8%, var(--theme-panel));
1659
+ color: var(--theme-fg-soft);
1660
+ transition:
1661
+ background-color 140ms ease,
1662
+ border-color 140ms ease,
1663
+ color 140ms ease;
1664
+ }
1665
+ .thread-ui-shell .thread-graph-load-more-button:hover:not(:disabled) {
1666
+ border-color: color-mix(in oklch, var(--theme-accent-solid) 28%, var(--theme-border));
1667
+ background: color-mix(in oklch, var(--theme-accent-solid) 14%, var(--theme-panel));
1668
+ color: var(--theme-fg);
1669
+ }
1670
+ .thread-ui-shell .thread-graph-code-preview {
1671
+ background: var(--theme-bg);
1672
+ color: var(--theme-fg);
1673
+ }
1674
+ .thread-ui-shell .thread-graph-code-preview pre,
1675
+ .thread-ui-shell .thread-graph-code-preview code {
1676
+ font-family:
1677
+ ui-monospace,
1678
+ SFMono-Regular,
1679
+ Menlo,
1680
+ Monaco,
1681
+ Consolas,
1682
+ "Liberation Mono",
1683
+ monospace !important;
1684
+ font-size: 0.78rem;
1685
+ line-height: 1.55;
1686
+ }
1687
+ .thread-ui-shell .thread-graph-plain-code-preview {
1688
+ min-height: 100%;
1689
+ margin: 0;
1690
+ padding: 1rem;
1691
+ background: transparent;
1692
+ color: var(--theme-fg);
1693
+ white-space: pre;
1694
+ }
1695
+ .thread-ui-shell .thread-tool-call {
1696
+ background: var(--theme-panel);
1697
+ color: var(--theme-fg);
1698
+ overflow: hidden;
1699
+ }
1700
+ .thread-ui-shell .thread-tool-call:hover {
1701
+ border-color: var(--theme-border-strong);
1702
+ }
1703
+ .thread-ui-shell .thread-graph-tool-call {
1704
+ font-family:
1705
+ Inter,
1706
+ ui-sans-serif,
1707
+ system-ui,
1708
+ -apple-system,
1709
+ BlinkMacSystemFont,
1710
+ "Segoe UI",
1711
+ sans-serif;
1712
+ }
1713
+ .thread-ui-shell .thread-graph-tool-call,
1714
+ .thread-ui-shell .thread-graph-tool-accordion,
1715
+ .thread-ui-shell .thread-graph-tool-trigger,
1716
+ .thread-ui-shell .thread-graph-tool-content,
1717
+ .thread-ui-shell .thread-graph-tool-json,
1718
+ .thread-ui-shell .thread-graph-tool-output {
1719
+ color: var(--theme-fg);
1720
+ }
1721
+ .thread-ui-shell .thread-graph-tool-accordion {
1722
+ overflow: hidden;
1723
+ border: 1px solid var(--theme-border);
1724
+ border-radius: 0.5rem;
1725
+ background: var(--theme-panel);
1726
+ box-shadow: 0 1px 2px color-mix(in oklch, var(--theme-bg) 65%, transparent);
1727
+ }
1728
+ .thread-ui-shell .thread-graph-tool-trigger {
1729
+ display: flex;
1730
+ width: 100%;
1731
+ min-width: 0;
1732
+ align-items: center;
1733
+ justify-content: space-between;
1734
+ gap: 0.75rem;
1735
+ border: 0;
1736
+ background: var(--theme-panel);
1737
+ text-align: left;
1738
+ transition: background 160ms ease, color 160ms ease;
1739
+ }
1740
+ .thread-ui-shell .thread-graph-tool-trigger:hover {
1741
+ background: var(--theme-hover);
1742
+ }
1743
+ .thread-ui-shell .thread-graph-tool-trigger svg {
1744
+ color: var(--theme-fg-muted);
1745
+ }
1746
+ .thread-ui-shell .thread-graph-tool-trigger > svg {
1747
+ margin-left: auto;
1748
+ }
1749
+ .thread-ui-shell .thread-graph-tool-badge {
1750
+ display: inline-flex;
1751
+ min-height: 1.35rem;
1752
+ shrink: 0;
1753
+ align-items: center;
1754
+ gap: 0.25rem;
1755
+ border: 1px solid transparent;
1756
+ border-radius: 999px;
1757
+ padding: 0.1rem 0.5rem;
1758
+ font-size: 0.75rem;
1759
+ font-weight: 400;
1760
+ line-height: 1rem;
1761
+ }
1762
+ .thread-ui-shell .thread-graph-tool-badge.is-completed {
1763
+ background: oklch(0.94 0.052 155);
1764
+ color: oklch(0.43 0.095 155);
1765
+ }
1766
+ .thread-ui-shell .thread-graph-tool-badge.is-failed {
1767
+ background: oklch(0.94 0.04 25);
1768
+ color: oklch(0.48 0.125 24);
1769
+ }
1770
+ .thread-ui-shell .thread-graph-tool-badge.is-pending {
1771
+ background: oklch(0.94 0.03 235);
1772
+ color: oklch(0.43 0.09 242);
1773
+ }
1774
+ .thread-ui-shell .thread-graph-tool-badge.is-neutral {
1775
+ background: var(--theme-muted);
1776
+ color: var(--theme-fg-muted);
1777
+ }
1778
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-tool-badge.is-completed,
1779
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-tool-badge.is-completed,
1780
+ .thread-ui-shell.dark .thread-graph-tool-badge.is-completed {
1781
+ background: oklch(0.31 0.05 155);
1782
+ color: oklch(0.8 0.115 155);
1783
+ }
1784
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-tool-badge.is-failed,
1785
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-tool-badge.is-failed,
1786
+ .thread-ui-shell.dark .thread-graph-tool-badge.is-failed {
1787
+ background: oklch(0.31 0.052 25);
1788
+ color: oklch(0.78 0.12 25);
1789
+ }
1790
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-tool-badge.is-pending,
1791
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-tool-badge.is-pending,
1792
+ .thread-ui-shell.dark .thread-graph-tool-badge.is-pending {
1793
+ background: oklch(0.3 0.042 235);
1794
+ color: oklch(0.77 0.1 235);
1795
+ }
1796
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-tool-badge.is-neutral,
1797
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-tool-badge.is-neutral,
1798
+ .thread-ui-shell.dark .thread-graph-tool-badge.is-neutral {
1799
+ background: #222733;
1800
+ color: rgb(148 163 184);
1801
+ }
1802
+ .thread-ui-shell .thread-graph-tool-content {
1803
+ display: grid;
1804
+ gap: 0.75rem;
1805
+ border-top: 0;
1806
+ background: var(--theme-panel);
1807
+ }
1808
+ .thread-ui-shell .thread-graph-tool-content h4 {
1809
+ margin: 0.25rem 0 0.5rem;
1810
+ color: var(--theme-fg-muted);
1811
+ font-size: 0.625rem;
1812
+ font-weight: 700;
1813
+ letter-spacing: 0.08em;
1814
+ line-height: 1rem;
1815
+ text-transform: uppercase;
1816
+ }
1817
+ .thread-ui-shell .thread-graph-tool-json,
1818
+ .thread-ui-shell .thread-graph-tool-output {
1819
+ overflow-x: auto;
1820
+ border: 1px solid var(--theme-border);
1821
+ border-radius: 0.375rem;
1822
+ background: var(--theme-surface-strong);
1823
+ padding: 0.75rem;
1824
+ font-family:
1825
+ ui-monospace,
1826
+ SFMono-Regular,
1827
+ Menlo,
1828
+ Monaco,
1829
+ Consolas,
1830
+ "Liberation Mono",
1831
+ monospace;
1832
+ font-size: 0.78rem;
1833
+ line-height: 1.55;
1834
+ white-space: pre-wrap;
1835
+ }
1836
+ .thread-ui-shell .thread-graph-tool-json > div {
1837
+ padding-left: 1rem;
1838
+ }
1839
+ .thread-ui-shell .thread-graph-tool-output {
1840
+ margin-top: 0.5rem;
1841
+ }
1842
+ .thread-ui-shell .thread-graph-tool-key {
1843
+ color: oklch(0.58 0.18 18);
1844
+ }
1845
+ .thread-ui-shell .thread-graph-tool-string {
1846
+ color: oklch(0.52 0.12 155);
1847
+ }
1848
+ .thread-ui-shell .thread-graph-tool-number {
1849
+ color: oklch(0.55 0.13 235);
1850
+ }
1851
+ .thread-ui-shell .thread-graph-tool-boolean {
1852
+ color: oklch(0.56 0.13 302);
1853
+ }
1854
+ .thread-ui-shell .thread-graph-tool-null,
1855
+ .thread-ui-shell .thread-graph-tool-punctuation,
1856
+ .thread-ui-shell .thread-graph-tool-object {
1857
+ color: var(--theme-fg-muted);
1858
+ }
1859
+ .thread-ui-shell .thread-graph-history-tool {
1860
+ width: 100%;
1861
+ min-width: 0;
1862
+ border: 0;
1863
+ background: transparent !important;
1864
+ color: var(--theme-fg);
1865
+ }
1866
+ .thread-ui-shell .thread-graph-history-tool-accordion {
1867
+ background: var(--theme-panel);
1868
+ }
1869
+ .thread-ui-shell .thread-graph-history-tool-trigger {
1870
+ min-height: 2.75rem;
1871
+ }
1872
+ .thread-ui-shell .thread-graph-history-tool-trigger > div:first-child {
1873
+ min-width: 0;
1874
+ }
1875
+ .thread-ui-shell .thread-graph-history-tool-icon {
1876
+ display: inline-flex;
1877
+ align-items: center;
1878
+ justify-content: center;
1879
+ color: var(--theme-fg-muted);
1880
+ }
1881
+ .thread-ui-shell .thread-graph-history-tool.is-command .thread-graph-history-tool-icon {
1882
+ color: oklch(0.63 0.12 75);
1883
+ }
1884
+ .thread-ui-shell .thread-graph-history-tool.is-tool .thread-graph-history-tool-icon {
1885
+ color: oklch(0.61 0.12 315);
1886
+ }
1887
+ .thread-ui-shell .thread-graph-history-tool.is-agent .thread-graph-history-tool-icon {
1888
+ color: oklch(0.58 0.11 170);
1889
+ }
1890
+ .thread-ui-shell .thread-graph-history-tool.is-skill .thread-graph-history-tool-icon {
1891
+ color: oklch(0.58 0.12 285);
1892
+ }
1893
+ .thread-ui-shell .thread-graph-history-tool.is-search .thread-graph-history-tool-icon {
1894
+ color: oklch(0.58 0.12 235);
1895
+ }
1896
+ .thread-ui-shell .thread-graph-history-tool.is-file-read .thread-graph-history-tool-icon {
1897
+ color: oklch(0.58 0.1 205);
1898
+ }
1899
+ .thread-ui-shell .thread-graph-history-tool-summary {
1900
+ display: flex;
1901
+ min-width: 0;
1902
+ align-items: center;
1903
+ gap: 0.5rem;
1904
+ overflow: hidden;
1905
+ border: 1px solid var(--theme-border);
1906
+ border-radius: 0.375rem;
1907
+ background: var(--theme-surface-strong);
1908
+ padding: 0.65rem 0.75rem;
1909
+ color: var(--theme-fg-soft);
1910
+ font-size: 0.875rem;
1911
+ line-height: 1.5;
1912
+ }
1913
+ .thread-ui-shell .thread-graph-history-tool-summary > span:first-child {
1914
+ min-width: 0;
1915
+ overflow: hidden;
1916
+ text-overflow: ellipsis;
1917
+ white-space: nowrap;
1918
+ }
1919
+ .thread-ui-shell .thread-graph-history-tool-ellipsis {
1920
+ flex: 0 0 auto;
1921
+ color: var(--theme-fg-muted);
1922
+ font-size: 0.75rem;
1923
+ letter-spacing: 0.16em;
1924
+ }
1925
+ .thread-ui-shell .thread-graph-history-tool-open {
1926
+ border-color: var(--theme-border);
1927
+ background: var(--theme-surface);
1928
+ color: var(--theme-fg-soft);
1929
+ }
1930
+ .thread-ui-shell .thread-graph-history-tool-open:hover {
1931
+ background: var(--theme-hover);
1932
+ color: var(--theme-fg);
1933
+ }
1934
+ .thread-ui-shell .thread-graph-history-event {
1935
+ display: flex;
1936
+ min-width: 0;
1937
+ width: 100%;
1938
+ align-items: flex-start;
1939
+ gap: 0.625rem;
1940
+ border: 0;
1941
+ background: transparent !important;
1942
+ color: var(--theme-fg);
1943
+ }
1944
+ .thread-ui-shell .thread-graph-history-event-icon {
1945
+ display: inline-flex;
1946
+ height: 1.75rem;
1947
+ width: 1.75rem;
1948
+ flex: 0 0 auto;
1949
+ align-items: center;
1950
+ justify-content: center;
1951
+ border: 1px solid var(--theme-border);
1952
+ border-radius: 999px;
1953
+ background: var(--theme-panel);
1954
+ color: var(--theme-fg-muted);
1955
+ }
1956
+ .thread-ui-shell .thread-graph-history-event-card {
1957
+ min-width: 0;
1958
+ flex: 1 1 auto;
1959
+ overflow: hidden;
1960
+ border: 1px solid var(--theme-border);
1961
+ border-radius: 0.5rem;
1962
+ background: var(--theme-panel);
1963
+ color: var(--theme-fg);
1964
+ box-shadow: 0 1px 2px color-mix(in oklch, var(--theme-bg) 65%, transparent);
1965
+ }
1966
+ .thread-ui-shell .thread-graph-history-event-header {
1967
+ display: flex;
1968
+ min-width: 0;
1969
+ align-items: center;
1970
+ justify-content: space-between;
1971
+ gap: 0.75rem;
1972
+ padding: 0.75rem 1rem;
1973
+ }
1974
+ .thread-ui-shell .thread-graph-history-event-heading {
1975
+ flex: 1 1 auto;
1976
+ min-width: 0;
1977
+ }
1978
+ .thread-ui-shell .thread-graph-history-event-title {
1979
+ flex: 0 0 auto;
1980
+ max-width: min(14rem, 36%);
1981
+ }
1982
+ .thread-ui-shell .thread-graph-history-event-actions {
1983
+ display: inline-flex;
1984
+ flex: 0 0 auto;
1985
+ align-items: center;
1986
+ gap: 0.5rem;
1987
+ }
1988
+ .thread-ui-shell .thread-graph-history-event-body {
1989
+ display: grid;
1990
+ gap: 0.625rem;
1991
+ border-top: 1px solid var(--theme-border);
1992
+ padding: 0.75rem 1rem 1rem;
1993
+ color: var(--theme-fg-soft);
1994
+ }
1995
+ .thread-ui-shell .thread-graph-history-event-line {
1996
+ display: flex;
1997
+ min-width: 0;
1998
+ align-items: center;
1999
+ gap: 0.5rem;
2000
+ color: var(--theme-fg);
2001
+ }
2002
+ .thread-ui-shell .thread-graph-history-event-primary {
2003
+ min-width: 0;
2004
+ color: var(--theme-fg);
2005
+ font-size: 0.875rem;
2006
+ font-weight: 500;
2007
+ line-height: 1.5;
2008
+ }
2009
+ .thread-ui-shell .thread-graph-history-event-secondary {
2010
+ min-width: 0;
2011
+ color: var(--theme-fg-muted);
2012
+ font-size: 0.75rem;
2013
+ line-height: 1.35;
2014
+ }
2015
+ .thread-ui-shell .thread-graph-history-event-summary {
2016
+ display: block;
2017
+ width: 100%;
2018
+ min-width: 0;
2019
+ overflow: hidden;
2020
+ border: 1px solid var(--theme-border);
2021
+ border-radius: 0.375rem;
2022
+ background: var(--theme-surface-strong);
2023
+ padding: 0.65rem 0.75rem;
2024
+ color: var(--theme-fg-soft);
2025
+ font-size: 0.875rem;
2026
+ line-height: 1.5;
2027
+ text-align: left;
2028
+ }
2029
+ .thread-ui-shell .thread-graph-history-event-summary.is-clickable {
2030
+ transition: background 160ms ease, color 160ms ease;
2031
+ }
2032
+ .thread-ui-shell .thread-graph-history-event-summary.is-clickable:hover {
2033
+ background: var(--theme-hover);
2034
+ color: var(--theme-fg);
2035
+ }
2036
+ .thread-ui-shell .thread-graph-history-event-prose {
2037
+ color: var(--theme-fg-soft);
2038
+ }
2039
+ .thread-ui-shell .thread-graph-history-event-pre {
2040
+ overflow-x: auto;
2041
+ border: 1px solid var(--theme-border);
2042
+ border-radius: 0.375rem;
2043
+ background: var(--theme-surface-strong);
2044
+ padding: 0.75rem;
2045
+ color: var(--theme-fg-soft);
2046
+ font-size: 0.8125rem;
2047
+ line-height: 1.55;
2048
+ white-space: pre-wrap;
2049
+ }
2050
+ .thread-ui-shell .thread-graph-history-event-action,
2051
+ .thread-ui-shell .thread-graph-history-event-pill {
2052
+ display: inline-flex;
2053
+ align-items: center;
2054
+ gap: 0.375rem;
2055
+ border: 1px solid var(--theme-border);
2056
+ border-radius: 999px;
2057
+ background: var(--theme-surface);
2058
+ padding: 0.25rem 0.55rem;
2059
+ color: var(--theme-fg-muted);
2060
+ font-size: 0.6875rem;
2061
+ font-weight: 500;
2062
+ line-height: 1rem;
2063
+ transition: background 160ms ease, color 160ms ease;
2064
+ }
2065
+ .thread-ui-shell .thread-graph-history-event-action:hover {
2066
+ background: var(--theme-hover);
2067
+ color: var(--theme-fg);
2068
+ }
2069
+ .thread-ui-shell .thread-graph-history-event-path {
2070
+ display: block;
2071
+ max-width: 100%;
2072
+ overflow: hidden;
2073
+ text-overflow: ellipsis;
2074
+ white-space: nowrap;
2075
+ color: var(--theme-fg-muted);
2076
+ font-size: 0.75rem;
2077
+ line-height: 1.4;
2078
+ text-align: left;
2079
+ }
2080
+ .thread-ui-shell .thread-graph-history-event-path:hover {
2081
+ color: var(--theme-fg);
2082
+ }
2083
+ .thread-ui-shell .thread-graph-history-event-image {
2084
+ max-height: 24rem;
2085
+ width: 100%;
2086
+ object-fit: contain;
2087
+ border: 1px solid var(--theme-border);
2088
+ border-radius: 0.5rem;
2089
+ background: var(--theme-surface-strong);
2090
+ }
2091
+ .thread-ui-shell .thread-graph-history-event.is-plan .thread-graph-history-event-icon {
2092
+ color: oklch(0.58 0.12 235);
2093
+ }
2094
+ .thread-ui-shell .thread-graph-history-event.is-context .thread-graph-history-event-icon {
2095
+ color: oklch(0.58 0.11 170);
2096
+ }
2097
+ .thread-ui-shell .thread-graph-history-event.is-image .thread-graph-history-event-icon,
2098
+ .thread-ui-shell .thread-graph-history-event.is-artifact .thread-graph-history-event-icon {
2099
+ color: oklch(0.58 0.12 285);
2100
+ }
2101
+ .thread-ui-shell .thread-graph-history-event.is-file-change .thread-graph-history-event-icon {
2102
+ color: oklch(0.62 0.12 145);
2103
+ }
2104
+ .thread-ui-shell .thread-graph-history-event.is-hook .thread-graph-history-event-icon {
2105
+ color: oklch(0.61 0.12 315);
2106
+ }
2107
+ @media (max-width: 639px) {
2108
+ .thread-ui-shell .thread-graph-history-event {
2109
+ gap: 0.5rem;
2110
+ }
2111
+ .thread-ui-shell .thread-graph-history-event-icon {
2112
+ height: 1.5rem;
2113
+ width: 1.5rem;
2114
+ }
2115
+ .thread-ui-shell .thread-graph-history-event-header,
2116
+ .thread-ui-shell .thread-graph-history-event-body {
2117
+ padding-left: 0.75rem;
2118
+ padding-right: 0.75rem;
2119
+ }
2120
+ }
2121
+ .thread-ui-shell .thread-graph-history-detail-row {
2122
+ border-color: var(--theme-border);
2123
+ background: var(--theme-surface);
2124
+ color: var(--theme-fg);
2125
+ }
2126
+ .thread-ui-shell .thread-graph-history-detail-row:hover {
2127
+ background: var(--theme-hover);
2128
+ color: var(--theme-fg);
2129
+ }
2130
+ .thread-ui-shell .thread-graph-history-detail-text {
2131
+ color: var(--theme-fg);
2132
+ }
2133
+ .thread-ui-shell .thread-graph-event-file-change .thread-graph-history-event-card {
2134
+ border-radius: 0.4375rem;
2135
+ }
2136
+ .thread-ui-shell .thread-graph-event-file-change .thread-graph-history-event-header {
2137
+ min-height: 2.75rem;
2138
+ padding-block: 0.5rem;
2139
+ }
2140
+ .thread-ui-shell .thread-graph-event-file-change .thread-graph-history-event-heading {
2141
+ flex: 1 1 auto;
2142
+ min-width: 0;
2143
+ gap: 0.375rem;
2144
+ }
2145
+ .thread-ui-shell .thread-graph-event-file-change .thread-graph-history-event-title {
2146
+ max-width: none;
2147
+ font-size: 0.8125rem;
2148
+ }
2149
+ .thread-ui-shell .thread-graph-file-change-inline,
2150
+ .thread-ui-shell .thread-graph-file-change-inline-button {
2151
+ min-width: 0;
2152
+ }
2153
+ .thread-ui-shell .thread-graph-file-change-inline {
2154
+ max-width: 100%;
2155
+ gap: 0.375rem;
2156
+ }
2157
+ .thread-ui-shell .thread-graph-file-change-inline-button {
2158
+ display: block;
2159
+ flex: 1 1 auto;
2160
+ color: inherit;
2161
+ }
2162
+ .thread-ui-shell .thread-graph-file-change-inline-button:hover .thread-graph-history-detail-text {
2163
+ color: var(--theme-fg);
2164
+ text-decoration: underline;
2165
+ text-decoration-thickness: 1px;
2166
+ text-underline-offset: 2px;
2167
+ }
2168
+ .thread-ui-shell .thread-graph-history-detail-meta {
2169
+ color: var(--theme-fg-muted);
2170
+ }
2171
+ .thread-ui-shell .thread-graph-history-delta-badge {
2172
+ display: inline-flex;
2173
+ align-items: center;
2174
+ justify-content: center;
2175
+ border: 1px solid transparent;
2176
+ border-radius: 999px;
2177
+ padding: 0.125rem 0.375rem;
2178
+ font-size: 0.6875rem;
2179
+ font-weight: 500;
2180
+ line-height: 1rem;
2181
+ }
2182
+ .thread-ui-shell .thread-graph-history-delta-badge.is-add {
2183
+ border-color: rgb(52 211 153 / 0.28);
2184
+ background: rgb(52 211 153 / 0.1);
2185
+ color: rgb(167 243 208);
2186
+ }
2187
+ .thread-ui-shell .thread-graph-history-delta-badge.is-remove {
2188
+ border-color: rgb(251 113 133 / 0.3);
2189
+ background: rgb(251 113 133 / 0.1);
2190
+ color: rgb(254 205 211);
2191
+ }
2192
+ .thread-ui-shell .thread-graph-history-delta-badge.is-neutral {
2193
+ border-color: var(--theme-border);
2194
+ background: var(--theme-muted);
2195
+ color: var(--theme-fg-soft);
2196
+ }
2197
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-history-delta-badge.is-add {
2198
+ border-color: rgb(16 185 129 / 0.25);
2199
+ background: rgb(16 185 129 / 0.1);
2200
+ color: rgb(4 120 87);
2201
+ }
2202
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-history-delta-badge.is-remove {
2203
+ border-color: rgb(244 63 94 / 0.25);
2204
+ background: rgb(244 63 94 / 0.1);
2205
+ color: rgb(190 18 60);
2206
+ }
2207
+ @media (max-width: 639px) {
2208
+ .thread-ui-shell .thread-graph-history-tool-trigger {
2209
+ padding-left: 0.75rem;
2210
+ padding-right: 0.75rem;
2211
+ }
2212
+ .thread-ui-shell .thread-graph-history-tool-trigger .thread-graph-tool-badge {
2213
+ max-width: 7.5rem;
2214
+ }
2215
+ .thread-ui-shell .thread-graph-history-tool-content {
2216
+ padding-left: 0.75rem;
2217
+ padding-right: 0.75rem;
2218
+ }
2219
+ }
2220
+ .thread-ui-shell .xyz-viewer-plugin {
2221
+ border-color: var(--theme-border);
2222
+ border-radius: 0;
2223
+ background: var(--theme-surface);
2224
+ color: var(--theme-fg);
2225
+ }
2226
+ .thread-ui-shell .xyz-viewer-plugin__header,
2227
+ .thread-ui-shell .xyz-viewer-plugin__toolbar,
2228
+ .thread-ui-shell .xyz-viewer-plugin__timeline,
2229
+ .thread-ui-shell .xyz-viewer-plugin__status {
2230
+ border-color: var(--theme-border);
2231
+ background: var(--theme-surface);
2232
+ color: var(--theme-fg-muted);
2233
+ }
2234
+ .thread-ui-shell .xyz-viewer-plugin__header h2 {
2235
+ color: var(--theme-fg);
2236
+ }
2237
+ .thread-ui-shell .xyz-viewer-plugin__header p,
2238
+ .thread-ui-shell .xyz-viewer-plugin__header span,
2239
+ .thread-ui-shell .xyz-viewer-plugin__tooltip span {
2240
+ color: var(--theme-fg-muted);
2241
+ }
2242
+ .thread-ui-shell .xyz-viewer-plugin__toolbar button,
2243
+ .thread-ui-shell .xyz-viewer-plugin__timeline button {
2244
+ border-color: var(--theme-border);
2245
+ background: var(--theme-surface-strong);
2246
+ color: var(--theme-fg-soft);
2247
+ }
2248
+ .thread-ui-shell .xyz-viewer-plugin__toolbar button:hover,
2249
+ .thread-ui-shell .xyz-viewer-plugin__timeline button:hover {
2250
+ background: var(--theme-hover);
2251
+ color: var(--theme-fg);
2252
+ }
2253
+ .thread-ui-shell .xyz-viewer-plugin__toolbar-divider {
2254
+ background: var(--theme-border);
2255
+ }
2256
+ .thread-ui-shell .xyz-viewer-plugin__stage {
2257
+ background: var(--theme-bg);
2258
+ }
2259
+ .thread-ui-shell .xyz-viewer-plugin__tooltip {
2260
+ border-color: var(--theme-border);
2261
+ background: color-mix(in oklch, var(--theme-panel) 96%, transparent);
2262
+ box-shadow: var(--theme-shadow);
2263
+ color: var(--theme-fg);
2264
+ }
2265
+ .thread-ui-shell .xyz-viewer-plugin__empty {
2266
+ color: var(--theme-fg-muted);
2267
+ }
2268
+ .thread-ui-shell .xyz-viewer-plugin__error {
2269
+ background: color-mix(in oklch, oklch(0.62 0.16 25) 14%, var(--theme-panel));
2270
+ color: oklch(0.78 0.12 25);
2271
+ }
2272
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-tool-key,
2273
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-tool-key,
2274
+ .thread-ui-shell.dark .thread-graph-tool-key {
2275
+ color: oklch(0.78 0.12 18);
2276
+ }
2277
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-tool-string,
2278
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-tool-string,
2279
+ .thread-ui-shell.dark .thread-graph-tool-string {
2280
+ color: oklch(0.79 0.11 155);
2281
+ }
2282
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-tool-number,
2283
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-tool-number,
2284
+ .thread-ui-shell.dark .thread-graph-tool-number {
2285
+ color: oklch(0.77 0.1 235);
2286
+ }
2287
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-tool-boolean,
2288
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-tool-boolean,
2289
+ .thread-ui-shell.dark .thread-graph-tool-boolean {
2290
+ color: oklch(0.79 0.1 302);
2291
+ }
2292
+ .thread-ui-shell .thread-timeline-surface,
2293
+ .thread-ui-shell .thread-scroll-container {
2294
+ background: var(--theme-surface);
2295
+ color: var(--theme-fg);
2296
+ scrollbar-color: var(--theme-border-strong) transparent;
2297
+ }
2298
+ .thread-ui-shell .thread-scroll-container > div > .divide-y {
2299
+ border-color: var(--theme-border);
2300
+ }
2301
+ .thread-ui-shell .timeline-item-frame {
2302
+ border-color: var(--theme-border);
2303
+ background: var(--theme-panel);
2304
+ color: var(--theme-fg);
2305
+ box-shadow: none;
2306
+ }
2307
+ .thread-ui-shell .timeline-agent {
2308
+ border-color: transparent;
2309
+ background: transparent;
2310
+ box-shadow: none;
2311
+ }
2312
+ .thread-ui-shell .timeline-user {
2313
+ border-color: transparent;
2314
+ background: oklch(0.94 0.025 214);
2315
+ color: oklch(0.24 0.027 255);
2316
+ }
2317
+ .thread-ui-shell.thread-ui-theme-dark .timeline-user,
2318
+ .thread-ui-shell[data-theme-effective=dark] .timeline-user,
2319
+ .thread-ui-shell.dark .timeline-user {
2320
+ background: oklch(0.29 0.034 224);
2321
+ color: var(--theme-fg);
2322
+ }
2323
+ .thread-ui-shell .timeline-command,
2324
+ .thread-ui-shell .timeline-agent-tool,
2325
+ .thread-ui-shell .timeline-skill-tool,
2326
+ .thread-ui-shell .timeline-action,
2327
+ .thread-ui-shell .timeline-file-change,
2328
+ .thread-ui-shell .timeline-file-read,
2329
+ .thread-ui-shell .timeline-search,
2330
+ .thread-ui-shell .timeline-plan,
2331
+ .thread-ui-shell .timeline-reasoning,
2332
+ .thread-ui-shell .timeline-other,
2333
+ .thread-ui-shell .timeline-special-warning,
2334
+ .thread-ui-shell .timeline-special-info,
2335
+ .thread-ui-shell .timeline-special-file-read,
2336
+ .thread-ui-shell .timeline-special-success,
2337
+ .thread-ui-shell .timeline-mobile-dense-event,
2338
+ .thread-ui-shell .timeline-batch-inner,
2339
+ .thread-ui-shell .timeline-item-inner {
2340
+ border-color: var(--theme-border);
2341
+ background: var(--theme-panel);
2342
+ color: var(--theme-fg);
2343
+ }
2344
+ .thread-ui-shell .timeline-special-warning,
2345
+ .thread-ui-shell .timeline-special-info,
2346
+ .thread-ui-shell .timeline-special-file-read,
2347
+ .thread-ui-shell .timeline-special-success {
2348
+ box-shadow: none;
2349
+ }
2350
+ .thread-ui-shell .timeline-mobile-dense-command,
2351
+ .thread-ui-shell .timeline-mobile-dense-search,
2352
+ .thread-ui-shell .timeline-mobile-dense-file-read,
2353
+ .thread-ui-shell .timeline-mobile-dense-file {
2354
+ background: var(--theme-panel);
2355
+ }
2356
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.border-stone-700, .border-stone-700\\/90, .border-stone-800, .border-stone-800\\/80) {
2357
+ border-color: var(--theme-border) !important;
2358
+ }
2359
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.bg-stone-800, .bg-stone-900, .bg-stone-900\\/60, .bg-stone-900\\/72, .bg-stone-900\\/80, .bg-stone-950, .bg-stone-950\\/35, .bg-stone-950\\/40, .bg-stone-950\\/60, .bg-stone-950\\/70, .bg-stone-950\\/90, .bg-stone-950\\/96) {
2360
+ background: var(--theme-surface-strong) !important;
2361
+ }
2362
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-stone-100, .text-stone-200, .text-stone-300, .text-sky-50, .text-sky-100, .text-emerald-50, .text-emerald-100, .text-amber-100) {
2363
+ color: var(--theme-fg) !important;
2364
+ }
2365
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-stone-400, .text-stone-500) {
2366
+ color: var(--theme-fg-muted) !important;
2367
+ }
2368
+ .thread-ui-shell .timeline-kind-agent,
2369
+ .thread-ui-shell .timeline-kind-user,
2370
+ .thread-ui-shell .timeline-kind-command,
2371
+ .thread-ui-shell .timeline-kind-search,
2372
+ .thread-ui-shell .timeline-kind-file-read,
2373
+ .thread-ui-shell .timeline-kind-reasoning,
2374
+ .thread-ui-shell .timeline-kind-agent-tool,
2375
+ .thread-ui-shell .timeline-kind-skill-tool,
2376
+ .thread-ui-shell .timeline-kind-action,
2377
+ .thread-ui-shell .timeline-kind-plan,
2378
+ .thread-ui-shell .timeline-kind-file {
2379
+ border-left-width: 1px;
2380
+ }
2381
+ .thread-ui-shell .timeline-primary-text,
2382
+ .thread-ui-shell .timeline-message-content,
2383
+ .thread-ui-shell .timeline-mobile-bubble-content,
2384
+ .thread-ui-shell .thread-message-prose,
2385
+ .thread-ui-shell .thread-message-prose :where(p, li, span, div, strong, em, code) {
2386
+ color: var(--theme-fg);
2387
+ }
2388
+ .thread-ui-shell .timeline-user .thread-message-prose,
2389
+ .thread-ui-shell .timeline-user .thread-message-prose :where(p, li, span, div, strong, em, code) {
2390
+ color: oklch(0.24 0.027 255);
2391
+ }
2392
+ .thread-ui-shell.thread-ui-theme-dark .timeline-user .thread-message-prose,
2393
+ .thread-ui-shell[data-theme-effective=dark] .timeline-user .thread-message-prose,
2394
+ .thread-ui-shell.dark .timeline-user .thread-message-prose,
2395
+ .thread-ui-shell.thread-ui-theme-dark .timeline-user .thread-message-prose :where(p, li, span, div, strong, em, code),
2396
+ .thread-ui-shell[data-theme-effective=dark] .timeline-user .thread-message-prose :where(p, li, span, div, strong, em, code),
2397
+ .thread-ui-shell.dark .timeline-user .thread-message-prose :where(p, li, span, div, strong, em, code) {
2398
+ color: var(--theme-fg);
2399
+ }
2400
+ .thread-ui-shell .timeline-agent .thread-message-prose,
2401
+ .thread-ui-shell .timeline-agent .thread-message-prose :where(p, li, span, div, strong, em, code) {
2402
+ color: var(--theme-fg);
2403
+ }
2404
+ .thread-ui-shell .thread-graph-message {
2405
+ width: 100%;
2406
+ min-width: 0;
2407
+ }
2408
+ .thread-ui-shell .thread-graph-message-bubble {
2409
+ color: var(--theme-fg);
2410
+ }
2411
+ .thread-ui-shell .thread-graph-message-bubble.is-user {
2412
+ width: 100%;
2413
+ max-width: 100%;
2414
+ border-radius: 0.75rem;
2415
+ background: #eef5f9;
2416
+ padding: 0.5rem 0.75rem;
2417
+ color: rgb(15 23 42);
2418
+ }
2419
+ .thread-ui-shell .thread-graph-message-bubble.is-assistant {
2420
+ width: 100%;
2421
+ border: 0;
2422
+ background: transparent;
2423
+ padding: 0;
2424
+ box-shadow: none;
2425
+ }
2426
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-message-bubble.is-user,
2427
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-message-bubble.is-user,
2428
+ .thread-ui-shell.dark .thread-graph-message-bubble.is-user {
2429
+ background: #212b35;
2430
+ color: rgb(241 245 249);
2431
+ }
2432
+ .thread-ui-shell .thread-graph-message-content.is-user,
2433
+ .thread-ui-shell .thread-graph-message-content.is-user .thread-message-prose,
2434
+ .thread-ui-shell .thread-graph-message-content.is-user .thread-graph-message-prose,
2435
+ .thread-ui-shell .thread-graph-message-content.is-user .thread-graph-markdown,
2436
+ .thread-ui-shell .thread-graph-message-content.is-user .thread-graph-plain-text,
2437
+ .thread-ui-shell .thread-graph-message-content.is-user .thread-message-prose :where(p, li, span, div, strong, em, code),
2438
+ .thread-ui-shell .thread-graph-message-content.is-user .thread-graph-message-prose :where(p, li, span, div, strong, em, code),
2439
+ .thread-ui-shell .thread-graph-message-content.is-user .thread-graph-markdown :where(p, li, span, div, strong, em, code) {
2440
+ color: rgb(51 65 85);
2441
+ }
2442
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-message-content.is-user,
2443
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-message-content.is-user,
2444
+ .thread-ui-shell.dark .thread-graph-message-content.is-user,
2445
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-message-content.is-user .thread-message-prose,
2446
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-message-content.is-user .thread-message-prose,
2447
+ .thread-ui-shell.dark .thread-graph-message-content.is-user .thread-message-prose,
2448
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-message-content.is-user .thread-graph-message-prose,
2449
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-message-content.is-user .thread-graph-message-prose,
2450
+ .thread-ui-shell.dark .thread-graph-message-content.is-user .thread-graph-message-prose,
2451
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-message-content.is-user .thread-graph-markdown,
2452
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-message-content.is-user .thread-graph-markdown,
2453
+ .thread-ui-shell.dark .thread-graph-message-content.is-user .thread-graph-markdown,
2454
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-message-content.is-user .thread-graph-plain-text,
2455
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-message-content.is-user .thread-graph-plain-text,
2456
+ .thread-ui-shell.dark .thread-graph-message-content.is-user .thread-graph-plain-text,
2457
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-message-content.is-user .thread-message-prose :where(p, li, span, div, strong, em, code),
2458
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-message-content.is-user .thread-message-prose :where(p, li, span, div, strong, em, code),
2459
+ .thread-ui-shell.dark .thread-graph-message-content.is-user .thread-message-prose :where(p, li, span, div, strong, em, code),
2460
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-message-content.is-user .thread-graph-message-prose :where(p, li, span, div, strong, em, code),
2461
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-message-content.is-user .thread-graph-message-prose :where(p, li, span, div, strong, em, code),
2462
+ .thread-ui-shell.dark .thread-graph-message-content.is-user .thread-graph-message-prose :where(p, li, span, div, strong, em, code),
2463
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-message-content.is-user .thread-graph-markdown :where(p, li, span, div, strong, em, code),
2464
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-message-content.is-user .thread-graph-markdown :where(p, li, span, div, strong, em, code),
2465
+ .thread-ui-shell.dark .thread-graph-message-content.is-user .thread-graph-markdown :where(p, li, span, div, strong, em, code) {
2466
+ color: rgb(226 232 240);
2467
+ }
2468
+ .thread-ui-shell .thread-graph-message-content.is-assistant,
2469
+ .thread-ui-shell .thread-graph-message-content.is-assistant .thread-graph-message-prose,
2470
+ .thread-ui-shell .thread-graph-message-content.is-assistant .thread-graph-markdown,
2471
+ .thread-ui-shell .thread-graph-message-content.is-assistant .thread-graph-plain-text,
2472
+ .thread-ui-shell .thread-graph-message-content.is-assistant .thread-graph-message-prose :where(p, li, span, div, strong, em, code) {
2473
+ color: var(--theme-fg);
2474
+ }
2475
+ .thread-ui-shell .thread-graph-message-prose,
2476
+ .thread-ui-shell .thread-graph-markdown,
2477
+ .thread-ui-shell .thread-graph-plain-text {
2478
+ color: inherit;
2479
+ }
2480
+ .thread-ui-shell .thread-graph-markdown {
2481
+ max-width: none;
2482
+ font-size: 0.875rem;
2483
+ line-height: 1.7;
2484
+ }
2485
+ .thread-ui-shell .thread-graph-message-markdown {
2486
+ color: inherit;
2487
+ word-break: break-word;
2488
+ }
2489
+ .thread-ui-shell .thread-graph-show-more {
2490
+ min-height: 1.25rem;
2491
+ border-color: var(--theme-border);
2492
+ background: color-mix(in oklch, var(--theme-panel) 72%, transparent);
2493
+ color: var(--theme-fg-muted);
2494
+ }
2495
+ .thread-ui-shell .thread-graph-show-more:hover,
2496
+ .thread-ui-shell .thread-graph-show-more:focus-visible {
2497
+ background: var(--theme-hover);
2498
+ color: var(--theme-fg);
2499
+ }
2500
+ .thread-ui-shell .thread-graph-markdown :where(p, ul, ol, pre, blockquote, table, hr) {
2501
+ margin-bottom: 0.75rem;
2502
+ }
2503
+ .thread-ui-shell .thread-graph-markdown :where(p:last-child, ul:last-child, ol:last-child, pre:last-child, blockquote:last-child, table:last-child, hr:last-child) {
2504
+ margin-bottom: 0;
2505
+ }
2506
+ .thread-ui-shell .thread-graph-markdown :where(a) {
2507
+ color: rgb(3 105 161);
2508
+ text-decoration: underline;
2509
+ text-underline-offset: 2px;
2510
+ }
2511
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-markdown :where(a),
2512
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-markdown :where(a),
2513
+ .thread-ui-shell.dark .thread-graph-markdown :where(a) {
2514
+ color: rgb(125 211 252);
2515
+ }
2516
+ .thread-ui-shell .thread-graph-markdown :where(blockquote) {
2517
+ border-left: 3px solid var(--theme-border-strong);
2518
+ padding-left: 0.85rem;
2519
+ color: var(--theme-fg-soft);
2520
+ }
2521
+ .thread-ui-shell .thread-graph-markdown :where(ul, ol) {
2522
+ padding-left: 1.25rem;
2523
+ }
2524
+ .thread-ui-shell .thread-graph-markdown :where(li) {
2525
+ margin-top: 0.25rem;
2526
+ }
2527
+ .thread-ui-shell .thread-graph-markdown :where(table) {
2528
+ display: block;
2529
+ width: 100%;
2530
+ overflow-x: auto;
2531
+ border-collapse: collapse;
2532
+ }
2533
+ .thread-ui-shell .thread-graph-markdown :where(th, td) {
2534
+ border: 1px solid var(--theme-border);
2535
+ padding: 0.4rem 0.55rem;
2536
+ text-align: left;
2537
+ }
2538
+ .thread-ui-shell .thread-graph-markdown :where(th) {
2539
+ background: var(--theme-surface-strong);
2540
+ color: var(--theme-fg);
2541
+ }
2542
+ .thread-ui-shell .thread-graph-code-block {
2543
+ border-color: rgb(226 232 240);
2544
+ background: rgb(248 250 252);
2545
+ color: rgb(31 41 55);
2546
+ }
2547
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-code-block,
2548
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-code-block,
2549
+ .thread-ui-shell.dark .thread-graph-code-block {
2550
+ border-color: #303642;
2551
+ background: #11141a;
2552
+ color: rgb(241 245 249);
2553
+ }
2554
+ .thread-ui-shell .thread-graph-code-block pre,
2555
+ .thread-ui-shell .thread-graph-code-block code {
2556
+ margin: 0;
2557
+ background: transparent;
2558
+ color: inherit;
2559
+ }
2560
+ .thread-ui-shell .thread-graph-code-copy {
2561
+ background: rgb(255 255 255 / 0.72);
2562
+ color: rgb(51 65 85);
2563
+ box-shadow: 0 4px 12px rgb(15 23 42 / 0.08);
2564
+ }
2565
+ .thread-ui-shell .thread-graph-code-copy:hover {
2566
+ background: rgb(255 255 255);
2567
+ color: rgb(15 23 42);
2568
+ }
2569
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-code-copy,
2570
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-code-copy,
2571
+ .thread-ui-shell.dark .thread-graph-code-copy {
2572
+ background: rgb(34 39 51 / 0.82);
2573
+ color: rgb(226 232 240);
2574
+ }
2575
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-code-copy:hover,
2576
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-code-copy:hover,
2577
+ .thread-ui-shell.dark .thread-graph-code-copy:hover {
2578
+ background: #2b313d;
2579
+ color: rgb(248 250 252);
2580
+ }
2581
+ .thread-ui-shell .thread-graph-inline-code {
2582
+ background: rgb(241 245 249);
2583
+ color: rgb(31 41 55);
2584
+ }
2585
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-inline-code,
2586
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-inline-code,
2587
+ .thread-ui-shell.dark .thread-graph-inline-code {
2588
+ background: #222733;
2589
+ color: rgb(241 245 249);
2590
+ }
2591
+ .thread-ui-shell .thread-graph-message-sender {
2592
+ background: oklch(0.96 0.025 155);
2593
+ color: oklch(0.42 0.11 155);
2594
+ }
2595
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-message-sender,
2596
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-message-sender,
2597
+ .thread-ui-shell.dark .thread-graph-message-sender {
2598
+ background: rgb(52 211 153 / 0.1);
2599
+ color: rgb(110 231 183);
2600
+ }
2601
+ .thread-ui-shell .thread-graph-message-copy {
2602
+ border-color: var(--theme-border);
2603
+ background: var(--theme-panel);
2604
+ color: var(--theme-fg-muted);
2605
+ }
2606
+ .thread-ui-shell .thread-graph-message-copy:hover {
2607
+ background: var(--theme-hover);
2608
+ color: var(--theme-fg);
2609
+ }
2610
+ .thread-ui-shell .thread-graph-message-header-actions {
2611
+ color: var(--theme-fg-muted);
2612
+ }
2613
+ .thread-ui-shell .thread-graph-message-time {
2614
+ color: var(--theme-fg-muted);
2615
+ white-space: nowrap;
2616
+ }
2617
+ .thread-ui-shell .thread-graph-message-status {
2618
+ box-shadow: none;
2619
+ }
2620
+ .thread-ui-shell .thread-graph-message-status-icon {
2621
+ align-items: center;
2622
+ justify-content: center;
2623
+ }
2624
+ @media (max-width: 639px) {
2625
+ .thread-ui-shell .thread-graph-message-header {
2626
+ margin-bottom: 0.375rem;
2627
+ flex-wrap: nowrap;
2628
+ }
2629
+ .thread-ui-shell .thread-graph-message-sender {
2630
+ padding: 0.1875rem 0.5rem;
2631
+ font-size: 0.6875rem;
2632
+ line-height: 1rem;
2633
+ }
2634
+ .thread-ui-shell .thread-graph-message-header-actions {
2635
+ gap: 0.25rem;
2636
+ }
2637
+ .thread-ui-shell .thread-graph-message-copy {
2638
+ height: 1.55rem;
2639
+ width: 1.55rem;
2640
+ border-radius: 0.45rem;
2641
+ }
2642
+ .thread-ui-shell .thread-graph-message-time {
2643
+ font-size: 0.625rem;
2644
+ }
2645
+ .thread-ui-shell :where(.thread-graph-message-status, .thread-graph-tool-badge) .thread-graph-status-label {
2646
+ position: absolute;
2647
+ width: 1px;
2648
+ height: 1px;
2649
+ padding: 0;
2650
+ margin: -1px;
2651
+ overflow: hidden;
2652
+ clip: rect(0, 0, 0, 0);
2653
+ white-space: nowrap;
2654
+ border: 0;
2655
+ }
2656
+ .thread-ui-shell :where(.thread-graph-message-status, .thread-graph-tool-badge) {
2657
+ min-width: 1.45rem;
2658
+ justify-content: center;
2659
+ padding-left: 0.25rem !important;
2660
+ padding-right: 0.25rem !important;
2661
+ }
2662
+ }
2663
+ @media (min-width: 640px) {
2664
+ .thread-ui-shell .thread-graph-message-bubble.is-user {
2665
+ padding: 0.375rem 1rem;
2666
+ }
2667
+ }
2668
+ `);Wt(`.thread-ui-shell .timeline-soft-text,
2669
+ .thread-ui-shell .thread-message-prose :where(blockquote) {
2670
+ color: var(--theme-fg-soft);
2671
+ }
2672
+ .thread-ui-shell .timeline-meta-text,
2673
+ .thread-ui-shell .thread-message-prose :where(figcaption) {
2674
+ color: var(--theme-fg-muted);
2675
+ }
2676
+ .thread-ui-shell .timeline-overlay-badge,
2677
+ .thread-ui-shell .ui-status-neutral,
2678
+ .thread-ui-shell .ui-status-info,
2679
+ .thread-ui-shell .ui-status-warning,
2680
+ .thread-ui-shell .ui-status-success,
2681
+ .thread-ui-shell .ui-status-danger {
2682
+ border-color: transparent;
2683
+ box-shadow: none;
2684
+ }
2685
+ .thread-ui-shell .timeline-command-status-complete,
2686
+ .thread-ui-shell .timeline-command-status-pending,
2687
+ .thread-ui-shell .timeline-delta-badge,
2688
+ .thread-ui-shell .timeline-live-plan-step {
2689
+ border-color: var(--theme-border);
2690
+ background: var(--theme-muted);
2691
+ color: var(--theme-fg-soft);
2692
+ }
2693
+ .thread-ui-shell .ui-status-neutral {
2694
+ background: var(--theme-muted);
2695
+ color: var(--theme-fg-soft);
2696
+ }
2697
+ .thread-ui-shell.thread-ui-theme-dark .ui-status-neutral,
2698
+ .thread-ui-shell[data-theme-effective=dark] .ui-status-neutral,
2699
+ .thread-ui-shell.dark .ui-status-neutral {
2700
+ border-color: #303642;
2701
+ background: #151923;
2702
+ color: rgb(203 213 225);
2703
+ }
2704
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-room-card.is-active .ui-status-neutral,
2705
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-room-card.is-active .ui-status-neutral,
2706
+ .thread-ui-shell.dark .thread-graph-room-card.is-active .ui-status-neutral {
2707
+ border-color: #424b5e;
2708
+ background: #1a1f2a;
2709
+ color: rgb(203 213 225);
2710
+ }
2711
+ .thread-ui-shell .ui-status-info {
2712
+ background: oklch(0.94 0.03 235);
2713
+ color: oklch(0.43 0.09 242);
2714
+ }
2715
+ .thread-ui-shell .ui-status-warning {
2716
+ background: oklch(0.94 0.048 84);
2717
+ color: oklch(0.46 0.08 75);
2718
+ }
2719
+ .thread-ui-shell .ui-status-success {
2720
+ background: oklch(0.94 0.052 155);
2721
+ color: oklch(0.43 0.095 155);
2722
+ }
2723
+ .thread-ui-shell .ui-status-danger {
2724
+ background: oklch(0.94 0.04 25);
2725
+ color: oklch(0.48 0.125 24);
2726
+ }
2727
+ .thread-ui-shell.thread-ui-theme-dark .ui-status-info,
2728
+ .thread-ui-shell[data-theme-effective=dark] .ui-status-info,
2729
+ .thread-ui-shell.dark .ui-status-info {
2730
+ background: oklch(0.3 0.042 235);
2731
+ color: oklch(0.77 0.1 235);
2732
+ }
2733
+ .thread-ui-shell.thread-ui-theme-dark .ui-status-warning,
2734
+ .thread-ui-shell[data-theme-effective=dark] .ui-status-warning,
2735
+ .thread-ui-shell.dark .ui-status-warning {
2736
+ background: oklch(0.31 0.045 75);
2737
+ color: oklch(0.83 0.11 80);
2738
+ }
2739
+ .thread-ui-shell.thread-ui-theme-dark .ui-status-success,
2740
+ .thread-ui-shell[data-theme-effective=dark] .ui-status-success,
2741
+ .thread-ui-shell.dark .ui-status-success {
2742
+ background: oklch(0.31 0.05 155);
2743
+ color: oklch(0.8 0.115 155);
2744
+ }
2745
+ .thread-ui-shell.thread-ui-theme-dark .ui-status-danger,
2746
+ .thread-ui-shell[data-theme-effective=dark] .ui-status-danger,
2747
+ .thread-ui-shell.dark .ui-status-danger {
2748
+ background: oklch(0.31 0.052 25);
2749
+ color: oklch(0.78 0.12 25);
2750
+ }
2751
+ .thread-ui-shell .thread-message-icon-user,
2752
+ .thread-ui-shell .thread-message-icon-agent {
2753
+ border-color: transparent;
2754
+ background: var(--theme-muted);
2755
+ color: var(--theme-fg-muted);
2756
+ }
2757
+ .thread-ui-shell .thread-graph-thinking-trigger {
2758
+ display: inline-flex;
2759
+ align-items: center;
2760
+ color: rgb(148 163 184);
2761
+ }
2762
+ .thread-ui-shell .thread-graph-thinking-trigger:hover,
2763
+ .thread-ui-shell .thread-graph-thinking-trigger[data-state=open] {
2764
+ color: rgb(125 211 252);
2765
+ }
2766
+ .thread-ui-shell .thread-graph-thinking-label {
2767
+ min-width: 0;
2768
+ }
2769
+ .thread-ui-shell .thread-graph-thinking-body {
2770
+ border-color: rgb(42 47 58);
2771
+ background: #1b1f29;
2772
+ color: rgb(203 213 225);
2773
+ }
2774
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-thinking-trigger {
2775
+ color: rgb(100 116 139);
2776
+ }
2777
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-thinking-trigger:hover,
2778
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-thinking-trigger[data-state=open] {
2779
+ color: rgb(3 105 161);
2780
+ }
2781
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-thinking-body {
2782
+ border-color: rgb(226 232 240);
2783
+ background: rgb(248 250 252);
2784
+ color: rgb(51 65 85);
2785
+ }
2786
+ .thread-ui-shell .timeline-corner-copy-visual {
2787
+ border-color: var(--theme-border);
2788
+ background: color-mix(in oklch, var(--theme-panel) 88%, transparent);
2789
+ color: var(--theme-fg-muted);
2790
+ }
2791
+ .thread-ui-shell .thread-composer-form {
2792
+ border-color: var(--theme-border);
2793
+ background: var(--theme-surface);
2794
+ }
2795
+ .thread-ui-shell .thread-composer-toolbar,
2796
+ .thread-ui-shell .thread-composer-input,
2797
+ .thread-ui-shell .thread-composer-menu {
2798
+ border-color: var(--theme-border);
2799
+ background: var(--theme-panel);
2800
+ color: var(--theme-fg);
2801
+ }
2802
+ .thread-ui-shell .thread-composer-toolbar {
2803
+ border-radius: 0;
2804
+ border: 0;
2805
+ background: transparent;
2806
+ box-shadow: none;
2807
+ order: 2;
2808
+ min-height: 2.75rem;
2809
+ padding: 0.25rem 0.75rem 0.65rem;
2810
+ flex-wrap: wrap;
2811
+ align-items: center;
2812
+ }
2813
+ .thread-ui-shell .thread-composer-prompt-region {
2814
+ order: 1;
2815
+ }
2816
+ .thread-ui-shell .thread-composer-input {
2817
+ position: relative;
2818
+ min-height: 5.25rem !important;
2819
+ max-height: 12rem !important;
2820
+ border: 0;
2821
+ border-radius: 0;
2822
+ background: transparent !important;
2823
+ box-shadow: none;
2824
+ overflow: visible;
2825
+ padding-top: 0.7rem;
2826
+ padding-bottom: 0.45rem;
2827
+ }
2828
+ .thread-ui-shell .thread-composer-input:focus-within {
2829
+ border-color: transparent;
2830
+ box-shadow: none;
2831
+ }
2832
+ .thread-ui-shell .thread-composer-input [contenteditable],
2833
+ .thread-ui-shell .thread-composer-input textarea {
2834
+ display: block;
2835
+ width: 100%;
2836
+ min-width: 0;
2837
+ background: transparent !important;
2838
+ color: var(--theme-fg);
2839
+ font-size: 1rem;
2840
+ line-height: 1.55;
2841
+ }
2842
+ .thread-ui-shell .thread-composer-input [contenteditable] {
2843
+ min-height: 4.15rem !important;
2844
+ max-height: 9.5rem !important;
2845
+ overflow-y: auto;
2846
+ }
2847
+ .thread-ui-shell .thread-composer-input textarea {
2848
+ min-height: 4.15rem !important;
2849
+ max-height: 9.5rem !important;
2850
+ overflow-y: auto;
2851
+ resize: none;
2852
+ }
2853
+ .thread-ui-shell .thread-composer-shell {
2854
+ border: 1px solid var(--theme-border);
2855
+ background: #fbfcfd;
2856
+ box-shadow: 0 4px 18px oklch(0.22 0.024 255 / 0.04);
2857
+ }
2858
+ .thread-ui-shell .thread-composer-send-button {
2859
+ flex: 0 0 auto;
2860
+ }
2861
+ .thread-ui-shell .thread-goal-compose-card {
2862
+ border-color: color-mix(in oklch, var(--theme-accent-solid) 18%, var(--theme-border));
2863
+ background: color-mix(in oklch, var(--theme-accent-solid) 7%, var(--theme-panel));
2864
+ color: var(--theme-fg-soft);
2865
+ box-shadow: 0 8px 18px rgb(15 23 42 / 0.05);
2866
+ }
2867
+ .thread-ui-shell .thread-goal-compose-label {
2868
+ color: color-mix(in oklch, var(--theme-accent-solid) 68%, var(--theme-fg));
2869
+ }
2870
+ .thread-ui-shell .thread-goal-compose-field {
2871
+ color: var(--theme-fg-soft);
2872
+ }
2873
+ .thread-ui-shell .thread-goal-compose-input {
2874
+ border-color: color-mix(in oklch, var(--theme-accent-solid) 20%, var(--theme-border));
2875
+ background: var(--theme-panel);
2876
+ color: var(--theme-fg);
2877
+ }
2878
+ .thread-ui-shell .thread-goal-compose-input::placeholder {
2879
+ color: var(--theme-fg-muted);
2880
+ }
2881
+ .thread-ui-shell .thread-goal-compose-input:focus {
2882
+ border-color: color-mix(in oklch, var(--theme-accent-solid) 48%, var(--theme-border));
2883
+ }
2884
+ .thread-ui-shell .thread-goal-compose-cancel {
2885
+ border-color: var(--theme-border);
2886
+ background: var(--theme-surface-strong);
2887
+ color: var(--theme-fg-soft);
2888
+ }
2889
+ .thread-ui-shell .thread-goal-compose-cancel:hover {
2890
+ background: var(--theme-hover);
2891
+ color: var(--theme-fg);
2892
+ }
2893
+ .thread-ui-shell .thread-goal-compose-error {
2894
+ color: rgb(190 18 60);
2895
+ }
2896
+ .thread-ui-shell.thread-ui-theme-dark .thread-goal-compose-card,
2897
+ .thread-ui-shell[data-theme-effective=dark] .thread-goal-compose-card,
2898
+ .thread-ui-shell.dark .thread-goal-compose-card {
2899
+ border-color: rgb(125 211 252 / 0.25);
2900
+ background: rgb(125 211 252 / 0.07);
2901
+ color: rgb(226 232 240);
2902
+ box-shadow: 0 8px 18px rgb(0 0 0 / 0.18);
2903
+ }
2904
+ .thread-ui-shell.thread-ui-theme-dark .thread-goal-compose-label,
2905
+ .thread-ui-shell[data-theme-effective=dark] .thread-goal-compose-label,
2906
+ .thread-ui-shell.dark .thread-goal-compose-label {
2907
+ color: rgb(224 242 254 / 0.9);
2908
+ }
2909
+ .thread-ui-shell.thread-ui-theme-dark .thread-goal-compose-field,
2910
+ .thread-ui-shell[data-theme-effective=dark] .thread-goal-compose-field,
2911
+ .thread-ui-shell.dark .thread-goal-compose-field {
2912
+ color: rgb(203 213 225);
2913
+ }
2914
+ .thread-ui-shell.thread-ui-theme-dark .thread-goal-compose-input,
2915
+ .thread-ui-shell[data-theme-effective=dark] .thread-goal-compose-input,
2916
+ .thread-ui-shell.dark .thread-goal-compose-input {
2917
+ border-color: rgb(125 211 252 / 0.25);
2918
+ background: rgb(2 6 23 / 0.46);
2919
+ color: rgb(241 245 249);
2920
+ }
2921
+ .thread-ui-shell.thread-ui-theme-dark .thread-goal-compose-cancel,
2922
+ .thread-ui-shell[data-theme-effective=dark] .thread-goal-compose-cancel,
2923
+ .thread-ui-shell.dark .thread-goal-compose-cancel {
2924
+ border-color: #343b48;
2925
+ background: #1d222c;
2926
+ color: rgb(203 213 225);
2927
+ }
2928
+ .thread-ui-shell.thread-ui-theme-dark .thread-goal-compose-cancel:hover,
2929
+ .thread-ui-shell[data-theme-effective=dark] .thread-goal-compose-cancel:hover,
2930
+ .thread-ui-shell.dark .thread-goal-compose-cancel:hover {
2931
+ background: #222733;
2932
+ color: rgb(241 245 249);
2933
+ }
2934
+ .thread-ui-shell.thread-ui-theme-dark .thread-goal-compose-error,
2935
+ .thread-ui-shell[data-theme-effective=dark] .thread-goal-compose-error,
2936
+ .thread-ui-shell.dark .thread-goal-compose-error {
2937
+ color: rgb(254 205 211);
2938
+ }
2939
+ @media (min-width: 640px) {
2940
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-composer-shell {
2941
+ border-radius: 16px;
2942
+ }
2943
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-composer-input {
2944
+ min-height: 5.75rem !important;
2945
+ max-height: 12.5rem !important;
2946
+ padding-top: 0.9rem;
2947
+ }
2948
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-composer-input [contenteditable],
2949
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-composer-input textarea {
2950
+ min-height: 4.5rem !important;
2951
+ max-height: 10rem !important;
2952
+ font-size: 0.875rem;
2953
+ }
2954
+ }
2955
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-composer-form {
2956
+ padding: 0.5rem 1rem 0.75rem;
2957
+ }
2958
+ .thread-ui-shell.thread-ui-theme-dark .thread-composer-shell,
2959
+ .thread-ui-shell[data-theme-effective=dark] .thread-composer-shell,
2960
+ .thread-ui-shell.dark .thread-composer-shell {
2961
+ border-color: #303642;
2962
+ background: #181b23;
2963
+ box-shadow: 0 8px 24px oklch(0 0 0 / 0.22);
2964
+ }
2965
+ .thread-ui-shell.thread-ui-theme-dark .thread-composer-toolbar,
2966
+ .thread-ui-shell[data-theme-effective=dark] .thread-composer-toolbar,
2967
+ .thread-ui-shell.dark .thread-composer-toolbar,
2968
+ .thread-ui-shell.thread-ui-theme-dark .thread-composer-input,
2969
+ .thread-ui-shell[data-theme-effective=dark] .thread-composer-input,
2970
+ .thread-ui-shell.dark .thread-composer-input {
2971
+ border-color: #303642 !important;
2972
+ background: transparent !important;
2973
+ color: rgb(241 245 249) !important;
2974
+ box-shadow: none !important;
2975
+ }
2976
+ .thread-ui-shell.thread-ui-theme-dark .thread-composer-input [contenteditable],
2977
+ .thread-ui-shell[data-theme-effective=dark] .thread-composer-input [contenteditable],
2978
+ .thread-ui-shell.dark .thread-composer-input [contenteditable],
2979
+ .thread-ui-shell.thread-ui-theme-dark .thread-composer-input textarea,
2980
+ .thread-ui-shell[data-theme-effective=dark] .thread-composer-input textarea,
2981
+ .thread-ui-shell.dark .thread-composer-input textarea {
2982
+ background: transparent !important;
2983
+ color: rgb(241 245 249) !important;
2984
+ }
2985
+ .thread-ui-shell .thread-graph-composer-form {
2986
+ border-color: var(--theme-border);
2987
+ background: var(--theme-surface);
2988
+ }
2989
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-form,
2990
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-form,
2991
+ .thread-ui-shell.dark .thread-graph-composer-form {
2992
+ border-color: var(--theme-border);
2993
+ background: var(--theme-surface);
2994
+ }
2995
+ .thread-ui-shell .thread-graph-composer-shell {
2996
+ border: 1px solid var(--theme-border);
2997
+ background: var(--theme-panel);
2998
+ box-shadow: 0 4px 18px oklch(0.22 0.024 255 / 0.04);
2999
+ overflow: visible !important;
3000
+ }
3001
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-shell,
3002
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-shell,
3003
+ .thread-ui-shell.dark .thread-graph-composer-shell {
3004
+ border-color: var(--theme-border-strong);
3005
+ background: var(--theme-panel);
3006
+ box-shadow: 0 8px 24px oklch(0 0 0 / 0.22);
3007
+ }
3008
+ .thread-ui-shell .thread-graph-composer-input-group {
3009
+ order: 1;
3010
+ display: flex;
3011
+ flex-direction: column;
3012
+ align-items: stretch;
3013
+ height: auto;
3014
+ min-height: 0;
3015
+ color: rgb(30 41 59);
3016
+ overflow: visible !important;
3017
+ }
3018
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-input-group,
3019
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-input-group,
3020
+ .thread-ui-shell.dark .thread-graph-composer-input-group {
3021
+ color: rgb(241 245 249);
3022
+ }
3023
+ .thread-ui-shell .thread-graph-composer-prompt-region {
3024
+ order: 1;
3025
+ }
3026
+ .thread-ui-shell .thread-graph-composer-input {
3027
+ position: relative;
3028
+ border: 0;
3029
+ background: transparent;
3030
+ color: rgb(30 41 59);
3031
+ box-shadow: none;
3032
+ overflow-y: auto;
3033
+ }
3034
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-input,
3035
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-input,
3036
+ .thread-ui-shell.dark .thread-graph-composer-input {
3037
+ color: rgb(241 245 249);
3038
+ }
3039
+ .thread-ui-shell .thread-graph-composer-input [contenteditable] {
3040
+ display: block;
3041
+ width: 100%;
3042
+ min-width: 0;
3043
+ overflow-y: auto;
3044
+ background: transparent;
3045
+ color: inherit;
3046
+ }
3047
+ .thread-ui-shell .thread-graph-composer-input .thread-composer-attachment-chip,
3048
+ .thread-ui-shell .thread-composer-input .thread-composer-attachment-chip {
3049
+ box-sizing: border-box;
3050
+ flex: 0 0 auto;
3051
+ width: max-content !important;
3052
+ max-width: min(100%, 7.25rem) !important;
3053
+ vertical-align: middle;
3054
+ }
3055
+ .thread-ui-shell .thread-graph-composer-input .thread-composer-attachment-chip-photo,
3056
+ .thread-ui-shell .thread-composer-input .thread-composer-attachment-chip-photo {
3057
+ display: inline-flex !important;
3058
+ flex-direction: column;
3059
+ align-items: flex-start;
3060
+ gap: 0.25rem;
3061
+ padding: 0.35rem !important;
3062
+ }
3063
+ .thread-ui-shell .thread-graph-composer-input .thread-composer-attachment-thumb,
3064
+ .thread-ui-shell .thread-composer-input .thread-composer-attachment-thumb {
3065
+ display: block;
3066
+ width: 5.75rem !important;
3067
+ height: 3.75rem !important;
3068
+ max-width: 100%;
3069
+ border-radius: 0.6rem !important;
3070
+ object-fit: cover;
3071
+ }
3072
+ .thread-ui-shell .thread-graph-composer-input .thread-composer-attachment-caption,
3073
+ .thread-ui-shell .thread-composer-input .thread-composer-attachment-caption {
3074
+ display: block !important;
3075
+ width: 100%;
3076
+ max-width: 5.75rem !important;
3077
+ margin-left: 0 !important;
3078
+ overflow: hidden;
3079
+ color: rgb(3 105 161);
3080
+ text-overflow: ellipsis;
3081
+ white-space: nowrap;
3082
+ }
3083
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-input .thread-composer-attachment-caption,
3084
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-input .thread-composer-attachment-caption,
3085
+ :root[data-theme-effective=dark] .thread-ui-shell .thread-graph-composer-input .thread-composer-attachment-caption,
3086
+ .thread-ui-shell.dark .thread-graph-composer-input .thread-composer-attachment-caption,
3087
+ .thread-ui-shell.thread-ui-theme-dark .thread-composer-input .thread-composer-attachment-caption,
3088
+ .thread-ui-shell[data-theme-effective=dark] .thread-composer-input .thread-composer-attachment-caption,
3089
+ :root[data-theme-effective=dark] .thread-ui-shell .thread-composer-input .thread-composer-attachment-caption,
3090
+ .thread-ui-shell.dark .thread-composer-input .thread-composer-attachment-caption {
3091
+ color: rgb(125 211 252);
3092
+ }
3093
+ .thread-ui-shell .thread-graph-composer-toolbar {
3094
+ order: 2;
3095
+ width: 100%;
3096
+ min-height: 2.75rem;
3097
+ flex-wrap: wrap;
3098
+ justify-content: flex-start;
3099
+ gap: 0.5rem;
3100
+ border: 0;
3101
+ background: transparent;
3102
+ padding: 0 0.5rem 0.5rem;
3103
+ color: rgb(100 116 139);
3104
+ box-shadow: none;
3105
+ overflow: visible !important;
3106
+ }
3107
+ @media (min-width: 640px) {
3108
+ .thread-ui-shell:not([data-thread-layout=mobile]) .thread-graph-composer-toolbar {
3109
+ flex-wrap: nowrap;
3110
+ padding: 0 0.75rem 0.75rem;
3111
+ }
3112
+ }
3113
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-toolbar,
3114
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-toolbar,
3115
+ .thread-ui-shell.dark .thread-graph-composer-toolbar {
3116
+ color: rgb(148 163 184);
3117
+ }
3118
+ .thread-ui-shell .thread-graph-composer-send-button {
3119
+ flex: 0 0 auto;
3120
+ }
3121
+ .thread-ui-shell .thread-graph-composer-stop-button {
3122
+ border-color: rgb(244 63 94 / 0.28) !important;
3123
+ box-shadow: 0 8px 18px rgb(15 23 42 / 0.14);
3124
+ }
3125
+ .thread-ui-shell .thread-graph-composer-prompt-region .thread-graph-composer-stop-button {
3126
+ position: absolute;
3127
+ }
3128
+ @media (max-width: 639px) {
3129
+ .thread-ui-shell .thread-graph-composer-form {
3130
+ padding: 0.35rem 0.55rem calc(env(safe-area-inset-bottom) + 0.35rem) !important;
3131
+ }
3132
+ .thread-ui-shell .thread-graph-composer-shell {
3133
+ border-radius: 14px !important;
3134
+ }
3135
+ .thread-ui-shell .thread-graph-composer-input {
3136
+ min-height: 3.65rem !important;
3137
+ max-height: 7.5rem !important;
3138
+ padding: 0.65rem 0.75rem 0.2rem !important;
3139
+ }
3140
+ .thread-ui-shell .thread-graph-composer-input [contenteditable] {
3141
+ min-height: 3rem !important;
3142
+ padding-right: 2.5rem;
3143
+ }
3144
+ .thread-ui-shell .thread-graph-composer-toolbar {
3145
+ min-height: 2.35rem;
3146
+ gap: 0.3rem;
3147
+ padding: 0 0.45rem 0.45rem;
3148
+ }
3149
+ .thread-ui-shell .thread-graph-composer-toolbar > .flex {
3150
+ min-width: 0;
3151
+ gap: 0.3rem;
3152
+ }
3153
+ .thread-ui-shell .thread-graph-composer-icon-button,
3154
+ .thread-ui-shell .thread-graph-composer-send-button {
3155
+ width: 1.95rem !important;
3156
+ height: 1.95rem !important;
3157
+ }
3158
+ .thread-ui-shell .thread-graph-composer-inline-toggle {
3159
+ height: 1.95rem;
3160
+ max-width: 6.75rem !important;
3161
+ padding-left: 0.5rem !important;
3162
+ padding-right: 0.5rem !important;
3163
+ font-size: 0.6875rem;
3164
+ }
3165
+ .thread-ui-shell .thread-graph-composer-stop-button {
3166
+ top: 0.45rem !important;
3167
+ right: 0.45rem !important;
3168
+ width: 1.8rem !important;
3169
+ height: 1.8rem !important;
3170
+ }
3171
+ }
3172
+ .thread-ui-shell .thread-composer-icon-button,
3173
+ .thread-ui-shell .thread-composer-inline-toggle,
3174
+ .thread-ui-shell .thread-composer-chip-button,
3175
+ .thread-ui-shell .thread-composer-menu-item,
3176
+ .thread-ui-shell .thread-composer-panel-button,
3177
+ .thread-ui-shell .thread-graph-composer-icon-button,
3178
+ .thread-ui-shell .thread-graph-composer-inline-toggle,
3179
+ .thread-ui-shell .thread-graph-composer-chip-button,
3180
+ .thread-ui-shell .thread-graph-composer-menu-item,
3181
+ .thread-ui-shell .thread-graph-composer-panel-button {
3182
+ border-color: var(--theme-border) !important;
3183
+ background: transparent !important;
3184
+ color: var(--theme-fg-soft) !important;
3185
+ }
3186
+ .thread-ui-shell .thread-composer-icon-button:hover,
3187
+ .thread-ui-shell .thread-composer-inline-toggle:hover,
3188
+ .thread-ui-shell .thread-composer-chip-button:hover,
3189
+ .thread-ui-shell .thread-composer-menu-item:hover,
3190
+ .thread-ui-shell .thread-composer-panel-button:hover,
3191
+ .thread-ui-shell .thread-graph-composer-icon-button:hover,
3192
+ .thread-ui-shell .thread-graph-composer-inline-toggle:hover,
3193
+ .thread-ui-shell .thread-graph-composer-chip-button:hover,
3194
+ .thread-ui-shell .thread-graph-composer-menu-item:hover,
3195
+ .thread-ui-shell .thread-graph-composer-panel-button:hover {
3196
+ background: var(--theme-hover) !important;
3197
+ color: var(--theme-fg) !important;
3198
+ }
3199
+ .thread-ui-shell .thread-composer-icon-button,
3200
+ .thread-ui-shell .thread-graph-composer-icon-button {
3201
+ background: var(--theme-muted) !important;
3202
+ }
3203
+ .thread-ui-shell.thread-ui-theme-dark .thread-composer-icon-button,
3204
+ .thread-ui-shell[data-theme-effective=dark] .thread-composer-icon-button,
3205
+ .thread-ui-shell.dark .thread-composer-icon-button,
3206
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-icon-button,
3207
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-icon-button,
3208
+ .thread-ui-shell.dark .thread-graph-composer-icon-button {
3209
+ border-color: #303642 !important;
3210
+ background: #222733 !important;
3211
+ color: rgb(203 213 225) !important;
3212
+ }
3213
+ .thread-ui-shell.thread-ui-theme-dark .thread-composer-icon-button:hover,
3214
+ .thread-ui-shell[data-theme-effective=dark] .thread-composer-icon-button:hover,
3215
+ .thread-ui-shell.dark .thread-composer-icon-button:hover,
3216
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-icon-button:hover,
3217
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-icon-button:hover,
3218
+ .thread-ui-shell.dark .thread-graph-composer-icon-button:hover {
3219
+ background: #2b313d !important;
3220
+ color: rgb(241 245 249) !important;
3221
+ }
3222
+ .thread-ui-shell .thread-composer-menu,
3223
+ .thread-ui-shell .thread-graph-composer-menu {
3224
+ border-radius: 12px;
3225
+ border-color: var(--theme-border) !important;
3226
+ background: color-mix(in oklch, var(--theme-panel) 96%, transparent) !important;
3227
+ color: var(--theme-fg) !important;
3228
+ box-shadow: 0 16px 38px oklch(0.22 0.024 255 / 0.16);
3229
+ z-index: 80;
3230
+ }
3231
+ .thread-ui-shell [data-composer-menu-surface=true] {
3232
+ border-color: var(--theme-border) !important;
3233
+ background: color-mix(in oklch, var(--theme-panel) 96%, transparent) !important;
3234
+ color: var(--theme-fg) !important;
3235
+ box-shadow: 0 16px 38px oklch(0.22 0.024 255 / 0.16) !important;
3236
+ }
3237
+ .thread-ui-shell .thread-graph-composer-menu {
3238
+ max-height: min(27rem, calc(100svh - 8rem));
3239
+ overflow: auto !important;
3240
+ }
3241
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(input, textarea, select) {
3242
+ border-color: var(--theme-border) !important;
3243
+ background: var(--theme-panel) !important;
3244
+ color: var(--theme-fg) !important;
3245
+ }
3246
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(input, textarea)::placeholder {
3247
+ color: var(--theme-fg-muted) !important;
3248
+ }
3249
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(input, textarea, select):focus {
3250
+ border-color: color-mix(in oklch, var(--theme-accent-solid) 38%, var(--theme-border)) !important;
3251
+ }
3252
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.border-sky-300\\/35, .border-emerald-400\\/45) {
3253
+ border-color: color-mix(in oklch, var(--theme-accent-solid) 24%, var(--theme-border)) !important;
3254
+ }
3255
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.bg-sky-300\\/10, .bg-sky-300\\/12, .bg-emerald-400\\/12) {
3256
+ background: color-mix(in oklch, var(--theme-accent-solid) 8%, var(--theme-panel)) !important;
3257
+ }
3258
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-rose-100\\/90, .text-rose-200) {
3259
+ color: rgb(190 18 60) !important;
3260
+ }
3261
+ .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-amber-100\\/85, .text-amber-100\\/60) {
3262
+ color: rgb(146 64 14) !important;
3263
+ }
3264
+ .thread-ui-shell.thread-ui-theme-dark .thread-composer-menu,
3265
+ .thread-ui-shell[data-theme-effective=dark] .thread-composer-menu,
3266
+ :root[data-theme-effective=dark] .thread-ui-shell .thread-composer-menu,
3267
+ .thread-ui-shell.dark .thread-composer-menu,
3268
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-menu,
3269
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-menu,
3270
+ :root[data-theme-effective=dark] .thread-ui-shell .thread-graph-composer-menu,
3271
+ .thread-ui-shell.dark .thread-graph-composer-menu,
3272
+ .thread-ui-shell.thread-ui-theme-dark [data-composer-menu-surface=true],
3273
+ .thread-ui-shell[data-theme-effective=dark] [data-composer-menu-surface=true],
3274
+ :root[data-theme-effective=dark] .thread-ui-shell [data-composer-menu-surface=true],
3275
+ .thread-ui-shell.dark [data-composer-menu-surface=true] {
3276
+ border-color: #303642 !important;
3277
+ background: rgb(23 26 34 / 0.96) !important;
3278
+ color: rgb(241 245 249) !important;
3279
+ box-shadow: 0 18px 48px rgb(0 0 0 / 0.28) !important;
3280
+ }
3281
+ .thread-ui-shell.thread-ui-theme-dark :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(input, textarea, select),
3282
+ .thread-ui-shell[data-theme-effective=dark] :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(input, textarea, select),
3283
+ :root[data-theme-effective=dark] .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(input, textarea, select),
3284
+ .thread-ui-shell.dark :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(input, textarea, select) {
3285
+ border-color: #303642 !important;
3286
+ background: #11141a !important;
3287
+ color: rgb(241 245 249) !important;
3288
+ }
3289
+ .thread-ui-shell.thread-ui-theme-dark :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-rose-100\\/90, .text-rose-200),
3290
+ .thread-ui-shell[data-theme-effective=dark] :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-rose-100\\/90, .text-rose-200),
3291
+ :root[data-theme-effective=dark] .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-rose-100\\/90, .text-rose-200),
3292
+ .thread-ui-shell.dark :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-rose-100\\/90, .text-rose-200) {
3293
+ color: rgb(254 205 211) !important;
3294
+ }
3295
+ .thread-ui-shell.thread-ui-theme-dark :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-amber-100\\/85, .text-amber-100\\/60),
3296
+ .thread-ui-shell[data-theme-effective=dark] :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-amber-100\\/85, .text-amber-100\\/60),
3297
+ :root[data-theme-effective=dark] .thread-ui-shell :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-amber-100\\/85, .text-amber-100\\/60),
3298
+ .thread-ui-shell.dark :where(.thread-composer-menu, .thread-graph-composer-menu, [data-composer-menu-surface=true]) :where(.text-amber-100\\/85, .text-amber-100\\/60) {
3299
+ color: rgb(253 230 138) !important;
3300
+ }
3301
+ .thread-ui-shell .thread-composer-plan-toggle-active,
3302
+ .thread-ui-shell .thread-graph-composer-plan-toggle-active {
3303
+ background: var(--theme-accent-soft);
3304
+ color: var(--theme-accent-strong);
3305
+ }
3306
+ .thread-ui-shell .thread-jump-latest-badge {
3307
+ border-color: var(--theme-border);
3308
+ background: var(--theme-panel);
3309
+ color: var(--theme-fg-muted);
3310
+ }
3311
+ .thread-ui-shell .ui-action-primary {
3312
+ background: var(--theme-accent-solid);
3313
+ color: var(--theme-accent-solid-fg);
3314
+ }
3315
+ .thread-ui-shell .ui-action-primary:hover {
3316
+ background: var(--theme-accent-solid-hover);
3317
+ }
3318
+ .thread-ui-shell .ui-action-info {
3319
+ background: oklch(0.46 0.1 235);
3320
+ color: oklch(0.98 0.005 235);
3321
+ }
3322
+ .thread-ui-shell .ui-action-danger {
3323
+ background: oklch(0.56 0.16 25);
3324
+ color: oklch(0.98 0.005 25);
3325
+ }
3326
+ .thread-ui-shell .thread-composer-send-button.ui-action-danger,
3327
+ .thread-ui-shell .thread-graph-composer-send-button.ui-action-danger {
3328
+ border: 1px solid var(--theme-border) !important;
3329
+ background: var(--theme-muted) !important;
3330
+ color: var(--theme-fg-soft) !important;
3331
+ }
3332
+ .thread-ui-shell.thread-ui-theme-dark .thread-composer-send-button.ui-action-danger,
3333
+ .thread-ui-shell[data-theme-effective=dark] .thread-composer-send-button.ui-action-danger,
3334
+ .thread-ui-shell.dark .thread-composer-send-button.ui-action-danger,
3335
+ .thread-ui-shell.thread-ui-theme-dark .thread-graph-composer-send-button.ui-action-danger,
3336
+ .thread-ui-shell[data-theme-effective=dark] .thread-graph-composer-send-button.ui-action-danger,
3337
+ .thread-ui-shell.dark .thread-graph-composer-send-button.ui-action-danger {
3338
+ border-color: #303642 !important;
3339
+ background: #222733 !important;
3340
+ color: rgb(241 245 249) !important;
3341
+ }
3342
+ .thread-ui-shell .thread-composer-send-button.ui-action-danger:hover,
3343
+ .thread-ui-shell .thread-graph-composer-send-button.ui-action-danger:hover {
3344
+ background: var(--theme-hover) !important;
3345
+ color: var(--theme-fg) !important;
3346
+ }
3347
+ .thread-ui-shell .thread-empty-surface,
3348
+ .thread-ui-shell .timeline-pending-card,
3349
+ .thread-ui-shell .timeline-note-card,
3350
+ .thread-ui-shell .timeline-activity-card,
3351
+ .thread-ui-shell .timeline-live-plan-card,
3352
+ .thread-ui-shell .timeline-question-section,
3353
+ .thread-ui-shell .timeline-live-plan-step,
3354
+ .thread-ui-shell .timeline-detail-row {
3355
+ border-color: var(--theme-border);
3356
+ background: var(--theme-panel);
3357
+ color: var(--theme-fg);
3358
+ }
3359
+ .thread-ui-shell .prose,
3360
+ .thread-ui-shell .prose :where(p, li, strong, code, pre, blockquote) {
3361
+ color: inherit;
3362
+ }
3363
+ .thread-ui-shell .prose img {
3364
+ max-width: min(28rem, 100%);
3365
+ height: auto;
3366
+ border-radius: 10px;
3367
+ border: 1px solid var(--theme-border);
3368
+ box-shadow: 0 12px 35px oklch(0.22 0.024 255 / 0.14);
3369
+ margin-top: 0.75rem;
3370
+ margin-bottom: 0.75rem;
3371
+ }
3372
+ .thread-ui-shell .thread-graph-plan-card {
3373
+ border-color: rgb(42 47 58);
3374
+ background: #1b1f29;
3375
+ color: rgb(241 245 249);
3376
+ box-shadow: none;
3377
+ }
3378
+ .thread-ui-shell .thread-graph-plan-step {
3379
+ border-color: rgb(48 54 66);
3380
+ background: #181b23;
3381
+ color: rgb(241 245 249);
3382
+ }
3383
+ .thread-ui-shell .thread-graph-plan-explanation {
3384
+ color: rgb(148 163 184);
3385
+ }
3386
+ .thread-ui-shell .thread-graph-plan-badge {
3387
+ border-color: transparent;
3388
+ background: rgb(56 189 248 / 0.12);
3389
+ color: rgb(186 230 253);
3390
+ box-shadow: none;
3391
+ text-transform: uppercase;
3392
+ letter-spacing: 0.16em;
3393
+ }
3394
+ .thread-ui-shell .thread-graph-plan-status {
3395
+ height: 1.75rem;
3396
+ min-width: 1.75rem;
3397
+ padding: 0;
3398
+ border-color: transparent;
3399
+ box-shadow: none;
3400
+ }
3401
+ .thread-ui-shell .thread-graph-plan-status.is-completed {
3402
+ background: rgb(52 211 153 / 0.14);
3403
+ color: rgb(167 243 208);
3404
+ }
3405
+ .thread-ui-shell .thread-graph-plan-status.is-running {
3406
+ background: rgb(56 189 248 / 0.14);
3407
+ color: rgb(186 230 253);
3408
+ }
3409
+ .thread-ui-shell .thread-graph-plan-status.is-pending,
3410
+ .thread-ui-shell .thread-graph-plan-status.is-unknown {
3411
+ background: #2b313d;
3412
+ color: rgb(203 213 225);
3413
+ }
3414
+ .thread-ui-shell .thread-graph-plan-status.is-failed {
3415
+ background: rgb(251 113 133 / 0.14);
3416
+ color: rgb(254 205 211);
3417
+ }
3418
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-card {
3419
+ border-color: rgb(226 232 240);
3420
+ background: rgb(248 250 252);
3421
+ color: rgb(15 23 42);
3422
+ }
3423
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-step {
3424
+ border-color: rgb(226 232 240);
3425
+ background: rgb(255 255 255);
3426
+ color: rgb(15 23 42);
3427
+ }
3428
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-explanation {
3429
+ color: rgb(100 116 139);
3430
+ }
3431
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-badge {
3432
+ background: rgb(14 165 233 / 0.1);
3433
+ color: rgb(3 105 161);
3434
+ }
3435
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-status.is-completed {
3436
+ background: rgb(16 185 129 / 0.12);
3437
+ color: rgb(4 120 87);
3438
+ }
3439
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-status.is-running {
3440
+ background: rgb(14 165 233 / 0.12);
3441
+ color: rgb(3 105 161);
3442
+ }
3443
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-status.is-pending,
3444
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-status.is-unknown {
3445
+ background: rgb(226 232 240);
3446
+ color: rgb(71 85 105);
3447
+ }
3448
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-status.is-failed {
3449
+ background: rgb(244 63 94 / 0.12);
3450
+ color: rgb(190 18 60);
3451
+ }
3452
+ .thread-ui-shell .thread-graph-event {
3453
+ background: transparent !important;
3454
+ color: var(--theme-fg) !important;
3455
+ }
3456
+ .thread-ui-shell .thread-graph-event-card {
3457
+ background: var(--theme-surface) !important;
3458
+ color: var(--theme-fg) !important;
3459
+ }
3460
+ .thread-ui-shell .thread-graph-plan-card,
3461
+ .thread-ui-shell .thread-graph-plan-step,
3462
+ .thread-ui-shell .thread-graph-plan-step-text {
3463
+ color: rgb(241 245 249) !important;
3464
+ }
3465
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-card,
3466
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-step,
3467
+ .thread-ui-shell[data-theme-effective=light] .thread-graph-plan-step-text {
3468
+ color: rgb(15 23 42) !important;
3469
+ }
3470
+ `);Wt(`.thread-export-dialog-root {
3471
+ --export-bg: rgb(248 250 252);
3472
+ --export-panel: rgb(255 255 255);
3473
+ --export-surface: rgb(241 245 249);
3474
+ --export-surface-strong: rgb(226 232 240);
3475
+ --export-border: rgb(203 213 225);
3476
+ --export-fg: rgb(15 23 42);
3477
+ --export-fg-soft: rgb(51 65 85);
3478
+ --export-fg-muted: rgb(100 116 139);
3479
+ --export-accent: rgb(217 119 6);
3480
+ --export-accent-bg: rgb(254 243 199);
3481
+ --export-accent-border: rgb(251 191 36);
3482
+ --export-shadow: rgb(15 23 42 / 0.16);
3483
+ color: var(--export-fg);
3484
+ }
3485
+ .thread-export-dialog-root.thread-ui-theme-dark,
3486
+ .thread-export-dialog-root[data-theme-effective=dark] {
3487
+ --export-bg: #12151c;
3488
+ --export-panel: #181d25;
3489
+ --export-surface: #1d222c;
3490
+ --export-surface-strong: #262c38;
3491
+ --export-border: #343b48;
3492
+ --export-fg: rgb(241 245 249);
3493
+ --export-fg-soft: rgb(203 213 225);
3494
+ --export-fg-muted: rgb(148 163 184);
3495
+ --export-accent: rgb(245 158 11);
3496
+ --export-accent-bg: rgb(245 158 11 / 0.16);
3497
+ --export-accent-border: rgb(245 158 11 / 0.34);
3498
+ --export-shadow: rgb(0 0 0 / 0.36);
3499
+ }
3500
+ .thread-export-dialog-backdrop {
3501
+ background: color-mix(in oklch, var(--export-bg) 68%, transparent);
3502
+ }
3503
+ .thread-export-dialog-root.thread-ui-theme-dark .thread-export-dialog-backdrop,
3504
+ .thread-export-dialog-root[data-theme-effective=dark] .thread-export-dialog-backdrop {
3505
+ background: rgb(2 6 23 / 0.74);
3506
+ }
3507
+ .thread-export-dialog-panel {
3508
+ border-color: var(--export-border);
3509
+ background: var(--export-panel);
3510
+ box-shadow: 0 26px 80px var(--export-shadow);
3511
+ }
3512
+ .thread-export-dialog-header,
3513
+ .thread-export-dialog-footer,
3514
+ .thread-export-dialog-box-header {
3515
+ border-color: var(--export-border);
3516
+ }
3517
+ .thread-export-dialog-title,
3518
+ .thread-export-dialog-strong,
3519
+ .thread-export-dialog-body-text {
3520
+ color: var(--export-fg);
3521
+ }
3522
+ .thread-export-dialog-subtitle,
3523
+ .thread-export-dialog-status-pill {
3524
+ color: var(--export-fg-muted);
3525
+ }
3526
+ .thread-export-dialog-icon-button,
3527
+ .thread-export-dialog-secondary-button,
3528
+ .thread-export-dialog-segment,
3529
+ .thread-export-dialog-box,
3530
+ .thread-export-dialog-status-pill {
3531
+ border-color: var(--export-border);
3532
+ background: var(--export-surface);
3533
+ }
3534
+ .thread-export-dialog-segment,
3535
+ .thread-export-dialog-box {
3536
+ background: color-mix(in oklch, var(--export-surface) 72%, var(--export-panel));
3537
+ }
3538
+ .thread-export-dialog-icon-button,
3539
+ .thread-export-dialog-secondary-button {
3540
+ color: var(--export-fg-soft);
3541
+ }
3542
+ .thread-export-dialog-icon-button:hover:not(:disabled),
3543
+ .thread-export-dialog-secondary-button:hover:not(:disabled),
3544
+ .thread-export-dialog-turn-row:hover {
3545
+ background: var(--export-surface-strong);
3546
+ color: var(--export-fg);
3547
+ }
3548
+ .thread-export-dialog-muted-action {
3549
+ color: var(--export-fg-muted);
3550
+ }
3551
+ .thread-export-dialog-muted-action:hover {
3552
+ color: var(--export-fg);
3553
+ }
3554
+ .thread-export-dialog-root .ui-status-warning {
3555
+ border: 1px solid var(--export-accent-border);
3556
+ background: var(--export-accent-bg);
3557
+ color: color-mix(in oklch, var(--export-accent) 72%, var(--export-fg));
3558
+ }
3559
+ .thread-export-dialog-checkbox {
3560
+ accent-color: var(--export-accent);
3561
+ }
3562
+ .thread-export-dialog-turn-row {
3563
+ color: var(--export-fg-soft);
3564
+ }
3565
+ `);function om(e){return e.replace(/\u00a0/g," ")}function lm(e,r){if(!e)return[];const n=[],a=[...r].sort((l,d)=>d.placeholder.length-l.placeholder.length);let o=0,s=0;for(;o<e.length;){const l=a.find(h=>e.startsWith(h.placeholder,o));if(l){n.push({type:"attachment",key:`${l.clientId}-${o}`,attachment:l}),o+=l.placeholder.length;continue}let d=e.length;for(const h of a){const u=e.indexOf(h.placeholder,o);u!==-1&&u<d&&(d=u)}const i=e.slice(o,d);i&&(n.push({type:"text",key:`text-${s}`,text:i}),s+=1),o=d}return n}function im(e,r,n){const a=e==="photo"?"PHOTO":"FILE";let o=0;for(;;){const s=o===0?r:`${r} (${o+1})`,l=`[${a} ${s}]`;if(!n.has(l))return l;o+=1}}function dm(e,r,n){const a=r.start>0?e[r.start-1]:"",o=r.end<e.length?e[r.end]:"",s=!!(a&&!/\s/.test(a)),l=!o||!/\s/.test(o);return`${s?" ":""}${n.join(" ")}${l?" ":""}`}function cm({files:e,kindForFile:r,usedPlaceholders:n,buildClientId:a}){return e.map(o=>{const s=r(o),l=jm(o,s),d=im(s,Nm(l),n);return n.add(d),{clientId:a(),kind:s,originalName:l,placeholder:d,file:o}})}function hm({prompt:e,attachments:r,files:n,selection:a,kindForFile:o,buildClientId:s}){const l=new Set(r.map(f=>f.placeholder)),d=cm({files:n,kindForFile:o,usedPlaceholders:l,buildClientId:s}),i=a?{start:a.start,end:a.end}:{start:e.length,end:e.length},h=dm(e,i,d.map(f=>f.placeholder)),u=`${e.slice(0,i.start)}${h}${e.slice(i.end)}`,p=h.endsWith(" ")?1:0,m=i.start+h.length-p;return{draft:{prompt:u,attachments:[...r,...d]},selection:{start:m,end:m},insertedAttachmentIds:d.map(f=>f.clientId)}}function um({prompt:e,attachments:r,isShellView:n}){if(n)return{prompt:e};const a=e.trim();if(!a)return null;const o=r.filter(s=>a.includes(s.placeholder));return o.length>0?{prompt:a,attachments:o}:{prompt:a}}function mm({files:e,plainText:r,htmlText:n,htmlToText:a}){if(e.length>0)return{type:"append-files",preventDefault:!0,files:e};const o=r||a(n);return!o&&!n?{type:"ignore",preventDefault:!1}:{type:"insert-text",preventDefault:!0,text:o}}function Ya(e){return e?{type:"accept-files",preventDefault:!0,activateDragTarget:!0}:{type:"ignore",preventDefault:!1,activateDragTarget:!1}}function pm(e){return e.length>0?{type:"accept-files",preventDefault:!0,activateDragTarget:!0,files:e}:{type:"ignore",preventDefault:!1,activateDragTarget:!1}}function fm({key:e,metaKey:r,ctrlKey:n,busy:a,disabled:o}){const s=e==="Enter"&&(r||n);return{preventDefault:s,submit:s&&!a&&!o}}function gm({nextMode:e,previousOptimisticMode:r}){return{optimisticMode:e??null,rollbackMode:e?r:null,shouldRollbackMode:!!e,closeMenuOnSuccess:!0}}function br(e){return`${e.prompt}${e.attachments.map(r=>`${r.clientId}${r.kind}${r.placeholder}${r.originalName}`).join("")}`}function Za(e){if(!e)return"Auto";switch(e){case"xhigh":return"xhigh";default:return e}}function xm(e){const r=e.trim();if(!r)return null;const n=Number(r);return!Number.isFinite(n)||n<=0?Number.NaN:Math.round(n*1e3)}function bm(e){if(!e)return"";const r=e/1e3;return Number.isInteger(r)?String(r):String(Number(r.toFixed(1)))}function In(e){return e.replace(/\r\n/g,`
3566
+ `)}function vm(e){const r=e.trim();return/^[A-Za-z0-9_-]+$/.test(r)?r:null}function km(e){const n=In(e).split(`
3567
+ `).map(o=>o.trim()).filter(Boolean).find(o=>/^\[mcp_servers\.[^\]]+\]$/.test(o));if(!n)return null;const a=n.match(/^\[mcp_servers\.([A-Za-z0-9_-]+)\]$/);return(a==null?void 0:a[1])??null}function wm(e,r){return`[mcp_servers.${e}]
3568
+ url = ${JSON.stringify(r.trim())}
3569
+ `}function Ja(e,r,n){var p,m;const a=In(e),o=`${In(n).trim()}
3570
+ `,s=a.split(`
3571
+ `),l=`[mcp_servers.${r}]`,d=`[mcp_servers.${r}.`;let i=-1,h=s.length;for(let f=0;f<s.length;f+=1)if((((p=s[f])==null?void 0:p.trim())??"")===l){i=f;break}if(i>=0){for(let x=i+1;x<s.length;x+=1){const k=((m=s[x])==null?void 0:m.trim())??"";if(k.startsWith("[")&&!(k===l||k.startsWith(d))){h=x;break}}const f=s.slice(0,i).join(`
3572
+ `).trimEnd(),g=s.slice(h).join(`
3573
+ `).trim();return[f,o.trimEnd(),g].filter(Boolean).join(`
3574
+
3575
+ `).replace(/\n{3,}/g,`
3576
+
3577
+ `).concat(`
3578
+ `)}const u=a.trimEnd();return u?`${u}
3579
+
3580
+ ${o}`:o}function ol(e){return typeof e!="number"||Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))}function un(e){const r=e/1e3;return Number.isInteger(r)?`${r}k`:`${Number(r.toFixed(1))}k`}function ym(e,r){if(!e)return"Select model";if((r==null?void 0:r.availability)!=="available"||typeof r.tokensInContextWindow!="number"||typeof r.modelContextWindow!="number")return`${e} · context unavailable`;const n=Math.max(r.tokensInContextWindow,0),a=Math.max(r.modelContextWindow,0),o=Math.max(a-n,0);return[e,`${un(n)} used / ${un(a)}`,`${un(o)} left`,`${ol(r.remainingPercent)}% context left`].join(" · ")}function jm(e,r){const n=e.name.trim();if(n)return n;const a=r==="photo"?e.type.includes("png")?".png":e.type.includes("heic")?".heic":e.type.includes("heif")?".heif":e.type.includes("webp")?".webp":".jpg":"";return`${r==="photo"?"photo":"file"}-${Date.now()}${a}`}function Nm(e){return e.replace(/[\r\n[\]]+/g," ").replace(/\s+/g," ").trim()||"attachment"}function Rn(e){return e.type.startsWith("image/")?"photo":"file"}function An(e,r){const n=[];if(e)for(const a of Array.from(e)){if(a.kind!=="file")continue;const o=a.getAsFile();o&&n.push(o)}return n.length>0?n:r?Array.from(r):[]}function Qa(e,r){return An(e,r).length>0}function Cm(e){const r=e.replace(/[\\/]+$/,"").trim();return r?r.split(/[\\/]/).filter(Boolean).at(-1)??r:""}function es(e){const r=e.placeholder.match(/^\[(?:PHOTO|FILE)\s+(.+)\]$/);return r!=null&&r[1]?r[1]:Cm(e.originalName)}var Rr=[{value:"preToolUse",label:"PreToolUse",matcherHint:"Bash"},{value:"permissionRequest",label:"PermissionRequest",matcherHint:"Bash"},{value:"postToolUse",label:"PostToolUse",matcherHint:"Bash"},{value:"sessionStart",label:"SessionStart",matcherHint:"startup|resume"},{value:"userPromptSubmit",label:"UserPromptSubmit",matcherHint:""},{value:"stop",label:"Stop",matcherHint:""},{value:"preCompact",label:"PreCompact",matcherHint:""},{value:"postCompact",label:"PostCompact",matcherHint:""}];function Sm({goalComposeMode:e,goalBusy:r,threadConnected:n,busy:a,isShellView:o,disabledPlaceholder:s,settingsBusy:l,supportedEffortCount:d,fastMode:i}){const h=e?"Describe the goal the backend should continue working toward...":s??(o?"Send shell input to the attached terminal...":"Ask the backend to inspect, modify, or explain code..."),u=e?r?"Setting...":"Set goal":!n&&a?"Connecting...":n&&a&&!o?"Sending...":"Send",p=n?e?"ui-action-info":"ui-action-primary":"ui-action-danger",m=l;return{promptPlaceholder:h,interruptLabel:o?"Send Ctrl-C":"Stop Current Turn",sendButtonLabel:u,sendButtonClassName:p,modelControlsDisabled:m,effortControlsDisabled:m||d===0,effortControlTitle:i?"Fast mode is on. Turn it off from the slash toolbox to edit reasoning.":d===0?"The selected model does not expose adjustable reasoning effort.":"Select reasoning effort"}}function Tm({isShellView:e,edgeToEdgeMobile:r,isMobileShell:n,openMenu:a,isDragTargetActive:o,busy:s}){const l=e?"thread-composer-layer thread-shell-composer-layer":"thread-graph-composer-layer",d=e?"thread-composer-form":"thread-graph-composer-form",i=e?"thread-composer-form-floating":"thread-graph-composer-form-floating",h=e?"thread-composer-input":"thread-graph-composer-input";return{composerLayerClassName:a?`${l} relative z-[80] shrink-0`:`${l} relative z-20 shrink-0`,formClassName:e?r||n?`${d} ${i} relative z-20 shrink-0 border-t border-[var(--theme-border)] bg-[var(--theme-surface)] px-3 py-2 pb-[calc(env(safe-area-inset-bottom)+0.5rem)] sm:px-4 sm:py-3`:`${d} relative z-20 shrink-0 border-t border-[var(--theme-border)] bg-[var(--theme-surface)] px-3 py-2 pb-[calc(env(safe-area-inset-bottom)+0.5rem)] sm:px-4 sm:py-3`:`${d} ${r?i:""} relative z-20 shrink-0 border-t px-3 py-2 pb-[calc(env(safe-area-inset-bottom)+0.5rem)] sm:px-4 sm:py-3`,composerShellClassName:e?"thread-composer-shell":"thread-graph-composer-shell",composerToolbarClassName:e?"thread-composer-toolbar":"thread-graph-composer-toolbar",composerInputClassName:h,composerIconButtonClassName:e?"thread-composer-icon-button":"thread-graph-composer-icon-button",composerMenuClassName:e?"thread-composer-menu":"thread-graph-composer-menu",composerMenuItemClassName:e?"thread-composer-menu-item":"thread-graph-composer-menu-item",composerInlineToggleClassName:e?"thread-composer-inline-toggle":"thread-graph-composer-inline-toggle",composerPanelButtonClassName:e?"thread-composer-panel-button":"thread-graph-composer-panel-button",composerChipButtonClassName:e?"thread-composer-chip-button":"thread-graph-composer-chip-button",composerPlanToggleActiveClassName:e?"thread-composer-plan-toggle-active":"thread-graph-composer-plan-toggle-active",composerSendButtonClassName:e?"thread-composer-send-button":"thread-graph-composer-send-button",composerPromptRegionClassName:e?"thread-composer-prompt-region":"thread-graph-composer-prompt-region",promptInputClassName:`${h} min-h-[5.25rem] w-full px-4 pr-14 pt-3 outline-none transition sm:min-h-[5.75rem] ${o?"is-drag-target border-sky-300/80 bg-sky-300/[0.08] shadow-[0_0_0_1px_rgba(125,211,252,0.2)]":""}`,graphChatInputGroupClassName:`thread-graph-composer-input-group relative border-0 bg-transparent shadow-none ring-0 ${s?"bg-amber-50/40 dark:bg-amber-400/10":"bg-transparent"}`,graphChatInputClassName:`${h} min-h-[68px] max-h-32 w-full overflow-y-auto px-3 pt-3 text-[16px] leading-relaxed text-slate-800 outline-none transition sm:min-h-[92px] sm:max-h-40 sm:px-4 sm:pt-4 sm:text-[14px] dark:text-slate-100 ${o?"is-drag-target bg-sky-300/[0.08] shadow-[0_0_0_1px_rgba(125,211,252,0.2)]":""}`}}function Em(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"m4 5 2 2-2 2"}),t.jsx("path",{d:"M7.75 9.5h4.25"})]})}function Lm(){return t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.5",strokeLinecap:"round",children:t.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5"})})}function Pm(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M10.75 2.5 5.25 13.5"}),t.jsx("path",{d:"M4.25 5.25h2.25"}),t.jsx("path",{d:"M9.5 10.75h2.25"})]})}function zm(){return t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M3 4.5A1.75 1.75 0 0 1 4.75 2.75h6.5A1.75 1.75 0 0 1 13 4.5v4A1.75 1.75 0 0 1 11.25 10.25H8l-2.75 2v-2H4.75A1.75 1.75 0 0 1 3 8.5v-4Z"})})}function Im(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",className:"h-3.5 w-3.5 fill-current",children:[t.jsx("path",{fillRule:"evenodd",d:"M14.5 10C16.9853 10 19 7.98528 19 5.5C19 5.01783 18.9242 4.55338 18.7838 4.11791C18.6792 3.79367 18.2734 3.72683 18.0325 3.96772L15.3402 6.66002C15.2098 6.79041 15.0168 6.84163 14.8466 6.77074C14.1172 6.46695 13.5334 5.88351 13.2292 5.15431C13.1582 4.98403 13.2094 4.79088 13.3398 4.66042L16.0327 1.9676C16.2735 1.72672 16.2067 1.32092 15.8825 1.21636C15.4469 1.07588 14.9823 1 14.5 1C12.0147 1 10 3.01472 10 5.5C10 5.59783 10.0031 5.69494 10.0093 5.79122C10.065 6.66418 9.88174 7.59855 9.20974 8.15855L1.98017 14.1832C1.3591 14.7008 1 15.4674 1 16.2759C1 17.7804 2.21962 19 3.7241 19C4.53256 19 5.29925 18.6409 5.81681 18.0198L11.8414 10.7903C12.4014 10.1183 13.3358 9.93497 14.2088 9.99073C14.3051 9.99688 14.4022 10 14.5 10ZM5 16C5 16.5523 4.55228 17 4 17C3.44772 17 3 16.5523 3 16C3 15.4477 3.44772 15 4 15C4.55228 15 5 15.4477 5 16Z",clipRule:"evenodd"}),t.jsx("path",{d:"M14.5 11.5C14.6731 11.5 14.8445 11.4927 15.0138 11.4783L18.7678 15.2323C19.7441 16.2086 19.7441 17.7915 18.7678 18.7678C17.7915 19.7441 16.2086 19.7441 15.2323 18.7678L10.8216 14.3571L12.9938 11.7505C13.0455 11.6885 13.1413 11.6131 13.3357 11.5552C13.5378 11.4951 13.805 11.468 14.1132 11.4877C14.2413 11.4959 14.3702 11.5 14.5 11.5Z"}),t.jsx("path",{d:"M6.00003 4.58582L8.33056 6.91635C8.3027 6.95627 8.27496 6.98497 8.24946 7.00622L6.79994 8.21415L4.58582 6.00003H3.30905C3.11966 6.00003 2.94653 5.89303 2.86184 5.72364L1.1612 2.32237C1.06495 2.12987 1.10268 1.89739 1.25486 1.74521L1.74521 1.25486C1.89739 1.10268 2.12987 1.06495 2.32237 1.1612L5.72364 2.86184C5.89303 2.94653 6.00003 3.11966 6.00003 3.30905V4.58582Z"})]})}function Mn(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M5.5 3.25h5"}),t.jsx("path",{d:"M6.4 2h3.2a.9.9 0 0 1 .9.9v.35h1.3a1.2 1.2 0 0 1 1.2 1.2v7.35a1.2 1.2 0 0 1-1.2 1.2H4.2A1.2 1.2 0 0 1 3 11.8V4.45a1.2 1.2 0 0 1 1.2-1.2h1.3V2.9a.9.9 0 0 1 .9-.9Z"})]})}function Rm(e){switch(e){case"bearerToken":return"Token";case"oAuth":return"OAuth";case"notLoggedIn":return"Login";case"unsupported":return"Public";default:return"Unknown"}}function Am(e){switch(e){case"repo":return"Repo";case"system":return"System";case"admin":return"Admin";case"user":default:return"User"}}function Mm(e){var r;return((r=Rr.find(n=>n.value===e))==null?void 0:r.label)??e}function _m(e){var r;switch(e){case"cloudRequirements":return"Cloud";case"legacyManagedConfigFile":case"legacyManagedConfigMdm":return"Managed";case"sessionFlags":return"Session";default:return((r=e[0])==null?void 0:r.toUpperCase())+e.slice(1)}}function $m(e){switch(e){case"managed":return"Managed";case"modified":return"Modified";case"trusted":return"Trusted";case"untrusted":return"Review"}}function Dm(e){switch(e){case"preToolUse":return"PreToolUse";case"permissionRequest":return"PermissionRequest";case"postToolUse":return"PostToolUse";case"preCompact":return"PreCompact";case"postCompact":return"PostCompact";case"sessionStart":return"SessionStart";case"userPromptSubmit":return"UserPromptSubmit";case"stop":return"Stop"}}function Bm(e){return e.source==="user"?"global":e.source==="project"?"project":null}function ll(e){const r=Bm(e);return!r||e.handlerType!=="command"||!e.command||e.isManaged?null:{scope:r,eventName:e.eventName,matcher:e.matcher,command:e.command,timeoutSec:e.timeoutSec,statusMessage:e.statusMessage}}function Gm(e){switch(e){case"active":return"Active";case"paused":return"Paused";case"budgetLimited":return"Budget";case"complete":return"Complete";default:return e}}function Fm({contextUsage:e}){const r=(e==null?void 0:e.availability)??"unavailable",n=ol(e==null?void 0:e.remainingPercent);if(r!=="available")return null;const a=n<=20?"rgba(251,113,133,0.90)":n<=40?"rgba(252,211,77,0.85)":"rgba(125,211,252,0.80)";return t.jsx("span",{"aria-hidden":"true",className:"thread-context-progress-track pointer-events-none mt-0.5 block",children:t.jsx("span",{className:"thread-context-progress-fill block",style:{width:`${n}%`,backgroundColor:a}})})}function St({label:e,tone:r="stone"}){const n=r==="rose"?"border-rose-300/35 bg-rose-300/14 text-rose-50":r==="sky"?"border-sky-300/35 bg-sky-300/14 text-sky-50":"border-stone-700/90 bg-stone-900/80 text-stone-100";return t.jsx("span",{className:`inline-flex min-w-[3rem] items-center justify-center rounded-full border px-2 py-1.5 text-[10px] font-medium tracking-[0.12em] ${n}`,children:e})}function Hm(e,{fastMode:r,goalComposeMode:n}){switch(e.action){case"fast":return{type:"toggleFast",fastMode:!r};case"compact":return{type:"runCompact"};case"goal":return n?{type:"exitGoalCompose"}:{type:"enterGoalCompose"};case"fork":case"skills":case"mcp":case"hooks":return{type:"openPanel",panel:e.action};default:return{type:"noop"}}}function Om(e,{fastMode:r,compactBusy:n,goalComposeMode:a,goalStatus:o,busy:s}){switch(e.action){case"fast":return r?"On":"Off";case"compact":return n?"Busy":"Run";case"goal":return a?"Composing":o?Gm(o):"Open";case"fork":return s?"Idle only":"Open";case"skills":case"mcp":case"hooks":return"View";default:return""}}function Um(e,{settingsBusy:r,compactBusy:n,busy:a,forkBusy:o}){switch(e.action){case"fast":return r;case"compact":return n||a;case"fork":return a||o;default:return!1}}function Wm(e,{fastMode:r,goalComposeMode:n,goalStatus:a,menuItemClassName:o}){return`${e.action==="fast"&&r||e.action==="goal"&&(n||a==="active")?"ui-status-warning":o} mt-1 block w-full rounded-xl px-3 py-2 text-left text-sm transition disabled:cursor-not-allowed disabled:opacity-60`}function Vm(e){if(!e)return"";const r=document.createElement("div");return r.innerHTML=e,r.textContent??""}function qm(e){return!!e.querySelector("[style], font")}function Et(e){return e instanceof HTMLElement&&e.dataset.segmentType==="attachment"&&e.dataset.placeholder?e.dataset.placeholder:e.textContent??""}function il(e){let r="";for(const n of Array.from(e.childNodes))r+=Et(n);return r.replace(/\u00a0/g," ")}function ts(e,r,n){var d;let a=null,o=n;if(r===e){const i=Array.from(e.childNodes);let h=0;for(let u=0;u<Math.min(n,i.length);u+=1){const p=i[u];p&&(h+=Et(p).length)}return h}if(r.nodeType===Node.TEXT_NODE)a=r;else{const i=Array.from(e.childNodes).find(h=>h.contains(r));if(!i)return il(e).length;if(a=i,i instanceof HTMLElement&&i.dataset.segmentType==="attachment"){const h=document.createRange();h.selectNodeContents(i);const u=Et(i).length;try{h.setEnd(r,n);const p=h.toString().length,m=((d=i.textContent)==null?void 0:d.length)??0;m===0?o=u:o=Math.round(Math.min(1,p/m)*u)}catch{o=u}}else{const h=document.createRange();h.selectNodeContents(i);try{h.setEnd(r,n),o=h.toString().length}catch{o=Et(i).length}}}const s=Array.from(e.childNodes);let l=0;for(const i of s){if(i===a)return i.nodeType===Node.TEXT_NODE?l+o:l+Math.min(o,Et(i).length);l+=Et(i).length}return l}function Km(e){const r=window.getSelection();if(!r||r.rangeCount===0)return null;const n=r.getRangeAt(0);return!e.contains(n.startContainer)||!e.contains(n.endContainer)?null:{start:ts(e,n.startContainer,n.startOffset),end:ts(e,n.endContainer,n.endOffset)}}function rs(e,r){let n=Math.max(0,r);const a=Array.from(e.childNodes);for(const[o,s]of a.entries()){const d=Et(s).length;if(s.nodeType===Node.TEXT_NODE){if(n<=d)return{node:s,offset:n};n-=d;continue}if(s instanceof HTMLElement&&s.dataset.segmentType==="attachment"){if(n===0)return{node:e,offset:o};if(n<=d){const i=a[o+1];return n===d&&(i==null?void 0:i.nodeType)===Node.TEXT_NODE?{node:i,offset:0}:{node:e,offset:o+1}}n-=d;continue}if(n<=d)return{node:e,offset:o+1};n-=d}return{node:e,offset:e.childNodes.length}}function Xm(e,r){const n=rs(e,r.start),a=rs(e,r.end),o=document.createRange();o.setStart(n.node,n.offset),o.setEnd(a.node,a.offset);const s=window.getSelection();s==null||s.removeAllRanges(),s==null||s.addRange(o)}function Ym(e,r){if(r.length===0)return!1;const n=r.at(-1);if(!n)return!1;const a=Array.from(e.childNodes).find(d=>d instanceof HTMLElement&&d.dataset.segmentType==="attachment"&&d.dataset.clientId===n);if(!(a instanceof HTMLElement))return!1;const o=document.createRange(),s=a.nextSibling;(s==null?void 0:s.nodeType)===Node.TEXT_NODE?o.setStart(s,0):o.setStartAfter(a),o.collapse(!0);const l=window.getSelection();return l==null||l.removeAllRanges(),l==null||l.addRange(o),!0}Ur();wt();function Zm({className:e,...r}){return t.jsx("div",{"data-slot":"input-group",role:"group",className:Ye("group/input-group relative flex w-full min-w-0 items-center rounded-md border shadow-xs outline-none transition-[color,box-shadow]","h-9 has-[>textarea]:h-auto","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col",e),...r})}var Jm=ir("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*=size-])]:size-4",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem]","block-start":"order-first w-full justify-start px-3 pt-3","block-end":"order-last w-full justify-start px-3 pb-3"}},defaultVariants:{align:"inline-start"}});function Qm({className:e,align:r="inline-start",...n}){return t.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":r,className:Ye(Jm({align:r}),e),onClick:a=>{var s;if(a.target.closest("button"))return;const o=(s=a.currentTarget.parentElement)==null?void 0:s.querySelector('[data-slot="input-group-control"] [contenteditable="true"], [data-slot="input-group-control"] textarea, [data-slot="input-group-control"] input, [data-slot="input-group-control"]');o==null||o.focus()},...n})}var ep=ir("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*=size-])]:size-3.5",sm:"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function vt({className:e,type:r="button",variant:n="ghost",size:a="xs",...o}){return t.jsx(sr,{type:r,"data-size":a,variant:n,className:Ye(ep({size:a}),e),...o})}function tp({className:e,...r}){return t.jsx("span",{className:Ye("flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4",e),...r})}function rp({photoInputRef:e,fileInputRef:r,onAppendAttachments:n}){function a(o,s){n(o.target.files,s),o.target.value=""}return t.jsxs(t.Fragment,{children:[t.jsx("input",{ref:e,type:"file",accept:"image/*",multiple:!0,tabIndex:-1,className:"sr-only",onChange:o=>a(o,"photo")}),t.jsx("input",{ref:r,type:"file",multiple:!0,tabIndex:-1,className:"sr-only",onChange:o=>a(o,"file")})]})}function np({activeView:e,followTail:r,onToggleFollow:n}){return e!=="chat"?null:t.jsx("button",{type:"button","aria-label":"Jump to latest",title:r?"Latest turn is in view":"Jump to the latest messages",onClick:()=>n==null?void 0:n(),className:"absolute left-1/2 top-3 z-40 inline-flex h-9 min-w-[5.75rem] -translate-x-1/2 -translate-y-[62%] items-start justify-center bg-transparent pt-1 touch-manipulation sm:top-4",children:t.jsx("span",{className:`thread-jump-latest-badge pointer-events-none inline-flex h-4 min-w-[3.75rem] items-center justify-center rounded-[0.7rem] border shadow-sm transition ${r?"is-active border-sky-300/36 bg-sky-300/[0.03] text-sky-100/86":"border-stone-500/70 bg-stone-950/[0.08] text-stone-200/86"}`,children:t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"m4 6 4 4 4-4"})})})})}function ap({activeView:e,layerClassName:r,formClassName:n,shellClassName:a,inputGroupClassName:o,error:s,followTail:l,photoInputRef:d,fileInputRef:i,onAppendAttachments:h,onToggleFollow:u,onSubmit:p,formRef:m,promptSlot:f,toolbarSlot:g,goalSlot:x,shellPromptSlot:k}){return t.jsxs("div",{className:r,children:[t.jsx(rp,{photoInputRef:d,fileInputRef:i,onAppendAttachments:h}),t.jsx(np,{activeView:e,followTail:l,onToggleFollow:u}),t.jsxs("form",{ref:m,"data-testid":e==="chat"?"chat-composer":void 0,onSubmit:p,className:n,children:[t.jsxs("div",{className:`${a} flex w-full flex-col overflow-hidden rounded-[16px] sm:rounded-[18px]`,children:[t.jsxs(Zm,{className:o,children:[f,g]}),x,k]}),s?t.jsx("div",{className:"mt-2 rounded-2xl border border-rose-500/40 bg-rose-500/10 px-4 py-3 text-sm text-rose-200",children:s}):null]})]})}function sp({open:e,iconButtonClassName:r,menuClassName:n,menuItemClassName:a,onToggle:o,onPickPhoto:s,onPickFile:l}){return t.jsxs("div",{className:"relative",children:[t.jsx(vt,{type:"button",variant:"ghost",size:"icon-xs","data-composer-menu-trigger":"true","aria-label":"Add attachment",title:"Add attachment",onClick:o,className:`${r} h-9 w-9 rounded-full sm:h-8 sm:w-8`,children:t.jsx(Lm,{})}),e&&t.jsx("div",{"data-composer-menu-surface":"true",className:`${n} absolute bottom-full left-0 mb-2 w-32 overflow-hidden rounded-2xl border bg-stone-900/72 shadow-2xl shadow-stone-950/20`,children:t.jsxs("div",{className:"p-2",children:[t.jsx("button",{type:"button",onClick:s,className:`${a} block w-full rounded-xl px-3 py-2 text-left text-sm transition`,children:"Photo"}),t.jsx("button",{type:"button",onClick:l,className:`${a} mt-1 block w-full rounded-xl px-3 py-2 text-left text-sm transition`,children:"File"})]})})]})}function op({openMenu:e,model:r,modelOptions:n,modelContextTitle:a,contextUsage:o,reasoningEffort:s,supportedEfforts:l,displayedCollaborationMode:d,planModeAvailable:i,settingsBusy:h,goalComposeMode:u,goalBusy:p,activeView:m,disabled:f,fastMode:g,sendButtonLabel:x,sendButtonClassName:k,modelControlsDisabled:b,effortControlsDisabled:y,effortControlTitle:w,inlineToggleClassName:v,menuItemClassName:N,planToggleActiveClassName:j,sendButtonBaseClassName:S,onSetOpenMenu:P,onUpdateSettings:C}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative min-w-0",children:[t.jsx(vt,{type:"button",variant:"ghost",size:"xs","data-composer-menu-trigger":"true","aria-haspopup":"menu","aria-expanded":e==="model","aria-label":r??"Select model",disabled:b||n.length===0,onClick:()=>P(M=>M==="model"?null:"model"),title:g?`Fast mode is on. Turn it off from the slash toolbox to edit model. ${a}`:a,className:`${v} relative min-w-0 max-w-[8.75rem] overflow-hidden rounded-full px-2.5 text-left text-stone-300 disabled:cursor-not-allowed disabled:text-stone-600 sm:max-w-[11rem]`,children:t.jsx("span",{className:"relative z-[1] block min-w-0 truncate whitespace-nowrap [direction:rtl]",children:r??"Select model"})}),r?t.jsx(Fm,{contextUsage:o}):null,e==="model"&&t.jsx("div",{"data-composer-menu-surface":"true",className:"absolute bottom-full left-0 mb-2 w-max min-w-[9rem] max-w-[14rem] overflow-hidden rounded-2xl border border-stone-700 bg-stone-900 shadow-2xl shadow-stone-950/40",children:t.jsx("div",{className:"max-h-72 overflow-auto p-2",children:n.map(M=>t.jsx("button",{type:"button",onClick:()=>C({model:M.model,reasoningEffort:M.defaultReasoningEffort}),className:`block w-full rounded-xl px-3 py-2 text-left transition ${M.model===r?"ui-status-warning":`${N} text-stone-300`}`,children:t.jsx("p",{className:"text-sm font-medium",children:M.model})},M.id))})})]}),t.jsxs("div",{className:"relative",children:[t.jsx(vt,{type:"button",variant:"ghost",size:"xs","data-composer-menu-trigger":"true","aria-haspopup":"menu","aria-expanded":e==="effort",disabled:y,onClick:()=>P(M=>M==="effort"?null:"effort"),title:w,className:`${v} rounded-full px-2 disabled:cursor-not-allowed disabled:text-stone-700 ${y?"text-stone-500":"text-stone-300 hover:text-stone-100"}`,children:Za(s)}),e==="effort"&&t.jsx("div",{"data-composer-menu-surface":"true",className:"absolute bottom-full left-0 mb-2 w-max min-w-[8rem] max-w-[12rem] overflow-hidden rounded-2xl border border-stone-700 bg-stone-900 shadow-2xl shadow-stone-950/40",children:t.jsx("div",{className:"max-h-72 overflow-auto p-2",children:l.map(M=>t.jsx("button",{type:"button",onClick:()=>C({reasoningEffort:M.reasoningEffort}),className:`block w-full rounded-xl px-3 py-2 text-left transition ${M.reasoningEffort===s?"ui-status-warning":`${N} text-stone-300`}`,children:t.jsx("p",{className:"text-sm font-medium",children:Za(M.reasoningEffort)})},M.reasoningEffort))})})]}),i&&t.jsx(vt,{type:"button",variant:"ghost",size:"xs","aria-pressed":d==="plan",disabled:h,onClick:()=>C({collaborationMode:d==="plan"?"default":"plan"}),className:`${v} rounded-full px-2.5 ${d==="plan"?j:"text-stone-500"} disabled:cursor-not-allowed disabled:opacity-60`,children:"Plan"}),t.jsx(vt,{type:"submit",variant:"default",size:"icon-xs","aria-label":u?"Set goal":"Send Prompt",title:x,disabled:p||(m==="chat"?f:!1),className:`${S} h-9 w-9 rounded-full text-sm font-medium disabled:cursor-not-allowed sm:h-8 sm:w-8 ${k}`,children:t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-4 w-4 fill-none stroke-current",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M8 13V3"}),t.jsx("path",{d:"m4 7 4-4 4 4"})]})})]})}function lp({busy:e,shellControlState:r,onPaste:n,onCopy:a,onClear:o,onShellControl:s}){const l=!!(r!=null&&r.shellInputEnabled),d=!!(r!=null&&r.isCommandRunning);return t.jsx("div",{"data-composer-menu-surface":"true",className:"absolute right-0 top-full z-40 mt-2 w-[11.5rem] max-w-[calc(100vw-1.5rem)] rounded-[1rem] border border-stone-700/90 bg-stone-950/96 p-2 shadow-2xl shadow-stone-950/40 sm:w-48",onMouseDown:i=>{i.stopPropagation()},onPointerDown:i=>{i.stopPropagation()},onTouchStart:i=>{i.stopPropagation()},children:t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx("button",{type:"button",onClick:n,className:"inline-flex items-center justify-center rounded-full border border-sky-300/35 bg-sky-300/12 px-2 py-2 text-sky-50",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(Mn,{}),t.jsx("span",{className:"text-[10px] font-medium tracking-[0.12em]",children:"Paste"})]})}),t.jsx("button",{type:"button",onClick:a,className:"inline-flex items-center justify-center rounded-full border border-stone-700/90 bg-stone-900/80 px-2 py-2 text-stone-100",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(Mn,{}),t.jsx("span",{className:"text-[10px] font-medium tracking-[0.12em]",children:"Copy"})]})}),t.jsx("button",{type:"button",disabled:e,onClick:o,className:"disabled:cursor-not-allowed disabled:opacity-45",children:t.jsx(St,{label:"CLEAR",tone:"sky"})}),t.jsx("button",{type:"button",disabled:!l||!d,onClick:()=>s("ctrl_c"),className:"disabled:cursor-not-allowed disabled:opacity-45",children:t.jsx(St,{label:"CTRL-C",tone:"rose"})}),t.jsx("button",{type:"button",disabled:!l,onClick:()=>s("ctrl_d"),className:"disabled:cursor-not-allowed disabled:opacity-45",children:t.jsx(St,{label:"CTRL-D"})}),t.jsx("button",{type:"button",disabled:!l,onClick:()=>s("esc"),className:"disabled:cursor-not-allowed disabled:opacity-45",children:t.jsx(St,{label:"ESC"})}),t.jsx("button",{type:"button",disabled:!l,onClick:()=>s("tab"),className:"disabled:cursor-not-allowed disabled:opacity-45",children:t.jsx(St,{label:"TAB"})}),t.jsx("button",{type:"button",disabled:!l,onClick:()=>s("up"),className:"disabled:cursor-not-allowed disabled:opacity-45",children:t.jsx(St,{label:"UP"})}),t.jsx("button",{type:"button",disabled:!l,onClick:()=>s("down"),className:"disabled:cursor-not-allowed disabled:opacity-45",children:t.jsx(St,{label:"DOWN"})})]})})}function ip({busy:e,forkBusy:r,composerMenuItemClassName:n,onForkLatest:a,onSelectForkTurnPanel:o}){return t.jsxs("div",{className:"p-2",children:[t.jsx("button",{type:"button",disabled:e||r,onClick:()=>void a(),className:`${n} block w-full rounded-xl px-3 py-2 text-left text-sm transition disabled:cursor-not-allowed disabled:opacity-60`,children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:"Fork from latest"}),t.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-stone-400",children:r?"Forking":"Run"})]})}),t.jsx("button",{type:"button",disabled:e||r,onClick:s=>{s.stopPropagation(),o()},className:`${n} mt-1 block w-full rounded-xl px-3 py-2 text-left text-sm transition disabled:cursor-not-allowed disabled:opacity-60`,children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:"Fork from selected turn"}),t.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-stone-400",children:"Pick"})]})}),e?t.jsx("p",{className:"mt-2 rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-sm text-stone-400",children:"Fork is only available while the thread is idle."}):null]})}function dp({forkTurnOptionsState:e,forkBusy:r,composerPanelButtonClassName:n,onForkTurn:a}){var o,s;return t.jsxs("div",{className:"p-2",children:[e.status==="loading"&&!e.data?t.jsx("p",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-sm text-stone-400",children:"Loading turns..."}):null,e.error?t.jsx("p",{className:"mb-2 rounded-xl border border-rose-500/35 bg-rose-500/10 px-3 py-3 text-sm text-rose-100/90",children:e.error}):null,(o=e.data)!=null&&o.length?t.jsx("div",{className:"space-y-2",children:e.data.map(l=>t.jsx("button",{type:"button",disabled:r,onClick:()=>void a(l.turnId),className:`${n} block w-full rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-left transition disabled:cursor-not-allowed disabled:opacity-60`,children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{className:"text-sm text-stone-100",children:["Turn ",l.turnIndex]}),t.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-stone-500",children:r?"Forking":l.status})]})},l.turnId))}):null,e.status!=="loading"&&!e.error&&(((s=e.data)==null?void 0:s.length)??0)===0?t.jsx("p",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-sm text-stone-400",children:"No turns available to fork yet."}):null]})}function cp({hooksPanelMode:e,hooksState:r,hostConfigFilesAvailable:n,hookTrustAvailable:a,hookConfigBusy:o,hookConfigError:s,hookConfigSuccess:l,editingHookTarget:d,hookScope:i,hookEventName:h,hookMatcher:u,hookCommand:p,hookTimeoutSec:m,hookStatusMessage:f,composerChipButtonClassName:g,onResetHookForm:x,onSetHooksPanelMode:k,onClearHookConfigStatus:b,onSetEditingHookTarget:y,onSetHookScope:w,onSetHookEventName:v,onSetHookMatcher:N,onSetHookCommand:j,onSetHookTimeoutSec:S,onSetHookStatusMessage:P,onSaveHook:C,onStartEditingHook:M,onTrustHook:_,onUntrustHook:A}){var te,W,D,q,de;return t.jsxs("div",{className:"p-2",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-stone-400",children:"Hook config sources"}),t.jsx("p",{className:"truncate text-[11px] text-stone-500",children:((te=r.data)==null?void 0:te.projectHooksPath)??"<workspace hooks config>"})]}),e==="list"&&n?t.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),x(),k("add"),b()},className:"shrink-0 rounded-full border border-sky-300/35 px-3 py-1.5 text-xs text-sky-100 transition hover:bg-sky-300/10",children:"Add Hook"}):null]}),r.status==="loading"&&!r.data?t.jsx("p",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-sm text-stone-400",children:"Loading hooks..."}):null,r.error?t.jsx("p",{className:"mb-2 rounded-xl border border-rose-500/35 bg-rose-500/10 px-3 py-3 text-sm text-rose-100/90",children:r.error}):null,s?t.jsx("p",{className:"mb-2 rounded-xl border border-rose-500/35 bg-rose-500/10 px-3 py-3 text-sm text-rose-100/90",children:s}):null,l?t.jsx("p",{className:"mb-2 rounded-xl border border-emerald-500/35 bg-emerald-500/10 px-3 py-3 text-sm text-emerald-100/90",children:l}):null,e==="add"||e==="edit"?t.jsxs("div",{className:"space-y-2 rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3",children:[e==="edit"?t.jsxs("p",{className:"rounded-lg border border-stone-800 bg-stone-950 px-3 py-2 text-[11px] text-stone-400",children:["Editing"," ",Dm((d==null?void 0:d.eventName)??h)," ","in ",(d==null?void 0:d.scope)==="global"?"global":"project"," ","hooks.json"]}):null,t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsxs("label",{className:"block text-xs text-stone-400",children:["Scope",t.jsxs("select",{"aria-label":"Hook scope",value:i,onChange:L=>w(L.target.value),disabled:e==="edit",className:"mt-1 w-full rounded-lg border border-stone-700 bg-stone-950 px-2.5 py-2 text-sm text-stone-100 outline-none focus:border-sky-300/50",children:[t.jsx("option",{value:"project",children:"Project"}),t.jsx("option",{value:"global",children:"Global"})]})]}),t.jsxs("label",{className:"block text-xs text-stone-400",children:["Event",t.jsx("select",{"aria-label":"Hook event",value:h,onChange:L=>v(L.target.value),className:"mt-1 w-full rounded-lg border border-stone-700 bg-stone-950 px-2.5 py-2 text-sm text-stone-100 outline-none focus:border-sky-300/50",children:Rr.map(L=>t.jsx("option",{value:L.value,children:L.label},L.value))})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"mb-1 block text-xs text-stone-400",children:"Matcher"}),t.jsx("input",{"aria-label":"Hook matcher",value:u,onChange:L=>N(L.target.value),placeholder:"Bash",className:"w-full rounded-lg border border-stone-700 bg-stone-950 px-3 py-2 text-sm text-stone-100 outline-none placeholder:text-stone-500 focus:border-sky-300/50"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"mb-1 block text-xs text-stone-400",children:"Command"}),t.jsx("textarea",{"aria-label":"Hook command",value:p,onChange:L=>j(L.target.value),rows:3,className:"w-full rounded-lg border border-stone-700 bg-stone-950 px-3 py-2 font-mono text-xs text-stone-100 outline-none placeholder:text-stone-500 focus:border-sky-300/50"})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsxs("label",{className:"block text-xs text-stone-400",children:["Timeout",t.jsx("input",{"aria-label":"Hook timeout seconds",value:m,onChange:L=>S(L.target.value),inputMode:"numeric",className:"mt-1 w-full rounded-lg border border-stone-700 bg-stone-950 px-3 py-2 text-sm text-stone-100 outline-none focus:border-sky-300/50"})]}),t.jsxs("label",{className:"block text-xs text-stone-400",children:["Status message",t.jsx("input",{"aria-label":"Hook status message",value:f,onChange:L=>P(L.target.value),className:"mt-1 w-full rounded-lg border border-stone-700 bg-stone-950 px-3 py-2 text-sm text-stone-100 outline-none focus:border-sky-300/50"})]})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[t.jsx("button",{type:"button",onClick:()=>{k("list"),y(null)},className:`${g} rounded-full border border-stone-700 px-3 py-1.5 text-xs text-stone-300 transition`,children:"Back"}),t.jsx("button",{type:"button",onClick:()=>void C(),disabled:o,className:"ui-status-info rounded-full px-3 py-1.5 text-xs transition disabled:cursor-not-allowed disabled:opacity-60",children:o?"Saving...":e==="edit"?"Update Hook":"Write Hook"})]})]}):null,e==="list"&&((W=r.data)!=null&&W.warnings.length)?t.jsx("div",{className:"mb-2 space-y-2",children:r.data.warnings.map(L=>t.jsx("p",{className:"rounded-xl border border-amber-500/25 bg-amber-500/10 px-3 py-2 text-xs text-amber-100/85",children:L},L))}):null,e==="list"&&((D=r.data)!=null&&D.errors.length)?t.jsx("div",{className:"mb-2 space-y-2",children:r.data.errors.map(L=>t.jsxs("div",{className:"rounded-xl border border-rose-500/35 bg-rose-500/10 px-3 py-2 text-xs text-rose-100/90",children:[t.jsx("p",{className:"font-medium",children:L.message}),t.jsx("p",{className:"mt-1 break-all text-rose-100/60",children:L.path})]},`${L.path}:${L.message}`))}):null,e==="list"&&((q=r.data)!=null&&q.hooks.length)?t.jsx("div",{className:"space-y-2",children:r.data.hooks.map(L=>t.jsxs("div",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-2.5",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"truncate text-sm font-medium text-stone-100",children:[Mm(L.eventName),L.matcher?` · ${L.matcher}`:""]}),t.jsx("p",{className:"mt-0.5 truncate font-mono text-[11px] text-stone-400",children:L.command??L.handlerType}),L.statusMessage?t.jsx("p",{className:"mt-1 truncate text-[11px] text-stone-500",children:L.statusMessage}):null]}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 text-[10px] uppercase tracking-[0.08em] text-stone-500",children:[ll(L)?t.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),M(L)},className:`${g} rounded-full border border-stone-700 px-2 py-0.5 text-[10px] normal-case tracking-normal text-sky-100 transition hover:border-sky-300/35 hover:bg-sky-300/10`,children:"Edit"}):null,a&&L.trustStatus==="trusted"&&!L.isManaged?t.jsx("button",{type:"button",disabled:o,onClick:Z=>{Z.stopPropagation(),A(L)},className:`${g} rounded-full border border-stone-700 px-2 py-0.5 text-[10px] normal-case tracking-normal text-amber-100 transition hover:border-amber-300/35 hover:bg-amber-300/10 disabled:cursor-not-allowed disabled:opacity-50`,children:"Untrust"}):null,(L.trustStatus==="untrusted"||L.trustStatus==="modified")&&!L.isManaged&&a?t.jsx("button",{type:"button",disabled:o||!L.currentHash,onClick:Z=>{Z.stopPropagation(),_(L)},className:`${g} rounded-full border border-stone-700 px-2 py-0.5 text-[10px] normal-case tracking-normal text-emerald-100 transition hover:border-emerald-300/35 hover:bg-emerald-300/10 disabled:cursor-not-allowed disabled:opacity-50`,children:"Trust"}):null,t.jsx("span",{className:"rounded-full border border-stone-700 px-2 py-0.5 text-stone-300",children:$m(L.trustStatus)})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 text-[10px] uppercase tracking-[0.14em] text-stone-500",children:[t.jsx("span",{className:"rounded-full border border-stone-700 px-2 py-1",children:_m(L.source)}),t.jsx("span",{className:"rounded-full border border-stone-700 px-2 py-1",children:L.enabled?"Enabled":"Disabled"}),t.jsxs("span",{className:"rounded-full border border-stone-700 px-2 py-1",children:[L.timeoutSec,"s"]})]})]},L.key))}):null,e==="list"&&r.status!=="loading"&&!r.error&&(((de=r.data)==null?void 0:de.hooks.length)??0)===0?t.jsx("p",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-sm text-stone-400",children:"No hooks configured for this workspace."}):null]})}function hp({mcpPanelMode:e,mcpState:r,mcpConfigEditing:n,mcpConfigPath:a,mcpConfigError:o,mcpConfigSuccess:s,mcpConfigBusy:l,mcpHttpName:d,mcpHttpUrl:i,mcpRawBlock:h,composerPanelButtonClassName:u,composerChipButtonClassName:p,onSetMcpPanelMode:m,onClearMcpConfigStatus:f,onSetMcpHttpName:g,onSetMcpHttpUrl:x,onSetMcpRawBlock:k,onPrepareRawMcpBlock:b,onSaveHttpMcp:y,onSaveRawMcpBlock:w}){var v,N;return t.jsxs("div",{className:"p-2",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-stone-400",children:"MCP config source"}),t.jsx("p",{className:"truncate text-[11px] text-stone-500",children:a??"<provider config>"})]}),e==="list"&&n?t.jsx("button",{type:"button",onClick:j=>{j.stopPropagation(),m("add"),f()},className:"shrink-0 rounded-full border border-sky-300/35 px-3 py-1.5 text-xs text-sky-100 transition hover:bg-sky-300/10",children:"Add MCP"}):null]}),r.status==="loading"&&!r.data?t.jsx("p",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-sm text-stone-400",children:"Loading MCP servers..."}):null,r.error?t.jsx("p",{className:"mb-2 rounded-xl border border-rose-500/35 bg-rose-500/10 px-3 py-3 text-sm text-rose-100/90",children:r.error}):null,o?t.jsx("p",{className:"mb-2 rounded-xl border border-rose-500/35 bg-rose-500/10 px-3 py-3 text-sm text-rose-100/90",children:o}):null,s?t.jsx("p",{className:"mb-2 rounded-xl border border-emerald-500/35 bg-emerald-500/10 px-3 py-3 text-sm text-emerald-100/90",children:s}):null,e==="add"?t.jsxs("div",{className:"space-y-2",children:[t.jsxs("button",{type:"button",onClick:j=>{j.stopPropagation(),m("http"),f()},className:`${u} block w-full rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-left transition`,children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{className:"text-sm text-stone-100",children:"HTTP / Streamable HTTP"}),t.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-stone-500",children:"Form"})]}),t.jsx("p",{className:"mt-1 text-xs text-stone-400",children:"Add an MCP server with a name and URL, then write the matching block into provider config."})]}),t.jsxs("button",{type:"button",onClick:j=>{j.stopPropagation(),b()},className:`${u} block w-full rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-left transition`,children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{className:"text-sm text-stone-100",children:"stdio / raw block"}),t.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-stone-500",children:"TOML"})]}),t.jsx("p",{className:"mt-1 text-xs text-stone-400",children:"Write a single `[mcp_servers.name]` block, then save it back into provider config."})]})]}):null,e==="http"?t.jsxs("div",{className:"space-y-2 rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:"mb-1 block text-xs text-stone-400",children:"MCP name"}),t.jsx("input",{"aria-label":"MCP name",value:d,onChange:j=>g(j.target.value),placeholder:"openaiDeveloperDocs",className:"w-full rounded-lg border border-stone-700 bg-stone-950 px-3 py-2 text-sm text-stone-100 outline-none placeholder:text-stone-500 focus:border-sky-300/50"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"mb-1 block text-xs text-stone-400",children:"URL"}),t.jsx("input",{"aria-label":"URL",value:i,onChange:j=>x(j.target.value),placeholder:"https://developers.openai.com/mcp",className:"w-full rounded-lg border border-stone-700 bg-stone-950 px-3 py-2 text-sm text-stone-100 outline-none placeholder:text-stone-500 focus:border-sky-300/50"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[t.jsx("button",{type:"button",onClick:()=>m("add"),className:`${p} rounded-full border border-stone-700 px-3 py-1.5 text-xs text-stone-300 transition`,children:"Back"}),t.jsx("button",{type:"button",onClick:()=>void y(),disabled:l,className:"ui-status-info rounded-full px-3 py-1.5 text-xs transition disabled:cursor-not-allowed disabled:opacity-60",children:l?"Saving...":"Write HTTP MCP"})]})]}):null,e==="stdio"?t.jsxs("div",{className:"space-y-2 rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3",children:[t.jsx("label",{className:"block text-xs text-stone-400",children:"MCP block for provider config"}),t.jsx("textarea",{"aria-label":"MCP block for provider config",value:h,onChange:j=>k(j.target.value),rows:8,className:"w-full rounded-lg border border-stone-700 bg-stone-950 px-3 py-2 text-sm text-stone-100 outline-none placeholder:text-stone-500 focus:border-sky-300/50"}),t.jsxs("div",{className:"flex items-center justify-between gap-2 pt-1",children:[t.jsx("button",{type:"button",onClick:()=>m("add"),className:`${p} rounded-full border border-stone-700 px-3 py-1.5 text-xs text-stone-300 transition`,children:"Back"}),t.jsx("button",{type:"button",onClick:()=>void w(),disabled:l,className:"ui-status-info rounded-full px-3 py-1.5 text-xs transition disabled:cursor-not-allowed disabled:opacity-60",children:l?"Saving...":"Write raw block"})]})]}):null,e==="list"&&((v=r.data)!=null&&v.servers.length)?t.jsx("div",{className:"space-y-2",children:r.data.servers.map(j=>t.jsxs("div",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-2.5",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-medium text-stone-100",children:j.name}),t.jsxs("p",{className:"mt-0.5 text-xs text-stone-400",children:[j.tools.length," tools · ",j.resourceCount," ","resources · ",j.resourceTemplateCount," templates"]})]}),t.jsx("span",{className:"shrink-0 rounded-full border border-stone-700 px-2 py-1 text-[10px] uppercase tracking-[0.14em] text-stone-300",children:Rm(j.authStatus)})]}),j.tools.length>0?t.jsx("p",{className:"mt-2 line-clamp-2 text-xs text-stone-500",children:j.tools.slice(0,4).map(S=>S.title??S.name).join(" · ")}):null]},j.name))}):null,e==="list"&&r.status!=="loading"&&!r.error&&(((N=r.data)==null?void 0:N.servers.length)??0)===0?t.jsx("p",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-sm text-stone-400",children:"No MCP servers available right now."}):null]})}function up({skillsState:e,copiedSkillName:r,composerChipButtonClassName:n,onCopySkillInvokeName:a}){var o,s,l,d;return t.jsxs("div",{className:"p-2",children:[e.status==="loading"&&!e.data?t.jsx("p",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-sm text-stone-400",children:"Loading skills..."}):null,e.error?t.jsx("p",{className:"mb-2 rounded-xl border border-rose-500/35 bg-rose-500/10 px-3 py-3 text-sm text-rose-100/90",children:e.error}):null,(o=e.data)!=null&&o.skills.length?t.jsx("div",{className:"space-y-2",children:e.data.skills.map(i=>{var h,u;return t.jsx("div",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-2.5",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"truncate text-sm font-medium text-stone-100",children:((h=i.interface)==null?void 0:h.displayName)??i.name}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[10px] uppercase tracking-[0.14em]",children:[t.jsx("span",{className:"rounded-full border border-stone-700 px-2 py-1 text-stone-400",children:Am(i.scope)}),t.jsxs("button",{type:"button",className:`inline-flex items-center gap-1 rounded-full border px-2 py-1 normal-case tracking-normal transition ${r===i.name?"border-emerald-400/45 bg-emerald-400/12 text-emerald-100":`${n} border-stone-700 text-stone-300 hover:border-stone-500`}`,onClick:()=>void a(i.name),title:`Copy $${i.name}`,"aria-label":`Copy $${i.name}`,children:[t.jsx(Mn,{}),"$",i.name]})]}),t.jsx("p",{className:"text-xs leading-5 text-stone-400",children:((u=i.interface)==null?void 0:u.shortDescription)??i.shortDescription??i.description})]})},i.path)})}):null,(s=e.data)!=null&&s.errors.length?t.jsx("div",{className:"mt-2 space-y-2",children:e.data.errors.map(i=>t.jsxs("div",{className:"rounded-xl border border-amber-500/25 bg-amber-500/10 px-3 py-2 text-xs text-amber-100/85",children:[t.jsx("p",{className:"font-medium",children:i.message}),t.jsx("p",{className:"mt-1 break-all text-amber-100/60",children:i.path})]},`${i.path}:${i.message}`))}):null,e.status!=="loading"&&!e.error&&(((l=e.data)==null?void 0:l.skills.length)??0)===0&&(((d=e.data)==null?void 0:d.errors.length)??0)===0?t.jsx("p",{className:"rounded-xl border border-stone-800 bg-stone-950/70 px-3 py-3 text-sm text-stone-400",children:"No skills available right now."}):null]})}function mp({open:e,slashPanelView:r,availableToolboxItems:n,busy:a,forkBusy:o,forkTurnOptionsState:s,skillsState:l,copiedSkillName:d,hooksPanelMode:i,hooksState:h,hostConfigFilesAvailable:u,hookTrustAvailable:p,hookConfigBusy:m,hookConfigError:f,hookConfigSuccess:g,editingHookTarget:x,hookScope:k,hookEventName:b,hookMatcher:y,hookCommand:w,hookTimeoutSec:v,hookStatusMessage:N,mcpPanelMode:j,mcpState:S,mcpConfigEditing:P,mcpConfigPath:C,mcpConfigError:M,mcpConfigSuccess:_,mcpConfigBusy:A,mcpHttpName:te,mcpHttpUrl:W,mcpRawBlock:D,iconButtonClassName:q,menuClassName:de,menuItemClassName:L,panelButtonClassName:Z,chipButtonClassName:R,onToggle:X,onToolboxItemClick:F,toolboxItemDisabled:z,toolboxItemClassName:V,toolboxItemStatus:H,onSetSlashPanelView:E,onOpenForkTurns:T,onForkLatest:K,onForkTurn:O,onCopySkillInvokeName:Q,onResetHookForm:B,onSetHooksPanelMode:ce,onClearHookConfigStatus:J,onSetEditingHookTarget:se,onSetHookScope:ue,onSetHookEventName:fe,onSetHookMatcher:Ne,onSetHookCommand:Y,onSetHookTimeoutSec:G,onSetHookStatusMessage:re,onSaveHook:le,onStartEditingHook:ge,onTrustHook:me,onUntrustHook:ze,onSetMcpPanelMode:Re,onClearMcpConfigStatus:Ee,onSetMcpHttpName:Te,onSetMcpHttpUrl:Pe,onSetMcpRawBlock:$,onPrepareRawMcpBlock:ie,onSaveHttpMcp:xe,onSaveRawMcpBlock:be}){return t.jsxs("div",{className:"relative",children:[t.jsx(vt,{type:"button",variant:"ghost",size:"icon-xs","data-composer-menu-trigger":"true","aria-label":"Open slash toolbox",title:"Open slash toolbox",onClick:X,className:`${q} h-9 w-9 rounded-full sm:h-8 sm:w-8`,children:t.jsx(Pm,{})}),e&&t.jsx("div",{"data-composer-menu-surface":"true",className:`${de} absolute bottom-full left-0 z-40 mb-2 w-72 overflow-hidden rounded-2xl border bg-stone-900/72 shadow-2xl shadow-stone-950/20 backdrop-blur-xl`,onClick:ve=>{ve.stopPropagation()},onMouseDown:ve=>{ve.stopPropagation()},onPointerDown:ve=>{ve.stopPropagation()},onTouchStart:ve=>{ve.stopPropagation()},children:r==="root"?t.jsxs("div",{className:"p-2",children:[n.map((ve,ye)=>t.jsx("button",{type:"button",disabled:z(ve),onClick:$e=>F(ve,$e),className:`${V(ve)} ${ye===0?"mt-0":""}`,title:ve.description??ve.label,children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:ve.command}),t.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-stone-400",children:H(ve)})]})},`${ve.action}:${ve.command}`)),n.length===0?t.jsx("p",{className:"px-3 py-2 text-sm text-stone-400",children:"No backend tools are available for this thread."}):null]}):t.jsx("div",{className:"max-h-80 overflow-auto",children:r==="fork"?t.jsx(ip,{busy:a,forkBusy:o,composerMenuItemClassName:L,onForkLatest:K,onSelectForkTurnPanel:()=>(E("forkTurns"),T())}):r==="forkTurns"?t.jsx(dp,{forkTurnOptionsState:s,forkBusy:o,composerPanelButtonClassName:Z,onForkTurn:O}):r==="skills"?t.jsx(up,{skillsState:l,copiedSkillName:d,composerChipButtonClassName:R,onCopySkillInvokeName:Q}):r==="hooks"?t.jsx(cp,{hooksPanelMode:i,hooksState:h,hostConfigFilesAvailable:u,hookTrustAvailable:p,hookConfigBusy:m,hookConfigError:f,hookConfigSuccess:g,editingHookTarget:x,hookScope:k,hookEventName:b,hookMatcher:y,hookCommand:w,hookTimeoutSec:v,hookStatusMessage:N,composerChipButtonClassName:R,onResetHookForm:B,onSetHooksPanelMode:ce,onClearHookConfigStatus:J,onSetEditingHookTarget:se,onSetHookScope:ue,onSetHookEventName:fe,onSetHookMatcher:Ne,onSetHookCommand:Y,onSetHookTimeoutSec:G,onSetHookStatusMessage:re,onSaveHook:le,onStartEditingHook:ge,onTrustHook:me,onUntrustHook:ze}):t.jsx(hp,{mcpPanelMode:j,mcpState:S,mcpConfigEditing:P,mcpConfigPath:C,mcpConfigError:M,mcpConfigSuccess:_,mcpConfigBusy:A,mcpHttpName:te,mcpHttpUrl:W,mcpRawBlock:D,composerPanelButtonClassName:Z,composerChipButtonClassName:R,onSetMcpPanelMode:Re,onClearMcpConfigStatus:Ee,onSetMcpHttpName:Te,onSetMcpHttpUrl:Pe,onSetMcpRawBlock:$,onPrepareRawMcpBlock:ie,onSaveHttpMcp:xe,onSaveRawMcpBlock:be})})})]})}function pp({isShellView:e,canToggleShellView:r,isMobileShell:n,shellPromptLabel:a,openMenu:o,toolbarClassName:s,iconButtonClassName:l,slashToolboxProps:d,attachmentMenuProps:i,settingsToolbarProps:h,shellToolsPanelProps:u,onToggleView:p,onDismissPromptFocus:m,onSetOpenMenu:f}){return t.jsxs(Qm,{align:"block-end",className:`${s} relative z-30 mb-0 flex items-center gap-2 text-xs`,children:[t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!e&&d?t.jsx(mp,{...d}):null,!e&&i?t.jsx(sp,{...i}):null,r&&t.jsx(vt,{type:"button",variant:"ghost",size:"icon-xs","aria-label":e?"Switch to chat":"Switch to shell",title:e?"Switch to chat":"Switch to shell",onClick:()=>p==null?void 0:p(),className:`${l} h-9 w-9 rounded-full sm:h-8 sm:w-8`,children:e?t.jsx(zm,{}):t.jsx(Em,{})})]}),t.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-1.5",children:[!e&&h?t.jsx(op,{...h}):null,e&&a?t.jsx(tp,{className:"min-w-0 max-w-[12rem] truncate rounded-full px-1.5 py-1 text-stone-400",title:a,children:a}):null,n&&t.jsxs("div",{className:"relative",children:[t.jsx("button",{type:"button","data-composer-menu-trigger":"true","aria-label":o==="shellTools"?"Close shell tools":"Open shell tools","aria-haspopup":"menu","aria-expanded":o==="shellTools",title:o==="shellTools"?"Close shell tools":"Open shell tools",onClick:()=>{m(),f(g=>g==="shellTools"?null:"shellTools")},className:"inline-flex h-7 w-7 items-center justify-center rounded-full border border-stone-700 bg-stone-900/92 text-stone-200 transition hover:bg-stone-800",children:t.jsx(Im,{})}),o==="shellTools"&&u?t.jsx(lp,{...u}):null]})]})]})}function fp(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`attachment-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function gp(e){return[...e.filter(r=>Rn(r)==="photo"),...e.filter(r=>Rn(r)==="file")]}function xp({prompt:e,attachments:r,updateDraft:n,getSelection:a,selectionSnapshotRef:o,pendingSelectionRef:s,pendingInsertedAttachmentIdsRef:l,onInserted:d,buildClientId:i=fp}){const h=c.useCallback((m,f)=>{if(m.length===0)return!1;const g=hm({prompt:e,attachments:r,files:m,selection:a()??o.current,kindForFile:f,buildClientId:i});return n(()=>g.draft),s.current=g.selection,o.current=g.selection,l.current=g.insertedAttachmentIds,d==null||d(),!0},[r,i,a,d,l,s,e,o,n]),u=c.useCallback((m,f)=>!m||m.length===0?!1:h(Array.from(m),()=>f),[h]),p=c.useCallback(m=>h(gp(m),Rn),[h]);return{appendAttachments:u,appendDroppedAttachments:p}}function ns(e){for(const r of e.values())URL.revokeObjectURL(r);e.clear()}function bp({attachments:e,isShellView:r}){const n=c.useRef(new Map),[a,o]=c.useState({});return c.useEffect(()=>{const s=n.current;if(r){ns(s),o({});return}const l={},d=new Set;for(const i of e){if(i.kind!=="photo")continue;d.add(i.clientId);let h=s.get(i.clientId);h||(h=URL.createObjectURL(i.file),s.set(i.clientId,h)),l[i.clientId]=h}for(const[i,h]of s.entries())d.has(i)||(URL.revokeObjectURL(h),s.delete(i));o(l)},[e,r]),c.useEffect(()=>{const s=n.current;return()=>{ns(s)}},[]),a}var vp=180;function mn(e,r){return{prompt:e??"",attachments:r??[]}}function kp({isShellView:e,draftPrompt:r,draftAttachments:n,onDraftChange:a}){const[o,s]=c.useState({prompt:"",attachments:[]}),[l,d]=c.useState(()=>mn(r,n)),i=c.useRef(null),h=c.useRef(l),u=c.useRef(br(l)),p=!e&&r!==void 0&&n!==void 0&&typeof a=="function",m=p?br(mn(r,n)):"",f=c.useRef(m);c.useLayoutEffect(()=>{if(!p){f.current="";return}const w=mn(r,n),v=br(w);v!==f.current&&(f.current=v,u.current=v,h.current=w,i.current!==null&&(window.clearTimeout(i.current),i.current=null),d(w))},[n,r,p]);const g=c.useCallback(w=>{if(!p||!a)return;const v=br(w);v!==u.current&&(u.current=v,a(()=>({prompt:w.prompt,attachments:w.attachments})))},[p,a]);c.useEffect(()=>()=>{g(h.current),i.current!==null&&window.clearTimeout(i.current)},[g]);const x=c.useCallback((w,v)=>{if(p){if(i.current!==null&&(window.clearTimeout(i.current),i.current=null),v==="immediate"){g(w);return}i.current=window.setTimeout(()=>{i.current=null,g(h.current)},vp)}},[p,g]),k=c.useCallback((w=h.current)=>{x(w,"immediate")},[x]),b=c.useCallback((w,v="immediate")=>{if(p){const N=w(h.current);h.current=N,d(N),x(N,v);return}s(N=>w(N))},[p,x]),y=p?l:o;return{prompt:y.prompt,attachments:y.attachments,isDraftControlled:p,updateDraft:b,flushControlledDraftToHost:k}}function wp({slashPanelView:e,onForkLatest:r,onForkTurn:n,closeMenu:a}){const[o,s]=c.useState(!1);c.useEffect(()=>{e!=="forkTurns"&&s(!1)},[e]);const l=c.useCallback(async()=>{if(r){s(!0);try{await r(),a()}finally{s(!1)}}},[a,r]),d=c.useCallback(async i=>{if(n){s(!0);try{await n(i),a()}finally{s(!1)}}},[a,n]);return{forkBusy:o,forkLatest:l,forkTurn:d}}function yp({prompt:e,goalTokenBudgetSource:r,promptRef:n,onOpenGoal:a,onUpdateGoal:o,updateDraft:s,closeMenu:l,resetSlashPanel:d}){const[i,h]=c.useState(!1),[u,p]=c.useState(""),[m,f]=c.useState(!1),[g,x]=c.useState(null),k=c.useCallback(async()=>{const w=e.trim();if(!w)return x("Goal objective cannot be empty."),!1;const v=u.trim(),N=xm(v);if(v.length>0&&(N===null||!Number.isInteger(N)||N<=0))return x("Token budget must be a positive number in thousands."),!1;if(!o)return x("/goal is unavailable in this view."),!1;f(!0),x(null);try{return await o({objective:w,status:"active",tokenBudget:N}),p(""),h(!1),s(()=>({prompt:"",attachments:[]})),!0}catch(j){return x(j instanceof Error?j.message:"Unable to set goal."),!1}finally{f(!1)}},[u,o,e,s]),b=c.useCallback(()=>{l(),d(),h(!0),p(bm(r==null?void 0:r.tokenBudget)),x(null),a==null||a(),requestAnimationFrame(()=>{var w;(w=n.current)==null||w.focus()})},[l,r==null?void 0:r.tokenBudget,a,n,d]),y=c.useCallback(()=>{h(!1),x(null)},[]);return{goalComposeMode:i,goalTokenBudget:u,goalBusy:m,goalLocalError:g,setGoalTokenBudget:p,submitGoal:k,enterGoalComposeMode:b,exitGoalComposeMode:y}}var pn=`node -e "process.stdin.resume(); process.stdin.on('end', () => console.error('hook ran'))"`;function jp(e){const r=new Map;for(const n of e??[])r.set(n.eventName,n.command);return r}function Np({slashPanelView:e,hookCommandTemplates:r,onCreateHook:n,onUpdateHook:a,onTrustHook:o,onUntrustHook:s}){const[l,d]=c.useState("list"),[i,h]=c.useState("project"),[u,p]=c.useState("preToolUse"),[m,f]=c.useState("Bash"),[g,x]=c.useState(pn),[k,b]=c.useState("30"),[y,w]=c.useState("Running hook"),[v,N]=c.useState(null),[j,S]=c.useState(!1),[P,C]=c.useState(null),[M,_]=c.useState(null),A=c.useMemo(()=>jp(r),[r]),te=c.useCallback(X=>A.get(X)??A.get("preToolUse")??pn,[A]),W=c.useMemo(()=>new Set([pn,...A.values()]),[A]),D=c.useCallback(()=>{C(null),_(null)},[]);c.useEffect(()=>{e!=="hooks"&&(d("list"),D())},[D,e]),c.useEffect(()=>{const X=Rr.find(F=>F.value===u);f(F=>{const z=F.trim(),V=new Set(Rr.map(H=>H.matcherHint).filter(Boolean));return z&&!V.has(z)?F:(X==null?void 0:X.matcherHint)??""}),x(F=>W.has(F.trim())?te(u):F)},[te,W,u]);const q=c.useCallback(()=>{N(null),h("project"),p("preToolUse"),f("Bash"),x(te("preToolUse")),b("30"),w("Running hook")},[te]),de=c.useCallback(X=>{const F=ll(X);if(!F){C("Only command hooks in global or project hooks.json can be edited here.");return}N(F),h(F.scope),p(F.eventName),f(F.matcher??""),x(F.command),b(F.timeoutSec?String(F.timeoutSec):""),w(F.statusMessage??""),C(null),_(null),d("edit")},[]),L=c.useCallback(async()=>{if(l==="edit"&&!a){C("Hook editing is unavailable in this view.");return}if(l!=="edit"&&!n){C("Hook editing is unavailable in this view.");return}if(l==="edit"&&!v){C("Select a hook to edit first.");return}const X=g.trim();if(!X){C("Hook command cannot be empty.");return}const F=k.trim(),z=F?Number(F):null;if(F&&(z===null||!Number.isInteger(z)||z<=0)){C("Timeout must be a positive number of seconds.");return}S(!0),C(null),_(null);try{const V={scope:i,eventName:u,matcher:m.trim()||null,command:X,timeoutSec:z,statusMessage:y.trim()||null};l==="edit"?await(a==null?void 0:a({...V,target:v})):await(n==null?void 0:n(V)),_(`${i==="project"?"Project":"Global"} hook ${l==="edit"?"updated":"written"} in hooks.json and trusted.`),d("list"),N(null)}catch(V){C(V instanceof Error?V.message:"Unable to write hooks.json.")}finally{S(!1)}},[v,g,u,m,i,y,k,l,n,a]),Z=c.useCallback(async X=>{if(!o||!X.currentHash){C("Hook trust is unavailable in this view.");return}S(!0),C(null),_(null);try{await o({key:X.key,currentHash:X.currentHash}),_("Hook trusted.")}catch(F){C(F instanceof Error?F.message:"Unable to trust hook.")}finally{S(!1)}},[o]),R=c.useCallback(async X=>{if(!s){C("Hook trust is unavailable in this view.");return}S(!0),C(null),_(null);try{await s({key:X.key}),_("Hook untrusted.")}catch(F){C(F instanceof Error?F.message:"Unable to untrust hook.")}finally{S(!1)}},[s]);return{hooksPanelMode:l,hookScope:i,hookEventName:u,hookMatcher:m,hookCommand:g,hookTimeoutSec:k,hookStatusMessage:y,editingHookTarget:v,hookConfigBusy:j,hookConfigError:P,hookConfigSuccess:M,setHooksPanelMode:d,setEditingHookTarget:N,setHookScope:h,setHookEventName:p,setHookMatcher:f,setHookCommand:x,setHookTimeoutSec:b,setHookStatusMessage:w,clearHookConfigStatus:D,resetHookForm:q,startEditingHook:de,saveHook:L,trustHook:Z,untrustHook:R}}var Cp=`[mcp_servers.example_stdio]
3581
+ command = "npx"
3582
+ args = ["-y", "your-mcp-server"]
3583
+ `,as="MCP entry written to provider config. Restart the backend if it does not appear immediately.";function Sp({hostConfigFilesAvailable:e,onReadProviderConfig:r,onWriteProviderConfig:n,setMcpPanelMode:a,onOpenMcp:o}){const[s,l]=c.useState(""),[d,i]=c.useState(""),[h,u]=c.useState(""),[p,m]=c.useState(null),[f,g]=c.useState(!1),[x,k]=c.useState(null),[b,y]=c.useState(null),w=c.useCallback(()=>{k(null),y(null)},[]),v=c.useCallback(async()=>{if(!e||!r)throw new Error("Provider config editing is unavailable for this thread.");const C=await r();return m(C.path),C},[e,r]),N=c.useCallback(async C=>{if(!e||!n)throw new Error("Provider config editing is unavailable for this thread.");const M=await n(C);return m(M.path),M},[e,n]),j=c.useCallback(async()=>{const C=vm(s),M=d.trim();if(!C){k("MCP name must use only letters, numbers, underscore, or hyphen.");return}if(!/^https?:\/\//i.test(M)){k("HTTP MCP URL must start with http:// or https://");return}g(!0),k(null),y(null);try{const _=await v(),A=Ja(_.content,C,wm(C,M));await N(A),y(as),a("list"),l(""),i(""),o==null||o()}catch(_){k(_ instanceof Error?_.message:"Unable to update provider config.")}finally{g(!1)}},[v,s,d,o,a,N]),S=c.useCallback(async()=>{g(!0),k(null),y(null);try{await v(),u(C=>C||Cp),a("stdio")}catch(C){k(C instanceof Error?C.message:"Unable to load provider config.")}finally{g(!1)}},[v,a]),P=c.useCallback(async()=>{const C=km(h);if(!C){k("The raw MCP block must start with a header like [mcp_servers.name].");return}g(!0),k(null),y(null);try{const M=await v(),_=Ja(M.content,C,h);await N(_),y(as),a("list"),o==null||o()}catch(M){k(M instanceof Error?M.message:"Unable to update provider config.")}finally{g(!1)}},[v,h,o,a,N]);return{mcpHttpName:s,mcpHttpUrl:d,mcpRawBlock:h,mcpConfigPath:p,mcpConfigBusy:f,mcpConfigError:x,mcpConfigSuccess:b,setMcpHttpName:l,setMcpHttpUrl:i,setMcpRawBlock:u,clearMcpConfigStatus:w,prepareRawMcpBlock:S,saveHttpMcp:j,saveRawMcpBlock:P}}function Tp({openMenu:e,setOpenMenu:r,slashPanelView:n,setSlashPanelView:a,setMcpPanelMode:o,clearMcpConfigStatus:s,clearHookConfigStatus:l}){const[d,i]=c.useState(null);c.useEffect(()=>{e!=="slash"&&(a("root"),o("list"),s(),l())},[l,s,e,o,a]),c.useEffect(()=>{n!=="mcp"&&(o("list"),s())},[s,o,n]),c.useEffect(()=>{if(!d)return;const u=window.setTimeout(()=>{i(p=>p===d?null:p)},1400);return()=>{window.clearTimeout(u)}},[d]),c.useEffect(()=>{function u(p){(typeof p.composedPath=="function"?p.composedPath():[]).some(g=>g instanceof HTMLElement&&(g.dataset.composerMenuSurface==="true"||g.dataset.composerMenuTrigger==="true"))||e&&r(null)}if(e)return window.addEventListener("pointerdown",u),()=>{window.removeEventListener("pointerdown",u)}},[e,r]);const h=c.useCallback(async u=>{try{await navigator.clipboard.writeText(`$${u}`),i(u)}catch{i(null)}},[]);return{copiedSkillName:d,copySkillInvokeName:h}}function Ep(e,r){const{attachment:n}=e,a=document.createElement("span");if(a.dataset.segmentType="attachment",a.dataset.clientId=n.clientId,a.dataset.placeholder=n.placeholder,a.contentEditable="false",a.className="thread-composer-attachment-chip mx-[0.12rem] inline-flex max-w-full align-baseline",n.kind==="photo"){a.classList.add("thread-composer-attachment-chip-photo","rounded-[0.95rem]","border","border-sky-300/35","bg-sky-300/10","p-1","shadow-sm","shadow-stone-950/20");const l=r[n.clientId];if(l){const i=document.createElement("img");i.src=l,i.alt=n.originalName||"Pasted image",i.className="thread-composer-attachment-thumb h-[4.5rem] w-[6rem] rounded-[0.7rem] bg-stone-950 object-contain",i.draggable=!1,a.append(i)}else{const i=document.createElement("span");i.className="thread-composer-attachment-thumb inline-block h-[4.5rem] w-[6rem] rounded-[0.7rem] bg-stone-900/80",i.setAttribute("aria-hidden","true"),a.append(i)}const d=document.createElement("span");return d.className="thread-composer-attachment-caption ml-2 inline-flex max-w-[8rem] items-center text-[10px] font-medium tracking-[0.08em] text-sky-50",d.textContent=es(n),a.append(d),a}a.classList.add("items-center","gap-2","rounded-[0.95rem]","border","border-emerald-300/35","bg-emerald-300/10","px-2.5","py-2","text-[10px]","font-medium","tracking-[0.08em]","text-emerald-50","shadow-sm","shadow-stone-950/20");const o=document.createElement("span");o.className="inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-emerald-200/25 bg-emerald-300/12 text-[9px]",o.textContent="FILE";const s=document.createElement("span");return s.className="inline-flex max-w-[10rem] truncate",s.textContent=es(n),a.append(o,s),a}function Lp(e,r){const n=document.createDocumentFragment();for(const a of e){if(a.type==="text"){n.append(document.createTextNode(a.text===" "?" ":a.text));continue}n.append(Ep(a,r))}return n}function Pp({promptRef:e,isShellView:r,prompt:n,promptSegments:a,attachmentPreviewUrls:o,previewSignature:s,editorSanitizeNonce:l,pendingSelectionRef:d,pendingInsertedAttachmentIdsRef:i,selectionSnapshotRef:h,renderedPreviewSignatureRef:u,renderedSanitizeNonceRef:p,serializeEditorPrompt:m,restoreSelection:f}){c.useLayoutEffect(()=>{const g=e.current;if(!g||r)return;const x=d.current,k=m()!==n||u.current!==s||p.current!==l;k&&(g.replaceChildren(Lp(a,o)),u.current=s,p.current=l),x!==null?(g.focus(),Ym(g,i.current)||f(x),h.current=x):document.activeElement===g&&k&&f(h.current),d.current=null,i.current=[]},[o,l,r,s,n,e,a,i,d,u,p,f,h,m])}function zp({tokenBudget:e,error:r,onTokenBudgetChange:n,onCancel:a}){return t.jsxs("div",{className:"thread-goal-compose-card relative z-20 mb-1.5 flex flex-wrap items-center gap-2 rounded-2xl border px-3 py-2 text-xs shadow-sm",children:[t.jsx("span",{className:"thread-goal-compose-label font-medium uppercase tracking-[0.16em]",children:"Goal"}),t.jsxs("label",{className:"thread-goal-compose-field flex items-center gap-2",children:[t.jsx("span",{children:"Max tokens (k)"}),t.jsx("input",{"aria-label":"Goal token budget",value:e,onChange:o=>n(o.target.value),inputMode:"numeric",placeholder:"Optional",className:"thread-goal-compose-input h-7 w-24 rounded-full border px-3 text-xs outline-none"})]}),r?t.jsx("span",{className:"thread-goal-compose-error min-w-0 flex-1",children:r}):null,t.jsx("button",{type:"button",onClick:a,className:"thread-goal-compose-cancel rounded-full border px-2.5 py-1 text-[11px] transition",children:"Cancel"})]})}function Ip({promptRef:e,prompt:r,disabled:n,promptPlaceholder:a,canInterrupt:o,interruptLabel:s,composerPromptRegionClassName:l,graphChatInputClassName:d,onInterrupt:i,onInput:h,onPaste:u,onKeyDown:p,onKeyUp:m,onMouseUp:f,onBlur:g,onDragEnter:x,onDragOver:k,onDragLeave:b,onDrop:y}){return t.jsxs("div",{"data-slot":"input-group-control",className:`${l} relative w-full`,children:[t.jsxs("div",{className:d,children:[r.length===0&&t.jsx("span",{className:`pointer-events-none absolute left-3 top-3 truncate text-slate-500 sm:left-4 sm:top-4 dark:text-slate-400 ${o?"right-12":"right-3 sm:right-4"}`,children:a}),t.jsx("div",{ref:e,role:"textbox","aria-label":"Prompt","aria-multiline":"true",contentEditable:!n,suppressContentEditableWarning:!0,onInput:h,onPaste:u,onKeyDown:p,onKeyUp:m,onMouseUp:f,onBlur:g,onDragEnter:x,onDragOver:k,onDragLeave:b,onDrop:y,className:`relative z-[1] min-h-[4.25rem] whitespace-pre-wrap break-words pb-2 outline-none sm:min-h-[4.25rem] ${o?"pr-12":""} ${n?"cursor-not-allowed text-slate-500":""}`})]}),o?t.jsx(vt,{type:"button",variant:"ghost",size:"icon-xs","aria-label":s,title:s,onClick:w=>{w.preventDefault(),i==null||i()},className:"thread-graph-composer-stop-button ui-action-danger absolute right-2 top-2 z-30 h-8 w-8 rounded-full text-sm font-medium",children:t.jsx("span",{"aria-hidden":"true",className:"block h-2.5 w-2.5 rounded-[2px] bg-current"})}):null]})}function Rp({prompt:e,promptPlaceholder:r,promptRegionClassName:n,promptInputClassName:a,interruptLabel:o,canInterrupt:s,sendButtonLabel:l,sendButtonClassName:d,sendDisabled:i,onPromptChange:h,onPromptKeyDown:u,onInterrupt:p}){return t.jsxs("div",{className:`${n} relative`,children:[t.jsx("textarea",{"aria-label":"Prompt",disabled:!1,value:e,onChange:m=>h(m.target.value),onKeyDown:u,rows:2,placeholder:r,className:`${a} resize-y pb-10`}),t.jsx("button",{type:"button","aria-label":o,title:o,onClick:()=>void(p==null?void 0:p()),disabled:!s,className:`absolute right-2.5 top-2.5 inline-flex h-8 w-8 items-center justify-center rounded-full border transition ${s?"border-rose-300/55 bg-rose-300/[0.14] text-rose-50 shadow-lg shadow-rose-950/20 hover:bg-rose-300/[0.22]":"cursor-not-allowed border-stone-700/30 bg-stone-400/[0.02] text-stone-500/55 opacity-55"}`,children:t.jsx("span",{"aria-hidden":"true",className:"block h-2.5 w-2.5 rounded-[2px] bg-current"})}),t.jsx("button",{type:"submit","aria-label":"Send Shell Input",onMouseDown:m=>{m.preventDefault()},onPointerDown:m=>{m.preventDefault()},onTouchStart:m=>{m.preventDefault()},disabled:i,className:`absolute bottom-2.5 right-2.5 rounded-full px-3.5 py-1.5 text-sm font-medium shadow-lg shadow-stone-950/30 transition disabled:cursor-not-allowed disabled:bg-stone-700 disabled:text-stone-300 ${d}`,children:l})]})}function Ap({isShellView:e,promptRef:r,prompt:n,disabled:a,promptPlaceholder:o,canInterrupt:s,interruptLabel:l,composerPromptRegionClassName:d,graphChatInputClassName:i,promptInputClassName:h,goalComposeMode:u,goalTokenBudget:p,goalLocalError:m,goalBusy:f,busy:g,sendButtonLabel:x,sendButtonClassName:k,onInterrupt:b,onPromptInput:y,onPromptPaste:w,onPromptKeyDown:v,onPromptKeyUp:N,onPromptMouseUp:j,onPromptBlur:S,onPromptDragEnter:P,onPromptDragOver:C,onPromptDragLeave:M,onPromptDrop:_,onGoalTokenBudgetChange:A,onCancelGoal:te,onShellPromptChange:W}){return{promptSlot:e?null:t.jsx(Ip,{promptRef:r,prompt:n,disabled:a,promptPlaceholder:o,canInterrupt:s,interruptLabel:l,composerPromptRegionClassName:d,graphChatInputClassName:i,onInterrupt:b,onInput:y,onPaste:w,onKeyDown:v,onKeyUp:N,onMouseUp:j,onBlur:S,onDragEnter:P,onDragOver:C,onDragLeave:M,onDrop:_}),goalSlot:u&&!e?t.jsx(zp,{tokenBudget:p,error:m,onTokenBudgetChange:A,onCancel:te}):null,shellPromptSlot:e?t.jsx(Rp,{prompt:n,promptPlaceholder:o,promptRegionClassName:d,promptInputClassName:h,interruptLabel:l,canInterrupt:s,sendButtonLabel:x,sendButtonClassName:k,sendDisabled:f||g,onPromptChange:W,onPromptKeyDown:v,onInterrupt:b}):null}}function Mp({collaborationMode:e,onUpdateSettings:r,closeMenu:n}){const[a,o]=c.useState(null),s=a??e;c.useEffect(()=>{o(null)},[e]);const l=c.useCallback(async d=>{const i=gm({nextMode:d.collaborationMode,previousOptimisticMode:a});i.optimisticMode&&o(i.optimisticMode);try{await(r==null?void 0:r(d)),i.closeMenuOnSuccess&&n()}catch(h){throw i.shouldRollbackMode&&o(i.rollbackMode),h}},[n,r,a]);return{displayedCollaborationMode:s,updateSettings:l}}function _p({isShellView:e,canToggleShellView:r,isMobileShell:n,shellPromptLabel:a,openMenu:o,toolbarClassName:s,iconButtonClassName:l,menuClassName:d,menuItemClassName:i,panelButtonClassName:h,chipButtonClassName:u,inlineToggleClassName:p,planToggleActiveClassName:m,sendButtonBaseClassName:f,slashPanelView:g,availableToolboxItems:x,busy:k,settingsBusy:b,compactBusy:y,forkBusy:w,fastMode:v,goalComposeMode:N,goalBusy:j,goalStatus:S,activeView:P,disabled:C,model:M,modelOptions:_,modelContextTitle:A,contextUsage:te,reasoningEffort:W,supportedEfforts:D,displayedCollaborationMode:q,sendButtonLabel:de,sendButtonClassName:L,modelControlsDisabled:Z,effortControlsDisabled:R,effortControlTitle:X,forkTurnOptionsState:F,skillsState:z,copiedSkillName:V,hooksPanelMode:H,hooksState:E,hookConfigBusy:T,hookConfigError:K,hookConfigSuccess:O,editingHookTarget:Q,hookScope:B,hookEventName:ce,hookMatcher:J,hookCommand:se,hookTimeoutSec:ue,hookStatusMessage:fe,mcpPanelMode:Ne,mcpState:Y,mcpConfigPath:G,mcpConfigError:re,mcpConfigSuccess:le,mcpConfigBusy:ge,mcpHttpName:me,mcpHttpUrl:ze,mcpRawBlock:Re,capabilities:Ee,shellControlState:Te,onToggleView:Pe,onDismissPromptFocus:$,onSetOpenMenu:ie,onToolboxItemClick:xe,onSetSlashPanelView:be,onOpenForkTurns:ve,onForkLatest:ye,onForkTurn:$e,onCopySkillInvokeName:Me,onResetHookForm:Ie,onSetHooksPanelMode:ot,onClearHookConfigStatus:We,onSetEditingHookTarget:Oe,onSetHookScope:Ze,onSetHookEventName:_e,onSetHookMatcher:oe,onSetHookCommand:qe,onSetHookTimeoutSec:Ke,onSetHookStatusMessage:nt,onSaveHook:tt,onStartEditingHook:at,onTrustHook:I,onUntrustHook:U,onSetMcpPanelMode:he,onClearMcpConfigStatus:Ce,onSetMcpHttpName:Ue,onSetMcpHttpUrl:Qe,onSetMcpRawBlock:lt,onPrepareRawMcpBlock:Ve,onSaveHttpMcp:Xe,onSaveRawMcpBlock:pe,onPickPhoto:Se,onPickFile:Je,onUpdateSettings:Fe,onPasteShell:At,onCopyShell:Mt,onClearShell:Zr,onShellControl:Jr}){const Qr=e?null:{open:o==="slash",slashPanelView:g,availableToolboxItems:x,busy:k,forkBusy:w,forkTurnOptionsState:F,skillsState:z,copiedSkillName:V,hooksPanelMode:H,hooksState:E,hostConfigFilesAvailable:Ee.hostConfigFiles,hookTrustAvailable:Ee.hookTrust,hookConfigBusy:T,hookConfigError:K,hookConfigSuccess:O,editingHookTarget:Q,hookScope:B,hookEventName:ce,hookMatcher:J,hookCommand:se,hookTimeoutSec:ue,hookStatusMessage:fe,mcpPanelMode:Ne,mcpState:Y,mcpConfigEditing:Ee.mcpConfigEditing,mcpConfigPath:G,mcpConfigError:re,mcpConfigSuccess:le,mcpConfigBusy:ge,mcpHttpName:me,mcpHttpUrl:ze,mcpRawBlock:Re,iconButtonClassName:l,menuClassName:d,menuItemClassName:i,panelButtonClassName:h,chipButtonClassName:u,onToggle:()=>ie(it=>it==="slash"?null:"slash"),onToolboxItemClick:xe,toolboxItemDisabled:it=>Um(it,{settingsBusy:b,compactBusy:y,busy:k,forkBusy:w}),toolboxItemClassName:it=>Wm(it,{fastMode:v,goalComposeMode:N,goalStatus:S,menuItemClassName:i}),toolboxItemStatus:it=>Om(it,{fastMode:v,compactBusy:y,goalComposeMode:N,goalStatus:S,busy:k}),onSetSlashPanelView:be,onOpenForkTurns:ve,onForkLatest:ye,onForkTurn:$e,onCopySkillInvokeName:Me,onResetHookForm:Ie,onSetHooksPanelMode:ot,onClearHookConfigStatus:We,onSetEditingHookTarget:Oe,onSetHookScope:Ze,onSetHookEventName:_e,onSetHookMatcher:oe,onSetHookCommand:qe,onSetHookTimeoutSec:Ke,onSetHookStatusMessage:nt,onSaveHook:tt,onStartEditingHook:at,onTrustHook:I,onUntrustHook:U,onSetMcpPanelMode:he,onClearMcpConfigStatus:Ce,onSetMcpHttpName:Ue,onSetMcpHttpUrl:Qe,onSetMcpRawBlock:lt,onPrepareRawMcpBlock:Ve,onSaveHttpMcp:Xe,onSaveRawMcpBlock:pe},en=e?null:{open:o==="attachments",iconButtonClassName:l,menuClassName:d,menuItemClassName:i,onToggle:()=>ie(it=>it==="attachments"?null:"attachments"),onPickPhoto:Se,onPickFile:Je},tn=e?null:{openMenu:o,model:M,modelOptions:_,modelContextTitle:A,contextUsage:te,reasoningEffort:W,supportedEfforts:D,displayedCollaborationMode:q,planModeAvailable:Ee.planMode,settingsBusy:b,goalComposeMode:N,goalBusy:j,activeView:P,disabled:C,fastMode:v,sendButtonLabel:de,sendButtonClassName:L,modelControlsDisabled:Z,effortControlsDisabled:R,effortControlTitle:X,inlineToggleClassName:p,menuItemClassName:i,planToggleActiveClassName:m,sendButtonBaseClassName:f,onSetOpenMenu:ie,onUpdateSettings:Fe};return{isShellView:e,canToggleShellView:r,isMobileShell:n,shellPromptLabel:a,openMenu:o,toolbarClassName:s,iconButtonClassName:l,slashToolboxProps:Qr,attachmentMenuProps:en,settingsToolbarProps:tn,shellToolsPanelProps:o==="shellTools"?{busy:k,shellControlState:Te,onPaste:At,onCopy:Mt,onClear:Zr,onShellControl:Jr}:null,shellControlState:Te,onToggleView:Pe,onDismissPromptFocus:$,onSetOpenMenu:ie}}function _n({activeView:e,edgeToEdgeMobile:r=!1,busy:n=!1,settingsBusy:a=!1,compactBusy:o=!1,error:s,model:l=null,reasoningEffort:d=null,fastMode:i=!1,collaborationMode:h="default",modelOptions:u=[],contextUsage:p=null,capabilities:m=null,toolboxItems:f=null,hookCommandTemplates:g=null,mcpConfigFormat:x="none",followTail:k=!1,threadConnected:b=!0,shellAvailable:y=!0,disabled:w=!1,disabledPlaceholder:v,shellControlState:N=null,draftPrompt:j,draftAttachments:S,skillsState:P={status:"idle",data:null,error:null},mcpState:C={status:"idle",data:null,error:null},hooksState:M={status:"idle",data:null,error:null},goalState:_={status:"idle",data:null,error:null},forkTurnOptionsState:A={status:"idle",data:null,error:null},onDraftChange:te,onSubmit:W,onInterrupt:D,onCompact:q,onOpenSkills:de,onOpenMcp:L,onOpenHooks:Z,onCreateHook:R,onUpdateHook:X,onTrustHook:F,onUntrustHook:z,onOpenGoal:V,onUpdateGoal:H,onOpenForkTurns:E,onForkLatest:T,onForkTurn:K,onReadProviderConfig:O,onWriteProviderConfig:Q,onToggleFollow:B,onUpdateSettings:ce,onToggleView:J,onShellCopy:se,onShellControl:ue,canInterrupt:fe=!1}){var va;const[Ne,Y]=c.useState(null),[G,re]=c.useState("root"),[le,ge]=c.useState("list"),me=c.useMemo(()=>({fast:(m==null?void 0:m.controls.performanceMode)??!1,compact:(m==null?void 0:m.turns.compact)??!1,goal:(m==null?void 0:m.controls.goals)??!1,fork:(m==null?void 0:m.branching.fork)??!1,skills:(m==null?void 0:m.management.skills)??!1,mcp:(m==null?void 0:m.management.mcpStatus)??!1,hooks:(m==null?void 0:m.management.hooks)??!1,hostConfigFiles:(m==null?void 0:m.management.hostConfigFiles)??!1,mcpConfigEditing:x==="codex-toml"&&!!(m!=null&&m.management.hostConfigFiles)&&!!O&&!!Q,hookTrust:(m==null?void 0:m.management.hookTrust)??!1,planMode:(m==null?void 0:m.controls.planMode)??!1}),[m,x,O,Q]),ze=c.useMemo(()=>(f??[]).filter(ee=>{switch(ee.action){case"fast":return me.fast;case"compact":return me.compact;case"goal":return me.goal;case"fork":return me.fork;case"skills":return me.skills;case"mcp":return me.mcp;case"hooks":return me.hooks;default:return!1}}),[me,f]),Re=c.useRef(null),Ee=c.useRef(null),Te=c.useRef(null),Pe=c.useRef(null),$=c.useRef(null),ie=c.useRef([]),xe=c.useRef(null),be=c.useRef(""),ve=c.useRef(0),ye=e==="shell",$e=y||ye,Me=!!(ye&&(N!=null&&N.isMobileShell)),Ie=(N==null?void 0:N.promptLabel)??null,[ot,We]=c.useState(!1),[Oe,Ze]=c.useState(0),{prompt:_e,attachments:oe,isDraftControlled:qe,updateDraft:Ke,flushControlledDraftToHost:nt}=kp({isShellView:ye,draftPrompt:j,draftAttachments:S,onDraftChange:te}),tt=bp({attachments:oe,isShellView:ye}),{displayedCollaborationMode:at,updateSettings:I}=Mp({collaborationMode:h,onUpdateSettings:ce,closeMenu:()=>Y(null)}),{forkBusy:U,forkLatest:he,forkTurn:Ce}=wp({slashPanelView:G,onForkLatest:T,onForkTurn:K,closeMenu:()=>Y(null)}),{hooksPanelMode:Ue,hookScope:Qe,hookEventName:lt,hookMatcher:Ve,hookCommand:Xe,hookTimeoutSec:pe,hookStatusMessage:Se,editingHookTarget:Je,hookConfigBusy:Fe,hookConfigError:At,hookConfigSuccess:Mt,setHooksPanelMode:Zr,setEditingHookTarget:Jr,setHookScope:Qr,setHookEventName:en,setHookMatcher:tn,setHookCommand:ia,setHookTimeoutSec:it,setHookStatusMessage:Pl,clearHookConfigStatus:da,resetHookForm:zl,startEditingHook:Il,saveHook:Rl,trustHook:Al,untrustHook:Ml}=Np({slashPanelView:G,hookCommandTemplates:g,onCreateHook:R,onUpdateHook:X,onTrustHook:F,onUntrustHook:z}),{goalComposeMode:qt,goalTokenBudget:_l,goalBusy:rn,goalLocalError:$l,setGoalTokenBudget:Dl,submitGoal:Bl,enterGoalComposeMode:Gl,exitGoalComposeMode:ca}=yp({prompt:_e,goalTokenBudgetSource:_.data,promptRef:Ee,onOpenGoal:V,onUpdateGoal:H,updateDraft:Ke,closeMenu:()=>Y(null),resetSlashPanel:()=>re("root")}),{mcpHttpName:Fl,mcpHttpUrl:Hl,mcpRawBlock:Ol,mcpConfigPath:Ul,mcpConfigBusy:Wl,mcpConfigError:Vl,mcpConfigSuccess:ql,setMcpHttpName:Kl,setMcpHttpUrl:Xl,setMcpRawBlock:Yl,clearMcpConfigStatus:ha,prepareRawMcpBlock:Zl,saveHttpMcp:Jl,saveRawMcpBlock:Ql}=Sp({hostConfigFilesAvailable:me.hostConfigFiles,onReadProviderConfig:O,onWriteProviderConfig:Q,setMcpPanelMode:ge,onOpenMcp:L}),{copiedSkillName:ei,copySkillInvokeName:ti}=Tp({openMenu:Ne,setOpenMenu:Y,slashPanelView:G,setSlashPanelView:re,setMcpPanelMode:ge,clearMcpConfigStatus:ha,clearHookConfigStatus:da}),ri=c.useCallback(ee=>{Ke(ke=>{if(typeof ee=="function"){const Le=ee(ke.prompt,ke.attachments);return{prompt:Le.prompt,attachments:Le.attachments??ke.attachments}}return{prompt:ee,attachments:ke.attachments}})},[Ke]),nn=c.useMemo(()=>u.find(ee=>ee.model===l)??null,[l,u]),ni=ym(l,p),ua=(nn==null?void 0:nn.supportedReasoningEfforts)??[],ai=c.useMemo(()=>lm(_e,oe),[oe,_e]),si=c.useMemo(()=>Object.entries(tt).sort(([ee],[ke])=>ee.localeCompare(ke)).map(([ee,ke])=>`${ee}:${ke}`).join("|"),[tt]);function oi(ee,ke){ke.stopPropagation();const Le=Hm(ee,{fastMode:i,goalComposeMode:qt});switch(Le.type){case"toggleFast":I({fastMode:Le.fastMode});break;case"runCompact":Y(null),q==null||q();break;case"enterGoalCompose":Gl();break;case"exitGoalCompose":ca(),Y(null);break;case"openPanel":re(Le.panel),Le.panel==="skills"?de==null||de():Le.panel==="mcp"?L==null||L():Le.panel==="hooks"&&(Z==null||Z());break}}function _t(){const ee=Ee.current;return ee?Km(ee):null}const li=c.useCallback(ee=>{const ke=Ee.current;!ke||!ee||Xm(ke,ee)},[]),ma=c.useCallback(()=>{const ee=Ee.current;return ee?il(ee):_e},[_e]),{appendAttachments:ii,appendDroppedAttachments:pa}=xp({prompt:_e,attachments:oe,updateDraft:Ke,getSelection:_t,selectionSnapshotRef:xe,pendingSelectionRef:$,pendingInsertedAttachmentIdsRef:ie,onInserted:()=>Y(null)});function fa(ee){if(!ee)return;const ke=_t()??xe.current,Le=(ke==null?void 0:ke.start)??_e.length,et=(ke==null?void 0:ke.end)??Le,st=om(ee),$t=`${_e.slice(0,Le)}${st}${_e.slice(et)}`;Ke(Oi=>({prompt:$t,attachments:Oi.attachments}));const jt=Le+st.length;$.current={start:jt,end:jt},xe.current={start:jt,end:jt}}Pp({promptRef:Ee,isShellView:ye,prompt:_e,promptSegments:ai,attachmentPreviewUrls:tt,previewSignature:si,editorSanitizeNonce:Oe,pendingSelectionRef:$,pendingInsertedAttachmentIdsRef:ie,selectionSnapshotRef:xe,renderedPreviewSignatureRef:be,renderedSanitizeNonceRef:ve,serializeEditorPrompt:ma,restoreSelection:li});function yt(){var ee;(ee=Ee.current)==null||ee.blur(),document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&document.activeElement.blur()}async function di(){var ee;if(yt(),Y(null),!!((ee=navigator.clipboard)!=null&&ee.readText))try{const ke=await navigator.clipboard.readText();fa(ke)}catch{return}}async function ga(){if(qe&&nt(),qt&&!ye){await Bl();return}const ee=um({prompt:_e,attachments:oe,isShellView:ye});!ee||await W(ee)===!1||Ke(()=>({prompt:"",attachments:[]}))}async function ci(ee){ee.preventDefault(),await ga()}function hi(){const ee=ma(),ke=_t();xe.current=ke;const Le=Ee.current;(Le?qm(Le):!1)&&($.current=ke,Ze(st=>st+1)),Ke(st=>({prompt:ee,attachments:st.attachments.filter($t=>ee.includes($t.placeholder))}),"deferred")}function ui(ee){var et,st,$t,jt;const ke=An((et=ee.clipboardData)==null?void 0:et.items,(st=ee.clipboardData)==null?void 0:st.files),Le=mm({files:ke,plainText:(($t=ee.clipboardData)==null?void 0:$t.getData("text/plain"))??"",htmlText:((jt=ee.clipboardData)==null?void 0:jt.getData("text/html"))??"",htmlToText:Vm});Le.preventDefault&&ee.preventDefault(),Le.type==="insert-text"?fa(Le.text):Le.type==="append-files"&&pa(Le.files)}function mi(ee){var Le,et;const ke=Ya(Qa((Le=ee.dataTransfer)==null?void 0:Le.items,(et=ee.dataTransfer)==null?void 0:et.files));ke.preventDefault&&ee.preventDefault(),ke.activateDragTarget&&We(!0)}function pi(ee){var Le,et;const ke=Ya(Qa((Le=ee.dataTransfer)==null?void 0:Le.items,(et=ee.dataTransfer)==null?void 0:et.files));ke.preventDefault&&ee.preventDefault(),ke.activateDragTarget&&ee.dataTransfer&&(ee.dataTransfer.dropEffect="copy"),ke.activateDragTarget&&We(!0)}function fi(ee){ee.currentTarget.contains(ee.relatedTarget)||We(!1)}function gi(ee){var et,st;const ke=An((et=ee.dataTransfer)==null?void 0:et.items,(st=ee.dataTransfer)==null?void 0:st.files),Le=pm(ke);Le.preventDefault&&ee.preventDefault(),Le.type==="accept-files"&&(We(!1),pa(Le.files??[]))}function xi(ee){const ke=fm({key:ee.key,metaKey:ee.metaKey,ctrlKey:ee.ctrlKey,busy:n,disabled:w});ke.preventDefault&&ee.preventDefault(),ke.submit&&ga()}const{promptPlaceholder:bi,interruptLabel:vi,sendButtonLabel:xa,sendButtonClassName:ba,modelControlsDisabled:ki,effortControlsDisabled:wi,effortControlTitle:yi}=Sm({goalComposeMode:qt,goalBusy:rn,threadConnected:b,busy:n,isShellView:ye,disabledPlaceholder:v,settingsBusy:a,supportedEffortCount:ua.length,fastMode:i}),{composerLayerClassName:ji,formClassName:Ni,composerShellClassName:Ci,composerToolbarClassName:Si,composerIconButtonClassName:Ti,composerMenuClassName:Ei,composerMenuItemClassName:Li,composerInlineToggleClassName:Pi,composerPanelButtonClassName:zi,composerChipButtonClassName:Ii,composerPlanToggleActiveClassName:Ri,composerSendButtonClassName:Ai,composerPromptRegionClassName:Mi,promptInputClassName:_i,graphChatInputGroupClassName:$i,graphChatInputClassName:Di}=Tm({isShellView:ye,edgeToEdgeMobile:r,isMobileShell:Me,openMenu:Ne!==null,isDragTargetActive:ot,busy:n}),Bi=_p({isShellView:ye,canToggleShellView:$e,isMobileShell:Me,shellPromptLabel:Ie,openMenu:Ne,toolbarClassName:Si,iconButtonClassName:Ti,menuClassName:Ei,menuItemClassName:Li,panelButtonClassName:zi,chipButtonClassName:Ii,inlineToggleClassName:Pi,planToggleActiveClassName:Ri,sendButtonBaseClassName:Ai,slashPanelView:G,availableToolboxItems:ze,busy:n,settingsBusy:a,compactBusy:o,forkBusy:U,fastMode:i,goalComposeMode:qt,goalBusy:rn,goalStatus:(va=_.data)==null?void 0:va.status,activeView:e,disabled:w,model:l,modelOptions:u,modelContextTitle:ni,contextUsage:p,reasoningEffort:d,supportedEfforts:ua,displayedCollaborationMode:at,sendButtonLabel:xa,sendButtonClassName:ba,modelControlsDisabled:ki,effortControlsDisabled:wi,effortControlTitle:yi,forkTurnOptionsState:A,skillsState:P,copiedSkillName:ei,hooksPanelMode:Ue,hooksState:M,hookConfigBusy:Fe,hookConfigError:At,hookConfigSuccess:Mt,editingHookTarget:Je,hookScope:Qe,hookEventName:lt,hookMatcher:Ve,hookCommand:Xe,hookTimeoutSec:pe,hookStatusMessage:Se,mcpPanelMode:le,mcpState:C,mcpConfigPath:Ul,mcpConfigError:Vl,mcpConfigSuccess:ql,mcpConfigBusy:Wl,mcpHttpName:Fl,mcpHttpUrl:Hl,mcpRawBlock:Ol,capabilities:{hostConfigFiles:me.hostConfigFiles,hookTrust:me.hookTrust,mcpConfigEditing:me.mcpConfigEditing,planMode:me.planMode},shellControlState:N,onToggleView:J,onDismissPromptFocus:yt,onSetOpenMenu:Y,onToolboxItemClick:oi,onSetSlashPanelView:re,onOpenForkTurns:()=>E==null?void 0:E(),onForkLatest:he,onForkTurn:Ce,onCopySkillInvokeName:ti,onResetHookForm:zl,onSetHooksPanelMode:Zr,onClearHookConfigStatus:da,onSetEditingHookTarget:Jr,onSetHookScope:Qr,onSetHookEventName:en,onSetHookMatcher:tn,onSetHookCommand:ia,onSetHookTimeoutSec:it,onSetHookStatusMessage:Pl,onSaveHook:Rl,onStartEditingHook:Il,onTrustHook:Al,onUntrustHook:Ml,onSetMcpPanelMode:ge,onClearMcpConfigStatus:ha,onSetMcpHttpName:Kl,onSetMcpHttpUrl:Xl,onSetMcpRawBlock:Yl,onPrepareRawMcpBlock:Zl,onSaveHttpMcp:Jl,onSaveRawMcpBlock:Ql,onPickPhoto:()=>{var ee;yt(),(ee=Te.current)==null||ee.click()},onPickFile:()=>{var ee;yt(),(ee=Pe.current)==null||ee.click()},onUpdateSettings:ee=>void I(ee),onPasteShell:()=>void di(),onCopyShell:()=>{yt(),Y(null),se==null||se()},onClearShell:()=>{yt(),Y(null),W({prompt:"clear"})},onShellControl:ee=>{yt(),Y(null),ue==null||ue(ee)}}),{promptSlot:Gi,goalSlot:Fi,shellPromptSlot:Hi}=Ap({isShellView:ye,promptRef:Ee,prompt:_e,disabled:w,promptPlaceholder:bi,canInterrupt:fe,interruptLabel:vi,composerPromptRegionClassName:Mi,graphChatInputClassName:Di,promptInputClassName:_i,goalComposeMode:qt,goalTokenBudget:_l,goalLocalError:$l,goalBusy:rn,busy:n,sendButtonLabel:xa,sendButtonClassName:ba,onInterrupt:D,onPromptInput:hi,onPromptPaste:ui,onPromptKeyDown:xi,onPromptKeyUp:()=>{xe.current=_t()},onPromptMouseUp:()=>{xe.current=_t()},onPromptBlur:()=>{xe.current=_t(),We(!1),qe&&nt()},onPromptDragEnter:mi,onPromptDragOver:pi,onPromptDragLeave:fi,onPromptDrop:gi,onGoalTokenBudgetChange:Dl,onCancelGoal:ca,onShellPromptChange:ri});return t.jsx(ap,{activeView:e,layerClassName:ji,formClassName:Ni,shellClassName:Ci,inputGroupClassName:$i,error:s,followTail:k,photoInputRef:Te,fileInputRef:Pe,onAppendAttachments:ii,onToggleFollow:B,onSubmit:ci,formRef:Re,promptSlot:Gi,toolbarSlot:t.jsx(pp,{...Bi}),goalSlot:Fi,shellPromptSlot:Hi})}var $p=c.createContext(null);function ta(){return c.useContext($p)}function Wr(e){return e?new Date(e).toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):"Time unavailable"}function ra(e){return e?new Date(e).toLocaleString():"Time unavailable"}function Dp(e){switch(e){case"idle":return"Idle";case"running":return"Running";case"interrupted":return"Interrupted";case"failed":return"Failed";case"not_loaded":return"Not Loaded";case"system_error":return"System Error"}}function Bp(e){switch(e){case"idle":return"ui-status-neutral";case"running":return"ui-status-info";case"interrupted":return"ui-status-warning";case"failed":case"system_error":return"ui-status-danger";case"not_loaded":return"ui-status-neutral"}}function dl(e){switch(e){case"sending":return"Sending";case"completed":return"Completed";case"interrupted":return"Interrupted";case"failed":return"Failed";case"inProgress":return"Running"}}function Gp({open:e,title:r,label:n,value:a,busy:o=!1,onChange:s,onCancel:l,onSubmit:d}){if(c.useEffect(()=>{if(!e)return;function h(u){u.key==="Escape"&&!o&&l()}return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h)}},[o,l,e]),!e)return null;function i(h){h.preventDefault(),d()}return Dr.createPortal(t.jsxs("div",{className:"fixed inset-0 z-[95] flex items-center justify-center p-4 sm:p-6",children:[t.jsx("button",{type:"button","aria-label":"Close rename dialog",onClick:l,disabled:o,className:"absolute inset-0 bg-stone-950/78 backdrop-blur-sm disabled:cursor-not-allowed"}),t.jsxs("form",{role:"dialog","aria-modal":"true","aria-label":r,onSubmit:i,className:"relative z-[1] w-full max-w-md rounded-[1.6rem] border border-stone-700 bg-stone-900 p-5 shadow-2xl shadow-stone-950/40 sm:p-6",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium text-stone-100",children:r}),t.jsx("p",{className:"mt-1 text-sm text-stone-500",children:"Changes are saved only after confirmation."})]}),t.jsx("button",{type:"button","aria-label":"Close dialog",onClick:l,disabled:o,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-stone-700 text-stone-300 transition hover:bg-stone-800 disabled:cursor-not-allowed disabled:opacity-60",children:t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-4 w-4 fill-current",children:t.jsx("path",{d:"M3.22 2.47 8 7.25l4.78-4.78 1.06 1.06L9.06 8.31l4.78 4.78-1.06 1.06L8 9.37l-4.78 4.78-1.06-1.06 4.78-4.78-4.78-4.78 1.06-1.06Z"})})})]}),t.jsxs("div",{className:"mt-5",children:[t.jsx("label",{htmlFor:"rename-dialog-input",className:"text-sm font-medium text-stone-200",children:n}),t.jsx("input",{id:"rename-dialog-input","aria-label":n,autoFocus:!0,value:a,onChange:h=>s(h.target.value),className:"mt-2 w-full rounded-2xl border border-stone-700 bg-stone-950 px-4 py-3 text-stone-100 outline-none transition focus:border-amber-300"})]}),t.jsxs("div",{className:"mt-5 flex items-center justify-end gap-2",children:[t.jsx("button",{type:"button",onClick:l,disabled:o,className:"rounded-full border border-stone-700 px-4 py-2 text-sm font-medium text-stone-300 transition hover:bg-stone-800 disabled:cursor-not-allowed disabled:opacity-60",children:"Cancel"}),t.jsx("button",{type:"submit",disabled:o||!a.trim(),className:"ui-action-success rounded-full px-4 py-2 text-sm font-medium transition disabled:cursor-not-allowed",children:"Save"})]})]})]}),document.body)}function Fp({children:e,effectiveTheme:r,layoutMode:n,themeMode:a,viewportConstrained:o}){return t.jsx("div",{className:`thread-ui-shell ${r==="dark"?"thread-ui-theme-dark dark":""} ${o?"thread-ui-viewport-constrained":""} ${o?"h-[100svh] max-h-[100svh] min-h-0 overflow-hidden overscroll-none":"min-h-[100svh] overflow-hidden"} bg-[#f6f8fb] text-slate-900 transition-colors duration-200 sm:p-2`,"data-theme-effective":r,"data-theme-mode":a??r,"data-thread-layout":n,children:e})}function Hp({children:e,roomsRailCollapsed:r}){return t.jsx("div",{className:`thread-shell-frame relative h-full min-h-0 ${r?"is-rail-collapsed sm:grid-cols-[56px_minmax(0,1fr)]":"sm:grid-cols-[264px_minmax(0,1fr)]"}`,children:e})}function Op({onClose:e,open:r}){return r?t.jsx("button",{type:"button","aria-hidden":"true",tabIndex:-1,className:"thread-mobile-only-block thread-mobile-scrim fixed inset-0 z-40 bg-slate-950/35 backdrop-blur-[1px]",onClick:e}):null}function Up({children:e,collapsed:r,mobileOpen:n}){return t.jsx("aside",{className:`thread-graph-rooms-surface thread-rooms-rail fixed inset-y-0 left-0 z-50 flex min-h-0 min-w-0 w-[min(20rem,calc(100vw-2rem))] flex-col overflow-x-hidden border-r border-slate-200/80 bg-white shadow-[0_20px_50px_rgba(15,23,42,0.18)] transition-transform duration-200 ease-out sm:static sm:z-auto sm:w-auto sm:translate-x-0 sm:rounded-[12px] sm:border sm:shadow-[0_10px_30px_rgba(15,23,42,0.04)] ${n?"translate-x-0":"pointer-events-none -translate-x-full sm:pointer-events-auto"} ${r?"thread-ui-rail-collapsed sm:items-center":""}`,children:e})}function Wp({children:e}){return t.jsx("main",{className:"thread-shell-main h-full min-h-0 min-w-0 overflow-hidden",children:t.jsx("div",{className:"thread-main-panel thread-shell-card flex h-full min-h-0 flex-col overflow-hidden bg-white shadow-[0_10px_30px_rgba(15,23,42,0.04)] sm:rounded-[12px] sm:border sm:border-slate-200/80",children:e})})}function Vp({children:e}){return t.jsx("div",{className:"thread-topbar-surface flex shrink-0 flex-col border-b border-slate-200 bg-white pt-[env(safe-area-inset-top)] sm:pt-0",children:e})}function qp({children:e}){return t.jsx("div",{className:"thread-split-region min-h-0 flex-1 overflow-hidden p-0 sm:p-2",children:e})}Ao();wt();function ss({...e}){return t.jsx(kd,{"data-slot":"dialog",...e})}function os({...e}){return t.jsx(wd,{"data-slot":"dialog-trigger",...e})}function Kp({...e}){return t.jsx(Sd,{"data-slot":"dialog-portal",...e})}function Xp({className:e,...r}){return t.jsx(Td,{"data-slot":"dialog-overlay",className:Ye("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",e),...r})}function ls({children:e,className:r,showCloseButton:n=!0,...a}){return t.jsxs(Kp,{"data-slot":"dialog-portal",children:[t.jsx(Xp,{}),t.jsxs(yd,{"data-slot":"dialog-content",className:Ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",r),...a,children:[e,n?t.jsxs(jd,{"data-slot":"dialog-close",className:"absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[t.jsx($s,{}),t.jsx("span",{className:"sr-only",children:"Close"})]}):null]})]})}function is({className:e,...r}){return t.jsx("div",{"data-slot":"dialog-header",className:Ye("flex flex-col gap-2 text-center sm:text-left",e),...r})}function ds({className:e,...r}){return t.jsx(Nd,{"data-slot":"dialog-title",className:Ye("text-lg font-semibold leading-none",e),...r})}function cs({className:e,...r}){return t.jsx(Cd,{"data-slot":"dialog-description",className:Ye("text-sm text-muted-foreground",e),...r})}var Yp=[{value:"system",label:"Follow system",icon:fd},{value:"dark",label:"Dark",icon:gd},{value:"light",label:"Light",icon:xd}];function Zp({thread:e,currentThreadId:r,currentWorkspaceId:n,workspaceLabels:a={},onOpenThread:o,getThreadHref:s,renderThreadLink:l,onBeginRenameThread:d,onDeleteThread:i,showDeleteButton:h=!1,showSessionCopyButton:u=!1,collapsed:p=!1}){const[m,f]=c.useState("idle"),g=c.useRef(null),x=a[e.workspaceId],k=x&&!n?x:null,b=r===e.id;c.useEffect(()=>()=>{g.current!==null&&window.clearTimeout(g.current)},[]);async function y(){const S=e.providerSessionId;if(S)try{await navigator.clipboard.writeText(S),f("copied"),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>f("idle"),1200)}catch{f("failed"),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>f("idle"),1600)}}const w=()=>o(e.id),v=`thread-graph-room-card group flex w-full items-center gap-3 rounded-xl border text-left transition ${b?"is-active":""} ${p?"justify-center px-2 py-2":"px-3 py-2.5"}`,N=t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`thread-graph-room-card-icon flex h-8 w-8 shrink-0 items-center justify-center rounded-full ${b?"is-active":""}`,children:t.jsx(Ds,{className:"h-4 w-4"})}),t.jsxs("div",{className:`min-w-0 flex-1 ${p?"thread-desktop-collapsed-hidden":""}`,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[t.jsx("p",{className:"thread-graph-room-card-title min-w-0 flex-1 truncate text-sm font-medium",title:e.title,children:e.title}),d&&!p?t.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),S.preventDefault(),d(e)},"aria-label":`Rename thread ${e.title}`,title:"Rename thread",className:"thread-card-quiet-button inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full transition",children:t.jsx(ud,{className:"h-3 w-3"})}):null,u&&e.providerSessionId?t.jsx("button",{type:"button","aria-label":"Copy session ID",title:m==="copied"?"Copied":m==="failed"?"Copy failed":"Copy session ID",onClick:S=>{S.stopPropagation(),S.preventDefault(),y()},className:"thread-card-quiet-button thread-card-session-copy-button inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full transition",children:t.jsx(Mr,{className:"h-3.5 w-3.5"})}):null]}),t.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-2",children:[k?t.jsx("p",{className:"thread-graph-room-card-meta min-w-0 flex-1 truncate text-[11px] text-[var(--theme-fg-muted)]",title:k,children:k}):t.jsx("span",{className:"min-w-0 flex-1","aria-hidden":"true"}),t.jsx("span",{className:`shrink-0 rounded-full border px-1.5 py-0.5 text-[9px] uppercase tracking-normal ${Bp(e.status)}`,children:Dp(e.status)}),t.jsx("time",{className:"shrink-0 text-[11px] text-[var(--theme-fg-muted)]",dateTime:e.lastTurnStartedAt??e.updatedAt,children:Wr(e.lastTurnStartedAt??e.updatedAt)})]})]}),h&&i&&!p?t.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),S.preventDefault(),i(e)},"aria-label":`Delete thread ${e.title}`,className:"thread-card-danger-button shrink-0 rounded-full p-1 transition",title:"Delete thread",children:t.jsx(lr,{className:"h-3.5 w-3.5"})}):null]}),j=s==null?void 0:s(e.id);return l?t.jsx(t.Fragment,{children:l({thread:e,children:N,className:v,onClick:w})}):j?t.jsx("a",{href:j,onClick:S=>{S.preventDefault(),w()},title:p?e.title:void 0,className:v,children:N}):t.jsx("div",{role:"link",tabIndex:0,onClick:w,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),w())},title:p?e.title:void 0,className:v,children:N})}function Jp({threads:e,currentThreadId:r,currentWorkspaceId:n,workspaceLabels:a={},onOpenThread:o,getThreadHref:s,renderThreadLink:l,onBeginRenameThread:d,onDeleteThread:i,scrollable:h=!1,maxHeightClassName:u="max-h-full",showDeleteButton:p=!1,showSessionCopyButton:m=!1,collapsed:f=!1}){const g=h?`min-h-0 min-w-0 overflow-x-hidden overflow-y-auto overscroll-contain pr-1 ${u}`:"";return t.jsx("div",{className:g,children:t.jsx("div",{className:"min-w-0 space-y-1",children:e.map(x=>t.jsx(Zp,{thread:x,currentThreadId:r,currentWorkspaceId:n,workspaceLabels:a,onOpenThread:o,showDeleteButton:p,showSessionCopyButton:m,collapsed:f,...s?{getThreadHref:s}:{},...l?{renderThreadLink:l}:{},...d?{onBeginRenameThread:d}:{},...i?{onDeleteThread:i}:{}},x.id))})})}function Qp({threads:e,status:r,loading:n=!1,error:a,viewportConstrained:o=!1,layoutMode:s="responsive",effectiveTheme:l,themeMode:d,onThemeModeChange:i,showMobileNewThreadShortcut:h=!0,mobileHeaderAction:u,currentThreadId:p,currentThreadLabel:m=null,currentWorkspaceId:f=null,currentWorkspaceLabel:g=null,sessionLabel:x=null,usageLabel:k=null,topbarActions:b,metaContent:y,settingsContent:w,globalSettingsContent:v,workspaceLabels:N={},workspaceReturnHref:j,onWorkspaceReturn:S,getThreadHref:P,onOpenThread:C,getNewThreadHref:M,newThreadHref:_,newThreadLabel:A="New Chat",onNewThread:te,onNewThreadTitle:W,renderThreadLink:D,onCloseAppNavigation:q,onRenameThread:de,onDeleteThread:L,workspaceContent:Z,workspaceTitle:R="Workspace",workspaceActions:X,children:F}){const z=ta(),[V,H]=c.useState(()=>typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)").matches:!1),E=d??(z==null?void 0:z.themeMode)??"system",T=l??(z==null?void 0:z.effectiveTheme)??(E==="system"?V?"dark":"light":E),[K,O]=c.useState(!1),[Q,B]=c.useState(!1),[ce,J]=c.useState(!1),[se,ue]=c.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 639px)").matches:s==="mobile"),[fe,Ne]=c.useState("chat"),[Y,G]=c.useState(null),[re,le]=c.useState(""),[ge,me]=c.useState(null),[ze,Re]=c.useState(!1),[Ee,Te]=c.useState(""),[Pe,$]=c.useState(!1),[ie,xe]=c.useState(!1),[be,ve]=c.useState("session");c.useEffect(()=>{if(typeof window>"u")return;const pe=window.matchMedia("(max-width: 639px)"),Se=()=>{ue(pe.matches)};return Se(),pe.addEventListener("change",Se),()=>{pe.removeEventListener("change",Se)}},[]),c.useEffect(()=>{if(typeof window>"u")return;const pe=window.matchMedia("(prefers-color-scheme: dark)"),Se=()=>{H(pe.matches)};return Se(),pe.addEventListener("change",Se),()=>{pe.removeEventListener("change",Se)}},[]);const ye=c.useMemo(()=>[...f?e.filter(Se=>Se.workspaceId===f):e].sort((Se,Je)=>{if(Se.id===p)return-1;if(Je.id===p)return 1;const Fe=Date.parse(Se.lastTurnStartedAt??Se.updatedAt);return Date.parse(Je.lastTurnStartedAt??Je.updatedAt)-Fe}),[p,f,e]),$e=_??(M==null?void 0:M(f)),Me=g??f??"all",Ie=x??m??p??"default_session",ot=k??(r!=null&&r.state?`runtime ${r.state}`:"waiting for agent usage"),We=i??(z==null?void 0:z.setThemeMode),Oe=!!We,Ze=()=>{O(!1),q==null||q()};async function _e(pe){if(!de)return;const Se=re.trim();if(Se){me(pe);try{await de(pe,Se),G(null),le("")}finally{me(null)}}}function oe(pe){G(pe.id),le(pe.title)}function qe(){G(null),le("")}function Ke(pe){C==null||C(pe),Ze()}function nt(pe){if(!$e||!pe.trim())return $e;try{const Se=new URL($e,window.location.origin);return Se.searchParams.set("title",pe.trim()),`${Se.pathname}${Se.search}${Se.hash}`}catch{const Se=$e.includes("?")?"&":"?";return`${$e}${Se}title=${encodeURIComponent(pe.trim())}`}}async function tt(){const pe=Ee.trim();$(!0);try{if(pe&&W){await W(pe),Te(""),Re(!1),Ze();return}if($e){window.location.assign(nt(pe)??$e);return}await(te==null?void 0:te()),Te(""),Re(!1),Ze()}finally{$(!1)}}function at(pe,Se=!1){const Je=Se?t.jsxs(t.Fragment,{children:[t.jsx(Nn,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:A})]}):t.jsxs(t.Fragment,{children:[t.jsx(Nn,{className:"h-4 w-4"}),t.jsx("span",{children:A})]});return t.jsxs(ss,{open:ze,onOpenChange:Fe=>{Pe||Re(Fe)},children:[t.jsx(os,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":Se?A:void 0,title:A,className:pe,children:Je})}),t.jsxs(ls,{"data-testid":"create-thread-dialog","data-theme-effective":T,"data-theme-mode":E,className:"thread-graph-create-thread-dialog thread-graph-dialog",children:[t.jsxs(is,{children:[t.jsx(ds,{children:"Create New Chat"}),t.jsx(cs,{children:"Name the room so it is easy to find later."})]}),t.jsxs("div",{className:"grid gap-3",children:[t.jsx("input",{id:"thread-graph-create-thread-title",name:"thread-title",value:Ee,onChange:Fe=>Te(Fe.target.value),onKeyDown:Fe=>{Fe.key==="Enter"&&(Fe.preventDefault(),tt())},placeholder:"Chat name","aria-label":"Chat name",autoComplete:"off",className:"thread-graph-create-thread-input h-10 rounded-md border px-3 text-sm outline-none transition"}),t.jsx("button",{type:"button",onClick:()=>void tt(),disabled:Pe,className:"thread-graph-create-thread-submit inline-flex h-10 items-center justify-center rounded-md px-4 text-sm font-medium transition disabled:cursor-not-allowed disabled:opacity-60",children:Pe?"Creating...":"Create"})]})]})]})}function I(){if(!w&&!y&&!v&&!Oe)return null;const pe=!!(w||y),Se=!!v,Je=be==="global"&&Se||!pe&&Se?"global":"session";return t.jsxs(ss,{children:[t.jsx(os,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":"Open settings",title:"Settings",className:"thread-icon-button inline-flex h-10 w-10 items-center justify-center rounded-full sm:h-9 sm:w-9",children:t.jsx(pd,{className:"h-4 w-4"})})}),t.jsxs(ls,{"data-testid":"settings-dialog","data-theme-effective":T,"data-theme-mode":E,className:"thread-graph-settings-dialog thread-graph-dialog",children:[t.jsxs(is,{children:[t.jsx(ds,{children:"Settings"}),t.jsx(cs,{children:"Manage this session and host-wide preferences."})]}),Oe?t.jsx("div",{className:"thread-graph-settings-card rounded-lg border p-3",children:t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"font-medium text-[var(--theme-fg)]",children:"Appearance"}),t.jsxs("p",{className:"mt-1 text-xs leading-5 text-[var(--theme-fg-muted)]",children:["Current theme: ",T]})]}),t.jsx("div",{className:"thread-graph-theme-mode-group grid grid-cols-3 gap-1 rounded-lg border p-1",role:"group","aria-label":"Theme mode",children:Yp.map(Fe=>{const At=Fe.icon,Mt=E===Fe.value;return t.jsxs("button",{type:"button","data-testid":`theme-mode-${Fe.value}`,"aria-pressed":Mt,disabled:!Oe,onClick:()=>We==null?void 0:We(Fe.value),className:`thread-graph-theme-mode-button inline-flex min-h-9 items-center justify-center gap-1.5 rounded-md px-2 text-xs font-medium transition ${Mt?"is-selected":""}`,children:[t.jsx(At,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:"truncate",children:Fe.label})]},Fe.value)})})]})}):null,t.jsxs("div",{className:"thread-graph-settings-tabs grid grid-cols-2 gap-1 rounded-lg border p-1",children:[t.jsx("button",{type:"button","aria-pressed":Je==="session",onClick:()=>ve("session"),className:`thread-graph-settings-tab-button rounded-md px-3 py-2 text-sm font-medium transition ${Je==="session"?"is-active":""}`,children:"Session"}),t.jsx("button",{type:"button","aria-pressed":Je==="global",disabled:!Se,onClick:()=>ve("global"),className:`thread-graph-settings-tab-button rounded-md px-3 py-2 text-sm font-medium transition ${Je==="global"?"is-active":""}`,children:"Global"})]}),t.jsx("div",{className:"thread-graph-settings-body mt-4 min-h-0 overflow-y-auto pr-1 text-sm",children:Je==="session"?t.jsxs("div",{className:"grid gap-4",children:[w?t.jsx("div",{className:"thread-graph-settings-card rounded-lg border p-3",children:w}):null,y?t.jsx("div",{className:"thread-graph-settings-card rounded-lg border p-3",children:y}):null,pe?null:t.jsx("div",{className:"thread-graph-settings-card rounded-lg border p-3 text-[var(--theme-fg-muted)]",children:"No session settings are available."})]}):t.jsx("div",{className:"thread-graph-settings-global-content",children:v})})]})]})}function U(pe=!1){return t.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:t.jsxs("section",{className:"flex min-h-0 flex-1 flex-col",children:[t.jsxs("div",{className:`mb-3 flex items-center gap-2 px-2 text-xs font-medium tracking-normal text-[var(--theme-fg-muted)] ${pe?"justify-center":""}`,children:[t.jsx(bd,{className:"h-3.5 w-3.5"}),t.jsx("span",{className:pe?"sr-only":"",children:"Rooms"}),!pe&&n?t.jsx("span",{className:"ml-auto text-xs text-[var(--theme-fg-muted)]",children:"Refreshing..."}):null]}),t.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto px-1",children:[a?t.jsx("div",{className:"rounded-xl border border-rose-500/30 bg-rose-500/10 px-3 py-3 text-sm text-rose-900 dark:text-rose-100",children:a}):null,!a&&ye.length===0&&!n?t.jsx("div",{className:"rounded-xl border border-dashed border-[var(--theme-border)] bg-[var(--theme-surface)] px-4 py-6 text-sm text-[var(--theme-fg-muted)]",children:"No threads available in this view."}):null,ye.length>0?t.jsx(Jp,{threads:ye,currentThreadId:p,currentWorkspaceId:f,workspaceLabels:N,onOpenThread:Ke,collapsed:pe,...de?{onBeginRenameThread:oe}:{},showDeleteButton:!!L,...P?{getThreadHref:P}:{},...D?{renderThreadLink:D}:{},...L?{onDeleteThread:L}:{}}):null]})]})})}function he(){return Z?t.jsxs("div",{className:"thread-workspace-panel relative flex h-full min-h-0 flex-col overflow-hidden rounded-[12px] border",children:[t.jsx("button",{type:"button",onClick:()=>J(!0),className:"thread-workspace-collapse-tab thread-desktop-only-inline-flex",title:"Collapse workspace","aria-label":"Collapse workspace",children:t.jsx(Sr,{className:"h-4 w-4"})}),X?t.jsx("div",{className:"pointer-events-none absolute right-12 top-2 z-20 flex items-center gap-1",children:t.jsx("div",{className:"pointer-events-auto",children:X})}):null,t.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:Z})]}):t.jsxs("div",{className:"thread-workspace-panel flex h-full min-h-0 flex-col overflow-hidden rounded-[12px] border",children:[t.jsxs("div",{className:"thread-workspace-panel-header flex h-12 shrink-0 items-center justify-between gap-3 border-b border-[var(--theme-border)] px-3 sm:h-[60px] sm:px-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-base font-semibold text-[var(--theme-fg)] sm:text-[18px]",children:R}),t.jsx("p",{className:"truncate text-xs text-[var(--theme-fg-muted)]",children:g??f??"Current context"})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[X,t.jsx("button",{type:"button",onClick:()=>J(!0),className:"thread-workspace-small-toggle thread-desktop-only-inline-flex",title:"Collapse workspace","aria-label":"Collapse workspace",children:t.jsx(Sr,{className:"h-4 w-4"})})]})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:Z??t.jsxs("div",{className:"grid h-full min-h-0 gap-3 overflow-y-auto p-3 text-sm text-[var(--theme-fg-soft)]",children:[t.jsxs("div",{className:"thread-workspace-card rounded-lg border p-3",children:[t.jsx("p",{className:"text-xs font-medium uppercase tracking-[0.14em] text-[var(--theme-fg-muted)]",children:"Runtime"}),t.jsx("p",{className:"mt-2 text-[var(--theme-fg)]",children:(r==null?void 0:r.state)??"unknown"})]}),t.jsxs("div",{className:"thread-workspace-card rounded-lg border p-3",children:[t.jsx("p",{className:"text-xs font-medium uppercase tracking-[0.14em] text-[var(--theme-fg-muted)]",children:"Workspace"}),t.jsx("p",{className:"mt-2 break-words text-[var(--theme-fg)]",children:g??f??"All threads"})]})]})})]})}const Ce=!!Z,Ue=s==="mobile"||s==="responsive"&&se,Qe=Ue,lt=Qe&&!K,Xe=!!(j||S)?t.jsx("a",{href:j??"#",onClick:pe=>{S&&(pe.preventDefault(),S())},className:"thread-icon-button inline-flex h-10 w-10 items-center justify-center rounded-full sm:h-9 sm:w-9",title:"Back to workspace","aria-label":"Back to workspace",children:t.jsx(md,{className:"h-4 w-4"})}):null;return t.jsxs(t.Fragment,{children:[t.jsx(Fp,{effectiveTheme:T,layoutMode:s,themeMode:E,viewportConstrained:o,children:t.jsxs(Hp,{roomsRailCollapsed:Q,children:[t.jsx(Op,{open:K,onClose:()=>O(!1)}),t.jsxs(Up,{collapsed:Q,mobileOpen:K,children:[t.jsx("div",{className:`thread-rooms-rail-header flex h-[calc(3.75rem+env(safe-area-inset-top))] shrink-0 items-end border-b border-[var(--theme-border)] px-4 pb-3 sm:h-16 sm:items-center sm:pb-0 ${Q?"sm:w-full sm:justify-center sm:px-2":""}`,children:t.jsxs("div",{className:`flex w-full items-center gap-3 ${Q?"sm:justify-center":"justify-between"}`,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[t.jsx("button",{type:"button",onClick:()=>B(pe=>!pe),className:"thread-icon-button thread-desktop-only-flex h-9 w-9 shrink-0 items-center justify-center rounded-full",title:Q?"Expand rooms":"Collapse rooms","aria-label":Q?"Expand rooms":"Collapse rooms",children:Q?t.jsx(dd,{className:"h-4 w-4"}):t.jsx(cd,{className:"h-4 w-4"})}),t.jsx("div",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-[var(--theme-accent-solid)] text-sm font-semibold text-[var(--theme-accent-solid-fg)] ${Q?"thread-desktop-collapsed-hidden":""}`,children:(g??"R").charAt(0).toUpperCase()}),t.jsxs("div",{className:`min-w-0 ${Q?"thread-desktop-collapsed-hidden":""}`,children:[t.jsx("p",{className:"truncate text-sm font-semibold text-[var(--theme-fg)]",children:g??"Remote Codex"}),t.jsx("p",{className:"truncate text-xs text-[var(--theme-fg-muted)]",children:f??"Thread workspace"})]})]}),t.jsxs("div",{className:`flex shrink-0 items-center gap-1 ${Q?"thread-desktop-collapsed-hidden":""}`,children:[I(),Xe,t.jsx("button",{type:"button",onClick:()=>O(!1),"aria-label":"Close rooms",title:"Close rooms",className:"thread-icon-button thread-mobile-only-inline-flex h-10 w-10 items-center justify-center rounded-full",children:t.jsx($s,{className:"h-4 w-4"})})]})]})}),t.jsx("div",{className:`thread-graph-new-room-strip flex shrink-0 items-center border-b ${Q?"h-12 w-full justify-center px-2 sm:h-12":"h-[68px] px-4"}`,children:at(`thread-graph-new-room-button inline-flex items-center justify-center rounded-xl font-medium transition ${Q?"h-9 w-9 p-0":"h-11 w-full gap-2 px-3 text-sm sm:h-9"}`,Q)}),t.jsx("div",{className:`flex min-h-0 flex-1 flex-col ${Q?"w-full px-2 py-2":"px-3 py-3"}`,children:U(Q)})]}),t.jsxs(Wp,{children:[t.jsxs(Vp,{children:[t.jsx("div",{className:"thread-topbar-row flex min-h-12 items-center px-3 py-1.5 sm:min-h-12 sm:px-4",children:t.jsxs("div",{className:"flex w-full items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 sm:gap-3",children:[lt?t.jsx("button",{type:"button",onClick:()=>O(!0),"aria-label":"Open rooms",title:"Open rooms",className:"thread-icon-button thread-mobile-only-inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full",children:t.jsx(hd,{className:"h-4 w-4"})}):null,t.jsxs("div",{className:"min-w-0",children:[Qe?t.jsx("h1",{className:"thread-mobile-only-block min-w-0 truncate text-sm font-semibold leading-none text-[var(--theme-fg)]",children:m??"Shared Workspace"}):null,t.jsxs("div",{className:"relative flex min-w-0 items-center gap-1.5",children:[t.jsxs("button",{type:"button",onClick:()=>{xe(pe=>!pe)},"aria-expanded":ie,"aria-haspopup":"dialog",className:"thread-topbar-meta-row flex min-w-0 max-w-full items-center gap-1 text-left text-[11px] leading-none sm:text-xs",title:"Session and usage",children:[t.jsx("span",{className:"shrink-0",children:"Room"}),t.jsx("span",{className:"truncate font-mono",children:Me})]}),ie?t.jsxs("div",{className:"thread-topbar-details-popover absolute left-0 top-[calc(100%+0.5rem)] z-50 w-[min(26rem,calc(100vw-1.5rem))] rounded-lg border p-2.5 shadow-lg",role:"dialog","aria-label":"Session and usage",children:[t.jsxs("button",{type:"button",onClick:()=>{var pe;Me&&((pe=navigator.clipboard)==null||pe.writeText(Me))},className:"thread-topbar-meta-row flex min-w-0 max-w-full items-center gap-2 text-left text-xs leading-5",title:"Copy room ID",children:[t.jsx("span",{className:"w-12 shrink-0",children:"Room"}),t.jsx("span",{className:"truncate font-mono",children:Me})]}),t.jsxs("button",{type:"button",onClick:()=>{var pe;Ie&&((pe=navigator.clipboard)==null||pe.writeText(Ie))},className:"thread-topbar-meta-row flex min-w-0 max-w-full items-center gap-2 text-left text-xs leading-5",title:"Copy session ID",children:[t.jsx("span",{className:"w-12 shrink-0",children:"Session"}),t.jsx("span",{className:"truncate font-mono",children:Ie})]}),t.jsxs("div",{className:"thread-topbar-meta-row mt-1 flex min-w-0 max-w-full items-center gap-2 text-xs leading-5",title:"Room token usage",children:[t.jsx("span",{className:"w-12 shrink-0",children:"Usage"}),t.jsx("span",{className:"truncate font-mono",children:ot})]})]}):null]})]})]}),t.jsxs("div",{className:"inline-flex shrink-0 items-center gap-2",children:[b?t.jsx("div",{className:"thread-graph-topbar-actions thread-desktop-only-inline-flex items-center rounded-lg border p-0.5 shadow-none",children:b}):null,Qe?u:null,Qe&&h?at("thread-secondary-action inline-flex h-10 items-center justify-center gap-2 rounded-lg border px-3 text-sm font-medium sm:h-9"):null]})]})}),Qe&&Ce?t.jsxs("div",{className:"thread-mobile-view-switch thread-mobile-only-grid grid-cols-2 gap-1 px-3 pb-2",children:[t.jsx("button",{type:"button",onClick:()=>Ne("chat"),className:`thread-mobile-segment h-10 rounded-lg text-sm font-medium transition ${fe==="chat"?"is-active":""}`,children:"Chat"}),t.jsx("button",{type:"button",onClick:()=>Ne("workspace"),className:`thread-mobile-segment h-10 rounded-lg text-sm font-medium transition ${fe==="workspace"?"is-active":""}`,children:"Workspace"})]}):null]}),t.jsx(qp,{children:Ce&&!ce?Ue?t.jsxs("div",{className:"thread-split-container thread-graph-shell-mobile-split h-full min-h-0 overflow-hidden",children:[t.jsx("div",{className:`h-full min-h-0 overflow-hidden ${fe==="chat"?"block":"thread-mobile-chat-hidden"}`,children:F}),t.jsx("div",{className:`h-full min-h-0 overflow-hidden ${fe==="workspace"?"block":"thread-mobile-workspace-hidden"}`,children:he()})]}):t.jsxs(Io,{direction:"horizontal",className:"thread-split-container thread-graph-shell-resizable thread-graph-shell-desktop-split h-full min-h-0 overflow-hidden",children:[t.jsx(zr,{defaultSize:47,minSize:30,maxSize:75,className:"thread-split-chat-pane min-w-0 overflow-hidden",children:F}),t.jsx(Ro,{className:"thread-resize-handle w-2 bg-transparent after:w-px after:bg-slate-200/80 after:transition-colors hover:after:bg-slate-300 dark:after:bg-[#303642] dark:hover:after:bg-[#475063]"}),t.jsx(zr,{defaultSize:53,minSize:30,maxSize:70,className:"thread-split-workspace-pane min-w-0 overflow-hidden",children:he()})]}):t.jsxs("div",{className:"thread-split-container relative h-full min-h-0 overflow-hidden",children:[Ce&&ce?t.jsx("button",{type:"button",onClick:()=>J(!1),className:"thread-workspace-expand-fab thread-desktop-only-inline-flex",title:"Expand workspace","aria-label":"Expand workspace",children:t.jsx(Wn,{className:"h-4 w-4"})}):null,F]})})]})]})}),t.jsx(Gp,{open:Y!==null,title:"Rename Thread",label:"Thread Title",value:re,busy:ge!==null,onChange:le,onCancel:qe,onSubmit:()=>Y?_e(Y):void 0})]})}function ef({open:e,title:r,text:n,onClose:a}){return c.useEffect(()=>{if(!e)return;function o(s){s.key==="Escape"&&a()}return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}},[a,e]),e?Dr.createPortal(t.jsxs("div",{className:"fixed inset-0 z-[90] flex items-center justify-center p-4 sm:p-6",children:[t.jsx("button",{type:"button","aria-label":"Close full text",onClick:a,className:"absolute inset-0 bg-stone-950/78 backdrop-blur-sm"}),t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":r,className:"relative z-[1] flex max-h-[min(82vh,52rem)] w-full max-w-4xl flex-col overflow-hidden rounded-[1.8rem] border border-stone-700 bg-stone-900 shadow-2xl shadow-stone-950/40",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-stone-800 px-4 py-3 sm:px-5",children:[t.jsx("p",{className:"truncate text-sm font-medium text-stone-100",children:r}),t.jsx("button",{type:"button","aria-label":"Close dialog",onClick:a,className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-stone-700 text-stone-300 transition hover:bg-stone-800",children:t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-4 w-4 fill-current",children:t.jsx("path",{d:"M3.22 2.47 8 7.25l4.78-4.78 1.06 1.06L9.06 8.31l4.78 4.78-1.06 1.06L8 9.37l-4.78 4.78-1.06-1.06 4.78-4.78-4.78-4.78 1.06-1.06Z"})})})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-4 py-4 sm:px-5",children:t.jsx("pre",{className:"whitespace-pre-wrap break-words text-sm leading-6 text-stone-200",children:n})})]})]}),document.body):null}var tf=[/^(?: {0,3})#{1,6}\s+\S/m,/^(?: {0,3})>{1,}\s*\S/m,/^(?: {0,3})(?:[-+*]|\d{1,9}[.)])\s+(?:\[[ xX]\]\s+)?\S/m,/^(?: {0,3})(?:```|~~~)/m,/^(?: {0,3})(?:[-*_]\s*){3,}$/m],rf=/^(?:\|?[^|\n]+\|[^|\n]+(?:\|[^|\n]+)*\|?\s*\n\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)+\|?\s*$)/m,nf=/!?\[[^\]\n]+\]\([^)]+\)/,af=/`[^`\n]+`/,sf=/(?:\*\*[^*\n]+\*\*|__[^_\n]+__)/,of=/(^|[^\w])(?:\*[^*\n]+\*|_[^_\n]+_)(?=[^\w]|$)/,lf=/~~[^~\n]+~~/;function df(e){const r=e.trim();return r?tf.some(n=>n.test(r))||rf.test(r)?!0:/[`[\]*_~!]/.test(r)?nf.test(r)||af.test(r)||sf.test(r)||of.test(r)||lf.test(r):!1:!1}Ur();function $n(e,r){const n=new Map(r.map(s=>[s.id,s])),a=e.map(s=>{var l,d;return{...s.manifest,enabled:((l=n.get(s.manifest.id))==null?void 0:l.enabled)??!0,source:((d=n.get(s.manifest.id))==null?void 0:d.source)??"builtin"}}),o=new Set(e.map(s=>s.manifest.id));for(const s of r)o.has(s.id)||a.push(s);return a}function na(e=[]){const r=$n(e,[]),n=e;return{plugins:r,loading:!1,error:null,async refresh(){},async importPluginManifest(){},async setPluginEnabled(){},async uninstallPlugin(){},renderArtifact:s=>{var d;const l=n.find(i=>i.renderArtifact&&i.manifest.capabilities.artifactTypes.some(h=>h.type===s.artifact.type));return((d=l==null?void 0:l.renderArtifact)==null?void 0:d.call(l,s))??null},renderInlineCode:s=>{for(const l of n)for(const d of l.inlineCodeRenderers??[]){if(!d.languages.includes(s.language.trim().toLowerCase()))continue;const i=d.render(s);if(i)return i}return null},hasRendererForArtifact:s=>n.some(l=>!!l.renderArtifact&&l.manifest.capabilities.artifactTypes.some(d=>d.type===s.type)),getThreadPanels:()=>n.flatMap(s=>s.threadPanels??[])}}var aa=c.createContext(na());function sa(){return c.useContext(aa)??na()}mr();function cl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function hs(e){return cl(e)?Object.entries(e):e==null||e===""?[]:[["value",e]]}function hl(e){return typeof e=="string"?t.jsxs("span",{className:"thread-graph-tool-string",children:['"',e,'"']}):typeof e=="number"?t.jsx("span",{className:"thread-graph-tool-number",children:e}):typeof e=="boolean"?t.jsx("span",{className:"thread-graph-tool-boolean",children:String(e)}):e===null?t.jsx("span",{className:"thread-graph-tool-null",children:"null"}):typeof e=="object"?t.jsx("span",{className:"thread-graph-tool-object",children:JSON.stringify(e)}):t.jsx("span",{children:String(e)})}function cf(e,r){return typeof r=="string"&&(e==="stdout"||e==="stderr"||e==="result")?t.jsx("pre",{className:"thread-graph-tool-output",children:r||"(empty)"}):typeof r=="object"&&r!==null?t.jsx("pre",{className:"thread-graph-tool-output",children:JSON.stringify(r,null,2)}):hl(r)}function us({callId:e,toolName:r,status:n,parameters:a,result:o}){const s=c.useMemo(()=>{switch(n){case"completed":return{className:"is-completed",icon:t.jsx($r,{className:"h-3.5 w-3.5"}),label:"Completed"};case"failed":return{className:"is-failed",icon:t.jsx(or,{className:"h-3.5 w-3.5"}),label:"Failed"};default:return{className:"is-pending",icon:t.jsx(_r,{className:"h-3.5 w-3.5 animate-spin"}),label:"Running"}}},[n]),l=c.useMemo(()=>hs(o),[o]),d=c.useMemo(()=>hs(a),[a]),i=c.useMemo(()=>typeof o=="string"?o.length>0:cl(o)?["stdout","stderr","result"].some(m=>{const f=o[m];return typeof f=="string"&&f.length>0}):!1,[o]),h=n==="pending"||i,[u,p]=c.useState(h?"item-1":void 0);return c.useEffect(()=>{h&&p("item-1")},[e,h]),t.jsx("div",{className:"thread-graph-tool-call my-2 w-full font-sans not-prose",children:t.jsx(dr,{type:"single",collapsible:!0,onValueChange:m=>p(m||void 0),className:"thread-graph-tool-accordion w-full overflow-hidden rounded-lg border",...u!==void 0?{value:u}:{},children:t.jsxs(cr,{value:"item-1",className:"border-0",children:[t.jsx(hr,{className:"thread-graph-tool-trigger px-4 py-3 hover:no-underline",children:t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(Un,{className:"h-4 w-4 shrink-0"}),t.jsx("span",{className:"min-w-0 truncate font-mono text-sm font-semibold",children:r}),t.jsxs("span",{className:`thread-graph-tool-badge ${s.className}`,title:s.label,"aria-label":`Status: ${s.label}`,children:[s.icon,t.jsx("span",{className:"thread-graph-status-label",children:s.label})]})]})}),t.jsxs(ur,{className:"thread-graph-tool-content px-4 pb-4 pt-1",children:[t.jsxs("section",{children:[t.jsx("h4",{children:"Parameters"}),t.jsxs("div",{className:"thread-graph-tool-json",children:["{",t.jsx("br",{}),d.length>0?d.map(([m,f],g)=>t.jsxs("div",{children:[t.jsxs("span",{className:"thread-graph-tool-key",children:['"',m,'"']}),t.jsx("span",{className:"thread-graph-tool-punctuation",children:": "}),hl(f),g<d.length-1?t.jsx("span",{className:"thread-graph-tool-punctuation",children:","}):null]},m)):t.jsx("div",{children:t.jsx("span",{className:"thread-graph-tool-null",children:"empty"})}),"}"]})]}),l.length>0?t.jsxs("section",{children:[t.jsx("h4",{children:"Result"}),t.jsxs("div",{className:"thread-graph-tool-json",children:["{",t.jsx("br",{}),l.map(([m,f],g)=>t.jsxs("div",{children:[t.jsxs("span",{className:"thread-graph-tool-key",children:['"',m,'"']}),t.jsx("span",{className:"thread-graph-tool-punctuation",children:": "}),cf(m,f),g<l.length-1?t.jsx("span",{className:"thread-graph-tool-punctuation",children:","}):null]},m)),"}"]})]}):null]})]})})})}var ms=null;function hf(){return ms??(ms=Promise.all([Be(()=>import("./core-DIQen2lE.js"),__vite__mapDeps([0,1,2])),Be(()=>import("./engine-javascript-DBd1bXLz.js"),[]),Be(()=>import("./ayu-light-BA47KaF1.js"),[]),Be(()=>import("./ayu-dark-DYE7WIF3.js"),[]),Be(()=>import("./javascript-wDzz0qaB.js"),[]),Be(()=>import("./typescript-BPQ3VLAy.js"),[]),Be(()=>import("./tsx-COt5Ahok.js"),[]),Be(()=>import("./jsx-g9-lgVsj.js"),[]),Be(()=>import("./python-B6aJPvgy.js"),[]),Be(()=>import("./json-Cp-IABpG.js"),[]),Be(()=>import("./shellscript-CEILq0vU.js").then(e=>e.b),[]),Be(()=>import("./shellscript-CEILq0vU.js").then(e=>e.s),[]),Be(()=>import("./yaml-Buea-lGh.js"),[]),Be(()=>import("./toml-vGWfd6FD.js"),[]),Be(()=>import("./markdown-Cvjx9yec.js"),[]),Be(()=>import("./html-pp8916En.js"),__vite__mapDeps([3,4,5])),Be(()=>import("./css-CLj8gQPS.js"),[]),Be(()=>import("./sql-CRqJ_cUM.js"),[]),Be(()=>import("./csv-fuZLfV_i.js"),[])]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:r},n,a,o,s,l,d,i,h,u,p,m,f,g,x,k,b,y])=>e({engine:r(),themes:[n.default,a.default],langs:[o.default,s.default,l.default,d.default,i.default,h.default,u.default,p.default,m.default,f.default,g.default,x.default,k.default,b.default,y.default]}))),ms}function Vr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Dn(e){if(!e)return{};if(Vr(e)&&Object.prototype.hasOwnProperty.call(e,"0"))try{const r=Object.keys(e).map(Number).filter(n=>Number.isFinite(n)).sort((n,a)=>n-a).map(n=>String(e[String(n)]??"")).join("");return JSON.parse(r)}catch{return e}if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}function Bn(){return{finalResult:null,stdout:"",stderr:""}}function uf(e){return typeof e=="string"?{result:e}:e}function ul(e){const r=Vr(e.finalResult)?{...e.finalResult}:e.finalResult!=null?{result:e.finalResult}:{};return e.stdout&&(r.stdout=e.stdout),e.stderr&&(r.stderr=e.stderr),!("status"in r)&&(e.stdout||e.stderr)&&(r.status="pending"),r}function ps(e){if(!e)return"pending";if(!Vr(e))return"completed";const r=e.status;return r==="stream"||r==="pending"||r==="running"?"pending":r==="failed"||r==="error"||r==="timed_out"||typeof e.exit_code=="number"&&e.exit_code!==0?"failed":"completed"}function mf(e){const r=new Map,n=/```tool-result\s*([\s\S]*?)\s*```/g,a=e.replace(n,(l,d)=>{try{const i=JSON.parse(d),h=i.call_id;if(typeof h!="string")return l;const u=uf(i.result),p=r.get(h)??Bn();return Vr(u)&&u.status==="stream"&&typeof u.chunk=="string"?u.stream==="stderr"?p.stderr+=u.chunk:p.stdout+=u.chunk:p.finalResult=u,r.set(h,p),""}catch{return l}}),o=/```tool-call\s*([\s\S]*?)\s*```/g;return{processedContent:a.replace(o,(l,d)=>{try{const i=JSON.parse(d),h=i.call_id,u=i.tool;if(typeof u!="string")return l;const p=Dn(i.args);if(typeof h=="string"&&r.has(h)){const m=ul(r.get(h)??Bn());return`\`\`\`tool-merged
3584
+ ${JSON.stringify({call:{tool:u,args:p,call_id:h},result:m},null,2)}
3585
+ \`\`\``}return l}catch{return l}}),resultMap:r}}function fs(e){return e.replace(/background-color:[^;"]+;?/g,"background-color: transparent;").replace(/background:[^;"]+;?/g,"background: transparent;")}function gs(e){return Array.isArray(e)?e.map(r=>String(r)).join(""):String(e??"")}function pf(e){if(!e||typeof e!="object"||!("position"in e))return{startLine:void 0,endLine:void 0};const r=e.position;if(!r||typeof r!="object")return{startLine:void 0,endLine:void 0};const n=r.start,a=r.end,o=n&&typeof n=="object"?n.line:void 0,s=a&&typeof a=="object"?a.line:void 0;return{startLine:typeof o=="number"?o:void 0,endLine:typeof s=="number"?s:void 0}}function ff({children:e,...r}){return gf(e)?t.jsx(t.Fragment,{children:e}):t.jsx("pre",{...r,children:e})}function gf(e){var n;if(!e||typeof e!="object"||!("props"in e))return!1;const r=(n=e.props)==null?void 0:n.className;return typeof r!="string"?!1:r.includes("language-tool-call")||r.includes("language-tool-merged")||r.includes("language-tool-result")}var xf=c.memo(function({className:r="thread-graph-markdown",content:n}){const a=c.useRef(null),o=sa(),[s,l]=c.useState(null),[d,i]=c.useState({}),[h,u]=c.useState(!1),{processedContent:p,resultMap:m}=c.useMemo(()=>mf(n),[n]);c.useEffect(()=>{let x=!0;return hf().then(k=>{x&&l(k)}).catch(()=>{}),()=>{x=!1}},[]),c.useEffect(()=>{const x=a.current,k=x==null?void 0:x.closest(".thread-ui-shell"),b=()=>k?k.getAttribute("data-theme-effective")==="dark"||k.classList.contains("dark")||k.classList.contains("thread-ui-theme-dark"):document.documentElement.classList.contains("dark");if(u(b()),!k)return;const y=new MutationObserver(()=>u(b()));return y.observe(k,{attributes:!0,attributeFilter:["class","data-theme-effective"]}),()=>y.disconnect()},[]);async function f(x,k){try{await navigator.clipboard.writeText(k),i(b=>({...b,[x]:"copied"})),window.setTimeout(()=>{i(b=>{const y={...b};return delete y[x],y})},1200)}catch{i(b=>({...b,[x]:"failed"}))}}const g=({children:x,className:k,inline:b,node:y,...w})=>{var _;const v=/language-(\w+(?:-\w+)*)/.exec(k||""),N=v?v[1]??"":"",j=gs(x).replace(/\n$/,""),{startLine:S,endLine:P}=pf(y),C=b===!1||!!k||j.includes(`
3586
+ `)||S!==P;if(N==="tool-merged"){let A={call:{tool:"Unknown",args:{},call_id:void 0},result:null};try{A=JSON.parse(j)}catch{A={call:{tool:"Error",args:{raw:j}},result:{status:"failed"}}}const te=typeof A.call.tool=="string"?A.call.tool:"Unknown",W=typeof A.call.call_id=="string"?A.call.call_id:void 0;return t.jsx(us,{callId:W,toolName:te,status:ps(A.result),parameters:Dn(A.call.args),result:A.result})}if(N==="tool-call"){let A={tool:"Unknown",args:{},call_id:void 0};try{A=JSON.parse(j)}catch{A={tool:"Error",args:{raw:j}}}const te=typeof A.call_id=="string"?A.call_id:void 0,W=te&&m.has(te)?ul(m.get(te)??Bn()):void 0;return t.jsx(us,{callId:te,toolName:typeof A.tool=="string"?A.tool:"Unknown",status:W?ps(W):"pending",parameters:Dn(A.args),result:W})}if(N==="tool-result")return null;if(["xyz","extxyz","cif","pdb"].includes(N)){const A=o.renderInlineCode({code:j,isIncomplete:!1,language:N});if(c.isValidElement(A))return A}if(C){const te=(((_=s==null?void 0:s.getLoadedLanguages)==null?void 0:_.call(s))??[]).includes(N)?N:"text",W=h?"ayu-dark":"ayu-light",D=`${N||"text"}:${j.length}:${j.slice(0,32)}`;let q="";if(s)try{q=fs(s.codeToHtml(j,{lang:te,theme:W}))}catch{q=fs(s.codeToHtml(j,{lang:"text",theme:W}))}return t.jsxs("div",{className:"thread-graph-code-block not-prose relative my-3 overflow-auto rounded-xl border p-3 text-sm shadow-sm",children:[t.jsx(sr,{type:"button",onClick:()=>void f(D,j),variant:"ghost",size:"sm",className:"thread-graph-code-copy absolute right-2 top-2 z-10 rounded-md p-1.5",title:d[D]==="copied"?"Copied":d[D]==="failed"?"Copy failed":"Copy","aria-label":"Copy code",children:t.jsx(Mr,{className:"h-3.5 w-3.5"})}),q?t.jsx("div",{dangerouslySetInnerHTML:{__html:q}}):t.jsx("pre",{children:t.jsx("code",{className:"whitespace-pre",children:j})})]})}const M=gs(x).replace(/`+/g,"");return t.jsx("code",{className:`thread-graph-inline-code rounded px-1 py-0.5 font-mono font-normal text-[0.9em] ${k||""}`,...w,children:M})};return t.jsx("div",{ref:a,className:`thread-graph-message-markdown ${r}`,children:t.jsx(vc,{remarkPlugins:[wc,yc],rehypePlugins:[kc],components:{code:g,pre:ff},children:p})})}),xs=4e3,bf=/\b(?:https?:\/\/|www\.)[^\s<>"'`]+/gi,vf=/[),.;:!?]+$/;function kf(e){return e.startsWith("www.")?`https://${e}`:e}function bs(e){const r=e.replace(/[\\/]+$/,"").trim();return r?r.split(/[\\/]/).filter(Boolean).at(-1)??r:""}function wf(e){var s;if(!e)return[];const r=/\[(PHOTO|FILE)\s+([^\]]+)\]/g,n=[];let a=0,o=0;for(const l of e.matchAll(r)){const d=l.index??0;d>a&&(n.push({type:"text",key:`text-${o}`,text:e.slice(a,d)}),o+=1);const i=l[1],h=((s=l[2])==null?void 0:s.trim())??"";i==="PHOTO"&&h?n.push({type:"photo",key:`photo-${o}`,path:h}):i==="FILE"&&h?n.push({type:"file",key:`file-${o}`,path:h}):n.push({type:"text",key:`text-${o}`,text:l[0]}),o+=1,a=d+l[0].length}return a<e.length&&n.push({type:"text",key:`text-${o}`,text:e.slice(a)}),n}function Ut({text:e}){var a;const r=[];let n=0;for(const o of e.matchAll(bf)){const s=o[0],l=o.index??0,d=((a=s.match(vf))==null?void 0:a[0])??"",i=d?s.slice(0,-d.length):s;i&&(l>n&&r.push(e.slice(n,l)),r.push(t.jsx("a",{href:kf(i),target:"_blank",rel:"noreferrer",className:"thread-inline-link",children:i},`${l}-${i}`)),d&&r.push(d),n=l+s.length)}return n<e.length&&r.push(e.slice(n)),t.jsx(t.Fragment,{children:r.length>0?r:e})}var ml=c.memo(function({text:r,scrollRootRef:n,streaming:a=!1,containerClassName:o="",plainTextClassName:s="thread-graph-plain-text whitespace-pre-wrap break-words text-[15px] leading-6",markdownClassName:l="thread-graph-markdown",onBeforeResize:d}){const i=c.useRef(null),h=c.useRef(null),[u,p]=c.useState(!1),m=df(r),f=!a&&r.length>xs,g=f&&!u?`${r.slice(0,xs).trimEnd()}
3587
+
3588
+ ...`:r,[x,k]=c.useState(a||typeof IntersectionObserver>"u"),b=c.useCallback(()=>{const y=n.current,w=i.current,v=(w==null?void 0:w.getBoundingClientRect().top)??null;d==null||d(),h.current=y&&v!==null?{root:y,top:v}:null,p(N=>!N)},[d,n]);return c.useLayoutEffect(()=>{const y=h.current,w=i.current;if(!y||!w)return;h.current=null;const v=()=>{const j=w.getBoundingClientRect().top;y.root.scrollTop+=j-y.top};v();const N=window.requestAnimationFrame(v);return()=>{window.cancelAnimationFrame(N)}},[u]),c.useEffect(()=>{if(a||typeof IntersectionObserver>"u"){k(!0);return}if(x||!i.current)return;const y=new IntersectionObserver(w=>{for(const v of w)if(v.isIntersecting){k(!0),y.disconnect();break}},{root:n.current,threshold:0});return y.observe(i.current),()=>{y.disconnect()}},[x,n,a]),t.jsxs("div",{ref:i,className:o,children:[x&&m?t.jsx(xf,{content:g,className:l}):t.jsx("p",{className:s,children:t.jsx(Ut,{text:g})}),f?t.jsx("button",{type:"button",onClick:b,className:"thread-graph-show-more timeline-meta-text mt-1.5 flex w-full items-center justify-center rounded-md border border-[var(--theme-border)] px-2 py-0.5 text-[10px] leading-4 transition hover:bg-[var(--theme-hover)] hover:text-[var(--theme-fg)]",children:u?"Show less":`Show more (${r.length.toLocaleString()} chars)`}):null]})}),yf=c.memo(function({text:r,scrollRootRef:n,streaming:a=!1,onBeforeResize:o}){return t.jsx(ml,{text:r,scrollRootRef:n,streaming:a,containerClassName:"thread-graph-message-prose",...o?{onBeforeResize:o}:{}})}),jf=c.memo(function({threadId:r,text:n,getImageAssetUrl:a}){const o=c.useMemo(()=>wf(n),[n]);return t.jsx("div",{className:"thread-graph-message-prose whitespace-pre-wrap break-words text-[15px] leading-6",children:o.map(s=>{if(s.type==="text")return t.jsx("span",{children:s.text},s.key);if(s.type==="photo"){const d=r?(a==null?void 0:a({threadId:r,path:s.path}))??null:null,i=bs(s.path)||"Attached image";return t.jsx("span",{className:"mx-[0.14rem] inline-flex align-middle",children:t.jsxs("span",{className:"inline-flex max-w-full flex-col rounded-[1rem] border border-sky-300/28 bg-sky-300/[0.08] p-1.5 shadow-sm shadow-stone-950/20",children:[d?t.jsx("img",{src:d,alt:i,className:"h-[4.5rem] w-[6rem] rounded-[0.75rem] bg-stone-950 object-contain",loading:"lazy"}):t.jsx("span",{className:"inline-flex h-[4.5rem] w-[6rem] items-center justify-center rounded-[0.75rem] bg-stone-950 text-[10px] text-sky-100",children:"PHOTO"}),t.jsx("span",{className:"mt-1 max-w-[7rem] truncate text-[10px] font-medium tracking-[0.08em] text-sky-50",title:s.path,children:i})]})},s.key)}const l=bs(s.path)||"Attached file";return t.jsx("span",{className:"mx-[0.14rem] inline-flex align-middle",children:t.jsxs("span",{className:"inline-flex max-w-[12rem] items-center gap-2 rounded-[0.95rem] border border-emerald-300/28 bg-emerald-300/[0.08] px-2.5 py-2 text-[10px] font-medium tracking-[0.08em] text-emerald-50 shadow-sm shadow-stone-950/20",title:s.path,children:[t.jsx("span",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-emerald-200/20 bg-emerald-300/12 text-[9px]",children:"FILE"}),t.jsx("span",{className:"min-w-0 truncate",children:l})]})},s.key)})})});function Nf(){return t.jsx("span",{className:"ml-1.5 inline-flex items-center gap-1","aria-hidden":"true",children:[0,1,2].map(e=>t.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-sky-200/90",style:{animationDelay:`${e*180}ms`}},e))})}function vs({status:e}){if(!e)return null;const r=e.toLowerCase(),n=r.includes("running")||r.includes("generating")||r.includes("steering"),a=r.includes("failed")||r.includes("error"),o=r.includes("accepted")||r.includes("complete"),s=n?"ui-status-warning":a?"ui-status-danger":o?"ui-status-success":"ui-status-neutral",l=n?t.jsx(_r,{className:"h-3.5 w-3.5 animate-spin"}):a?t.jsx(or,{className:"h-3.5 w-3.5"}):o?t.jsx($r,{className:"h-3.5 w-3.5"}):t.jsx(ld,{className:"h-3.5 w-3.5"});return t.jsxs("span",{className:`thread-graph-message-status inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-normal ${s}`,title:e,"aria-label":`Status: ${e}`,children:[t.jsx("span",{className:"thread-graph-message-status-icon inline-flex shrink-0",children:n?t.jsx(Nf,{}):l}),t.jsx("span",{className:"thread-graph-status-label",children:e})]})}function Cf({children:e,copyButton:r,kind:n,reasoning:a,status:o,timeLabel:s,timeTitle:l}){const d=n==="userMessage",i=s?t.jsx("time",{dateTime:l??void 0,title:l??void 0,className:"thread-graph-message-time text-[10px] leading-none sm:text-[11px]",children:s}):null;return t.jsx("div",{"data-testid":"chat-message","data-role":d?"user":"assistant",className:"thread-graph-message flex justify-start",children:t.jsxs("div",{className:`thread-graph-message-bubble min-w-0 w-full max-w-full ${d?"is-user":"is-assistant"}`,children:[d?null:t.jsxs("div",{className:"thread-graph-message-header mb-2 flex min-w-0 items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx("span",{className:"thread-graph-message-sender rounded-full px-2.5 py-1 text-xs font-semibold tracking-[0.02em]",children:"Assistant"}),t.jsx(vs,{status:o??"Complete"})]}),r||i?t.jsxs("div",{className:"thread-graph-message-header-actions flex shrink-0 items-center gap-1.5 sm:gap-2",children:[r,i]}):null]}),a,t.jsx("div",{className:`thread-graph-message-content min-w-0 ${d?"is-user":"is-assistant"}`,children:e}),d&&(o||i)?t.jsxs("div",{className:"mt-1 flex items-center justify-end gap-2",children:[o?t.jsx(vs,{status:o}):null,i]}):null]})})}mr();function fn(e){if(!e)return!1;const r=e.toLowerCase();return r.includes("running")||r.includes("inprogress")||r.includes("in_progress")}function Sf({tone:e="amber"}){const r=e==="sky"?"bg-sky-300/90":"bg-amber-200/90";return t.jsx("span",{className:"ml-1.5 inline-flex items-center gap-1","aria-hidden":"true",children:[0,1,2].map(n=>t.jsx("span",{className:`h-1.5 w-1.5 animate-pulse rounded-full ${r}`,style:{animationDelay:`${n*180}ms`}},n))})}var tr=c.memo(function({threadId:r,item:n,scrollRootRef:a,streaming:o=!1,adapter:s,timeLabel:l,timeTitle:d,onBeforeMessageResize:i}){const[h,u]=c.useState("idle"),[p,m]=c.useState(!1),f=c.useRef(null),g=n.kind==="agentMessage"?n.reasoningItems??[]:[],x=g.map(v=>v.text.trim()).filter(Boolean).join(`
3589
+
3590
+ `),k=n.kind==="userMessage"&&(n.status==="Steering"||n.status==="Accepted"||n.status==="Awaiting response");c.useEffect(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);async function b(){try{await navigator.clipboard.writeText(n.text),u("copied"),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>u("idle"),1200)}catch{u("failed"),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>u("idle"),1600)}}const y=n.kind==="agentMessage"?t.jsx("button",{type:"button","aria-label":"Copy agent reply",title:h==="copied"?"Copied":h==="failed"?"Copy failed":"Copy agent reply",onClick:()=>void b(),className:`thread-graph-message-copy inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border transition ${h==="copied"?"ui-status-info":h==="failed"?"ui-status-danger":""}`,children:t.jsx(Mr,{className:"h-3.5 w-3.5"})}):null,w=n.kind==="agentMessage"&&x?t.jsx("div",{className:"thread-graph-message-thinking mb-3 mt-2",children:t.jsx(dr,{type:"single",collapsible:!0,className:"thread-graph-thinking-accordion w-full border-none",onValueChange:v=>m(!!v),...p?{value:"thoughts"}:{},children:t.jsxs(cr,{value:"thoughts",className:"border-b-0",children:[t.jsx(hr,{className:"thread-graph-thinking-trigger py-2 hover:no-underline",children:t.jsxs("div",{className:"thread-graph-thinking-label flex items-center gap-2 text-sm font-medium transition-colors",children:[t.jsx(Ui,{className:`h-4 w-4 ${g.some(v=>fn(v.status))?"animate-pulse":""}`}),t.jsx("span",{children:g.some(v=>fn(v.status))?"Thinking...":"Thought Process"}),g.some(v=>fn(v.status))?t.jsx(Sf,{tone:"sky"}):null]})}),t.jsx(ur,{className:"thread-graph-thinking-content pb-0",children:t.jsx("pre",{className:"thread-graph-thinking-body my-1 max-h-56 overflow-auto whitespace-pre-wrap break-words rounded-xl border p-3 text-[12px] leading-5",children:t.jsx(Ut,{text:x})})})]})})}):null;return t.jsx(Cf,{kind:n.kind,status:k||n.kind==="agentMessage"?n.status:null,copyButton:y,reasoning:w,timeLabel:l,timeTitle:d,children:n.kind==="agentMessage"?t.jsx(yf,{text:n.text,scrollRootRef:a,streaming:o,...i?{onBeforeResize:i}:{}}):t.jsx(jf,{threadId:r,text:n.text,getImageAssetUrl:s==null?void 0:s.getImageAssetUrl})})});function ks(e){return e.replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}function pl(e){const r=e.trim().match(/^<hook_prompt(?:\s+hook_run_id="([^"]+)")?>([\s\S]*)<\/hook_prompt>$/);if(!r)return null;const n=r[1]?ks(r[1]):null,a=ks(r[2]??"").trim(),o=(n==null?void 0:n.split(":")[0])??"hook",s=o==="stop"?"Stop":o,l=(n==null?void 0:n.split(":").slice(2).join(":"))||null;return{id:`live-hook-prompt:${n??"unknown"}`,kind:"hook",text:`${s} hook`,previewText:a||`${s} hook`,detailText:a||null,status:"Completed",hookEventName:o,hookEventLabel:s,hookHandlerType:"command",hookScope:"turn",hookSource:l?"project":null,hookSourcePath:l,hookStatusMessage:null,hookOutputEntries:a?[{kind:"warning",text:a}]:[]}}function Tf(e){return e==="userMessage"||e==="agentMessage"}function Ef(e){return e==="commandExecution"||e==="webSearch"||e==="fileRead"||e==="fileChange"||e==="image"||e==="contextCompaction"}function Lf(e){return e==="agentMessage"||e==="reasoning"||e==="agentToolCall"||e==="skillToolCall"||e==="toolCall"||e==="plan"}function Pf(e,r){if(!r)return e;const n=[...e],a=n.findIndex(s=>s.kind==="userMessage");if(a<0)return n;for(let s=a+1;s<n.length;s+=1){const l=n[s];if(!l||l.kind!=="userMessage")continue;let d=s+1;for(;d<n.length&&Ef(n[d].kind);)d+=1;if(d===s+1)continue;const[i]=n.splice(s,1);n.splice(d-1,0,i),s=d-1}let o=!1;return n.map((s,l)=>s.kind!=="userMessage"?s:o?n.slice(l+1).some(i=>Lf(i.kind))?s:{...s,status:"Awaiting response"}:(o=!0,s))}function gt(e){return typeof e.sequence=="number"&&Number.isFinite(e.sequence)}function vr(e){return gt(e)?e.sequence:Number.POSITIVE_INFINITY}function ws(e){var h;const r=[];let n=0;for(;n<e.length&&((h=e[n])==null?void 0:h.kind)==="userMessage"&&!gt(e[n]);)r.push(e[n]),n+=1;const a=e.slice(n);if(!a.some(gt))return e;const o=a.map(u=>vr(u)).filter(Number.isFinite),s=o.length>0?Math.max(...o):0,l=[];let d=0;for(;d<a.length;){const u=a[d];if(gt(u)){l.push({item:u,index:d,order:vr(u)}),d+=1;continue}const p=d;for(;d<a.length&&!gt(a[d]);)d+=1;const m=a.slice(p,d),f=[...a.slice(0,p)].reverse().find(gt),g=a.slice(d).find(gt),x=f?vr(f):null,k=g?vr(g):null;m.forEach((b,y)=>{let w;if(x===null&&k!==null)w=k-(m.length-y)/(m.length+1);else if(x!==null&&k!==null&&k>x){const v=k-x;w=x+(y+1)/(m.length+1)*v}else w=s+1+y/(m.length+1);l.push({item:b,index:p+y,order:w})})}const i=l.sort((u,p)=>{const m=u.order-p.order;return m===0?u.index-p.index:m}).map(u=>u.item);return[...r,...i]}function zf(e,r){if(!r||r.length===0)return ws(e);const n=new Map(r.map(s=>[s.id,s])),a=e.map(s=>{const l=n.get(s.id);if(!l)return s;n.delete(s.id);const d={...s,...l,text:l.text||s.text},i=l.detailText??s.detailText,h=l.previewText??s.previewText,u=l.status??s.status,p=l.sequence??s.sequence;return i!==void 0&&(d.detailText=i),h!==void 0&&(d.previewText=h),u!==void 0&&(d.status=u),p!==void 0&&(d.sequence=p),d}),o=[...n.values()];return o.length===0&&!a.some(gt)||(a.push(...o),!a.some(s=>typeof s.sequence=="number"&&Number.isFinite(s.sequence)))?a:ws(a)}function If(e,r){if(!e)return"";const n=r.filter(i=>i.kind==="agentMessage").map(i=>i.text).filter(i=>i.length>0),a=n.at(-1)??"";if(a){const i=e.lastIndexOf(a);if(i>=0){const h=e.slice(i+a.length);return h.trim()?h:""}}const o=n.join("");if(!o)return e;const s=Math.min(e.length,o.length);let l=0;for(;l<s&&e[l]===o[l];)l+=1;if(l===0)return e;const d=e.slice(l);return d.trim()?d:""}function fl(e){if(!e)return!1;const r=e.toLowerCase();return r.includes("running")||r.includes("inprogress")||r.includes("in_progress")}function Ar(e){return e==="inProgress"||e==="sending"}function Rf(e){var i,h;const r=[];let n=0;const a=new Set,o=[];function s(){const u=r.at(-1);return(u==null?void 0:u.kind)!=="item"||u.item.kind!=="agentMessage"?null:u}function l(u,p){if(p.length!==0){u.item={...u.item,reasoningItems:[...u.item.reasoningItems??[],...p]};for(const m of p)a.add(m.id)}}function d(){const u=o.splice(0);for(const p of u)r.push({kind:"item",key:p.id,item:p})}for(;n<e.length;){const u=e[n];if(!u)break;if(a.has(u.id)){n+=1;continue}if(u.kind==="reasoning"){let f=n;const g=[];for(;f<e.length&&((i=e[f])==null?void 0:i.kind)==="reasoning";)g.push(e[f]),f+=1;const x=s();x?l(x,g):o.push(...g),n=f;continue}if(u.kind==="agentMessage"){const f=o.splice(0),g={kind:"item",key:u.id,item:u};l(g,f),r.push(g),n+=1;continue}if(u.kind!=="commandExecution"&&u.kind!=="fileChange"&&u.kind!=="webSearch"&&u.kind!=="fileRead"){r.push({kind:"item",key:u.id,item:u}),n+=1;continue}const p=[];for(;n<e.length&&((h=e[n])==null?void 0:h.kind)===u.kind;)p.push(e[n]),n+=1;if(p.length===1){r.push({kind:"item",key:p[0].id,item:p[0]});continue}const m=p.map(f=>f.id).join(":");if(u.kind==="commandExecution"){r.push({kind:"commandGroup",key:m,items:p});continue}if(u.kind==="fileChange"){r.push({kind:"fileChangeGroup",key:m,items:p});continue}if(u.kind==="fileRead"){r.push({kind:"fileReadGroup",key:m,items:p});continue}r.push({kind:"searchGroup",key:m,items:p})}return d(),r}function gl(e,r){return[...e.map(n=>({id:n.id,startedAt:n.startedAt??""})),...r?[{id:r.id,startedAt:r.startedAt??""}]:[]]}function rr(e,r,n){const a=e.get(r)??[];a.push(n),e.set(r,a)}function xl(e,r){return e.find(n=>r&&n.startedAt&&r.localeCompare(n.startedAt)<=0)}function Af({answeredRequestNotes:e,pendingRequests:r,visibleTurns:n,optimisticTurn:a}){const o=new Set(n.map(f=>f.id)),s=new Map,l=new Map,d=[],i=[];for(const f of e)f.turnId&&o.has(f.turnId)?rr(s,f.turnId,f):d.push(f);for(const f of r)f.turnId&&o.has(f.turnId)?rr(l,f.turnId,f):i.push(f);const h=gl(n,a),u=new Map,p=[],m=[...d.map(f=>({kind:"note",id:f.id,createdAt:f.createdAt??"",note:f})),...i.map(f=>({kind:"request",id:f.id,createdAt:f.createdAt,request:f}))].sort((f,g)=>f.createdAt.localeCompare(g.createdAt));for(const f of m){const g=xl(h,f.createdAt);if(!g){p.push(f);continue}rr(u,g.id,f)}return{notesByTurnId:s,pendingRequestsByTurnId:l,beforeTurnId:u,trailing:p}}function Mf({activityNotes:e,visibleTurns:r,optimisticTurn:n}){const a=[...e].sort((p,m)=>p.createdAt.localeCompare(m.createdAt)),o=gl(r,n),s=[],l=new Map,d=new Map,i=[],u=o.map(p=>p.startedAt).filter(p=>!!p).sort().at(-1)??null;for(const p of a){if(p.anchorTurnId==="__leading__"){s.push(p);continue}if(p.anchorTurnId){o.some(f=>f.id===p.anchorTurnId)?rr(d,p.anchorTurnId,p):s.push(p);continue}const m=xl(o,p.createdAt);if(!m){!u||p.createdAt.localeCompare(u)<=0?s.push(p):i.push(p);continue}rr(l,m.id,p)}return{leading:s,beforeTurnId:l,afterTurnId:d,trailing:i}}function bl({request:e,busy:r=!1,onRespond:n}){const[a,o]=c.useState({}),[s,l]=c.useState({}),[d,i]=c.useState(null),h=e.questions[0]??null,u="__other__",p=e.kind==="planDecision"?"Plan":e.kind==="requestUserInput"?"Answer Required":e.title;function m(b){const y=/\s*\(recommended\)\s*$/i.test(b);return{rawLabel:b,displayLabel:b.replace(/\s*\(recommended\)\s*$/i,"").trim(),recommended:y}}function f(b){h&&(i(b),n==null||n(e.id,{answers:{[h.id]:{answers:[b]}}}))}function g(b){const y=a[b.id]??"";return Array.isArray(y)?y.map(w=>w===u?(s[b.id]??"").trim():w.trim()).filter(Boolean).join(", "):y===u?(s[b.id]??"").trim():y.trim()}function x(b){const y=a[b.id]??"";if(Array.isArray(y))return y.map(v=>v===u?(s[b.id]??"").trim():v.trim()).filter(Boolean);if(y===u){const v=(s[b.id]??"").trim();return v?[v]:[]}const w=y.trim();return w?[w]:[]}function k(b,y){o(w=>{const v=w[b],N=Array.isArray(v)?v:[],j=N.includes(y)?N.filter(S=>S!==y):[...N,y];return{...w,[b]:j}})}return t.jsxs("div",{className:"timeline-pending-card w-full rounded-[1rem] border px-3 py-3 sm:rounded-[1.2rem] sm:px-4",children:[t.jsx("div",{className:"flex items-center justify-between gap-3",children:t.jsxs("div",{children:[t.jsx("p",{className:"timeline-primary-text text-sm font-medium",children:p}),e.kind!=="planDecision"&&e.description&&t.jsx("p",{className:"timeline-soft-text mt-1 text-[13px] leading-5",children:e.description})]})}),t.jsx("div",{className:"mt-3 space-y-3",children:e.questions.map(b=>t.jsxs("div",{className:"timeline-question-section rounded-xl border p-2.5 sm:p-3",children:[t.jsx("p",{className:"timeline-meta-text text-xs uppercase tracking-[0.2em]",children:b.header}),t.jsx("p",{className:"timeline-primary-text mt-1 text-[13px] leading-5 sm:text-sm",children:b.question}),e.kind==="planDecision"&&b.options&&b.options.length>0?t.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:b.options.map((y,w)=>{const v=m(y.label),N=v.displayLabel.toLowerCase()==="implement";return t.jsxs("button",{type:"button",disabled:r,onClick:()=>f(y.label),className:`relative rounded-2xl border px-2.5 py-1.5 pr-6 text-[12px] leading-4 transition sm:text-[13px] ${w===0?"ui-action-info":"border-stone-700 text-stone-200 hover:bg-stone-800"} disabled:cursor-not-allowed disabled:opacity-60`,title:y.description,children:[v.recommended?t.jsx("span",{"aria-hidden":"true",className:"absolute right-1.5 top-1 inline-flex h-3.5 w-3.5 items-center justify-center rounded-full bg-white/18 text-[10px] leading-none text-current",children:"✦"}):null,r&&d===y.label?N?"Starting...":"Saving...":v.displayLabel]},y.label)})}):b.options&&b.options.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[b.options.map(y=>{const w=m(y.label),v=a[b.id];return t.jsxs("button",{type:"button",disabled:r,onClick:()=>b.multiSelect?k(b.id,y.label):o(N=>({...N,[b.id]:y.label})),className:`relative rounded-2xl border px-3 py-1.5 pr-6 text-[12px] leading-4 transition sm:text-[13px] ${(b.multiSelect?Array.isArray(v)&&v.includes(y.label):v===y.label)?"ui-status-warning":"border-stone-700 text-stone-300 hover:bg-stone-800"} disabled:cursor-not-allowed disabled:opacity-60`,title:y.description,children:[w.recommended?t.jsx("span",{"aria-hidden":"true",className:"absolute right-1.5 top-1 inline-flex h-3.5 w-3.5 items-center justify-center rounded-full bg-white/10 text-[10px] leading-none text-amber-100/90",children:"✦"}):null,w.displayLabel]},y.label)}),b.isOther&&(()=>{const y=a[b.id];return t.jsx("button",{type:"button",disabled:r,onClick:()=>b.multiSelect?k(b.id,u):o(w=>({...w,[b.id]:u})),className:`rounded-2xl border px-3 py-1.5 text-[12px] leading-4 transition sm:text-[13px] ${(b.multiSelect?Array.isArray(y)&&y.includes(u):y===u)?"ui-status-info":"border-stone-700 text-stone-300 hover:bg-stone-800"} disabled:cursor-not-allowed disabled:opacity-60`,children:"Not from above"})})()]}),b.isOther&&(()=>{const y=a[b.id];return(b.multiSelect?Array.isArray(y)&&y.includes(u):y===u)?t.jsx("input",{"aria-label":`${b.header} custom answer`,value:s[b.id]??"",onChange:v=>l(N=>({...N,[b.id]:v.target.value})),placeholder:"Enter a custom answer",className:"mt-3 w-full rounded-xl border border-stone-700 bg-stone-900 px-3 py-2 text-sm text-stone-100 outline-none transition focus:border-sky-300"}):null})()]}):t.jsx("input",{"aria-label":b.header,value:a[b.id]??"",onChange:y=>o(w=>({...w,[b.id]:y.target.value})),className:"mt-3 w-full rounded-xl border border-stone-700 bg-stone-900 px-3 py-2 text-sm text-stone-100 outline-none transition focus:border-amber-300"})]},b.id))}),e.kind!=="planDecision"&&t.jsx("div",{className:"mt-3 flex justify-end",children:t.jsx("button",{type:"button",disabled:r||e.questions.some(b=>!g(b)),onClick:()=>void(n==null?void 0:n(e.id,{answers:Object.fromEntries(e.questions.map(b=>[b.id,{answers:x(b)}]))})),className:"ui-action-info rounded-full px-4 py-2 text-sm font-medium transition disabled:cursor-not-allowed",children:r?"Submitting...":"Submit"})})]})}function vl({note:e}){return t.jsxs("div",{className:"timeline-note-card w-full rounded-2xl border px-3 py-2.5",children:[t.jsx("p",{className:"timeline-meta-text text-[11px] uppercase tracking-[0.2em]",children:e.title}),t.jsx("div",{className:"mt-1 space-y-1",children:e.summaryLines.map((r,n)=>t.jsxs("p",{className:"timeline-primary-text text-[13px] leading-5",children:["You selected ",r]},`${e.id}-${n}`))})]})}function kl({note:e,onOpenThread:r,onOpenLinkedThread:n}){const a=e.kind==="forkCreated"?"Fork":e.kind==="forkSource"?"Fork source":"System",o=e.kind==="forkCreated"?`Thread forked from Turn ${e.turnIndex??"?"}`:e.kind==="forkSource"?`Forked from ${e.linkedThreadTitle??"source thread"} at Turn ${e.turnIndex??"?"}`:e.text??"";return t.jsxs("div",{className:"timeline-activity-card w-full rounded-2xl border px-3 py-2.5",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("p",{className:"timeline-meta-text text-[11px] uppercase tracking-[0.2em]",children:a}),t.jsx("time",{dateTime:e.createdAt,title:ra(e.createdAt),className:"timeline-meta-text text-[10px]",children:Wr(e.createdAt)})]}),t.jsx("p",{className:"timeline-primary-text mt-1 text-[13px] leading-5",children:o}),e.linkedThreadId?t.jsx("button",{type:"button",onClick:()=>{const s=e.linkedThreadId;s&&(n==null||n(s),r==null||r(s))},className:"relative z-10 mt-2 inline-flex cursor-pointer rounded-full border border-amber-300/30 px-3 py-1.5 text-xs text-amber-100 transition hover:bg-amber-300/10",children:e.kind==="forkCreated"?"Open fork":"Back to source"}):null]})}function Yt({notes:e,onOpenThread:r,onOpenLinkedThread:n}){return e.length===0?null:t.jsx("div",{className:"thread-graph-message-section space-y-3 px-3 py-4 sm:px-5",children:e.map(a=>t.jsx(kl,{note:a,onOpenThread:r,onOpenLinkedThread:n},a.id))})}function Gn({entries:e,respondingRequestId:r,onRespondToRequest:n}){return e.length===0?null:t.jsx("div",{className:"thread-graph-message-section space-y-3 px-3 py-4 sm:px-5",children:e.map(a=>a.kind==="note"?t.jsx(vl,{note:a.note},a.id):t.jsx(bl,{request:a.request,busy:r===a.request.id,onRespond:n},a.id))})}function _f({notes:e,requests:r,respondingRequestId:n,onRespondToRequest:a}){const o=[...e.map(s=>({kind:"note",id:s.id,createdAt:s.createdAt??"",note:s})),...r.map(s=>({kind:"request",id:s.id,createdAt:s.createdAt,request:s}))].sort((s,l)=>s.createdAt.localeCompare(l.createdAt));return t.jsx(Gn,{entries:o,respondingRequestId:n,onRespondToRequest:a})}function $f({entries:e,respondingRequestId:r,onRespondToRequest:n,onOpenThread:a,onOpenLinkedThread:o}){return e.length===0?null:t.jsx("div",{className:"thread-graph-message-section space-y-3 px-3 py-4 sm:px-5",children:[...e].sort((s,l)=>s.createdAt.localeCompare(l.createdAt)).map(s=>s.kind==="activity"?t.jsx(kl,{note:s.note,onOpenThread:a,onOpenLinkedThread:o},s.id):s.kind==="note"?t.jsx(vl,{note:s.note},s.id):t.jsx(bl,{request:s.request,busy:r===s.request.id,onRespond:n},s.id))})}function Df({entries:e,expandedGroups:r,onToggleGroupedItem:n,renderCommandGroup:a,renderFileChangeGroup:o,renderFileReadGroup:s,renderItem:l,renderSearchGroup:d}){return t.jsx(t.Fragment,{children:e.map(i=>{const h=r[i.key]??!1,u=()=>n(i.key);return i.kind==="commandGroup"?a(i,h,u):i.kind==="fileChangeGroup"?o(i,h,u):i.kind==="searchGroup"?d(i,h,u):i.kind==="fileReadGroup"?s(i,h,u):l(i)})})}function qr({children:e,className:r,count:n,countBadgeClassName:a,desktopIconClassName:o,expanded:s,expandedListClassName:l,icon:d,onToggleExpanded:i,runningIndicator:h,summary:u,toggleAriaLabel:p,trailingSummary:m}){return t.jsx("div",{className:`thread-graph-history-group ${r} relative min-w-0 w-full overflow-hidden rounded-[0.9rem] border px-3 py-2.5`,children:t.jsxs("div",{className:"flex items-start gap-2.5",children:[t.jsxs("div",{className:"thread-graph-history-group-icon mt-0.5 flex shrink-0 items-center",children:[t.jsxs("span",{className:`relative inline-flex h-8 w-8 items-center justify-center rounded-[0.9rem] border shadow-sm shadow-stone-950/20 ${o}`,children:[d,t.jsx("span",{className:`absolute -right-1 -top-1 inline-flex min-w-[1.1rem] items-center justify-center rounded-full border bg-stone-950/90 px-1 text-[9px] font-semibold leading-4 ${a}`,children:n})]}),h]}),t.jsxs("div",{className:"thread-graph-history-group-card min-w-0 flex-1 rounded-[0.85rem] border px-3 py-2",children:[t.jsxs("button",{type:"button","aria-expanded":s,"aria-label":p,onClick:i,className:"thread-graph-history-group-toggle flex w-full min-w-0 items-center justify-between gap-3 text-left",children:[t.jsx("div",{className:"thread-graph-history-group-summary min-w-0 flex flex-1 flex-wrap items-center gap-2 pr-1",children:u}),m]}),s?t.jsx("div",{className:`thread-graph-history-group-list mt-3 space-y-2 border-t pt-3 ${l}`,children:e}):null]})]})})}mr();wt();var Bf=ir("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium outline-none transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Kr({asChild:e=!1,className:r,variant:n,...a}){const o=e?_s:"span";return t.jsx(o,{"data-slot":"badge",className:Ye(Bf({variant:n,className:r})),...a})}function Xr(e){if(!e)return!1;const r=e.trim().toLowerCase();return r==="running"||r==="in_progress"||r==="in progress"||r==="pending"}function Gf(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M5 2.75h4l2 2v6.5a1.5 1.5 0 0 1-1.5 1.5h-4A1.5 1.5 0 0 1 4 11.25v-7A1.5 1.5 0 0 1 5.5 2.75Z"}),t.jsx("path",{d:"M9 2.75v2h2"}),t.jsx("path",{d:"M6.2 8h3.6"}),t.jsx("path",{d:"M6.2 10h1.7"})]})}function Ff(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M5 2.75h4l2 2v6.5a1.5 1.5 0 0 1-1.5 1.5h-4A1.5 1.5 0 0 1 4 11.25v-7A1.5 1.5 0 0 1 5.5 2.75Z"}),t.jsx("path",{d:"M9 2.75v2h2"}),t.jsx("path",{d:"M6.15 7.25h3.7"}),t.jsx("path",{d:"M6.15 9.25h2.8"}),t.jsx("path",{d:"m10.4 10.7 1.2 1.2"}),t.jsx("circle",{cx:"9.25",cy:"9.55",r:"1.45"})]})}function Hf(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("rect",{x:"2.75",y:"3",width:"8.5",height:"3",rx:"1.1"}),t.jsx("rect",{x:"4.25",y:"6.5",width:"8.5",height:"3",rx:"1.1"}),t.jsx("rect",{x:"5.75",y:"10",width:"7.5",height:"3",rx:"1.1"}),t.jsx("path",{d:"m6.25 4.5 1 1-1 1"}),t.jsx("path",{d:"M7.9 5.5h1.7"}),t.jsx("path",{d:"m7.75 8 1 1-1 1"}),t.jsx("path",{d:"M9.4 9h1.7"})]})}function Of(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"6",cy:"6",r:"2.3"}),t.jsx("path",{d:"m8 8 1.6 1.6"}),t.jsx("circle",{cx:"9.3",cy:"8.8",r:"2"}),t.jsx("path",{d:"m10.75 10.25 1.65 1.65"}),t.jsx("circle",{cx:"11.2",cy:"4.75",r:"1.8"}),t.jsx("path",{d:"m12.45 6 1.1 1.1"})]})}function Uf(e){const r=e.trim();if(!r)return"";const n=r.match(/(, \+\d+ more.*)$/),a=(n==null?void 0:n[1])??"",s=(a?r.slice(0,-a.length):r).replace(/\\/g,"/");if(!s.startsWith("/"))return`${s.replace(/^\.\//,"")}${a}`;const l=["/apps/","/packages/","/src/","/test/","/tests/","/docs/","/config/","/scripts/","/e2e/","/.agents/","/.codex/"];for(const d of l){const i=s.indexOf(d);if(i>=0)return`${s.slice(i+1)}${a}`}return r}function wl(e,r=42){const n=Uf(e);if(!n)return"";const a=n.match(/(, \+\d+ more.*)$/),o=(a==null?void 0:a[1])??"",s=o?n.slice(0,-o.length):n;if(s.length<=r)return`${s}${o}`;const d=s.replace(/\\/g,"/").split("/").filter(Boolean);if(d.length>1){const i=[];let h=o.length+4;for(let u=d.length-1;u>=0;u-=1){const p=d[u],m=h+p.length+(i.length>0?1:0);if(i.length>0&&m>r)break;i.unshift(p),h=m}if(i.length>0)return`.../${i.join("/")}${o}`}return`...${s.slice(-(r-o.length-3))}${o}`}function Wf(e){var a;const r=[];if(typeof e.changedFiles=="number"&&e.changedFiles>0&&r.push(`${e.changedFiles} ${e.changedFiles===1?"file":"files"}`),typeof e.addedLines=="number"&&e.addedLines>0&&r.push(`+${e.addedLines}`),typeof e.removedLines=="number"&&e.removedLines>0&&r.push(`-${e.removedLines}`),r.length>0)return r;const n=(a=e.previewText)==null?void 0:a.trim();return n?n.replace(/\bfiles changed\b/gi,"files").replace(/\bfile changed\b/gi,"file").split("·").map(o=>o.trim()).filter(Boolean):[]}function Fn({tone:e="amber"}){const r=e==="emerald"?"bg-sky-200/90":e==="sky"?"bg-sky-300/90":"bg-amber-200/90";return t.jsx("span",{className:"ml-1.5 inline-flex items-center gap-1","aria-hidden":"true",children:[0,1,2].map(n=>t.jsx("span",{className:`h-1.5 w-1.5 animate-pulse rounded-full ${r}`,style:{animationDelay:`${n*180}ms`}},n))})}function Vf(e){var n;const r=e.replace(/\r\n/g,`
3591
+ `).split(`
3592
+ `);for(;r.length>1&&((n=r.at(-1))==null?void 0:n.trim())==="";)r.pop();return r}function ut(e){const r=Vf(e);return r.length===1?{firstLine:r[0]??"",showGap:!1,isTruncated:!1}:{firstLine:r[0]??"",showGap:!0,isTruncated:!0}}function yl(e){const r=(e==null?void 0:e.trim().toLowerCase())??"";return r==="completed"||r==="complete"||r==="success"||r==="succeeded"?{className:"is-completed",icon:t.jsx($r,{className:"h-3.5 w-3.5"}),label:"Completed"}:r==="failed"||r==="failure"||r==="error"||r==="errored"?{className:"is-failed",icon:t.jsx(or,{className:"h-3.5 w-3.5"}),label:"Failed"}:Xr(e)?{className:"is-pending",icon:t.jsx(_r,{className:"h-3.5 w-3.5 animate-spin"}),label:(e==null?void 0:e.trim())||"Running"}:{className:"is-neutral",icon:null,label:(e==null?void 0:e.trim())||"Event"}}function qf(e){switch(e){case"command":return"is-command";case"tool":return"is-tool";case"agent":return"is-agent";case"skill":return"is-skill";case"search":return"is-search";case"fileRead":return"is-file-read"}}function Kf(e){switch(e){case"plan":return"is-plan";case"context":return"is-context";case"generic":return"is-generic";case"image":return"is-image";case"fileChange":return"is-file-change";case"artifact":return"is-artifact";case"hook":return"is-hook"}}function Rt({actions:e,children:r,className:n,headerMeta:a,icon:o,item:s,title:l,tone:d}){const i=yl(s.status);return t.jsxs("div",{className:`thread-graph-event thread-graph-history-event ${Kf(d)} ${n??""}`,children:[t.jsx("div",{className:"thread-graph-history-event-icon","aria-hidden":"true",children:o}),t.jsxs("div",{className:"thread-graph-history-event-card",children:[t.jsxs("div",{className:"thread-graph-history-event-header",children:[t.jsxs("div",{className:"thread-graph-history-event-heading flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"thread-graph-history-event-title min-w-0 truncate font-mono text-sm font-semibold",children:l}),s.status?t.jsxs(Kr,{variant:"outline",className:`thread-graph-tool-badge ${i.className} rounded-full px-2 py-0.5 text-xs font-normal`,title:i.label,"aria-label":`Status: ${i.label}`,children:[i.icon,t.jsx("span",{className:"thread-graph-status-label",children:i.label})]}):null,a]}),e?t.jsx("div",{className:"thread-graph-history-event-actions",children:e}):null]}),r?t.jsx("div",{className:"thread-graph-history-event-body",children:r}):null]})]})}function Vt({actionLabel:e="Open details",actionTitle:r,className:n,details:a,icon:o,item:s,onOpen:l,preview:d,title:i,tone:h}){const u=yl(s.status),[p,m]=c.useState(Xr(s.status)?"item-1":void 0);return t.jsx("div",{className:`thread-graph-event thread-graph-history-tool ${qf(h)} ${n??""}`,children:t.jsx(dr,{type:"single",collapsible:!0,onValueChange:f=>m(f||void 0),className:"thread-graph-tool-accordion thread-graph-history-tool-accordion w-full overflow-hidden rounded-lg border",...p!==void 0?{value:p}:{},children:t.jsxs(cr,{value:"item-1",className:"border-0",children:[t.jsx(hr,{className:"thread-graph-tool-trigger thread-graph-history-tool-trigger px-4 py-3 hover:no-underline",children:t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t.jsx("span",{className:"thread-graph-history-tool-icon shrink-0",children:o}),t.jsx("span",{className:"min-w-0 truncate font-mono text-sm font-semibold",children:i}),t.jsxs(Kr,{variant:"outline",className:`thread-graph-tool-badge ${u.className} ml-1 sm:ml-2 rounded-full px-2 py-0.5 text-xs font-normal`,title:u.label,"aria-label":`Status: ${u.label}`,children:[u.icon,t.jsx("span",{className:"thread-graph-status-label",children:u.label})]})]})}),t.jsxs(ur,{className:"thread-graph-tool-content thread-graph-history-tool-content px-4 pb-4 pt-1",children:[t.jsxs("section",{children:[t.jsx("h4",{children:"Summary"}),t.jsxs("div",{className:"thread-graph-history-tool-summary",children:[t.jsx(Ut,{text:d.firstLine}),d.showGap?t.jsx("span",{className:"thread-graph-history-tool-ellipsis",children:"..."}):null]})]}),a?t.jsx("section",{children:a}):null,t.jsxs("button",{type:"button","aria-label":e,onClick:l,className:"thread-graph-history-tool-open inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium transition",children:[t.jsx(od,{className:"h-3.5 w-3.5"}),r]})]})]})})})}var Xf=c.memo(function({item:r,scrollRootRef:n,onBeforeResize:a}){return t.jsx(Rt,{className:"thread-graph-event-plan",icon:t.jsx(Wi,{className:"h-4 w-4"}),item:r,title:"plan",tone:"plan",children:t.jsx("div",{className:"thread-graph-history-event-prose",children:t.jsx(ml,{text:r.text,scrollRootRef:n,plainTextClassName:"thread-graph-plain-text whitespace-pre-wrap break-words text-sm leading-6",markdownClassName:"thread-graph-markdown text-sm",...a?{onBeforeResize:a}:{}})})})}),Yf=c.memo(function({item:r}){const n=Xr(r.status)||r.text==="Compacting context",a=n?"Compacting context":"Context compacted",o=r.detailText&&r.detailText!==a?r.detailText:null;return t.jsxs(Rt,{className:"thread-graph-event-context",icon:t.jsx(Vi,{className:"h-4 w-4"}),item:r,title:"context",tone:"context",children:[t.jsxs("div",{className:"thread-graph-history-event-line",children:[t.jsx("span",{className:"thread-graph-history-event-primary",children:a}),n?t.jsx(Fn,{tone:"emerald"}):null]}),o?t.jsx("p",{className:"thread-graph-history-event-secondary",title:o,children:o}):null]})}),Zf=c.memo(function({item:r}){return t.jsx(Rt,{className:"thread-graph-event-generic",icon:t.jsx(qi,{className:"h-4 w-4"}),item:r,title:r.kind,tone:"generic",children:t.jsx("pre",{className:"thread-graph-history-event-pre",children:t.jsx(Ut,{text:r.text})})})}),Jf=c.memo(function({item:r,onOpen:n}){const a=ut(r.previewText??r.text);return t.jsx(Vt,{actionLabel:"Open full command",actionTitle:"Command Output",className:"thread-graph-event-command",icon:t.jsx(As,{className:"h-4 w-4"}),item:r,onOpen:()=>n(r,"Command Output"),preview:a,title:"command",tone:"command"})}),Qf=c.memo(function({item:r,onOpen:n}){const a=ut(r.text);return t.jsx(Vt,{actionLabel:"Open full tool call",actionTitle:"Tool Call Details",className:"thread-graph-event-tool",icon:t.jsx(Un,{className:"h-4 w-4"}),item:r,onOpen:()=>n(r,"Tool Call Details"),preview:a,title:"tool_call",tone:"tool"})}),eg=c.memo(function({item:r,onOpen:n}){const a=ut(r.text);return t.jsx(Vt,{actionLabel:"Open agent details",actionTitle:"Agent Details",className:"thread-graph-event-agent-tool",icon:t.jsx(Ki,{className:"h-4 w-4"}),item:r,onOpen:()=>n(r,"Agent Details"),preview:a,title:"agent",tone:"agent"})}),tg=c.memo(function({item:r,onOpen:n}){const a=ut(r.text);return t.jsx(Vt,{actionLabel:"Open skill details",actionTitle:"Skill Details",className:"thread-graph-event-skill-tool",icon:t.jsx(Xi,{className:"h-4 w-4"}),item:r,onOpen:()=>n(r,"Skill Details"),preview:a,title:"skill",tone:"skill"})}),rg=c.memo(function({item:r,onOpen:n}){var l,d;const a=((l=r.previewText)==null?void 0:l.trim())||r.text||"Web search",o=((d=r.detailText)==null?void 0:d.trim())||r.text||"Web search",s=ut(a);return t.jsx(Vt,{actionLabel:"Open full web search",actionTitle:"Web Search Details",className:"thread-graph-event-search",icon:t.jsx(Yi,{className:"h-4 w-4"}),item:r,onOpen:()=>n("Web Search Details",o),preview:s,title:"web_search",tone:"search"})}),ng=c.memo(function({item:r,onOpen:n}){var l,d;const a=((l=r.previewText)==null?void 0:l.trim())||r.text||"File read",o=((d=r.detailText)==null?void 0:d.trim())||r.text||"File read",s=ut(a);return t.jsx(Vt,{actionLabel:"Open full file read",actionTitle:"File Read Details",className:"thread-graph-event-file-read",icon:t.jsx(Zi,{className:"h-4 w-4"}),item:r,onOpen:()=>n("File Read Details",o),preview:s,title:"file_read",tone:"fileRead"})}),ag=c.memo(function({threadId:r,item:n,onOpen:a,getImageAssetUrl:o}){const s=n.assetPath??n.detailText??null,l=r&&s?(o==null?void 0:o({threadId:r,path:s}))??null:null;return t.jsxs(Rt,{className:"thread-graph-event-image",icon:t.jsx(Ji,{className:"h-4 w-4"}),item:n,title:"image",tone:"image",children:[l?t.jsx("button",{type:"button",onClick:()=>a("Image Path",s??n.text),className:"block w-full text-left",children:t.jsx("img",{src:l,alt:n.text||"Image preview",className:"thread-graph-history-event-image",loading:"lazy"})}):t.jsx("div",{className:"thread-graph-history-event-summary",children:n.text}),s?t.jsx("button",{type:"button",onClick:()=>a("Image Path",s),className:"thread-graph-history-event-path",title:s,children:s}):null]})}),sg=c.memo(function({item:r,onOpen:n}){var u,p,m;const a=(u=r.previewText)!=null&&u.trim()&&r.text.trim()!==r.previewText.trim()?r.text.trim():null,o=((p=r.detailText)==null?void 0:p.trim())||null,s=wl(a??((m=r.previewText)==null?void 0:m.trim())??r.text,48),l=Wf(r),d=!!(o||r.hasDeferredDetail),i=t.jsxs("div",{className:"thread-graph-event-line thread-graph-file-change-inline flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"thread-graph-history-detail-text min-w-0 flex-1 overflow-hidden whitespace-nowrap text-clip text-sm",title:a??s,children:s}),l.length>0&&t.jsx("div",{className:"inline-flex shrink-0 items-center justify-end gap-1.5 text-xs",children:l.map(f=>t.jsx("span",{className:`thread-graph-history-delta-badge ${f.startsWith("+")?"is-add":f.startsWith("-")?"is-remove":"is-neutral"}`,children:f},f))})]}),h=d?t.jsx("button",{type:"button","aria-label":"Open file change details",onClick:()=>n("File Change Details",o??r.text),className:"thread-graph-file-change-inline-button min-w-0 flex-1 text-left",title:a??s,children:i}):i;return t.jsx(Rt,{className:"thread-graph-event-file-change",headerMeta:h,icon:t.jsx(Qi,{className:"h-4 w-4"}),item:r,title:"file_change",tone:"fileChange"})}),og=c.memo(function({item:r,onSelect:n}){const a=sa(),[o,s]=c.useState(!1),l=r.artifact,d=l?a.renderArtifact({artifact:l,expanded:o,onToggleExpanded:()=>s(i=>!i)}):null;return t.jsx(Rt,{actions:t.jsxs("span",{className:"inline-flex items-center gap-2",children:[l&&!a.hasRendererForArtifact(l)?t.jsx("span",{className:"thread-graph-history-event-secondary",children:"No renderer"}):null,l&&n?t.jsxs("button",{type:"button","aria-label":`Open artifact inspector for ${l.title}`,onClick:()=>n(r,l),className:"thread-graph-history-event-action",children:[t.jsx(ka,{className:"h-3.5 w-3.5"}),"Inspect"]}):null]}),className:"thread-graph-event-artifact",icon:t.jsx(ka,{className:"h-4 w-4"}),item:r,title:(l==null?void 0:l.type)??"artifact",tone:"artifact",children:d??t.jsxs("div",{className:"space-y-2",children:[t.jsxs("button",{type:"button",onClick:()=>s(i=>!i),className:"thread-graph-history-event-summary is-clickable flex w-full items-center justify-between gap-3 text-left",children:[t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"thread-graph-history-event-primary block truncate",children:(l==null?void 0:l.title)??r.text}),t.jsx("span",{className:"thread-graph-history-event-secondary mt-1 block truncate",children:(l==null?void 0:l.summaryText)??r.previewText??r.text})]}),t.jsx("span",{className:"thread-graph-history-event-pill",children:o?"Hide":"Open"})]}),o?t.jsx("pre",{className:"thread-graph-history-event-pre max-h-80 overflow-auto",children:JSON.stringify((l==null?void 0:l.payload)??r,null,2)}):null]})})}),lg=c.memo(function({item:r}){var i,h;const n=((i=r.hookOutputEntries)==null?void 0:i.map(u=>u.text.trim()).filter(Boolean).join(`
3593
+ `).trim())??"",a=r.hookEventLabel?`${r.hookEventLabel} hook`:r.text,o=((h=r.hookStatusMessage)==null?void 0:h.trim())||(r.previewText&&r.previewText!==r.hookStatusMessage?r.previewText.trim():"")||r.text.trim(),l=ut(n||(o&&o!==a?o:a)),d=!!(n&&l.showGap);return t.jsx(Rt,{className:"thread-graph-event-hook",icon:t.jsx(ed,{className:"h-4 w-4"}),item:r,title:r.hookEventLabel?`${r.hookEventLabel}_hook`:"hook",tone:"hook",children:t.jsxs("div",{className:"thread-graph-history-event-line",children:[t.jsx("p",{className:"thread-graph-history-detail-text min-w-0 flex-1 overflow-hidden whitespace-nowrap text-clip",children:n?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"thread-graph-history-event-secondary mr-2 font-sans text-[11px] uppercase",children:a}),t.jsx(Ut,{text:l.firstLine})]}):t.jsx(Ut,{text:l.firstLine&&l.firstLine!==a?`${a} · ${l.firstLine}`:a})}),d?t.jsx("span",{className:"thread-graph-history-detail-meta shrink-0 text-[11px] font-medium tracking-[0.28em]",children:"..."}):null]})})}),ig=c.memo(function({items:r,expanded:n,onToggleExpanded:a,onOpen:o}){const s=r.filter(d=>Xr(d.status)).length,l=r.length===1?"1 command":`${r.length} commands`;return t.jsx(qr,{className:"thread-graph-history-group-command",count:r.length,countBadgeClassName:"border-amber-200/35 text-amber-100",desktopIconClassName:"border-amber-300/30 bg-amber-300/[0.14] text-amber-100",expanded:n,expandedListClassName:"border-amber-300/12",icon:t.jsx(Hf,{}),onToggleExpanded:a,runningIndicator:s>0?t.jsx(Fn,{}):null,summary:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"rounded-full border border-amber-300/28 bg-amber-300/12 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.24em] text-amber-100",children:"Batch"}),t.jsx("span",{className:"rounded-full border border-stone-700/90 bg-stone-900/80 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em] text-stone-300",children:l}),s>0?t.jsx("span",{className:"inline-flex items-center text-xs text-amber-100/90",children:t.jsx(Fn,{})}):null]}),toggleAriaLabel:`${n?"Collapse":"Expand"} ${r.length} command entries`,children:r.map((d,i)=>{const h=ut(d.text);return t.jsxs("button",{type:"button","aria-label":`Open grouped command ${i+1}`,onClick:()=>o(d,`Command Output ${i+1}`),className:"thread-graph-history-detail-row block w-full rounded-md border px-3 py-2 text-left transition",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("span",{className:"rounded-full border border-amber-300/18 bg-amber-300/[0.07] px-2 py-0.5 text-[10px] uppercase tracking-[0.18em] text-amber-100",children:["Step ",i+1]}),d.status&&t.jsx("span",{className:"thread-graph-history-detail-meta text-xs",children:d.status})]}),t.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-2 text-sm leading-6",children:[t.jsx("p",{className:"thread-graph-history-detail-text min-w-0 flex-1 overflow-hidden whitespace-nowrap text-clip",children:h.firstLine}),h.showGap?t.jsx("span",{className:"thread-graph-history-detail-meta shrink-0 text-[11px] font-medium tracking-[0.28em]",children:"..."}):null]})]},d.id)})})}),dg=c.memo(function({items:r,expanded:n,onToggleExpanded:a,onOpen:o}){const s=r.length===1?"1 search":`${r.length} searches`;return t.jsx(qr,{className:"thread-graph-history-group-search",count:r.length,countBadgeClassName:"border-sky-200/35 text-sky-100",desktopIconClassName:"border-sky-300/30 bg-sky-300/[0.14] text-sky-100",expanded:n,expandedListClassName:"border-sky-300/12",icon:t.jsx(Of,{}),onToggleExpanded:a,summary:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"rounded-full border border-sky-300/28 bg-sky-300/12 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.24em] text-sky-100",children:"Batch"}),t.jsx("span",{className:"rounded-full border border-stone-700/90 bg-stone-900/80 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em] text-stone-300",children:s})]}),toggleAriaLabel:`${n?"Collapse":"Expand"} ${r.length} web search entries`,children:r.map((l,d)=>{var p,m;const i=((p=l.previewText)==null?void 0:p.trim())||l.text||"Web search",h=ut(i),u=((m=l.detailText)==null?void 0:m.trim())||l.text||"Web search";return t.jsxs("button",{type:"button","aria-label":`Open grouped web search ${d+1}`,onClick:()=>o(`Web Search ${d+1}`,u),className:"thread-graph-history-detail-row block w-full rounded-md border px-3 py-2 text-left transition",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("span",{className:"rounded-full border border-sky-300/18 bg-sky-300/[0.07] px-2 py-0.5 text-[10px] uppercase tracking-[0.18em] text-sky-100",children:["Search ",d+1]}),l.status&&t.jsx("span",{className:"thread-graph-history-detail-meta text-xs",children:l.status})]}),t.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-2 text-sm leading-6",children:[t.jsx("p",{className:"thread-graph-history-detail-text min-w-0 flex-1 overflow-hidden whitespace-nowrap text-clip",children:h.firstLine}),h.showGap?t.jsx("span",{className:"thread-graph-history-detail-meta shrink-0 text-[11px] font-medium tracking-[0.28em]",children:"..."}):null]})]},l.id)})})}),cg=c.memo(function({items:r,expanded:n,onToggleExpanded:a,onOpen:o}){const s=r.length===1?"1 file read":`${r.length} file reads`;return t.jsx(qr,{className:"thread-graph-history-group-file-read",count:r.length,countBadgeClassName:"border-cyan-200/35 text-cyan-100",desktopIconClassName:"border-cyan-300/30 bg-cyan-300/[0.14] text-cyan-100",expanded:n,expandedListClassName:"border-cyan-300/12",icon:t.jsx(Ff,{}),onToggleExpanded:a,summary:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"rounded-full border border-cyan-300/28 bg-cyan-300/12 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.24em] text-cyan-100",children:"Batch"}),t.jsx("span",{className:"rounded-full border border-stone-700/90 bg-stone-900/80 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em] text-stone-300",children:s})]}),toggleAriaLabel:`${n?"Collapse":"Expand"} ${r.length} file read entries`,children:r.map((l,d)=>{var p,m;const i=((p=l.previewText)==null?void 0:p.trim())||l.text||"File read",h=ut(i),u=((m=l.detailText)==null?void 0:m.trim())||l.text||"File read";return t.jsxs("button",{type:"button","aria-label":`Open grouped file read ${d+1}`,onClick:()=>o(`File Read ${d+1}`,u),className:"thread-graph-history-detail-row block w-full rounded-md border px-3 py-2 text-left transition",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("span",{className:"rounded-full border border-cyan-300/18 bg-cyan-300/[0.07] px-2 py-0.5 text-[10px] uppercase tracking-[0.18em] text-cyan-100",children:["Read ",d+1]}),l.status&&t.jsx("span",{className:"thread-graph-history-detail-meta text-xs",children:l.status})]}),t.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-2 text-sm leading-6",children:[t.jsx("p",{className:"thread-graph-history-detail-text min-w-0 flex-1 overflow-hidden whitespace-nowrap text-clip",children:h.firstLine}),h.showGap?t.jsx("span",{className:"thread-graph-history-detail-meta shrink-0 text-[11px] font-medium tracking-[0.28em]",children:"..."}):null]})]},l.id)})})}),hg=c.memo(function({items:r,expanded:n,onToggleExpanded:a,onOpen:o}){const s=r.reduce((h,u)=>h+(u.changedFiles??0),0),l=r.reduce((h,u)=>h+(u.addedLines??0),0),d=r.reduce((h,u)=>h+(u.removedLines??0),0),i=r.length===1?"1 file change":`${r.length} file changes`;return t.jsx(qr,{className:"thread-graph-history-group-file-change",count:r.length,countBadgeClassName:"border-lime-200/35 text-lime-100",desktopIconClassName:"border-lime-300/30 bg-lime-300/[0.14] text-lime-100",expanded:n,expandedListClassName:"border-lime-300/12",icon:t.jsx(Gf,{}),onToggleExpanded:a,summary:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"rounded-full border border-lime-300/28 bg-lime-300/12 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.24em] text-lime-100",children:"Batch"}),t.jsx("span",{className:"rounded-full border border-stone-700/90 bg-stone-900/80 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.16em] text-stone-300",children:i}),s>0?t.jsxs("span",{className:"thread-graph-history-detail-meta text-xs",children:[s," files"]}):null]}),toggleAriaLabel:`${n?"Collapse":"Expand"} ${r.length} file change entries`,trailingSummary:t.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[l>0?t.jsxs("span",{className:"thread-graph-history-delta-badge is-add",children:["+",l]}):null,d>0?t.jsxs("span",{className:"thread-graph-history-delta-badge is-remove",children:["-",d]}):null]}),children:r.map((h,u)=>{var f,g,x,k;const p=((f=h.detailText)==null?void 0:f.trim())||((g=h.previewText)==null?void 0:g.trim())||h.text,m=(x=h.previewText)!=null&&x.trim()&&h.text.trim()!==h.previewText.trim()?h.text.trim():((k=h.previewText)==null?void 0:k.trim())||h.text;return t.jsx("button",{type:"button","aria-label":`Open grouped file change ${u+1}`,onClick:()=>o(`File Change ${u+1}`,p),className:"thread-graph-history-detail-row block w-full rounded-md border px-3 py-2 text-left transition",children:t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"thread-graph-history-detail-text min-w-0 flex-1 text-sm leading-6",title:m,children:wl(m,34)}),t.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(h.addedLines??0)>0?t.jsxs("span",{className:"thread-graph-history-delta-badge is-add",children:["+",h.addedLines]}):null,(h.removedLines??0)>0?t.jsxs("span",{className:"thread-graph-history-delta-badge is-remove",children:["-",h.removedLines]}):null]})]})},h.id)})})});function ug(e){const r=e.trim().toLowerCase();return r==="completed"||r==="done"||r==="complete"?"completed":r==="in_progress"||r==="in-progress"||r==="running"||r==="active"?"in_progress":r==="failed"||r==="error"||r==="cancelled"?"failed":r==="pending"||r==="todo"?"pending":"unknown"}function mg({status:e}){const r=ug(e),n=r==="completed"?"Plan step status: Completed":r==="in_progress"?"Plan step status: In progress":r==="pending"?"Plan step status: Pending":r==="failed"?"Plan step status: Failed":`Plan step status: ${e}`,a=r==="completed"?"thread-graph-plan-status is-completed":r==="in_progress"?"thread-graph-plan-status is-running":r==="pending"?"thread-graph-plan-status is-pending":r==="failed"?"thread-graph-plan-status is-failed":"thread-graph-plan-status is-unknown";return t.jsx(Kr,{"aria-label":n,title:n.replace("Plan step status: ",""),className:a,children:r==="completed"?t.jsx($r,{className:"h-3.5 w-3.5"}):r==="in_progress"?t.jsx(_r,{className:"h-3.5 w-3.5 animate-spin"}):r==="pending"?t.jsx(id,{className:"h-3.5 w-3.5"}):r==="failed"?t.jsx(or,{className:"h-3.5 w-3.5"}):t.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",children:"?"})})}function pg({livePlan:e}){return t.jsxs("div",{className:"thread-graph-plan-card rounded-xl border px-3 py-3",children:[t.jsxs("div",{className:"thread-graph-plan-header flex flex-wrap items-center justify-between gap-2",children:[t.jsx("p",{className:"text-sm font-semibold",children:"Plan update"}),t.jsx(Kr,{className:"thread-graph-plan-badge",children:"Live"})]}),e.explanation?t.jsx("p",{className:"thread-graph-plan-explanation mt-3 text-sm",children:e.explanation}):null,t.jsx("div",{className:"mt-3 space-y-2",children:e.plan.map((r,n)=>t.jsxs("div",{className:"thread-graph-plan-step flex items-center justify-between gap-3 rounded-lg border px-3 py-2 text-sm",children:[t.jsx("span",{className:"thread-graph-plan-step-text min-w-0 flex-1",children:r.step}),t.jsx(mg,{status:r.status})]},`${e.turnId}-${n}`))})]})}function fg({footer:e,history:r,liveHookPrompt:n,liveOutput:a,livePlan:o}){return t.jsxs(t.Fragment,{children:[r,o?t.jsx(pg,{livePlan:o}):null,n??a??null,e]})}function gg({absoluteIndex:e,body:r,collapsed:n,error:a,footer:o,headerStatus:s,isActive:l=!1,onToggleCollapse:d,refCallback:i,startedAt:h,timeLabel:u,timeTitle:p,tokenSummary:m}){return t.jsxs("article",{ref:i,"data-testid":"chat-turn","data-turn-active":l?"true":"false",className:"thread-graph-turn px-3 py-2 sm:px-5 sm:py-3",children:[t.jsxs("div",{className:"thread-graph-turn-header flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 items-start gap-1.5",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 items-center gap-1.5 overflow-hidden",children:[t.jsxs("span",{className:"thread-graph-turn-index rounded-[0.6rem] border px-1.5 py-0.5 text-[10px] uppercase tracking-[0.16em]",children:["Turn ",e]}),t.jsx("time",{dateTime:h??void 0,title:p,className:"thread-graph-turn-time shrink-0 text-[10px] sm:text-[11px]",children:u}),s,a?t.jsx("p",{className:"hidden truncate text-[11px] text-rose-200 sm:block",children:a}):null]}),m]}),t.jsx("button",{type:"button","aria-label":`${n?"Expand":"Collapse"} turn ${e}`,title:n?"Expand turn":"Collapse turn",onClick:d,className:"thread-graph-turn-collapse inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md transition",children:t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:n?t.jsx("path",{d:"m4.5 10 3.5-3.5L11.5 10"}):t.jsx("path",{d:"m4.5 6 3.5 3.5L11.5 6"})})})]}),a?t.jsx("p",{className:"mt-1 text-[11px] text-rose-200 sm:hidden",children:a}):null,n?null:t.jsxs("div",{className:"thread-graph-turn-body mt-2 space-y-2",children:[r,o]})]})}function xg(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M8 2.75v8"}),t.jsx("path",{d:"m4.75 7.5 3.25 3.25L11.25 7.5"})]})}function bg(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M8 13.25v-8"}),t.jsx("path",{d:"m11.25 8.5-3.25-3.25L4.75 8.5"})]})}function vg(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M3.25 5.25 8 2.75l4.75 2.5L8 7.75l-4.75-2.5Z"}),t.jsx("path",{d:"M3.25 8 8 10.5 12.75 8"}),t.jsx("path",{d:"M3.25 10.75 8 13.25l4.75-2.5"}),t.jsx("path",{d:"M3.25 5.25v5.5"}),t.jsx("path",{d:"M12.75 5.25v5.5"})]})}function kg(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M6.2 3.2a2.3 2.3 0 0 0-2.95 3.5A2.4 2.4 0 0 0 4.5 11h.2c.25 1.1 1.1 1.8 2.3 1.8h1.8c1.2 0 2.05-.7 2.3-1.8h.2A2.4 2.4 0 0 0 12.75 6.7 2.3 2.3 0 0 0 9.8 3.2"}),t.jsx("path",{d:"M6.3 6.15c.45-.42 1.02-.65 1.7-.65s1.25.23 1.7.65"}),t.jsx("path",{d:"M8 5.5v4.75"}),t.jsx("path",{d:"M6.75 9.05 8 10.25l1.25-1.2"})]})}function kr(e){if(!Number.isFinite(e)||e<=0)return"0";if(e>=1e6){const r=e>=1e7?Math.round(e/1e6):e/1e6;return`${String(r.toFixed(1)).replace(/\.0$/,"")}m`}if(e>=1e3){const r=e>=1e4?Math.round(e/1e3):e/1e3;return`${String(r.toFixed(1)).replace(/\.0$/,"")}k`}return String(Math.round(e))}function wg(e){return!Number.isFinite(e)||e<=0?"$0":e>=100?`$${Math.round(e)}`:e>=10?`$${String(e.toFixed(1)).replace(/\.0$/,"")}`:e>=1?`$${String(e.toFixed(2)).replace(/0$/,"").replace(/\.$/,"")}`:e>=.1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(3)}`:e>=.001?`$${e.toFixed(4)}`:"<$0.001"}function er(e){return!Number.isFinite(e)||e<=0?"$0.0000":`$${e.toFixed(4)}`}function wr(e,r,n){const a=e??null;return!Number.isFinite(a??NaN)||a===null||r<=0||n<=0?null:a*n/r}function jl(e){var d,i,h,u,p;const r=(d=e.tokenUsage)==null?void 0:d.total;if(!r)return[];const n=Math.max(r.inputTokens-r.cachedInputTokens,0),a=Math.max(r.cachedInputTokens,0),o=Math.max(r.reasoningOutputTokens,0),s=Math.max(r.outputTokens-o,0);return[n>0?{id:"in",label:"Input",tokenCompactValue:kr(n),tokenRawValue:n,usdCompactValue:e.priceEstimate?er(e.priceEstimate.inputUsd):"--",usdRawValue:((i=e.priceEstimate)==null?void 0:i.inputUsd)??null,className:"token-badge-in",icon:t.jsx(xg,{})}:null,a>0?{id:"cache",label:"Cached input",tokenCompactValue:kr(a),tokenRawValue:a,usdCompactValue:e.priceEstimate?er(e.priceEstimate.cachedInputUsd):"--",usdRawValue:((h=e.priceEstimate)==null?void 0:h.cachedInputUsd)??null,className:"token-badge-cache",icon:t.jsx(vg,{})}:null,s>0?{id:"out",label:"Output",tokenCompactValue:kr(s),tokenRawValue:s,usdCompactValue:e.priceEstimate?er(wr(e.priceEstimate.outputUsd,Math.max(r.outputTokens,0),s)??0):"--",usdRawValue:wr((u=e.priceEstimate)==null?void 0:u.outputUsd,Math.max(r.outputTokens,0),s),className:"token-badge-out",icon:t.jsx(bg,{})}:null,o>0?{id:"reason",label:"Reasoning",tokenCompactValue:kr(o),tokenRawValue:o,usdCompactValue:e.priceEstimate?er(wr(e.priceEstimate.outputUsd,Math.max(r.outputTokens,0),o)??0):"--",usdRawValue:wr((p=e.priceEstimate)==null?void 0:p.outputUsd,Math.max(r.outputTokens,0),o),className:"token-badge-reason",icon:t.jsx(kg,{})}:null].filter(m=>m!==null)}function yg(e){return jl(e).map(r=>({id:r.id,label:r.tokenCompactValue,title:`${r.label}: ${r.tokenRawValue} tokens`,className:r.className,icon:r.icon}))}function Nl(e){return{label:e.priceEstimate?wg(e.priceEstimate.totalUsd):"--",title:e.priceEstimate===null||e.priceEstimate===void 0?"Price estimate unavailable for this model.":`Estimated cost: ${er(e.priceEstimate.totalUsd)}`,className:e.priceEstimate?"token-badge-total":"token-badge-empty"}}var gn="inline-flex shrink-0 items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-normal leading-none sm:text-[11px]";function jg({turn:e}){const r=jl(e),n=Nl(e),[a,o]=c.useState(!1),[s,l]=c.useState(!1),[d,i]=c.useState(0),h=c.useRef(null),u=c.useRef(null),p=c.useRef(null);if(c.useLayoutEffect(()=>{if(!a||r.length===0){i(0);return}const f=()=>{const g=h.current,x=p.current;if(!g||!x)return;const k=g.getBoundingClientRect(),b=x.offsetWidth||x.getBoundingClientRect().width;if(b<=0)return;const y=window.innerWidth||document.documentElement.clientWidth,w=12,v=k.left+k.width/2-b/2,N=w,j=Math.max(N,y-w-b),S=Math.min(Math.max(v,N),j);i(Math.round(S-v))};return f(),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[r.length,a]),c.useEffect(()=>{if(!a&&!s)return;const f=g=>{g.target instanceof Node&&(h.current&&!h.current.contains(g.target)&&o(!1),u.current&&!u.current.contains(g.target)&&l(!1))};return document.addEventListener("pointerdown",f),()=>{document.removeEventListener("pointerdown",f)}},[s,a]),!n&&r.length===0)return null;const m=()=>t.jsx("div",{className:"thread-token-popover min-w-[12rem] rounded-2xl border p-2.5 shadow-2xl shadow-black/20 backdrop-blur",children:t.jsx("div",{className:"space-y-1",children:r.map(f=>t.jsxs("div",{className:"thread-token-popover-row flex items-center justify-between gap-3 rounded-xl border px-2.5 py-1.5 text-[11px]",title:`${f.label}: ${f.tokenRawValue} tokens`,children:[t.jsxs("span",{className:"thread-token-popover-text inline-flex min-w-0 items-center gap-2",children:[t.jsx("span",{className:"inline-flex shrink-0",children:f.icon}),t.jsx("span",{className:"thread-token-popover-strong font-medium",children:f.usdCompactValue})]}),t.jsx("span",{className:"thread-token-popover-text shrink-0 font-medium",children:f.tokenCompactValue})]},f.id))})});return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"hidden shrink-0 items-center gap-1.5 md:inline-flex",children:[n?t.jsxs("div",{ref:u,className:"relative shrink-0",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[t.jsx("button",{type:"button","aria-label":"Show token and price details","aria-expanded":s,onFocus:()=>l(!0),onBlur:()=>l(!1),className:`${gn} appearance-none whitespace-nowrap bg-transparent !text-[10px] !font-normal !leading-none transition hover:bg-[var(--theme-hover)] sm:!text-[11px] ${n.className}`,title:n.title,children:n.label}),s&&r.length>0?t.jsx("div",{className:"absolute left-1/2 top-full z-30 mt-1.5 -translate-x-1/2",children:m()}):null]}):null,r.map(f=>t.jsxs("span",{className:`${gn} ${f.className}`,title:`${f.label}: ${f.usdCompactValue}, ${f.tokenRawValue} tokens`,children:[f.icon,t.jsx("span",{className:"thread-token-badge-value font-medium",children:f.tokenCompactValue})]},f.id))]}),t.jsxs("div",{ref:h,className:"relative shrink-0 md:hidden",children:[n?t.jsx("button",{type:"button","aria-label":"Show token and price details","aria-expanded":a,onClick:()=>o(f=>!f),className:`${gn} appearance-none whitespace-nowrap bg-transparent !text-[10px] !font-normal !leading-none transition hover:bg-[var(--theme-hover)] sm:!text-[11px] ${n.className}`,title:n.title,children:n.label}):null,a&&r.length>0?t.jsx("div",{ref:p,className:"absolute left-1/2 top-full z-30 mt-1.5",style:{transform:`translateX(${d}px) translateX(-50%)`},children:m()}):null]})]})}function Ng({tone:e="amber"}){const r=e==="emerald"?"bg-sky-200/90":e==="sky"?"bg-sky-300/90":"bg-amber-200/90";return t.jsx("span",{className:"ml-1.5 inline-flex items-center gap-1","aria-hidden":"true",children:[0,1,2].map(n=>t.jsx("span",{className:`h-1.5 w-1.5 rounded-full animate-pulse ${r}`,style:{animationDelay:`${n*180}ms`}},n))})}function ys(e){const r=e.trim().toLowerCase();return r==="completed"||r==="done"||r==="complete"?"completed":r==="in_progress"||r==="in progress"||r==="inprogress"||r==="running"||r==="active"?"in_progress":r==="pending"||r==="todo"||r==="not_started"||r==="not started"||r==="queued"?"pending":r==="failed"||r==="error"?"failed":"other"}function Cg(e){switch(e.kind){case"fileChange":case"webSearch":case"image":case"contextCompaction":return!0;case"commandExecution":case"toolCall":return!fl(e.status);default:return!1}}function Sg(e,r,n){if(!e||!Ar(n))return e;const a=e.plan.findIndex(d=>ys(d.status)==="in_progress");if(a<0)return e;const o=e.plan.findIndex((d,i)=>i>a&&ys(d.status)==="pending");if(o<0||!r.some(d=>Cg(d)))return e;const l=e.plan.map((d,i)=>i===a?{...d,status:"completed"}:i===o?{...d,status:"in_progress"}:d);return{...e,plan:l}}function Tg(e){var a;const r=(a=e.model)!=null&&a.trim()?e.model.trim():"--";let n="--";return e.reasoningEffortAvailable===null||e.reasoningEffortAvailable===void 0?n="--":e.reasoningEffortAvailable===!1?n="-":n=e.reasoningEffort??"--",[r,n].join(" · ")}function js({status:e}){const r=dl(e);return e==="completed"?t.jsx("span",{"aria-label":r,title:r,className:"timeline-status-icon timeline-status-icon-success inline-flex h-4 w-4 items-center justify-center",children:t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"m3.75 8.25 2.5 2.5 6-6"})})}):e==="failed"?t.jsx("span",{"aria-label":r,title:r,className:"timeline-status-icon timeline-status-icon-failed inline-flex h-4 w-4 items-center justify-center",children:t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"m5 5 6 6M11 5l-6 6"})})}):e==="interrupted"?t.jsx("span",{"aria-label":r,title:r,className:"timeline-status-icon timeline-status-icon-warning inline-flex h-4 w-4 items-center justify-center",children:t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M6 4.5v7M10 4.5v7"})})}):t.jsx("span",{"aria-label":r,title:r,className:"inline-flex min-w-[1.25rem] items-center justify-center text-sky-200",children:t.jsx(Ng,{tone:"emerald"})})}function Ns({turn:e,variant:r="header"}){const n=dl(e.status),a=Tg(e),o=yg(e),s=Nl(e),l=Ar(e.status),d=e.status==="failed"?"border-rose-300/20 bg-rose-300/[0.06] text-rose-100":l?"border-sky-300/22 bg-sky-300/[0.08] text-sky-100":"border-stone-700/90 bg-stone-900/70 text-stone-200";if(r==="footer")return t.jsxs("div",{className:`flex w-full flex-col gap-1.5 rounded-[0.95rem] border px-3 py-2 text-xs ${d}`,children:[t.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(js,{status:e.status}),t.jsx("span",{className:"timeline-soft-text min-w-0 truncate",children:a})]}),e.startedAt&&t.jsx("time",{dateTime:e.startedAt,title:ra(e.startedAt),className:"timeline-meta-text shrink-0 text-[11px]",children:Wr(e.startedAt)})]}),(s||o.length>0)&&t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pl-6",children:[s?t.jsx("span",{className:`inline-flex items-center rounded-full border px-1.5 py-0.5 text-[10px] font-medium ${s.className}`,title:s.title,children:s.label}):null,o.map(h=>t.jsxs("span",{className:`inline-flex items-center rounded-full border px-1.5 py-0.5 text-[10px] font-medium ${h.className}`,title:h.title,children:[h.icon?t.jsx("span",{className:"mr-1",children:h.icon}):null,h.label]},h.id))]})]});const i=`${n} · ${a}`;return t.jsxs("span",{className:`inline-flex min-w-0 items-center gap-1.5 rounded-full border px-2 py-1 text-[10px] sm:text-[11px] ${d}`,title:i,children:[t.jsx(js,{status:e.status}),t.jsx("span",{className:"timeline-meta-text min-w-0 truncate",children:a})]})}var oa=c.memo(function({threadId:r,item:n,scrollRootRef:a,onOpenExpandedText:o,onOpenCommandDetail:s,onOpenToolCallDetail:l,onOpenDeferredHistoryItemDetail:d,onSelectArtifact:i,onBeforeMessageResize:h,adapter:u,timeLabel:p,timeTitle:m}){var f,g,x;if(Tf(n.kind))return t.jsx(tr,{threadId:r,item:n,scrollRootRef:a,timeLabel:p,timeTitle:m,...h?{onBeforeMessageResize:h}:{},...u?{adapter:u}:{}});if(n.kind==="artifact")return t.jsx(og,{item:n,...i?{onSelect:(k,b)=>i({item:k,artifact:b})}:{}});if(n.kind==="commandExecution")return t.jsx(Jf,{item:n,onOpen:s});if(n.kind==="toolCall")return t.jsx(Qf,{item:n,onOpen:l});if(n.kind==="agentToolCall")return t.jsx(eg,{item:n,onOpen:l});if(n.kind==="skillToolCall")return t.jsx(tg,{item:n,onOpen:l});if(n.kind==="webSearch"){const k=n,b=((f=k.detailText)==null?void 0:f.trim())||k.text||"Web search";return t.jsx(rg,{item:k,onOpen:()=>d(k,"Web Search Details",b,"Loading full web search details...","Unable to load full web search details.")})}if(n.kind==="fileRead"){const k=n,b=((g=k.detailText)==null?void 0:g.trim())||k.text||"File read";return t.jsx(ng,{item:k,onOpen:()=>d(k,"File Read Details",b,"Loading full file read details...","Unable to load full file read details.")})}if(n.kind==="image")return t.jsx(ag,{threadId:r,item:n,onOpen:o,getImageAssetUrl:u==null?void 0:u.getImageAssetUrl});if(n.kind==="plan")return t.jsx(Xf,{item:n,scrollRootRef:a,...h?{onBeforeResize:h}:{}});if(n.kind==="fileChange"){const k=n,b=((x=k.detailText)==null?void 0:x.trim())||k.text||"File change";return t.jsx(sg,{item:k,onOpen:()=>d(k,"File Change Details",b,"Loading full file change details...","Unable to load full file change details.")})}return n.kind==="contextCompaction"?t.jsx(Yf,{item:n}):n.kind==="hook"?t.jsx(lg,{item:n}):t.jsx(Zf,{item:n})}),xn=c.memo(function({threadId:r,adapter:n,turn:a,absoluteIndex:o,isCollapsed:s,livePlan:l,liveItems:d,liveOutput:i,forceActive:h=!1,onToggleCollapse:u,onOpenExpandedText:p,onOpenCommandDetail:m,onOpenToolCallDetail:f,onOpenDeferredHistoryItemDetail:g,onSelectArtifact:x,onBeforeMessageResize:k,scrollRootRef:b,articleRef:y,isLatestVisibleTurn:w=!1}){const v=!!l||!!i||!!(d&&d.length>0),N=h||Ar(a.status)||v||w,j=N&&!Ar(a.status)?{...a,status:"inProgress"}:a,S=c.useMemo(()=>zf(a.items,d),[d,a.items]),P=c.useMemo(()=>Sg(l,S,a.status),[l,S,a.status]),C=c.useMemo(()=>If(i,S),[i,S]),M=c.useMemo(()=>Pf(S,N),[N,S]),_=c.useMemo(()=>Rf(M),[M]),A=Wr(a.startedAt),te=ra(a.startedAt),W=c.useMemo(()=>pl(C),[C]),[D,q]=c.useState({}),de=c.useCallback(z=>{q(V=>({...V,[z]:!V[z]}))},[]),L=t.jsx(Eg,{entries:_,expandedGroups:D,onToggleGroupedItem:de,threadId:r,scrollRootRef:b,onOpenExpandedText:p,onOpenCommandDetail:m,onOpenToolCallDetail:f,onOpenDeferredHistoryItemDetail:g,...k?{onBeforeMessageResize:k}:{},timeLabel:A,timeTitle:te,...x?{onSelectArtifact:x}:{},...n?{adapter:n}:{}}),Z=W?t.jsx(oa,{threadId:r,item:W,scrollRootRef:b,onOpenExpandedText:p,onOpenCommandDetail:m,onOpenToolCallDetail:f,onOpenDeferredHistoryItemDetail:g,timeLabel:A,timeTitle:te,...x?{onSelectArtifact:x}:{},...n?{adapter:n}:{}}):null,R=!W&&C?t.jsx(tr,{item:{id:"live-agent-message",kind:"agentMessage",text:C},scrollRootRef:b,timeLabel:A,timeTitle:te,streaming:!0,...k?{onBeforeMessageResize:k}:{}}):null,X=N?t.jsx(Ns,{turn:j,variant:"footer"}):null,F=t.jsx(fg,{footer:X,history:L,liveHookPrompt:Z,liveOutput:R,livePlan:P});return t.jsx(gg,{absoluteIndex:o,body:F,collapsed:s,error:a.error,headerStatus:t.jsx(Ns,{turn:a}),isActive:N,onToggleCollapse:()=>u(a.id),refCallback:y,startedAt:a.startedAt,timeLabel:A,timeTitle:te,tokenSummary:t.jsx(jg,{turn:a})})});function Eg({entries:e,expandedGroups:r,onToggleGroupedItem:n,threadId:a,scrollRootRef:o,onOpenExpandedText:s,onOpenCommandDetail:l,onOpenToolCallDetail:d,onOpenDeferredHistoryItemDetail:i,onSelectArtifact:h,onBeforeMessageResize:u,adapter:p,timeLabel:m,timeTitle:f}){return t.jsx(Df,{entries:e,expandedGroups:r,onToggleGroupedItem:n,renderCommandGroup:(g,x,k)=>t.jsx(ig,{items:g.items,expanded:x,onToggleExpanded:k,onOpen:l},g.key),renderFileChangeGroup:(g,x,k)=>t.jsx(hg,{items:g.items,expanded:x,onToggleExpanded:k,onOpen:s},g.key),renderSearchGroup:(g,x,k)=>t.jsx(dg,{items:g.items,expanded:x,onToggleExpanded:k,onOpen:s},g.key),renderFileReadGroup:(g,x,k)=>t.jsx(cg,{items:g.items,expanded:x,onToggleExpanded:k,onOpen:s},g.key),renderItem:g=>t.jsx(oa,{threadId:a,item:g.item,scrollRootRef:o,timeLabel:m,timeTitle:f,onOpenExpandedText:s,onOpenCommandDetail:l,onOpenToolCallDetail:d,onOpenDeferredHistoryItemDetail:i,...u?{onBeforeMessageResize:u}:{},...h?{onSelectArtifact:h}:{},...p?{adapter:p}:{}},g.key)})}var Cs=10,Lg=10,Hn=80;function Zt(e,r=Hn){return e.scrollHeight-e.scrollTop-e.clientHeight<=r}function Pg(e,r){const n=e.getBoundingClientRect(),a=r.getBoundingClientRect(),o=Math.max(n.top,a.top),s=Math.min(n.bottom,a.bottom);return Math.max(0,s-o)>0}function zg(e){return e.map(n=>{const a=n.createdAt;return typeof a=="string"&&a.trim()?a:null}).filter(n=>!!n).sort()[0]??null}function Ig(e,r){return{id:e,startedAt:zg(r),status:"inProgress",error:null,model:null,reasoningEffort:null,reasoningEffortAvailable:null,tokenUsage:null,priceEstimate:null,items:[]}}function Ss(e,r,n){return{id:e.id,kind:e.kind,title:r,text:n}}function Rg({loadHistoryItemDetail:e,onSelectHistoryItemDetail:r}){const n=c.useRef(0),a=c.useRef(new Map),[o,s]=c.useState(null),l=c.useCallback((f,g)=>{s({title:f,text:g})},[]),d=c.useCallback((f,g,x)=>{if(x&&r){r({item:f,detail:g});return}s({title:g.title,text:g.text})},[r]),i=c.useCallback(async({item:f,fallbackTitle:g,fallbackText:x,loadingText:k,errorText:b,useSelectionCallback:y})=>{if(!f.hasDeferredDetail||!e){d(f,Ss(f,g,x),y);return}const w=a.current.get(f.id);if(w){d(f,w,y);return}const v=n.current+1;n.current=v,y&&r||s({title:g,text:k});try{const N=await e(f.id);if(a.current.set(f.id,N),n.current!==v)return;d(f,N,y)}catch(N){if(n.current!==v)return;d(f,Ss(f,g,N instanceof Error?N.message:b),y)}},[e,r,d]),h=c.useCallback(async(f,g)=>{var x;await i({item:f,fallbackTitle:g,fallbackText:((x=f.detailText)==null?void 0:x.trim())||f.text||"Command output",loadingText:"Loading full command output...",errorText:"Unable to load full command output.",useSelectionCallback:!0})},[i]),u=c.useCallback(async(f,g)=>{var x;await i({item:f,fallbackTitle:g,fallbackText:((x=f.detailText)==null?void 0:x.trim())||f.text||"Tool call",loadingText:"Loading full tool call details...",errorText:"Unable to load full tool call details.",useSelectionCallback:!0})},[i]),p=c.useCallback(async(f,g,x,k,b)=>{await i({item:f,fallbackTitle:g,fallbackText:x,loadingText:k,errorText:b,useSelectionCallback:!1})},[i]),m=c.useCallback(()=>{n.current+=1,s(null)},[]);return{expandedText:o,openExpandedText:l,openCommandDetail:h,openToolCallDetail:u,openDeferredHistoryItemDetail:p,closeExpandedText:m}}function Ag(e){const r=c.useRef(null),n=c.useRef(0),a=r.current;return(a===null||a.length!==e.length||e.some((s,l)=>!Object.is(s,a[l])))&&(n.current+=1,r.current=e),n.current}function Mg({threadId:e,turnsLength:r,totalTurnCount:n,loadingEarlier:a,onLoadEarlier:o,scrollRequestKey:s,bottomSpacer:l,onTailVisibilityChange:d,contentRevisionInputs:i}){const h=c.useRef(null),u=c.useRef(null),p=c.useRef(s),m=c.useRef(null),f=c.useRef(l),g=c.useRef(0),x=c.useRef(0),k=c.useRef(null),b=c.useRef(null),y=c.useRef(!0),w=c.useRef(!0),v=c.useRef(!1),N=c.useRef(!1),j=c.useRef(!1),[S,P]=c.useState(Cs),[C,M]=c.useState(0),[_,A]=c.useState(!0),te=Ag(i),W=typeof o=="function"||n!==void 0,D=n??r,q=W?0:Math.max(0,r-S),L=(W?Math.max(0,D-r):0)+q,Z=W?r:r-q,R=W?0:r-Z,X=W?Math.max(0,D-r):0,F=W?X+R:R,z=!W&&F>0&&C>=2,V=W&&X>0&&R===0&&typeof o=="function",H=c.useCallback(()=>{const B=h.current,ce=k.current;if(!B)return;const J=ce?Pg(B,ce):Zt(B);y.current=J,A(se=>se===J?se:J)},[]),E=c.useCallback(()=>{const B=h.current;if(B){N.current=!0;const ce=B.scrollTop,J=x.current,se=ce-J;x.current=ce,Zt(B,1)?(v.current=!1,w.current=!0):se<-1?(v.current=!0,w.current=!1):se>1&&(w.current=!v.current&&Zt(B,Hn))}H()},[H]),T=c.useCallback(()=>{const B=h.current;B&&(B.scrollTop=B.scrollHeight,x.current=B.scrollTop,g.current=B.scrollHeight,y.current=!0,A(ce=>ce||!0),v.current=!1,w.current=!0)},[]),K=c.useCallback(()=>{const B=h.current;B&&(x.current=B.scrollTop,g.current=B.scrollHeight,w.current=!1,v.current=!0)},[]),O=c.useCallback(()=>{if(W&&R===0){o==null||o();return}P(B=>Math.min(r,B+Lg)),M(B=>B+1)},[R,o,W,r]),Q=c.useCallback(()=>{P(r)},[r]);return c.useLayoutEffect(()=>{const B=window.requestAnimationFrame(()=>{T()});return()=>{window.cancelAnimationFrame(B)}},[e,T]),c.useEffect(()=>{j.current=!1,N.current=!1},[e]),c.useEffect(()=>{P(B=>B>=r-1?r:Math.max(B,Cs))},[r]),c.useEffect(()=>{const B=h.current;B&&(g.current=B.scrollHeight,x.current=B.scrollTop,Zt(B,1)?(v.current=!1,w.current=!0):(v.current||!Zt(B,Hn))&&(w.current=!1)),H()},[te,H,S]),c.useEffect(()=>{const B=s!==p.current,ce=m.current!==te;if(m.current=te,!(B||ce&&w.current&&!v.current))return;const se=window.requestAnimationFrame(()=>{T()});return s!==p.current&&(p.current=s),()=>{window.cancelAnimationFrame(se)}},[te,_,T,s]),c.useEffect(()=>{const B=h.current,ce=u.current;if(!B||!ce||typeof ResizeObserver>"u")return;g.current=B.scrollHeight;const J=new ResizeObserver(()=>{const se=B.scrollHeight,ue=g.current;if(g.current=se,se<=ue)return;const fe=ue>0&&ue-B.scrollTop-B.clientHeight<=1;v.current||!(w.current||fe||y.current)||window.requestAnimationFrame(()=>{T()})});return J.observe(ce),()=>{J.disconnect()}},[T]),c.useEffect(()=>{if(!w.current||v.current){f.current=l;return}if(l===f.current)return;f.current=l;const B=window.requestAnimationFrame(()=>{T()});return()=>{window.cancelAnimationFrame(B)}},[l,T]),c.useEffect(()=>{d==null||d(_)},[_,d]),c.useEffect(()=>{const B=h.current,ce=b.current;if(!B||!ce||!V||a||j.current||typeof IntersectionObserver>"u")return;const J=new IntersectionObserver(se=>{!N.current||a||j.current||!se.some(ue=>ue.isIntersecting)||(j.current=!0,o==null||o())},{root:B,threshold:.01});return J.observe(ce),()=>{J.disconnect()}},[V,a,o]),{scrollContainerRef:h,scrollContentRef:u,tailSentinelRef:k,topSentinelRef:b,isTailVisible:_,handleScroll:E,preserveScrollPositionForResize:K,serverManagedHistory:W,effectiveTotalTurnCount:D,startIndex:q,visibleTurnAbsoluteOffset:L,hiddenCount:F,loadedHiddenCount:R,unloadedHiddenCount:X,showLoadAll:z,handleLoadEarlierClick:O,handleLoadAllClick:Q}}function _g({threadId:e,turns:r,totalTurnCount:n,pendingRequests:a=[],activeTurnId:o=null,threadRunning:s=!1,pendingSteers:l=[],livePlan:d=null,liveItems:i=null,respondingRequestId:h=null,onRespondToRequest:u,liveOutput:p,scrollRequestKey:m=0,bottomSpacer:f=0,className:g="",onTailVisibilityChange:x,loadingEarlier:k=!1,onLoadEarlier:b,ephemeralUserNote:y=null,answeredRequestNotes:w=[],activityNotes:v=[],optimisticSteers:N=[],optimisticTurn:j=null,onLoadHistoryItemDetail:S,onOpenThread:P,onSelectArtifact:C,onSelectHistoryItemDetail:M,adapter:_}){var ot,We,Oe,Ze,_e;const[A,te]=c.useState({}),W=(_==null?void 0:_.onLoadHistoryItemDetail)??S,D=_==null?void 0:_.onOpenLinkedThread,{expandedText:q,openExpandedText:de,openCommandDetail:L,openToolCallDetail:Z,openDeferredHistoryItemDetail:R,closeExpandedText:X}=Rg({loadHistoryItemDetail:W,onSelectHistoryItemDetail:M}),{scrollContainerRef:F,scrollContentRef:z,tailSentinelRef:V,topSentinelRef:H,handleScroll:E,preserveScrollPositionForResize:T,serverManagedHistory:K,effectiveTotalTurnCount:O,startIndex:Q,visibleTurnAbsoluteOffset:B,hiddenCount:ce,loadedHiddenCount:J,unloadedHiddenCount:se,showLoadAll:ue,handleLoadEarlierClick:fe,handleLoadAllClick:Ne}=Mg({threadId:e,turnsLength:r.length,totalTurnCount:n,loadingEarlier:k,onLoadEarlier:b,scrollRequestKey:m,bottomSpacer:f,onTailVisibilityChange:x,contentRevisionInputs:[r,a,l,N,p,d,i,j,w,v,y,f]}),Y=c.useCallback(oe=>{te(qe=>({...qe,[oe]:!qe[oe]}))},[]),G=K?r:r.slice(Q),re=O+1,le=s&&(!o||!G.some(oe=>oe.id===o)&&(j==null?void 0:j.id)!==o),ge=(j==null?void 0:j.id)??((ot=G.at(-1))==null?void 0:ot.id)??null,me=le&&ge!==null,ze=!!i&&(G.some(oe=>oe.id===i.turnId)||(j==null?void 0:j.id)===i.turnId),Re=i&&ze?i.turnId:i&&me?ge:null,Ee=j&&Re===j.id?(i==null?void 0:i.items)??null:null,Te=((i==null?void 0:i.items.length)??0)>0,Pe=i&&Re===null?i.items:null,$=c.useMemo(()=>i&&Re===null&&i.items.length>0?Ig(i.turnId,i.items):null,[i,Re]),ie=Math.max(1,O+(j?1:0)),xe=!!p&&!!j&&j.status!=="failed"&&!Ee,be=p&&G.length>0?o&&G.some(oe=>oe.id===o)?o:((We=G.findLast(oe=>fl(oe.status)))==null?void 0:We.id)??(me?ge:null):null,ve=!!be,ye=c.useMemo(()=>pl(p),[p]),$e=[...l.map(oe=>({id:oe.id,prompt:oe.prompt,status:"Accepted",createdAt:oe.createdAt})),...N.map(oe=>({id:oe.id,prompt:oe.prompt,status:oe.status==="steering"?"Steering":null,createdAt:oe.createdAt}))].sort((oe,qe)=>oe.createdAt.localeCompare(qe.createdAt)),Me=c.useMemo(()=>Af({answeredRequestNotes:w,pendingRequests:a,visibleTurns:G,optimisticTurn:j}),[w,j,a,G]),Ie=c.useMemo(()=>Mf({activityNotes:v,visibleTurns:G,optimisticTurn:j}),[v,j,G]);return t.jsxs(t.Fragment,{children:[t.jsx("section",{className:`flex min-h-0 flex-1 flex-col ${g}`.trim(),children:t.jsx("div",{ref:F,"data-testid":"chat-scroll-container",onScroll:E,className:"thread-graph-scroll-container min-h-0 flex-1 overflow-y-auto overscroll-contain",style:f>0?{paddingBottom:f}:void 0,children:t.jsxs("div",{ref:z,className:"thread-graph-scroll-content",children:[t.jsx("div",{ref:H,"aria-hidden":"true",className:"h-px"}),r.length>0&&t.jsx("div",{className:"thread-graph-history-control px-3 pb-1 pt-2 sm:px-5 sm:pb-1.5 sm:pt-3",children:t.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 text-xs sm:text-sm",children:[ce>0&&t.jsx("button",{type:"button",onClick:fe,disabled:k,className:"thread-graph-history-button rounded-full border px-2.5 py-1.5 transition",children:k?"Loading earlier...":"Load 10 earlier"}),ue&&t.jsx("button",{type:"button",onClick:Ne,className:"rounded-full border border-amber-300/40 px-2.5 py-1.5 text-amber-200 transition hover:bg-amber-300/10",children:"Load full history"}),t.jsxs("p",{className:"timeline-meta-text",children:["Showing ",G.length," of ",O," turns",ce>0?` · ${ce} earlier hidden${J>0&&se>0?` (${J} loaded)`:""}`:""]})]})}),r.length===0&&!p&&!j&&t.jsx("div",{className:"thread-graph-empty-state px-3 py-8 text-sm sm:px-5",children:"Send the first prompt to start the thread."}),(G.length>0||j||Ie.leading.length>0||Ie.trailing.length>0)&&t.jsxs("div",{className:"thread-graph-message-list",children:[Ie.leading.length>0?t.jsx(Yt,{notes:Ie.leading,onOpenThread:P,onOpenLinkedThread:D}):null,G.map((oe,qe)=>{var Ke,nt,tt,at,I;return t.jsxs("div",{children:[(((Ke=Ie.beforeTurnId.get(oe.id))==null?void 0:Ke.length)??0)>0?t.jsx(Yt,{notes:Ie.beforeTurnId.get(oe.id)??[],onOpenThread:P,onOpenLinkedThread:D}):null,(((nt=Me.beforeTurnId.get(oe.id))==null?void 0:nt.length)??0)>0?t.jsx(Gn,{entries:Me.beforeTurnId.get(oe.id)??[],respondingRequestId:h,onRespondToRequest:u??void 0}):null,t.jsx(xn,{threadId:e,..._?{adapter:_}:{},turn:oe,absoluteIndex:B+qe+1,isCollapsed:A[oe.id]??!1,livePlan:(d==null?void 0:d.turnId)===oe.id?d:null,liveItems:Re===oe.id?(i==null?void 0:i.items)??null:null,liveOutput:be===oe.id?p:"",forceActive:o===oe.id||me&&ge===oe.id,onToggleCollapse:Y,onOpenExpandedText:de,onOpenCommandDetail:L,onOpenToolCallDetail:Z,onOpenDeferredHistoryItemDetail:R,onBeforeMessageResize:T,...C?{onSelectArtifact:C}:{},scrollRootRef:F,articleRef:void 0}),(((tt=Ie.afterTurnId.get(oe.id))==null?void 0:tt.length)??0)>0?t.jsx(Yt,{notes:Ie.afterTurnId.get(oe.id)??[],onOpenThread:P,onOpenLinkedThread:D}):null,(at=Me.notesByTurnId.get(oe.id))!=null&&at.length||(I=Me.pendingRequestsByTurnId.get(oe.id))!=null&&I.length?t.jsx(_f,{notes:Me.notesByTurnId.get(oe.id)??[],requests:Me.pendingRequestsByTurnId.get(oe.id)??[],respondingRequestId:h,onRespondToRequest:u??void 0}):null]},oe.id)}),j&&G.every(oe=>oe.id!==j.id)&&t.jsxs(t.Fragment,{children:[(((Oe=Ie.beforeTurnId.get(j.id))==null?void 0:Oe.length)??0)>0?t.jsx(Yt,{notes:Ie.beforeTurnId.get(j.id)??[],onOpenThread:P,onOpenLinkedThread:D}):null,(((Ze=Me.beforeTurnId.get(j.id))==null?void 0:Ze.length)??0)>0?t.jsx(Gn,{entries:Me.beforeTurnId.get(j.id)??[],respondingRequestId:h,onRespondToRequest:u??void 0}):null,t.jsx(xn,{threadId:e,..._?{adapter:_}:{},turn:j,absoluteIndex:re,isCollapsed:A[j.id]??!1,livePlan:null,liveItems:Ee,liveOutput:xe?p:"",forceActive:o===j.id||me&&ge===j.id,onToggleCollapse:Y,onOpenExpandedText:de,onOpenCommandDetail:L,onOpenToolCallDetail:Z,onOpenDeferredHistoryItemDetail:R,onBeforeMessageResize:T,...C?{onSelectArtifact:C}:{},scrollRootRef:F}),(((_e=Ie.afterTurnId.get(j.id))==null?void 0:_e.length)??0)>0?t.jsx(Yt,{notes:Ie.afterTurnId.get(j.id)??[],onOpenThread:P,onOpenLinkedThread:D}):null]})]}),$e.length>0&&t.jsx("div",{className:"thread-graph-message-section space-y-3 px-3 py-4 sm:px-5",children:$e.map(oe=>t.jsx(tr,{threadId:e,item:{id:oe.id,kind:"userMessage",text:oe.prompt,status:oe.status},scrollRootRef:F,onBeforeMessageResize:T,..._?{adapter:_}:{}},oe.id))}),(Me.trailing.length>0||Ie.trailing.length>0)&&t.jsx($f,{entries:[...Ie.trailing.map(oe=>({kind:"activity",id:oe.id,createdAt:oe.createdAt,note:oe})),...Me.trailing],respondingRequestId:h,onRespondToRequest:u??void 0,onOpenThread:P,onOpenLinkedThread:D}),y&&t.jsx("div",{className:"thread-graph-message-section px-3 py-2.5 sm:px-5",children:t.jsx(tr,{threadId:e,item:{id:"ephemeral-plan-decision-note",kind:"userMessage",text:y},scrollRootRef:F,onBeforeMessageResize:T})}),$&&Pe&&Pe.length>0&&t.jsx(xn,{threadId:e,..._?{adapter:_}:{},turn:$,absoluteIndex:ie,isCollapsed:A[$.id]??!1,livePlan:(d==null?void 0:d.turnId)===$.id?d:null,liveItems:Pe,liveOutput:"",forceActive:!0,onToggleCollapse:Y,onOpenExpandedText:de,onOpenCommandDetail:L,onOpenToolCallDetail:Z,onOpenDeferredHistoryItemDetail:R,onBeforeMessageResize:T,...C?{onSelectArtifact:C}:{},scrollRootRef:F}),p&&!ve&&!xe&&!Te&&t.jsx("div",{className:"thread-graph-message-section px-3 py-2.5 sm:px-5",children:ye?t.jsx(oa,{threadId:e,item:ye,scrollRootRef:F,onOpenExpandedText:de,onOpenCommandDetail:L,onOpenToolCallDetail:Z,onOpenDeferredHistoryItemDetail:R,onBeforeMessageResize:T,...C?{onSelectArtifact:C}:{},..._?{adapter:_}:{}}):t.jsx(tr,{threadId:e,item:{id:"live-agent-message-fallback",kind:"agentMessage",text:p},scrollRootRef:F,streaming:!0,onBeforeMessageResize:T,..._?{adapter:_}:{}})}),t.jsx("div",{ref:V,"aria-hidden":"true",className:"h-px w-full"})]})})}),t.jsx(ef,{open:q!==null,title:(q==null?void 0:q.title)??"Full text",text:(q==null?void 0:q.text)??"",onClose:X})]})}var Cl=c.memo(_g);function $g(e){return/^[a-z]$/i.test(e)?String.fromCharCode(e.toUpperCase().charCodeAt(0)-64):null}function On(e){return e.replace(/\r\n/g,`
3594
+ `)}function Ts(e){const r=On(e),n=r.split(`
3595
+ `);return r.endsWith(`
3596
+ `)&&n.at(-1)===""&&n.pop(),n}function Dg(e){const r=e.trim();return r?/(?:[$%#>])\s*$/.test(r):!1}function Bg(e,r){const n=r.trim();if(!n||e.length===0)return e;const[a,...o]=e;if(a===void 0)return e;const s=a.trim();return s===n||s.endsWith(` ${n}`)||s.endsWith(`$ ${n}`)||s.endsWith(`% ${n}`)||s.endsWith(`# ${n}`)||s.endsWith(`> ${n}`)?o:e}function Gg(e,r,n){var i,h;const a=Ts(e),o=Ts(r);let s=0;for(;s<a.length&&s<o.length&&a[s]===o[s];)s+=1;let l=0;for(;l<a.length-s&&l<o.length-s&&a[a.length-1-l]===o[o.length-1-l];)l+=1;let d=o.slice(s,o.length-l);for(d=Bg(d,n);d.length>0&&((i=d[0])==null?void 0:i.trim())==="";)d.shift();for(;d.length>0&&(((h=d.at(-1))==null?void 0:h.trim())===""||Dg(d.at(-1)??""));)d.pop();return d.join(`
3597
+ `).trimEnd()}function Fg(e){switch(e){case"ctrl_c":return"";case"ctrl_d":return"";case"esc":return"\x1B";case"tab":return" ";case"up":return"\x1B[A";case"down":return"\x1B[B"}}function Es(e){return{background:e==="light"?"#f2ede5":"#0c1117",foreground:e==="light"?"#3f3a36":"#d6dde6",cursor:e==="light"?"#3f3a36":"#d6dde6",black:e==="light"?"#d8cfc2":"#0f1720",brightBlack:e==="light"?"#8a7f73":"#475569",red:"#f87171",brightRed:"#fb7185",green:e==="light"?"#16a34a":"#86efac",brightGreen:e==="light"?"#22c55e":"#4ade80",yellow:"#fbbf24",brightYellow:"#fcd34d",blue:e==="light"?"#2563eb":"#93c5fd",brightBlue:e==="light"?"#3b82f6":"#60a5fa",magenta:e==="light"?"#7c3aed":"#c4b5fd",brightMagenta:e==="light"?"#8b5cf6":"#a78bfa",cyan:e==="light"?"#0891b2":"#67e8f9",brightCyan:e==="light"?"#06b6d4":"#22d3ee",white:e==="light"?"#5b5148":"#e2e8f0",brightWhite:e==="light"?"#2c2723":"#f8fafc"}}function bn(e){switch(e){case"not_created":return"Not created";case"creating":return"Creating";case"running":return"Running";case"attached":return"Attached";case"detached":return"Detached";case"exited":return"Exited";case"not_found":return"Missing";case"workspace_missing":return"Workspace missing"}}function Yr(e){if(!e)return"";const r=e.replace(/[\\/]+$/,"");return r?r.split(/[\\/]/).filter(Boolean).at(-1)??r:""}function la(e,r){const n=[r==null?void 0:r.trim(),e==null?void 0:e.trim()].filter(Boolean);return n.length>0?n.join(" "):null}function vn(e){return Math.min(75,Math.max(25,e))}function Hg(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",className:"h-4 w-4 fill-current",children:[t.jsx("path",{fillRule:"evenodd",d:"M14.5 10C16.9853 10 19 7.98528 19 5.5C19 5.01783 18.9242 4.55338 18.7838 4.11791C18.6792 3.79367 18.2734 3.72683 18.0325 3.96772L15.3402 6.66002C15.2098 6.79041 15.0168 6.84163 14.8466 6.77074C14.1172 6.46695 13.5334 5.88351 13.2292 5.15431C13.1582 4.98403 13.2094 4.79088 13.3398 4.66042L16.0327 1.9676C16.2735 1.72672 16.2067 1.32092 15.8825 1.21636C15.4469 1.07588 14.9823 1 14.5 1C12.0147 1 10 3.01472 10 5.5C10 5.59783 10.0031 5.69494 10.0093 5.79122C10.065 6.66418 9.88174 7.59855 9.20974 8.15855L1.98017 14.1832C1.3591 14.7008 1 15.4674 1 16.2759C1 17.7804 2.21962 19 3.7241 19C4.53256 19 5.29925 18.6409 5.81681 18.0198L11.8414 10.7903C12.4014 10.1183 13.3358 9.93497 14.2088 9.99073C14.3051 9.99688 14.4022 10 14.5 10ZM5 16C5 16.5523 4.55228 17 4 17C3.44772 17 3 16.5523 3 16C3 15.4477 3.44772 15 4 15C4.55228 15 5 15.4477 5 16Z",clipRule:"evenodd"}),t.jsx("path",{d:"M14.5 11.5C14.6731 11.5 14.8445 11.4927 15.0138 11.4783L18.7678 15.2323C19.7441 16.2086 19.7441 17.7915 18.7678 18.7678C17.7915 19.7441 16.2086 19.7441 15.2323 18.7678L10.8216 14.3571L12.9938 11.7505C13.0455 11.6885 13.1413 11.6131 13.3357 11.5552C13.5378 11.4951 13.805 11.468 14.1132 11.4877C14.2413 11.4959 14.3702 11.5 14.5 11.5Z"}),t.jsx("path",{d:"M6.00003 4.58582L8.33056 6.91635C8.3027 6.95627 8.27496 6.98497 8.24946 7.00622L6.79994 8.21415L4.58582 6.00003H3.30905C3.11966 6.00003 2.94653 5.89303 2.86184 5.72364L1.1612 2.32237C1.06495 2.12987 1.10268 1.89739 1.25486 1.74521L1.74521 1.25486C1.89739 1.10268 2.12987 1.06495 2.32237 1.1612L5.72364 2.86184C5.89303 2.94653 6.00003 3.11966 6.00003 3.30905V4.58582Z"})]})}function Og({connected:e}){return e?t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",className:"h-4.5 w-4.5 fill-none stroke-current",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"})}):t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",className:"h-4.5 w-4.5 fill-none stroke-current",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M13.181 8.68a4.503 4.503 0 0 1 1.903 6.405m-9.768-2.782L3.56 14.06a4.5 4.5 0 0 0 6.364 6.365l3.129-3.129m5.614-5.615 1.757-1.757a4.5 4.5 0 0 0-6.364-6.365l-4.5 4.5c-.258.26-.479.541-.661.84m1.903 6.405a4.495 4.495 0 0 1-1.242-.88 4.483 4.483 0 0 1-1.062-1.683m6.587 2.345 5.907 5.907m-5.907-5.907L8.898 8.898M2.991 2.99 8.898 8.9"})})}function Ls(){return t.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-3.5 w-3.5 fill-none stroke-current",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M5.5 3.25h5"}),t.jsx("path",{d:"M6.4 2h3.2a.9.9 0 0 1 .9.9v.35h1.3a1.2 1.2 0 0 1 1.2 1.2v7.35a1.2 1.2 0 0 1-1.2 1.2H4.2A1.2 1.2 0 0 1 3 11.8V4.45a1.2 1.2 0 0 1 1.2-1.2h1.3V2.9a.9.9 0 0 1 .9-.9Z"})]})}function kn({label:e,tone:r="stone"}){const n=r==="rose"?"border-rose-300/35 bg-rose-300/14 text-rose-600 dark:text-rose-50":r==="sky"?"border-sky-300/35 bg-sky-300/14 text-sky-600 dark:text-sky-50":"shell-control-chip border";return t.jsx("span",{className:`inline-flex min-w-[3.45rem] items-center justify-center rounded-full border px-2.5 py-1.5 text-[11px] font-medium tracking-[0.12em] ${n}`,children:e})}var Ug=120,Wg=800,Vg=4e3,qg=4500,Kg="Shell connection timed out. Reconnecting...";function Xg({isCurrentSocket:e,viewerId:r}){return!e||r?null:{connectionError:Kg,isConnecting:!1,settleAttachPromise:!1,closeSocket:!0}}function Yg({isCurrentSocket:e,shellId:r,attachSize:n}){return e?{message:{type:"shell.attach",shellId:r,cols:n.cols,rows:n.rows},shouldScheduleAttachTimeout:!0}:null}function Zg({intentionalDisconnect:e,userDisconnectedShellId:r,shellId:n}){return!e&&r!==n}function Jg({isCurrentSocket:e,hadViewer:r,intentionalDisconnect:n,userDisconnectedShellId:a,shellId:o}){return e?{shouldDetachShell:r,shouldScheduleReconnect:Zg({intentionalDisconnect:n,userDisconnectedShellId:a,shellId:o})}:null}function Qg({hasAttachSize:e,hasPendingRetry:r}){return!e&&!r}function Sl({shellId:e,terminalReady:r,isVisible:n,canAttachShell:a,userDisconnectedShellId:o,hasTerminal:s,attachSize:l,hasPendingAttachRetry:d,hasCurrentSocketForShell:i,hasReconnectTimer:h}){return!e||!r||!n||!a||o===e||!s?{type:"skip"}:l===void 0?{type:"measureSize"}:l?i?{type:"reuseSocket",shouldClearAttachRetry:d}:{type:"startAttach",attachSize:l,shouldClearAttachRetry:d,shouldClearReconnectTimer:h}:Qg({hasAttachSize:!1,hasPendingRetry:d})?{type:"scheduleRetry"}:{type:"skip"}}function ex({hasShellId:e,terminalReady:r,workspacePathMissing:n,hasViewer:a,hasPendingAttach:o}){return!e||!r||n?{type:"reject"}:a?{type:"alreadyConnected"}:o?{type:"joinPending"}:{type:"startAttach"}}function tx({shellId:e,userDisconnectedShellId:r}){return{shouldClearUserDisconnectedShellId:!!e&&r===e,intentionalDisconnect:!1,connectionError:null,isConnecting:!0,shouldIncrementReconnectKey:!0}}function rx({hasShell:e}){return e?null:{viewerId:null,isConnecting:!1,settleAttachPromise:!1,connectionError:null,runtimePromptLabel:null,isCommandRunning:!1,shellSnapshot:"",lastCommandOutput:"",pendingCommand:null,shouldResetTerminal:!0}}function nx({hasReconnectTimer:e,hasAttachTimeout:r,hasAttachRetry:n}){return{shouldClearReconnectTimer:e,shouldClearAttachTimeout:r,shouldClearAttachRetry:n,settleAttachPromise:!1}}function Tl({shellId:e,viewerId:r}){return e&&r?{type:"shell.detach",shellId:e,viewerId:r}:null}function ax({shellId:e,viewerId:r,hasSocket:n}){return{userDisconnectedShellId:e,intentionalDisconnect:!0,detachMessage:Tl({shellId:e,viewerId:r}),shouldCloseSocket:n,shouldClearSocketRef:!0,shouldClearLastSentSize:!0,shouldDetachShell:!!e}}function sx({shellId:e,viewerId:r,socketReadyState:n,openReadyState:a,hasAttachRetryTimer:o,hasAttachTimeout:s,isCurrentSocket:l}){const d=Tl({shellId:e,viewerId:r});return{intentionalDisconnect:!0,shouldClearAttachRetry:o,detachMessage:d,shouldSendDetachMessage:!!(d&&n===a),shouldClearViewer:!0,isConnecting:!1,settleAttachPromise:l?!1:void 0,shouldClearAttachTimeout:s,shouldCloseSocket:!0,shouldClearSocketRef:l}}function ox({size:e,previousSize:r,shellId:n,viewerId:a,syncBackendSize:o}){return o?(r==null?void 0:r.cols)===e.cols&&r.rows===e.rows?{nextLastSentSize:r,message:null}:{nextLastSentSize:e,message:n&&a?{type:"shell.resize",shellId:n,viewerId:a,cols:e.cols,rows:e.rows}:null}:{nextLastSentSize:r??e,message:null}}function lx(e,r){const n=typeof e.cwdBaseName=="string"?e.cwdBaseName:null,a=typeof e.envPrefix=="string"?e.envPrefix:null;return{data:typeof e.data=="string"?e.data:"",replace:e.replace===!0,cursorX:typeof e.cursorX=="number"?e.cursorX:void 0,cursorY:typeof e.cursorY=="number"?e.cursorY:void 0,paneHeight:typeof e.paneHeight=="number"?e.paneHeight:void 0,promptLabel:la(n??Yr(r),a),isCommandRunning:e.isCommandRunning===!0}}function ix({currentSnapshot:e,data:r,replace:n,isCommandRunning:a,pendingCommand:o}){if(!r)return{nextSnapshot:e,nextPendingCommand:o,lastCommandOutput:null};const s=On(n?r:`${e}${r}`);return!n||a||!o?{nextSnapshot:s,nextPendingCommand:o,lastCommandOutput:null}:{nextSnapshot:s,nextPendingCommand:null,lastCommandOutput:Gg(o.beforeSnapshot,s,o.command)}}function dx({event:e,currentViewerId:r}){if(e.type==="shell.output")return null;if(e.type==="shell.connected"){const a=String(e.payload.viewerId??"");return{viewerId:a||null,isConnecting:!1,settleAttachPromise:!!a,isCommandRunning:void 0,connectionError:void 0,intentionalDisconnect:void 0,closeSocket:!1,shellUpdate:{status:"attached",attachedViewerId:a}}}if(e.type==="shell.error")return{viewerId:void 0,isConnecting:!1,settleAttachPromise:!1,isCommandRunning:void 0,connectionError:String(e.payload.message??"Shell connection failed."),intentionalDisconnect:void 0,closeSocket:!1,shellUpdate:e.payload.code==="viewer_conflict"?{status:"detached",attachedViewerId:null}:void 0};if(e.type==="shell.detached"){const a=String(e.payload.viewerId??"");if(!a||a!==r)return null;const o=String(e.payload.reason??"");return{viewerId:null,isConnecting:!1,settleAttachPromise:!1,isCommandRunning:!1,connectionError:o==="replaced"?"This shell connection was taken over by another pane or device.":null,intentionalDisconnect:o==="replaced"?!0:void 0,closeSocket:!0,shellUpdate:{status:"detached",attachedViewerId:null}}}if(e.type==="shell.exited")return{viewerId:null,isConnecting:!1,settleAttachPromise:!1,isCommandRunning:!1,connectionError:void 0,intentionalDisconnect:!0,closeSocket:!0,shellUpdate:{status:e.payload.state==="exited"?"exited":"not_found",attachedViewerId:null}};const n=e.payload.state;return{viewerId:n==="attached"?void 0:null,isConnecting:n==="attached"?void 0:!1,settleAttachPromise:n==="attached"?void 0:!1,isCommandRunning:n==="attached"?void 0:!1,connectionError:void 0,intentionalDisconnect:void 0,closeSocket:!1,shellUpdate:{status:n,attachedViewerId:n==="attached"?void 0:null}}}function El(e,r,n,a,o){const s=r.replace(/\r\n/g,`
3598
+ `),l=s.split(`
3599
+ `);s.endsWith(`
3600
+ `)&&l.at(-1)===""&&l.pop();let i=l.join(`\r
3601
+ `);if(n!==void 0&&a!==void 0){const u=(o!==void 0?Math.max(0,l.length-o):0)+a,p=Math.max(0,l.length-u-1);p>0&&(i+=`\x1B[${p}A`),i+=`\r\x1B[${n+1}G`}e.reset(),e.write(i,()=>{e.scrollToBottom()})}function Ps(e){return e?Array.from(e.querySelectorAll(".xterm-rows > div")).map(n=>n.textContent??"").filter((n,a,o)=>n.length>0||a<o.length-1).join(`
3602
+ `).trimEnd():""}function cx({clearTimeout:e}){let r=null;const n=o=>{(o==null?void 0:o.timer)!==null&&(o==null?void 0:o.timer)!==void 0&&e(o.timer)};return{hasPending:()=>!!r,joinPending:()=>new Promise(o=>{r==null||r.waiters.push(o)}),start:({timeoutMs:o,setTimeout:s,onTimeout:l})=>new Promise(d=>{const i=s(()=>{r=null,l(),d(!1)},o);r={waiters:[d],timer:i}}),settle:o=>{const s=r;if(s){r=null,n(s);for(const l of s.waiters)l(o)}},clear:()=>{const o=r;r=null,n(o)}}}var zs={status:"not_created",shellInputEnabled:!1,isConnecting:!1,isCommandRunning:!1,promptLabel:null,error:null,hasShell:!1};function ht(e){return e.status!=="exited"&&e.status!=="not_found"}function hx({shell:e,workspacePathMissing:r}){return!!(e&&!r&&ht(e))}function ux(e,r){return e.status===r.status&&e.shellInputEnabled===r.shellInputEnabled&&e.isConnecting===r.isConnecting&&e.isCommandRunning===r.isCommandRunning&&e.promptLabel===r.promptLabel&&e.error===r.error&&e.hasShell===r.hasShell}function mx(e){return(e.activeShellId?e.shells.find(r=>r.id===e.activeShellId&&ht(r)):null)??(e.shell&&ht(e.shell)?e.shell:null)??e.shells.find(ht)??null}function px({activeRuntime:e,activeShell:r,busy:n,loading:a,status:o,workspacePathMissing:s}){const l=n||a||o==="creating"||s,d=e.shellInputEnabled?"Disconnect shell":r&&!ht(r)?"Restart shell":r?"Connect shell":"Create shell",i=e.shellInputEnabled?"border-emerald-300/45 bg-emerald-300/18 text-emerald-50 ring-1 ring-emerald-300/20 hover:bg-emerald-300/24":r&&!ht(r)?"border-stone-600 bg-stone-800/90 text-stone-100 hover:border-stone-500 hover:bg-stone-800":s?"border-rose-300/35 bg-rose-300/12 text-rose-100":"border-stone-600 bg-stone-800/90 text-stone-100 hover:border-stone-500 hover:bg-stone-800";return{disabled:l,label:d,className:i}}function fx({activeRuntime:e,activeShell:r,connectionButtonDisabled:n,connectionButtonLabel:a,isMobileShell:o,busy:s,loading:l,error:d}){return{status:e.status,connectionButtonDisabled:n,connectionButtonLabel:a,shellInputEnabled:e.shellInputEnabled,isConnecting:e.isConnecting,isCommandRunning:e.isCommandRunning,promptLabel:e.promptLabel??(r?la(Yr(r.cwd),null):null),isMobileShell:o,hasShell:!!r,busy:s,loading:l,error:e.error??d}}function Lt(e){return e.current===null?!1:(window.clearTimeout(e.current),e.current=null,!0)}function gx({attachRetryTimerRef:e,setReconnectKey:r,delayMs:n=Ug}){e.current=window.setTimeout(()=>{e.current=null,r(a=>a+1)},n)}function xx({reconnectTimerRef:e,setReconnectKey:r,delayMs:n=Wg}){e.current=window.setTimeout(()=>{e.current=null,r(a=>a+1)},n)}function bx({shellSocket:e,socketRef:r,viewerIdRef:n,attachTimeoutRef:a,setConnectionError:o,setIsConnecting:s,settleAttachPromise:l,delayMs:d=Vg}){a.current=window.setTimeout(()=>{var h,u,p;a.current=null;const i=Xg({isCurrentSocket:!e.socket||((h=r.current)==null?void 0:h.socket)===e.socket,viewerId:n.current});i&&(o(i.connectionError),s(i.isConnecting),l(i.settleAttachPromise),i.closeSocket&&((u=e.close)==null||u.call(e),(p=e.socket)==null||p.close()))},d)}function vx(e){return{...e,status:e.status==="attached"?"detached":e.status,attachedViewerId:null}}function kx({shellId:e,viewerId:r,shellSocket:n,attachRetryTimerRef:a,attachTimeoutRef:o,socketRef:s,openReadyState:l}){var d;return sx({shellId:e,viewerId:r,socketReadyState:n.socket.readyState,openReadyState:l,hasAttachRetryTimer:a.current!==null,hasAttachTimeout:o.current!==null,isCurrentSocket:((d=s.current)==null?void 0:d.socket)===n.socket})}function wx({closeApplication:e,shellId:r,attachTimeoutRef:n,socketRef:a,reconnectTimerRef:o,setViewerId:s,setIsConnecting:l,settleAttachPromise:d,onShellUpdate:i,setReconnectKey:h}){const u=e.closeAction;return u?(e.shouldClearAttachTimeout&&Lt(n),e.shouldClearSocketRef&&(a.current=null),s(e.viewerId),l(e.isConnecting),d(e.settleAttachPromise),u.shouldDetachShell&&i(r,vx,"detached"),u.shouldScheduleReconnect&&xx({reconnectTimerRef:o,setReconnectKey:h}),!0):!1}function yx({cleanupAction:e,shellSocket:r,attachRetryTimerRef:n,attachTimeoutRef:a,socketRef:o,intentionalDisconnectRef:s,setViewerId:l,setIsConnecting:d,settleAttachPromise:i}){s.current=e.intentionalDisconnect,e.shouldClearAttachRetry&&Lt(n),e.shouldSendDetachMessage&&e.detachMessage&&r.send(e.detachMessage),l(null),d(e.isConnecting),e.settleAttachPromise!==void 0&&i(e.settleAttachPromise),e.shouldClearAttachTimeout&&Lt(a),r.socket.close(),e.shouldClearSocketRef&&(o.current=null)}function jx({eventShellId:e,shellId:r,socketExists:n,isCurrentSocket:a}){return n&&!a?!1:e===r}function Nx(e){return Sl({...e,attachSize:void 0})}function Cx({attachSize:e,...r}){return Sl({...r,attachSize:e})}function Sx({isCurrentSocket:e,shellId:r,attachSize:n,hasAttachTimeout:a}){const o=Yg({isCurrentSocket:e,shellId:r,attachSize:n});return{openAction:o,shouldClearAttachTimeout:!!(o&&a)}}function Tx(e){const r=String(e.payload.viewerId??"");return{viewerId:r||null,settleAttachPromise:!!r,nextShell:n=>({...n,status:"attached",attachedViewerId:r})}}function Ex({event:e,shellCwd:r,currentSnapshot:n,pendingCommand:a}){const o=lx(e.payload,r),s=o.data?ix({currentSnapshot:n,data:o.data,replace:o.replace,isCommandRunning:o.isCommandRunning,pendingCommand:a}):null;return{output:o,snapshotUpdate:s}}function Lx({isCurrentSocket:e,hadViewer:r,intentionalDisconnect:n,userDisconnectedShellId:a,shellId:o,hasAttachTimeout:s}){const l=Jg({isCurrentSocket:e,hadViewer:r,intentionalDisconnect:n,userDisconnectedShellId:a,shellId:o});return{closeAction:l,shouldClearAttachTimeout:!!(l&&s),shouldClearSocketRef:!!l,viewerId:null,isConnecting:!1,settleAttachPromise:!1}}function Px(e,r){return r.shellUpdate?{...e,status:r.shellUpdate.status==="attached"||r.shellUpdate.status==="detached"||r.shellUpdate.status==="exited"||r.shellUpdate.status==="not_found"?r.shellUpdate.status:e.status,attachedViewerId:r.shellUpdate.attachedViewerId===void 0?e.attachedViewerId:r.shellUpdate.attachedViewerId}:e}function zx(e){return e.current}function Ix({shell:e,shellAdapter:r,canAttachShell:n,terminalReady:a,reconnectKey:o,terminalRef:s,socketRef:l,viewerIdRef:d,shellIdRef:i,reconnectTimerRef:h,attachTimeoutRef:u,attachRetryTimerRef:p,isVisibleRef:m,intentionalDisconnectRef:f,userDisconnectedShellIdRef:g,shellSnapshotRef:x,pendingCommandRef:k,lastCommandOutputRef:b,snapshotCursorRef:y,syncTerminalSizeRef:w,setReconnectKey:v,setViewerId:N,setIsConnecting:j,setConnectionError:S,setRuntimePromptLabel:P,setIsCommandRunning:C,settleAttachPromise:M,onShellUpdate:_}){const A=e==null?void 0:e.id,te=e==null?void 0:e.cwd;c.useEffect(()=>{const W=s.current,D={shellId:A??null,terminalReady:a,isVisible:m.current,canAttachShell:n,userDisconnectedShellId:g.current,hasTerminal:!!W,hasPendingAttachRetry:p.current!==null,hasCurrentSocketForShell:!!(l.current&&i.current===A),hasReconnectTimer:h.current!==null};if(Nx(D).type==="skip")return;const de=w.current(),L=Cx({...D,attachSize:de});if(L.type==="skip"||L.type==="measureSize")return;if(L.type==="scheduleRetry"){gx({attachRetryTimerRef:p,setReconnectKey:v});return}if(L.shouldClearAttachRetry&&Lt(p),L.type==="reuseSocket"||(L.shouldClearReconnectTimer&&Lt(h),!A||!W))return;const Z=L.attachSize;i.current=A,W.reset(),S(null),N(null),j(!0),f.current=!1;const R=r.connectSocket({onConnected:()=>{var V;const X=u.current,F=Sx({isCurrentSocket:((V=l.current)==null?void 0:V.socket)===R.socket,shellId:A,attachSize:Z,hasAttachTimeout:X!==null}),z=F.openAction;z&&(R.send(z.message),F.shouldClearAttachTimeout&&X!==null&&Lt(u),z.shouldScheduleAttachTimeout&&bx({shellSocket:R,socketRef:l,viewerIdRef:d,attachTimeoutRef:u,setConnectionError:S,setIsConnecting:j,settleAttachPromise:M}))},onShellEvent:X=>{var V;if(!jx({eventShellId:X.shellId,shellId:A,socketExists:!!R.socket,isCurrentSocket:((V=l.current)==null?void 0:V.socket)===R.socket}))return;if(X.type==="shell.connected"){Lt(u);const H=Tx(X);N(H.viewerId),j(!1),M(H.settleAttachPromise),_(A,H.nextShell,"attached");return}if(X.type==="shell.output"){const{output:H,snapshotUpdate:E}=Ex({event:X,shellCwd:te,currentSnapshot:x.current,pendingCommand:k.current});y.current={cursorX:H.cursorX,cursorY:H.cursorY,paneHeight:H.paneHeight},P(H.promptLabel),C(H.isCommandRunning),E&&(x.current=E.nextSnapshot,k.current=E.nextPendingCommand,E.lastCommandOutput!==null&&(b.current=E.lastCommandOutput),H.replace?El(W,H.data,H.cursorX,H.cursorY,H.paneHeight):W.write(H.data));return}const z=dx({event:X,currentViewerId:d.current});z&&(z.viewerId!==void 0&&N(z.viewerId),z.isConnecting!==void 0&&j(z.isConnecting),z.settleAttachPromise!==void 0&&M(z.settleAttachPromise),z.isCommandRunning!==void 0&&C(z.isCommandRunning),z.connectionError!==void 0&&S(z.connectionError),z.intentionalDisconnect!==void 0&&(f.current=z.intentionalDisconnect),z.shellUpdate&&_(A,H=>Px(H,z),z.shellUpdate.status),z.closeSocket&&R.socket.close())}});return l.current=R,R.socket.addEventListener("close",()=>{var z;const X=u.current,F=Lx({isCurrentSocket:((z=l.current)==null?void 0:z.socket)===R.socket,hadViewer:!!d.current,intentionalDisconnect:f.current,userDisconnectedShellId:g.current,shellId:A,hasAttachTimeout:X!==null});wx({closeApplication:F,shellId:A,attachTimeoutRef:u,socketRef:l,reconnectTimerRef:h,setViewerId:N,setIsConnecting:j,settleAttachPromise:M,onShellUpdate:_,setReconnectKey:v})}),()=>{const X=zx(d),F=kx({shellId:A,viewerId:X,shellSocket:R,attachRetryTimerRef:p,attachTimeoutRef:u,socketRef:l,openReadyState:WebSocket.OPEN});yx({cleanupAction:F,shellSocket:R,attachRetryTimerRef:p,attachTimeoutRef:u,socketRef:l,intentionalDisconnectRef:f,setViewerId:N,setIsConnecting:j,settleAttachPromise:M})}},[p,u,n,f,m,b,_,k,o,h,S,C,j,v,P,N,M,te,A,r,i,x,y,l,w,a,s,g,d])}function wn(e){return e.current}var Is=c.forwardRef(function({paneId:r,shell:n,isActive:a,isVisible:o,isMobileShell:s,effectiveTheme:l,workspacePathMissing:d,shellAdapter:i,onActivate:h,onShellUpdate:u,onRuntimeStateChange:p,onFeedback:m},f){const g=c.useRef(null),x=c.useRef(null),k=c.useRef(null),b=c.useRef(null),y=c.useRef(null),w=c.useRef(null),v=c.useRef(null),N=c.useRef(null),j=c.useRef(!1),S=c.useRef(null),P=c.useRef(""),C=c.useRef(null),M=c.useRef(""),_=c.useRef(null),A=c.useRef(null),te=c.useRef({cursorX:void 0,cursorY:void 0,paneHeight:void 0}),W=c.useRef(!1),D=c.useRef(null),q=c.useRef(o),de=c.useRef(s),L=c.useRef(()=>!1),Z=c.useRef(()=>null),R=c.useRef(()=>{}),X=c.useRef(cx({clearTimeout:window.clearTimeout})),[F,z]=c.useState(null),[V,H]=c.useState(!1),[E,T]=c.useState(null),[K,O]=c.useState(!1),[Q,B]=c.useState(null),[ce,J]=c.useState(null),[se,ue]=c.useState(!1),[fe,Ne]=c.useState(0),Y=(n==null?void 0:n.status)??"not_created",G=hx({shell:n,workspacePathMissing:d}),re=c.useMemo(()=>la(Yr(n==null?void 0:n.cwd),null),[n==null?void 0:n.cwd]),le=ce??re,ge=c.useCallback($=>{b.current=$,T($)},[]),me=c.useCallback($=>{X.current.settle($)},[]);c.useEffect(()=>{q.current=o},[o]),c.useEffect(()=>{de.current=s},[s]),c.useEffect(()=>{y.current=(n==null?void 0:n.id)??null},[n==null?void 0:n.id]);const ze=c.useCallback($=>{const ie=k.current,xe=y.current,be=b.current;return!ie||!xe||!be?!1:(ie.send({type:"shell.input",shellId:xe,viewerId:be,data:$}),!0)},[]);c.useEffect(()=>{L.current=ze},[ze]);const Re=c.useCallback(()=>{const $=k.current,ie=y.current,xe=b.current;return!$||!ie||!xe?!1:($.send({type:"shell.clear",shellId:ie,viewerId:xe}),!0)},[]),Ee=c.useCallback(()=>{if(!o||!F)return!1;const $=F.getBoundingClientRect();return $.width>0&&$.height>0},[o,F]),Te=c.useCallback($=>{const ie=g.current,xe=x.current;if(!ie||!xe||!Ee()||(xe.fit(),ie.cols<=0||ie.rows<=0))return null;const be={cols:ie.cols,rows:ie.rows},ve=ox({size:be,previousSize:A.current,shellId:y.current,viewerId:b.current,syncBackendSize:($==null?void 0:$.syncBackendSize)!==!1});return($==null?void 0:$.syncBackendSize)===!1||(A.current=ve.nextLastSentSize,!ve.message)||k.current&&k.current.send(ve.message),be},[Ee]);c.useEffect(()=>{Z.current=Te},[Te]);const Pe=c.useCallback($=>{const ie=g.current;!ie||!Ee()||(Te(($==null?void 0:$.syncBackendSize)===void 0?void 0:{syncBackendSize:$.syncBackendSize}),P.current&&!Ps(F)?El(ie,P.current,te.current.cursorX,te.current.cursorY,te.current.paneHeight):ie.scrollToBottom(),$!=null&&$.focus&&!s&&ie.focus())},[s,Ee,Te,F]);return c.useEffect(()=>{R.current=()=>Pe()},[Pe]),c.useEffect(()=>{p({status:E?"attached":Y,shellInputEnabled:!!(E&&n),isConnecting:K,isCommandRunning:se,promptLabel:le,error:Q,hasShell:!!n})},[Q,K,se,p,le,n,Y,E]),c.useEffect(()=>{if(!F||g.current||W.current)return;let $=!1;return W.current=!0,(async()=>{const[{Terminal:ie},{FitAddon:xe}]=await Promise.all([Be(()=>import("./terminal-vendor-CLGgN91S.js").then(ye=>ye.x),__vite__mapDeps([6,2,7])),Be(()=>import("./terminal-vendor-CLGgN91S.js").then(ye=>ye.a),__vite__mapDeps([6,2,7]))]);if($||!F){W.current=!1;return}const be=new ie({cursorBlink:!0,disableStdin:de.current,fontFamily:"IBM Plex Mono, SFMono-Regular, Menlo, monospace",fontSize:13,lineHeight:1.25,scrollback:3e3,theme:Es(l)}),ve=new xe;be.loadAddon(ve),be.open(F),g.current=be,x.current=ve,Z.current(),be.attachCustomKeyEventHandler(ye=>{if(de.current||ye.type!=="keydown")return!0;if(ye.ctrlKey&&!ye.altKey&&!ye.metaKey&&!ye.shiftKey){const $e=$g(ye.key);if(!$e)return!0;if(L.current($e))return ye.preventDefault(),!1}return!0}),H(!0),W.current=!1,_.current=new ResizeObserver(()=>{R.current()}),_.current.observe(F),D.current=be.onData(ye=>{de.current||L.current(ye)})})(),()=>{var ie,xe,be;$=!0,W.current=!1,(ie=D.current)==null||ie.dispose(),D.current=null,(xe=_.current)==null||xe.disconnect(),_.current=null,H(!1),(be=g.current)==null||be.dispose(),g.current=null,x.current=null,A.current=null}},[l,F]),c.useEffect(()=>{var ie;const $=rx({hasShell:!!n});$&&(ge($.viewerId),O($.isConnecting),me($.settleAttachPromise),B($.connectionError),J($.runtimePromptLabel),ue($.isCommandRunning),P.current=$.shellSnapshot,M.current=$.lastCommandOutput,C.current=$.pendingCommand,$.shouldResetTerminal&&((ie=g.current)==null||ie.reset()))},[ge,me,n]),c.useEffect(()=>{const $=g.current;$&&($.options.theme=Es(l))},[l]),c.useEffect(()=>{const $=g.current;$&&($.options.disableStdin=s)},[s]),c.useEffect(()=>{if(!o||!V)return;const $=window.requestAnimationFrame(()=>{Pe({focus:a,syncBackendSize:!1}),!k.current&&(n!=null&&n.id)&&S.current!==n.id&&Ne(ie=>ie+1)});return()=>{window.cancelAnimationFrame($)}},[a,o,Pe,n==null?void 0:n.id,V]),Ix({shell:n,shellAdapter:i,canAttachShell:G,terminalReady:V,reconnectKey:fe,terminalRef:g,socketRef:k,viewerIdRef:b,shellIdRef:y,reconnectTimerRef:w,attachTimeoutRef:v,attachRetryTimerRef:N,isVisibleRef:q,intentionalDisconnectRef:j,userDisconnectedShellIdRef:S,shellSnapshotRef:P,pendingCommandRef:C,lastCommandOutputRef:M,snapshotCursorRef:te,syncTerminalSizeRef:Z,setReconnectKey:Ne,setViewerId:ge,setIsConnecting:O,setConnectionError:B,setRuntimePromptLabel:J,setIsCommandRunning:ue,settleAttachPromise:me,onShellUpdate:u}),c.useEffect(()=>()=>{const $=wn(w),ie=wn(v),xe=wn(N),be=nx({hasReconnectTimer:$!==null,hasAttachTimeout:ie!==null,hasAttachRetry:xe!==null});be.shouldClearReconnectTimer&&$!==null&&window.clearTimeout($),be.shouldClearAttachTimeout&&ie!==null&&window.clearTimeout(ie),be.shouldClearAttachRetry&&xe!==null&&window.clearTimeout(xe),me(be.settleAttachPromise)},[me]),c.useImperativeHandle(f,()=>({disconnect(){const $=k.current,ie=y.current,xe=b.current,be=ax({shellId:ie,viewerId:xe,hasSocket:!!$});S.current=be.userDisconnectedShellId,j.current=be.intentionalDisconnect,$&&be.detachMessage&&$.send(be.detachMessage),ge(null),O(!1),me(!1),be.shouldCloseSocket&&($==null||$.socket.close()),k.current=null,A.current=null,be.shouldDetachShell&&ie&&u(ie,ve=>({...ve,status:"detached",attachedViewerId:null}),"detached")},reconnect(){const $=ex({hasShellId:!!y.current,terminalReady:V,workspacePathMissing:d,hasViewer:!!b.current,hasPendingAttach:X.current.hasPending()});if($.type==="reject")return Promise.resolve(!1);if($.type==="alreadyConnected")return Promise.resolve(!0);if($.type==="joinPending")return X.current.joinPending();const ie=X.current.start({timeoutMs:qg,setTimeout:window.setTimeout,onTimeout:()=>{O(!1)}}),xe=tx({shellId:y.current,userDisconnectedShellId:S.current});return xe.shouldClearUserDisconnectedShellId&&(S.current=null),j.current=xe.intentionalDisconnect,B(xe.connectionError),O(xe.isConnecting),Ne(be=>be+1),ie},sendInput($){return ze($)},sendCommand($){const ie={command:$,beforeSnapshot:P.current};if(C.current=ie,$.trim()==="clear"){const ve=Re();return!ve&&C.current===ie&&(C.current=null),ve}const xe=$.endsWith(`
3603
+ `)?$:`${$}
3604
+ `,be=ze(xe);return!be&&C.current===ie&&(C.current=null),be},sendControl($){return $==="clear"?Re():ze(Fg($))},async copyLastCommandOutput(){const $=M.current.trim()||Ps(F);if(!$)return m==null||m("failed","Nothing to copy"),!1;try{return await navigator.clipboard.writeText($),m==null||m("done","Copied"),!0}catch{return m==null||m("failed","Copy failed"),!1}},focus(){var $;($=g.current)==null||$.focus()},refreshLayout($){Pe($)}}),[m,u,Pe,Re,ze,ge,me,F,V,d]),t.jsxs("div",{className:`relative min-h-0 flex-1 overflow-hidden ${a?"shell-pane-active":""}`,onMouseDown:h,"data-pane-id":r,children:[t.jsx("div",{ref:z,className:`h-full w-full px-2 py-2 sm:px-3 sm:py-3 ${s?"mobile-shell-selectable":""}`,onMouseDown:()=>{var $;h(),($=g.current)==null||$.focus()}}),a&&t.jsx("div",{className:"pointer-events-none absolute right-2 top-2 rounded-md border border-sky-300/30 bg-sky-300/10 px-2 py-1 text-[10px] uppercase tracking-[0.12em] text-sky-100",children:"Active"})]})}),Rx=c.forwardRef(function({threadId:r,shellAdapter:n,isVisible:a=!0,showHeader:o=!0,showFloatingToolbox:s=!0,effectiveTheme:l="dark",loadSplitRatio:d,saveSplitRatio:i,onStateChange:h},u){const p=c.useRef(null),m=c.useRef(null),f=c.useRef(null),g=c.useRef(null),x=c.useRef(null),k=c.useRef(!1),[b,y]=c.useState(null),[w,v]=c.useState(!0),[N,j]=c.useState(!1),[S,P]=c.useState(null),[C,M]=c.useState("primary"),[_,A]=c.useState(null),[te,W]=c.useState(null),[D,q]=c.useState("single"),[de,L]=c.useState(50),[Z,R]=c.useState(null),[X,F]=c.useState(""),[z,V]=c.useState(!1),[H,E]=c.useState(!1),[T,K]=c.useState(!1),[O,Q]=c.useState({primary:zs,secondary:zs}),[B,ce]=c.useState(null),J=(b==null?void 0:b.state)??"not_created",se=c.useMemo(()=>(b==null?void 0:b.shells)??[],[b==null?void 0:b.shells]),ue=c.useMemo(()=>se.filter(ht),[se]),fe=c.useMemo(()=>ue.find(I=>I.id===_)??null,[ue,_]),Ne=c.useMemo(()=>ue.find(I=>I.id===te)??null,[ue,te]),Y=C==="secondary"?Ne:fe,G=O[C],re=(b==null?void 0:b.workspacePathStatus)==="missing",le=C==="secondary"?m:p,ge=px({activeRuntime:G,activeShell:Y,busy:N,loading:w,status:J,workspacePathMissing:re}),me=ge.disabled,ze=ge.label,Re=ge.className,Ee=(B==null?void 0:B.tone)==="done"?"shell-floating-feedback shell-floating-feedback-done":(B==null?void 0:B.tone)==="failed"?"shell-floating-feedback shell-floating-feedback-failed":"shell-floating-feedback",Te=c.useCallback((I,U)=>{ce({tone:I,text:U}),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{ce(null),f.current=null},1800)},[]),Pe=c.useCallback((I,U,he)=>{y(Ce=>{var lt;if(!Ce)return Ce;const Ue=Ce.shells.map(Ve=>Ve.id===I?U(Ve):Ve),Qe=((lt=Ce.shell)==null?void 0:lt.id)===I?U(Ce.shell):Ue.find(Ve=>{var Xe;return Ve.id===((Xe=Ce.shell)==null?void 0:Xe.id)})??Ce.shell;return{...Ce,...he?{state:he}:{},shell:Qe,shells:Ue}})},[]),$=c.useCallback(async()=>{v(!0);try{const I=await n.fetchState(r);y(I),P(null)}catch(I){P(I instanceof Error?I.message:"Unable to load shell state.")}finally{v(!1)}},[n,r]);c.useEffect(()=>{$()},[$]),c.useEffect(()=>{const I=d==null?void 0:d(r);if(I==null){L(50);return}const U=typeof I=="number"?I:Number.parseFloat(String(I));L(Number.isFinite(U)?vn(U):50)},[d,r]),c.useEffect(()=>{if(!b){A(null),W(null);return}const I=mx(b);A(U=>U&&b.shells.some(he=>he.id===U&&ht(he))?U:(I==null?void 0:I.id)??null),W(U=>{if(D!=="columns")return null;if(U&&b.shells.some(Ce=>Ce.id===U&&ht(Ce)))return U;const he=b.shells.find(Ce=>ht(Ce)&&Ce.id!==(I==null?void 0:I.id));return(he==null?void 0:he.id)??null})},[b,D]),c.useEffect(()=>{D!=="columns"&&(M("primary"),W(null))},[D]),c.useEffect(()=>{if(D!=="columns"||te||ue.length<2)return;const I=ue.find(U=>U.id!==(fe==null?void 0:fe.id))??null;I&&W(I.id)},[ue,fe==null?void 0:fe.id,te,D]),c.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const I=window.matchMedia("(max-width: 767px), (hover: none) and (pointer: coarse)"),U=()=>{V(I.matches),I.matches||(K(!1),E(!1))};return U(),I.addEventListener("change",U),()=>{I.removeEventListener("change",U)}},[]),c.useEffect(()=>()=>{f.current!==null&&window.clearTimeout(f.current),x.current!==null&&window.cancelAnimationFrame(x.current)},[]);const ie=c.useCallback((I,U)=>{Q(he=>{const Ce=he[I];return ux(Ce,U)?he:{...he,[I]:U}})},[]),xe=c.useCallback(I=>ie("primary",I),[ie]),be=c.useCallback(I=>ie("secondary",I),[ie]),ve=c.useCallback(I=>{var he;if((he=I.label)!=null&&he.trim())return I.label.trim();const U=se.findIndex(Ce=>Ce.id===I.id);return`Shell ${U>=0?U+1:""}`.trim()},[se]),ye=c.useCallback(I=>{var U;R(I.id),F(((U=I.label)==null?void 0:U.trim())||ve(I))},[ve]),$e=c.useCallback(()=>{R(null),F("")},[]),Me=c.useCallback(async()=>{if(Z){j(!0);try{const I=X.trim(),U=await n.updateShell(Z,{label:I.length>0?I:null});y(he=>{var Ce;return he&&{...he,state:he.activeShellId===U.id?U.status:he.state,shell:((Ce=he.shell)==null?void 0:Ce.id)===U.id?U:he.shell,shells:he.shells.map(Ue=>Ue.id===U.id?U:Ue)}}),R(null),F(""),P(null)}catch(I){P(I instanceof Error?I.message:"Unable to rename shell.")}finally{j(!1)}}},[X,Z,n]),Ie=c.useCallback((I,U)=>{if(I==="primary"){A(U),W(he=>he===U?null:he);return}W(U),A(he=>he===U?null:he)},[]),ot=c.useCallback(I=>{var U,he;if(I==="primary"){(U=p.current)==null||U.disconnect(),A(null),D==="columns"&&M("secondary");return}(he=m.current)==null||he.disconnect(),W(null),M("primary"),q("single")},[D]),We=c.useCallback((I,U=C)=>{const he=D==="columns"?U:"primary";Ie(he,I.id),D!=="columns"&&W(null),M(he)},[C,Ie,D]),Oe=c.useCallback(async(I=C)=>{var U;if(!k.current){k.current=!0,j(!0);try{const he=await n.createShell(r);y(he);const Ce=he.activeShellId??((U=he.shell)==null?void 0:U.id)??null;if(Ce){const Ue=D==="columns"?I:"primary";Ie(Ue,Ce),D!=="columns"&&W(null),M(Ue)}P(null)}catch(he){P(he instanceof Error?he.message:"Unable to create shell.")}finally{k.current=!1,j(!1)}}},[C,Ie,n,D,r]);c.useEffect(()=>{!a||!b||w||N||re||J==="creating"||ue.length>0||Oe("primary")},[N,Oe,a,ue.length,w,b,J,re]);const Ze=c.useCallback(async(I=(Y==null?void 0:Y.id)??"")=>{if(I){j(!0);try{await n.terminateShell(I),A(U=>U===I?null:U),W(U=>U===I?null:U),await $(),P(null)}catch(U){P(U instanceof Error?U.message:"Unable to terminate shell.")}finally{j(!1)}}},[Y==null?void 0:Y.id,$,n]),_e=c.useCallback(async()=>{var I,U;if(!me){if(G.shellInputEnabled){(I=le.current)==null||I.disconnect();return}if(!Y||Y.status==="exited"||Y.status==="not_found"){await Oe(C);return}await((U=le.current)==null?void 0:U.reconnect())}},[C,le,G.shellInputEnabled,Y,me,Oe]),oe=c.useCallback(I=>{typeof window>"u"||i==null||i(r,vn(I))},[i,r]),qe=c.useCallback(()=>{var I,U;(I=p.current)==null||I.refreshLayout({syncBackendSize:!0}),(U=m.current)==null||U.refreshLayout({syncBackendSize:!0})},[]),Ke=c.useCallback(I=>{var Qe,lt;if(D!=="columns")return;const U=g.current;if(!U)return;I.preventDefault(),(lt=(Qe=I.currentTarget).setPointerCapture)==null||lt.call(Qe,I.pointerId);const he=Ve=>{const Xe=U.getBoundingClientRect();if(Xe.width<=0)return;const pe=vn((Ve-Xe.left)/Xe.width*100);L(pe),x.current!==null&&window.cancelAnimationFrame(x.current),x.current=window.requestAnimationFrame(()=>{x.current=null,qe()})},Ce=Ve=>{he(Ve.clientX)},Ue=Ve=>{he(Ve.clientX);const Xe=U.getBoundingClientRect();Xe.width>0&&oe((Ve.clientX-Xe.left)/Xe.width*100),window.removeEventListener("pointermove",Ce),window.removeEventListener("pointerup",Ue)};window.addEventListener("pointermove",Ce),window.addEventListener("pointerup",Ue,{once:!0})},[oe,qe,D]),nt=c.useCallback((I,U)=>{Ie(U,I.id),M(U)},[Ie]),tt=c.useCallback(async()=>{var U;return await((U=le.current)==null?void 0:U.copyLastCommandOutput())?!0:(Te("failed","Nothing to copy"),!1)},[le,Te]);c.useEffect(()=>{h==null||h(fx({activeRuntime:G,activeShell:Y,connectionButtonDisabled:me,connectionButtonLabel:ze,isMobileShell:z,busy:N,loading:w,error:S}))},[G,Y,N,me,ze,S,z,w,h]),c.useImperativeHandle(u,()=>({async toggleConnection(){await _e()},sendInput(I){var U;return((U=le.current)==null?void 0:U.sendInput(I))??!1},sendCommand(I){var U;return((U=le.current)==null?void 0:U.sendCommand(I))??!1},sendControl(I){var U;return((U=le.current)==null?void 0:U.sendControl(I))??!1},async copyLastCommandOutput(){var I;return await((I=le.current)==null?void 0:I.copyLastCommandOutput())??!1},async terminate(){await Ze()},focus(){var I;(I=le.current)==null||I.focus()},refreshLayout(I){var U,he;(U=p.current)==null||U.refreshLayout(I),D==="columns"&&((he=m.current)==null||he.refreshLayout(I))}}),[le,_e,Ze,D]);const at=I=>t.jsx("div",{className:`rounded-md border px-2 py-1.5 text-xs ${I.id===(Y==null?void 0:Y.id)?"border-sky-300/40 bg-sky-300/12 text-sky-50":"border-stone-800 bg-stone-900/40 text-stone-300"}`,children:t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[Z===I.id?t.jsx("form",{className:"min-w-0 flex-1",onSubmit:U=>{U.preventDefault(),Me()},children:t.jsx("input",{value:X,onChange:U=>F(U.currentTarget.value),onKeyDown:U=>{U.key==="Escape"&&(U.preventDefault(),$e())},autoFocus:!0,className:"w-full rounded border border-sky-300/35 bg-stone-950/70 px-2 py-1 text-xs text-stone-100 outline-none","aria-label":"Shell name"})}):t.jsxs("button",{type:"button",onClick:()=>We(I),onDoubleClick:()=>ye(I),className:"min-w-0 flex-1 text-left",title:I.tmuxSessionName,children:[t.jsx("span",{className:"block truncate",children:ve(I)}),t.jsxs("span",{className:"block truncate text-[10px] text-[var(--theme-fg-muted)]",children:[bn(I.status)," · ",Yr(I.cwd)||I.cwd]})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[Z===I.id?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>void Me(),className:"rounded border border-sky-300/35 bg-sky-300/12 px-1.5 py-1 text-[10px] text-sky-50",title:"Save shell name",children:"Save"}),t.jsx("button",{type:"button",onClick:$e,className:"rounded border border-stone-700 px-1.5 py-1 text-[10px] text-stone-200",title:"Cancel rename",children:"Cancel"})]}):t.jsx("button",{type:"button",onClick:()=>ye(I),className:"rounded border border-stone-700 px-1.5 py-1 text-[10px] text-stone-200 hover:border-sky-300/40",title:"Rename shell",children:"Rename"}),D==="columns"&&t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:()=>nt(I,"primary"),className:"rounded border border-stone-700 px-1.5 py-1 text-[10px] text-stone-200 hover:border-sky-300/40",title:"Open in left pane",children:"L"}),t.jsx("button",{type:"button",onClick:()=>nt(I,"secondary"),className:"rounded border border-stone-700 px-1.5 py-1 text-[10px] text-stone-200 hover:border-sky-300/40",title:"Open in right pane",children:"R"})]}),t.jsx("button",{type:"button",disabled:N,onClick:()=>void Ze(I.id),className:"rounded border border-rose-300/35 bg-rose-300/12 px-1.5 py-1 text-[10px] text-rose-100 disabled:cursor-not-allowed disabled:opacity-50",title:"Kill shell process",children:"Kill"})]})]})},I.id);return t.jsxs("div",{className:"shell-panel flex min-h-0 flex-1 flex-col",children:[o&&t.jsxs("div",{className:"shell-header shrink-0 border-b px-3 py-3 sm:px-5",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs uppercase tracking-[0.24em] text-[var(--theme-fg-muted)]",children:"Shell"}),t.jsx("p",{className:"mt-1 truncate text-sm text-[var(--theme-fg-soft)]",children:G.promptLabel??(Y==null?void 0:Y.cwd)??"Create a terminal for this thread."})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("button",{type:"button","aria-label":ze,title:`${ze} (${bn(G.status)})`,disabled:me,onClick:()=>void _e(),className:`inline-flex h-10 w-10 items-center justify-center rounded-full border shadow-lg shadow-stone-950/25 transition disabled:cursor-not-allowed disabled:opacity-60 ${Re}`,children:t.jsx(Og,{connected:G.shellInputEnabled})}),Y&&t.jsx("button",{type:"button",disabled:N,onClick:()=>void Ze(Y.id),className:"rounded-full border border-rose-300/35 bg-rose-300/12 px-3 py-2 text-sm text-rose-600 transition hover:bg-rose-300/18 dark:text-rose-100 disabled:cursor-not-allowed disabled:opacity-60",children:"Terminate"})]})]}),(S||w||re)&&t.jsxs("div",{className:"shell-banner mt-3 rounded-2xl border px-3 py-3 text-sm",children:[w&&t.jsx("p",{className:"text-[var(--theme-fg-muted)]",children:"Loading shell state..."}),!w&&re&&t.jsx("p",{className:"text-rose-600 dark:text-rose-100",children:"Workspace path is missing on this machine. Restore the path before creating a shell."}),!w&&S&&t.jsx("p",{className:"text-amber-700 dark:text-amber-100",children:S})]})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"shell-terminal-bar flex shrink-0 items-center gap-2 border-b px-2 py-2",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-1",children:[t.jsx("span",{className:"min-w-0 truncate text-xs text-[var(--theme-fg-soft)]",children:Y?ve(Y):"No live shell process"}),Y&&t.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.12em] text-[var(--theme-fg-muted)]",children:bn(G.status)})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsxs("span",{className:"hidden text-xs text-[var(--theme-fg-muted)] sm:inline",children:["Live ",ue.length]}),t.jsx("button",{type:"button","aria-expanded":H,"aria-label":H?"Hide shell processes":"Show shell processes",onClick:()=>E(I=>!I),className:"rounded-md border border-stone-700/80 bg-stone-900/50 px-2.5 py-1.5 text-xs text-stone-200 sm:hidden",children:"Processes"})]})]}),H&&t.jsxs("div",{className:"shrink-0 border-b border-stone-800/80 bg-stone-950/55 p-2 sm:hidden",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-[var(--theme-fg-muted)]",children:"Processes"}),t.jsxs("span",{className:"text-[10px] text-[var(--theme-fg-muted)]",children:[ue.length," live"]})]}),t.jsxs("div",{className:"max-h-52 space-y-1 overflow-y-auto",children:[ue.map(at),ue.length===0&&t.jsx("p",{className:"px-2 py-3 text-xs text-[var(--theme-fg-muted)]",children:"No live shell processes"})]}),t.jsx("div",{className:"mt-2 flex justify-end border-t border-stone-800/80 pt-2",children:t.jsx("button",{type:"button","aria-label":"New shell",title:"New shell",disabled:N||w||re,onClick:()=>void Oe(C),className:"inline-flex h-8 w-8 items-center justify-center rounded-md border border-sky-300/35 bg-sky-300/12 text-base leading-none text-sky-50 disabled:cursor-not-allowed disabled:opacity-50",children:"+"})})]}),J==="not_created"||re?t.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center",children:t.jsxs("div",{className:"shell-empty-state max-w-md rounded-[1.6rem] border px-6 py-8",children:[t.jsx("p",{className:"text-base font-medium text-[var(--theme-fg)]",children:"Durable thread shell"}),t.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--theme-fg-muted)]",children:"The shell runs under a supervisor-managed PTY and reconnects after browser disconnects. Create it explicitly when you want to inspect or take over the workspace."}),!re&&t.jsx("button",{type:"button",disabled:N||w,onClick:()=>void Oe("primary"),className:"mt-5 rounded-md border border-sky-300/35 bg-sky-300/12 px-3 py-2 text-sm text-sky-50 disabled:cursor-not-allowed disabled:opacity-50",children:"New Shell"})]})}):t.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 gap-2 p-2 sm:grid-cols-[minmax(0,1fr)_16rem] sm:p-3",children:[t.jsxs("div",{className:"shell-terminal-frame relative min-h-0 overflow-hidden rounded-[1.4rem] border shadow-inner",children:[!o&&(S||w||re)&&t.jsxs("div",{className:"shell-banner absolute left-2 right-2 top-2 z-10 rounded-2xl border px-3 py-3 text-sm backdrop-blur sm:left-3 sm:right-3 sm:top-3",children:[w&&t.jsx("p",{className:"text-[var(--theme-fg-muted)]",children:"Loading shell state..."}),!w&&re&&t.jsx("p",{className:"text-rose-600 dark:text-rose-100",children:"Workspace path is missing on this machine. Restore the path before creating a shell."}),!w&&S&&t.jsx("p",{className:"text-amber-700 dark:text-amber-100",children:S})]}),t.jsxs("div",{ref:g,className:`relative grid h-full min-h-0 ${D==="columns"?"grid-cols-1 sm:grid-cols-[var(--shell-left)_0.35rem_var(--shell-right)]":"grid-cols-1"}`,style:D==="columns"?{"--shell-left":`${de}fr`,"--shell-right":`${100-de}fr`}:void 0,"data-shell-split-ratio":de,children:[t.jsx(Is,{ref:p,paneId:"primary",shell:fe,isActive:C==="primary",isVisible:a,isMobileShell:z,effectiveTheme:l,workspacePathMissing:re,shellAdapter:n,onActivate:()=>M("primary"),onShellUpdate:Pe,onRuntimeStateChange:xe,onFeedback:Te}),D==="columns"&&t.jsx("button",{type:"button",onClick:()=>ot("primary"),className:"absolute left-2 top-2 z-10 rounded-md border border-stone-700/80 bg-stone-950/70 px-2 py-1 text-[10px] text-stone-200 hover:border-rose-300/40",title:"Close left pane",children:"Close"}),D==="columns"&&t.jsx("button",{type:"button","aria-label":"Resize shell panes",title:"Resize shell panes",onPointerDown:Ke,className:"hidden cursor-col-resize border-x border-stone-800/80 bg-stone-900/60 transition hover:border-sky-300/40 hover:bg-sky-300/10 sm:block"}),D==="columns"&&t.jsxs("div",{className:"relative min-h-0 border-t border-stone-800/80 sm:border-l sm:border-t-0",children:[t.jsx(Is,{ref:m,paneId:"secondary",shell:Ne,isActive:C==="secondary",isVisible:a,isMobileShell:z,effectiveTheme:l,workspacePathMissing:re,shellAdapter:n,onActivate:()=>M("secondary"),onShellUpdate:Pe,onRuntimeStateChange:be,onFeedback:Te}),t.jsx("button",{type:"button",onClick:()=>ot("secondary"),className:"absolute left-2 top-2 z-10 rounded-md border border-stone-700/80 bg-stone-950/70 px-2 py-1 text-[10px] text-stone-200 hover:border-rose-300/40",title:"Close right pane",children:"Close"})]})]}),s&&z&&t.jsxs("div",{className:"pointer-events-none absolute bottom-3 right-3 z-20 flex flex-col items-end gap-2",children:[B&&t.jsx("div",{className:`pointer-events-auto rounded-full border px-3 py-1.5 text-[11px] shadow-lg shadow-stone-950/30 backdrop-blur ${Ee}`,children:B.text}),T&&t.jsx("div",{className:"shell-toolbox pointer-events-auto rounded-[1.2rem] border p-2 shadow-2xl backdrop-blur",children:t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx("button",{type:"button",onClick:()=>{Te("idle","Use the prompt box tools to paste")},className:"inline-flex items-center justify-center rounded-full border border-sky-300/35 bg-sky-300/12 px-2.5 py-2 text-sky-600 dark:text-sky-50",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(Ls,{}),t.jsx("span",{className:"text-[11px] font-medium tracking-[0.12em]",children:"Paste"})]})}),t.jsx("button",{type:"button",onClick:()=>void tt(),className:"shell-toolbox-copy inline-flex items-center justify-center rounded-full border px-2.5 py-2",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(Ls,{}),t.jsx("span",{className:"text-[11px] font-medium tracking-[0.12em]",children:"Copy"})]})}),t.jsx("button",{type:"button",disabled:!G.shellInputEnabled,onClick:()=>{var I;(I=le.current)!=null&&I.sendControl("clear")?Te("done","Cleared"):Te("failed","Connect the shell first")},className:"disabled:opacity-45",children:t.jsx(kn,{label:"CLEAR",tone:"sky"})}),t.jsx("button",{type:"button",disabled:!G.shellInputEnabled||!G.isCommandRunning,onClick:()=>{var I;(I=le.current)!=null&&I.sendInput("")?Te("done","Sent Ctrl-C"):Te("failed","Connect the shell first")},className:"disabled:opacity-45",children:t.jsx(kn,{label:"CTRL-C",tone:"rose"})}),["ctrl_d","esc","tab","up","down"].map(I=>t.jsx("button",{type:"button",disabled:!G.shellInputEnabled,onClick:()=>{var U;(U=le.current)!=null&&U.sendControl(I)?Te("done",`Sent ${I.toUpperCase().replace("_","-")}`):Te("failed","Connect the shell first")},className:"disabled:opacity-45",children:t.jsx(kn,{label:I.toUpperCase().replace("_","-"),tone:"stone"})},I))]})}),t.jsx("button",{type:"button","aria-expanded":T,"aria-label":T?"Close shell tools":"Open shell tools",onClick:()=>K(I=>!I),className:"shell-toolbox-trigger pointer-events-auto inline-flex h-11 w-11 items-center justify-center rounded-full border shadow-2xl backdrop-blur transition",children:t.jsx(Hg,{})})]})]}),t.jsxs("aside",{className:"hidden min-h-0 overflow-hidden rounded-[1rem] border border-stone-800/80 bg-stone-950/30 p-2 sm:flex sm:flex-col",children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-[var(--theme-fg-muted)]",children:"Processes"}),t.jsxs("span",{className:"text-[10px] text-[var(--theme-fg-muted)]",children:[ue.length," live"]})]}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto",children:[ue.map(at),ue.length===0&&t.jsx("p",{className:"px-2 py-3 text-xs text-[var(--theme-fg-muted)]",children:"No live shell processes"})]}),t.jsx("div",{className:"mt-2 flex justify-end border-t border-stone-800/80 pt-2",children:t.jsx("button",{type:"button","aria-label":"New shell",title:"New shell",disabled:N||w||re,onClick:()=>void Oe(C),className:"inline-flex h-8 w-8 items-center justify-center rounded-md border border-sky-300/35 bg-sky-300/12 text-base leading-none text-sky-50 disabled:cursor-not-allowed disabled:opacity-50",children:"+"})})]})]})]})})]})}),Ax=c.lazy(async()=>({default:(await Promise.resolve().then(()=>(sm(),sl))).ThreadGraphWorkspacePanel}));function Mx(){return t.jsx("div",{className:"flex h-full min-h-0 flex-1 items-center justify-center px-4 text-sm text-[var(--theme-fg-muted)]",children:"Loading workspace..."})}function Ll(e){return t.jsx(c.Suspense,{fallback:t.jsx(Mx,{}),children:t.jsx(Ax,{...e})})}c.memo(Ll);function Zx({open:e,title:r,description:n,confirmLabel:a="Delete",busy:o=!1,onCancel:s,onConfirm:l}){return c.useEffect(()=>{if(!e)return;function d(i){i.key==="Escape"&&!o&&s()}return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}},[o,s,e]),e?Dr.createPortal(t.jsxs("div",{className:"fixed inset-0 z-[95] flex items-center justify-center p-4 sm:p-6",children:[t.jsx("button",{type:"button","aria-label":"Close confirmation dialog",onClick:s,disabled:o,className:"absolute inset-0 bg-stone-950/78 backdrop-blur-sm disabled:cursor-not-allowed"}),t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":r,className:"relative z-[1] w-full max-w-md rounded-[1.6rem] border border-stone-700 bg-stone-900 p-5 shadow-2xl shadow-stone-950/40 sm:p-6",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium text-stone-100",children:r}),t.jsx("p",{className:"mt-2 text-sm leading-6 text-stone-400",children:n})]}),t.jsx("button",{type:"button","aria-label":"Close dialog",onClick:s,disabled:o,className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-stone-700 text-stone-300 transition hover:bg-stone-800 disabled:cursor-not-allowed disabled:opacity-60",children:t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-4 w-4 fill-current",children:t.jsx("path",{d:"M3.22 2.47 8 7.25l4.78-4.78 1.06 1.06L9.06 8.31l4.78 4.78-1.06 1.06L8 9.37l-4.78 4.78-1.06-1.06 4.78-4.78-4.78-4.78 1.06-1.06Z"})})})]}),t.jsxs("div",{className:"mt-5 flex items-center justify-end gap-2",children:[t.jsx("button",{type:"button",onClick:s,disabled:o,className:"rounded-full border border-stone-700 px-4 py-2 text-sm font-medium text-stone-300 transition hover:bg-stone-800 disabled:cursor-not-allowed disabled:opacity-60",children:"Cancel"}),t.jsx("button",{type:"button",onClick:()=>void l(),disabled:o,className:"ui-action-danger rounded-full px-4 py-2 text-sm font-medium transition disabled:cursor-not-allowed",children:o?"Deleting...":a})]})]})]}),document.body):null}function _x(e){if(!e)return"No time";const r=new Date(e);return Number.isNaN(r.getTime())?e:r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function $x(e){switch(e){case"inProgress":return"running";case"completed":return"completed";case"interrupted":return"interrupted";case"failed":return"failed"}}function Jx({open:e,busy:r=!1,turnsState:n,onCancel:a,onLoadTurns:o,onExport:s}){var j,S,P;const l=c.useMemo(()=>{var C;return((C=n.data)==null?void 0:C.turns)??[]},[(j=n.data)==null?void 0:j.turns]),d=c.useMemo(()=>l.slice(0,10).map(C=>C.turnId),[l]),[i,h]=c.useState("latest"),[u,p]=c.useState(()=>new Set),[m,f]=c.useState(!0),[g,x]=c.useState("pdf"),[k,b]=c.useState(()=>typeof document<"u"&&!document.documentElement.classList.contains("dark")?"light":"dark");if(c.useEffect(()=>{e&&(h("latest"),x("pdf"),f(!0),o())},[o,e]),c.useEffect(()=>{e&&l.length>0&&p(new Set(d))},[d,e,l.length]),c.useEffect(()=>{if(!e)return;function C(M){M.key==="Escape"&&!r&&a()}return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[r,a,e]),c.useEffect(()=>{if(!e)return;const C=document.querySelector(".thread-ui-shell"),M=()=>C?C.getAttribute("data-theme-effective")==="dark"||C.classList.contains("dark")||C.classList.contains("thread-ui-theme-dark")?"dark":"light":document.documentElement.classList.contains("dark")?"dark":"light";if(b(M()),!C)return;const _=new MutationObserver(()=>b(M()));return _.observe(C,{attributes:!0,attributeFilter:["class","data-theme-effective"]}),()=>_.disconnect()},[e]),!e)return null;const y=i==="latest"?Math.min(10,((S=n.data)==null?void 0:S.totalTurnCount)??10):u.size,w=!r&&(i==="latest"||u.size>0);function v(C){p(M=>{const _=new Set(M);return _.has(C)?_.delete(C):_.add(C),_})}function N(){const C={format:g,mode:i,...i==="latest"?{limit:10}:{turnIds:[...u]},profile:"review",options:{includeTokenAndPrice:m}};s(C)}return Dr.createPortal(t.jsxs("div",{className:`thread-export-dialog-root thread-ui-theme-${k} fixed inset-0 z-[96] flex items-center justify-center p-3 sm:p-6`,"data-theme-effective":k,children:[t.jsx("button",{type:"button","aria-label":"Close export dialog",onClick:a,disabled:r,className:"thread-export-dialog-backdrop absolute inset-0 backdrop-blur-sm disabled:cursor-not-allowed"}),t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Export transcript",className:"thread-export-dialog-panel relative z-[1] flex max-h-[min(46rem,calc(100vh-2rem))] w-full max-w-2xl flex-col rounded-[1.6rem] border shadow-2xl",children:[t.jsxs("div",{className:"thread-export-dialog-header flex items-start justify-between gap-3 border-b px-5 py-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"thread-export-dialog-title text-sm font-semibold",children:"Export transcript"}),t.jsx("p",{className:"thread-export-dialog-subtitle mt-1 text-xs",children:"Default review copy summarizes command batches and file changes."})]}),t.jsx("button",{type:"button","aria-label":"Close dialog",onClick:a,disabled:r,className:"thread-export-dialog-icon-button inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full border transition disabled:cursor-not-allowed disabled:opacity-60",children:t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-4 w-4 fill-current",children:t.jsx("path",{d:"M3.22 2.47 8 7.25l4.78-4.78 1.06 1.06L9.06 8.31l4.78 4.78-1.06 1.06L8 9.37l-4.78 4.78-1.06-1.06 4.78-4.78-4.78-4.78 1.06-1.06Z"})})})]}),t.jsxs("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:[t.jsx("div",{className:"thread-export-dialog-segment inline-flex rounded-full border p-1",children:[["latest","Latest 10"],["selected","Custom selection"]].map(([C,M])=>t.jsx("button",{type:"button",onClick:()=>h(C),className:`rounded-full px-3 py-1.5 text-sm transition ${i===C?"ui-status-warning":"thread-export-dialog-muted-action"}`,children:M},C))}),t.jsx("div",{className:"thread-export-dialog-segment mt-4 inline-flex rounded-full border p-1",children:[["pdf","PDF"],["html","HTML"]].map(([C,M])=>t.jsx("button",{type:"button",onClick:()=>x(C),className:`rounded-full px-3 py-1.5 text-sm transition ${g===C?"ui-status-warning":"thread-export-dialog-muted-action"}`,children:M},C))}),i==="selected"?t.jsxs("div",{className:"thread-export-dialog-box mt-4 rounded-2xl border",children:[t.jsxs("div",{className:"thread-export-dialog-box-header flex flex-wrap items-center justify-between gap-2 border-b px-3 py-2.5",children:[t.jsxs("p",{className:"thread-export-dialog-subtitle text-xs",children:["Selected ",u.size," of ",((P=n.data)==null?void 0:P.totalTurnCount)??l.length]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>p(new Set(l.map(C=>C.turnId))),className:"thread-export-dialog-secondary-button rounded-full border px-2.5 py-1 text-xs transition",children:"Select all"}),t.jsx("button",{type:"button",onClick:()=>p(new Set),className:"thread-export-dialog-secondary-button rounded-full border px-2.5 py-1 text-xs transition",children:"Clear"})]})]}),n.status==="loading"?t.jsx("p",{className:"thread-export-dialog-subtitle px-3 py-6 text-sm",children:"Loading turns..."}):n.status==="failed"?t.jsx("p",{className:"px-3 py-6 text-sm text-rose-500 dark:text-rose-200",children:n.error}):t.jsx("div",{className:"max-h-80 overflow-auto p-2",children:l.map(C=>t.jsxs("label",{className:"thread-export-dialog-turn-row flex cursor-pointer items-center gap-3 rounded-xl px-2.5 py-2 text-sm transition",children:[t.jsx("input",{type:"checkbox",checked:u.has(C.turnId),onChange:()=>v(C.turnId),className:"thread-export-dialog-checkbox h-4 w-4"}),t.jsxs("span",{className:"thread-export-dialog-strong shrink-0 text-xs font-medium",children:["Turn ",C.turnNumber]}),t.jsx("span",{className:"thread-export-dialog-subtitle shrink-0 text-xs",children:_x(C.startedAt)}),t.jsx("span",{className:"thread-export-dialog-body-text min-w-0 flex-1 truncate text-left",children:C.userPromptPreview}),t.jsx("span",{className:"thread-export-dialog-status-pill hidden shrink-0 rounded-full border px-2 py-0.5 text-[10px] sm:inline",children:$x(C.status)})]},C.turnId))})]}):t.jsx("p",{className:"thread-export-dialog-box thread-export-dialog-body-text mt-4 rounded-2xl border px-3 py-3 text-sm",children:"Exports the latest 10 turns in chronological order."}),t.jsxs("div",{className:"thread-export-dialog-body-text mt-4 grid gap-2 text-sm sm:grid-cols-2",children:[t.jsxs("label",{className:"thread-export-dialog-box flex items-center gap-2 rounded-xl border px-3 py-2",children:[t.jsx("input",{type:"checkbox",checked:m,onChange:C=>f(C.target.checked),className:"thread-export-dialog-checkbox h-4 w-4"}),"Token and price"]}),t.jsx("p",{className:"thread-export-dialog-box thread-export-dialog-subtitle flex items-center rounded-xl border px-3 py-2 text-xs",children:g==="html"?"HTML keeps the chat timeline styling and omits raw command output.":"Review exports keep message text readable and omit tool activity."})]})]}),t.jsxs("div",{className:"thread-export-dialog-footer flex items-center justify-between gap-3 border-t px-5 py-4",children:[t.jsxs("p",{className:"thread-export-dialog-subtitle min-w-0 text-xs",children:[y," ",y===1?"turn":"turns"," will be exported."]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:a,disabled:r,className:"thread-export-dialog-secondary-button rounded-full border px-4 py-2 text-sm font-medium transition disabled:cursor-not-allowed disabled:opacity-60",children:"Cancel"}),t.jsx("button",{type:"button",onClick:N,disabled:!w,className:"ui-status-warning rounded-full px-4 py-2 text-sm font-medium transition disabled:cursor-not-allowed disabled:opacity-60",children:r?"Exporting...":`Export ${g.toUpperCase()}`})]})]})]})]}),document.body)}function yn(e){if(e===void 0)return"-";if(Math.abs(e)>1e4){const r=Math.abs(e)>=1e5?0:1;return`${(e/1e3).toLocaleString(void 0,{maximumFractionDigits:r})}k`}return e.toLocaleString()}function Dx(e){return`in ${yn(e.input)} / out ${yn(e.output)} / cache ${yn(e.cache)}`}function Bx({detail:e,adapter:r,timelineAdapter:n,TimelineComponent:a=Cl,liveOutput:o="",beforeTimelineContent:s,composerProps:l,timelineProps:d,threadUsageSummary:i,transcriptItemCount:h,useFloatingMobileComposer:u=!1,floatingMobileComposerBottomOffset:p=0,composerHostRef:m}){const[f,g]=c.useState(!1),[x,k]=c.useState(0),[b,y]=c.useState(0),[w,v]=c.useState(0),[N,j]=c.useState(!1),S=c.useRef(null),P=d==null?void 0:d.onTailVisibilityChange,C=e.pendingRequests.length>0,M=c.useCallback(L=>{P==null||P(L)},[P]);c.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const L=window.matchMedia("(max-width: 639px)"),Z=()=>g(L.matches);return Z(),L.addEventListener("change",Z),()=>{L.removeEventListener("change",Z)}},[]),c.useEffect(()=>{var Z,R;if(typeof window>"u")return;const L=()=>{const X=window.visualViewport,F=X?Math.max(0,Math.round(window.innerHeight-X.height-X.offsetTop)):0,z=X?Math.max(0,Math.round(window.innerHeight-X.height)):F,V=Math.min(F,z),H=Math.max(0,Math.round(window.innerHeight*.52));v(Math.min(V,H))};return L(),(Z=window.visualViewport)==null||Z.addEventListener("resize",L),(R=window.visualViewport)==null||R.addEventListener("scroll",L),window.addEventListener("resize",L),()=>{var X,F;(X=window.visualViewport)==null||X.removeEventListener("resize",L),(F=window.visualViewport)==null||F.removeEventListener("scroll",L),window.removeEventListener("resize",L)}},[]),c.useLayoutEffect(()=>{const L=S.current;if(!L||!f){k(0);return}const Z=()=>{k(Math.ceil(L.getBoundingClientRect().height))};if(Z(),typeof ResizeObserver>"u")return;const R=new ResizeObserver(Z);return R.observe(L),()=>{R.disconnect()}},[f,l,C]),c.useLayoutEffect(()=>{var X,F;const L=S.current;if(!L||!f){y(0);return}const Z=()=>{const z=L.getBoundingClientRect();y(Math.max(0,Math.ceil(window.innerHeight-z.top)))};Z(),window.addEventListener("resize",Z),(X=window.visualViewport)==null||X.addEventListener("resize",Z),(F=window.visualViewport)==null||F.addEventListener("scroll",Z);let R=null;return typeof ResizeObserver<"u"&&(R=new ResizeObserver(Z),R.observe(L)),()=>{var z,V;window.removeEventListener("resize",Z),(z=window.visualViewport)==null||z.removeEventListener("resize",Z),(V=window.visualViewport)==null||V.removeEventListener("scroll",Z),R==null||R.disconnect()}},[f,w,N,l,C]),c.useEffect(()=>{if(!f){j(!1);return}const L=R=>{var F;const X=R.target;X instanceof HTMLElement&&((F=S.current)!=null&&F.contains(X))&&j(!0)},Z=R=>{var F;const X=R.relatedTarget;X instanceof HTMLElement&&((F=S.current)!=null&&F.contains(X))||j(!1)};return document.addEventListener("focusin",L),document.addEventListener("focusout",Z),()=>{document.removeEventListener("focusin",L),document.removeEventListener("focusout",Z)}},[f]);const _=c.useCallback(L=>{S.current=L,m&&(m.current=L)},[m]),A=f&&N?Math.max(0,w-p):0,te=Math.max(x,144),W=Math.max(b,te+A),D=f?W+12:0,q=D>0?{"--thread-graph-chat-scroll-bottom-spacer":`${D}px`}:void 0,de=u&&f?{bottom:`${p+A}px`,paddingBottom:"env(safe-area-inset-bottom)"}:void 0;return t.jsxs("div",{"data-testid":"chat-panel",className:"thread-graph-chat-panel relative flex h-full min-h-0 flex-col",style:q,children:[s,t.jsx(a,{threadId:e.thread.id,turns:e.turns,totalTurnCount:e.totalTurnCount??e.turns.length,pendingRequests:e.pendingRequests,activeTurnId:e.thread.activeTurnId,threadRunning:e.thread.status==="running"||e.thread.activeTurnId!==null,liveOutput:o,className:"thread-timeline-surface min-h-0 flex-1",...d,adapter:n,onOpenThread:(d==null?void 0:d.onOpenThread)??r.openThread,onTailVisibilityChange:M}),t.jsxs("div",{className:"thread-chat-usage-footer hidden shrink-0 items-center justify-between gap-3 px-4 py-1 text-[10px] leading-4 sm:flex",children:[t.jsxs("span",{className:"min-w-0 truncate",children:[e.turns.length," turn",e.turns.length!==1?"s":"",t.jsx("span",{className:"mx-1 text-[var(--theme-border-contrast)]",children:"|"}),h," item",h!==1?"s":""]}),t.jsxs("span",{className:"shrink-0",children:["Usage"," ",i&&i.turns>0?Dx(i):"waiting for agent usage"]})]}),l?u?t.jsx("div",{ref:_,className:"fixed inset-x-0 bottom-0 z-50 overflow-visible sm:hidden",style:de??{bottom:`${p}px`,paddingBottom:"env(safe-area-inset-bottom)"},children:t.jsx(_n,{...l,activeView:"chat",edgeToEdgeMobile:!0,onSubmit:r.sendPrompt})}):t.jsx("div",{ref:_,className:"thread-graph-composer-host shrink-0",children:t.jsx(_n,{...l,activeView:"chat",onSubmit:r.sendPrompt})}):null]})}function Gx(e){return e.turns.reduce((r,n)=>{var o;const a=(o=n.tokenUsage)==null?void 0:o.total;return a?{input:r.input+a.inputTokens,output:r.output+a.outputTokens,cache:r.cache+a.cachedInputTokens,turns:r.turns+1}:r},{input:0,output:0,cache:0,turns:0})}function jn(e){return typeof e!="number"||!Number.isFinite(e)||e<=0?"0":e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(Math.round(e))}function Fx(e){return!e||e.turns<=0?"waiting for agent usage":`in ${jn(e.input)} / out ${jn(e.output)} / cache ${jn(e.cache)}`}function Qx({threads:e,detail:r,loading:n,error:a,status:o=null,plugins:s,adapter:l,metaContent:d,settingsContent:i,globalSettingsContent:h,mobileHeaderAction:u,appMenuButton:p,appNavigationMenu:m,workspaceReturnHref:f,onWorkspaceReturn:g,surfaceActions:x,floatingPanel:k,workspaceContent:b,workspaceTitle:y,workspaceActions:w,workspaceFeatures:v,onNewThreadTitle:N,beforeTimelineContent:j,errorContent:S,workspaceMissingContent:P,dialogs:C,currentThreadId:M,currentWorkspaceId:_,currentWorkspaceLabel:A,onCloseAppNavigation:te,className:W="thread-detail-surface relative flex h-full min-h-0 flex-1 flex-col overflow-hidden",activeView:D="chat",liveOutput:q="",timelineProps:de,composerProps:L,shellComposerProps:Z,useFloatingMobileComposer:R=!1,floatingMobileComposerBottomOffset:X=0,composerHostRef:F,shellPanelRef:z,shellEffectiveTheme:V="dark",shellThemeMode:H=V,onShellThemeModeChange:E,onShellStateChange:T,shellUnavailableContent:K,shellDisconnectedContent:O,timelineComponent:Q=Cl,shellPanelComponent:B=Rx,shellContent:ce,loadingContent:J,emptyContent:se}){const ue=sa(),fe=s??ue??na(),{getImageAssetUrl:Ne,loadHistoryItemDetail:Y,openThread:G}=l,re=c.useMemo(()=>({...Ne?{getImageAssetUrl:Pe=>Ne(Pe.path)}:{},onOpenLinkedThread:G,...Y?{onLoadHistoryItemDetail:Y}:{}}),[Ne,Y,G]),le=fe.getThreadPanels().some(Pe=>Pe.kind==="terminal"),ge=c.useMemo(()=>r?Gx(r):null,[r]),me=c.useMemo(()=>Fx(ge),[ge]),ze=c.useMemo(()=>{var Pe;return r?r.turns.reduce(($,ie)=>$+ie.items.length,((Pe=r.liveItems)==null?void 0:Pe.items.length)??0):0},[r]),Re=b??(r?t.jsx(Ll,{detail:r,status:o,plugins:fe,workspaceAdapter:l.workspace??null,metaContent:d,settingsContent:i,activeView:D,features:v}):null),Ee=n?J??t.jsx("div",{className:"flex flex-1 items-center justify-center px-6 py-12 text-center text-[var(--theme-fg-muted)]",children:"Loading thread detail..."}):r?t.jsxs("div",{className:W,children:[k?t.jsx("div",{className:"fixed right-3 top-20 z-50 lg:absolute lg:right-4 lg:top-16",children:k}):null,a&&!n&&(S??t.jsx("div",{className:"shrink-0 border-b border-rose-500/20 bg-rose-500/10 px-5 py-4 text-sm text-rose-100 sm:px-6",children:a})),r.workspacePathStatus==="missing"&&(P??t.jsxs("div",{className:"shrink-0 border-b border-rose-500/20 bg-rose-500/10 px-5 py-4 text-sm text-rose-100 sm:px-6",children:[t.jsx("p",{className:"font-medium text-rose-50",children:"Workspace path missing"}),t.jsx("p",{className:"mt-1 break-words text-rose-100/90",children:r.workspace.absPath})]})),t.jsx("div",{className:D==="chat"?"flex min-h-0 flex-1 flex-col":"hidden",children:t.jsx(Bx,{detail:r,adapter:l,timelineAdapter:re,TimelineComponent:Q,liveOutput:q,threadUsageSummary:ge,transcriptItemCount:ze,useFloatingMobileComposer:R,floatingMobileComposerBottomOffset:X,...j?{beforeTimelineContent:j}:{},...L?{composerProps:L}:{},...de?{timelineProps:de}:{},...F?{composerHostRef:F}:{}})}),t.jsxs("div",{className:D==="shell"?"flex min-h-0 flex-1 flex-col":"hidden",children:[ce??(r.thread.isLoaded&&le&&l.shell?t.jsx(B,{ref:z,threadId:r.thread.id,shellAdapter:l.shell,effectiveTheme:V,isVisible:D==="shell",showHeader:!1,showFloatingToolbox:!1,...T?{onStateChange:T}:{}}):r.thread.isLoaded&&!le?K??t.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-4 sm:p-6",children:t.jsxs("div",{className:"thread-empty-surface max-w-md rounded-[1.6rem] border px-6 py-8 text-center",children:[t.jsx("p",{className:"text-base font-medium text-[var(--theme-fg)]",children:"Terminal plugin disabled"}),t.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--theme-fg-muted)]",children:"Enable the Terminal plugin in Settings to use the shell panel."})]})}):O??t.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-4 sm:p-6",children:t.jsxs("div",{className:"thread-empty-surface max-w-md rounded-[1.6rem] border px-6 py-8 text-center",children:[t.jsx("p",{className:"text-base font-medium text-[var(--theme-fg)]",children:"Thread disconnected"}),t.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--theme-fg-soft)]",children:"Reconnect this thread before creating or attaching a shell."})]})})),D==="shell"&&Z&&!ce?t.jsx(_n,{...Z,activeView:"shell",onSubmit:l.sendPrompt}):null]}),C]}):se??t.jsx("div",{className:"flex flex-1 items-center justify-center px-6 py-12 text-center text-[var(--theme-fg-muted)]",children:"Select a thread to inspect."}),Te=t.jsx(Qp,{threads:e,status:o,loading:n,error:n?null:a,viewportConstrained:!0,currentThreadId:M??(r==null?void 0:r.thread.id),currentThreadLabel:r==null?void 0:r.thread.title,currentWorkspaceId:_??(r==null?void 0:r.thread.workspaceId),currentWorkspaceLabel:A??(r==null?void 0:r.workspace.label),sessionLabel:(r==null?void 0:r.thread.providerSessionId)??(r==null?void 0:r.thread.id),usageLabel:me,topbarActions:x,metaContent:d,settingsContent:i,globalSettingsContent:h,mobileHeaderAction:u,effectiveTheme:V,themeMode:H,appMenuButton:p,appNavigationMenu:m,workspaceReturnHref:f,...g?{onWorkspaceReturn:g}:{},showMobileAppMenu:!!p,showMobileThreadNavToggle:!0,showMobileNewThreadShortcut:!1,onOpenThread:l.openThread,workspaceContent:Re,workspaceTitle:y??"Workspace",workspaceActions:w,...N?{onNewThreadTitle:N}:{},...te?{onCloseAppNavigation:te}:{},...E?{onThemeModeChange:E}:{},...l.getThreadHref?{getThreadHref:l.getThreadHref}:{},...l.getNewThreadHref?{getNewThreadHref:l.getNewThreadHref}:{},...l.renameThread?{onRenameThread:l.renameThread}:{},...l.deleteThread?{onDeleteThread:l.deleteThread}:{},children:Ee});return s?t.jsx(aa.Provider,{value:fe,children:Te}):Te}var Hx={},Ox=[];function eb({adapter:e=Hx,builtinPlugins:r=Ox,children:n}){const[a,o]=c.useState(()=>$n(r,[])),[s,l]=c.useState(!1),[d,i]=c.useState(null),h=c.useCallback(async()=>{l(!0),i(null);try{const w=e.fetchPlugins?await e.fetchPlugins():[];o($n(r,w))}catch(w){i(w instanceof Error?w.message:"Unable to load plugins.")}finally{l(!1)}},[e,r]);c.useEffect(()=>{h()},[h]);const u=c.useCallback(async(w,v)=>{if(e.updatePlugin){const N=await e.updatePlugin(w,{enabled:v});o(j=>j.map(S=>S.id===N.id?N:S));return}o(N=>N.map(j=>j.id===w?{...j,enabled:v}:j))},[e]),p=c.useCallback(async w=>{if(!e.importPlugin)throw new Error("Plugin import is not available.");const v=await e.importPlugin(w);o(N=>[...N.filter(S=>S.id!==v.id),v])},[e]),m=c.useCallback(async w=>{if(!e.deletePlugin)throw new Error("Plugin uninstall is not available.");const v=await e.deletePlugin(w);o(N=>N.filter(j=>j.id!==v.id))},[e]),f=c.useMemo(()=>{const w=new Set(a.filter(v=>v.enabled).map(v=>v.id));return r.filter(v=>w.has(v.manifest.id))},[r,a]),g=c.useCallback(w=>{var N;const v=f.find(j=>j.renderArtifact&&j.manifest.capabilities.artifactTypes.some(S=>S.type===w.artifact.type));return((N=v==null?void 0:v.renderArtifact)==null?void 0:N.call(v,w))??null},[f]),x=c.useCallback(w=>{for(const v of f)for(const N of v.inlineCodeRenderers??[]){if(!N.languages.includes(w.language.trim().toLowerCase()))continue;const j=N.render(w);if(j)return j}return null},[f]),k=c.useCallback(w=>f.some(v=>!!v.renderArtifact&&v.manifest.capabilities.artifactTypes.some(N=>N.type===w.type)),[f]),b=c.useCallback(()=>f.flatMap(w=>w.threadPanels??[]),[f]),y=c.useMemo(()=>({plugins:a,loading:s,error:d,refresh:h,importPluginManifest:p,setPluginEnabled:u,uninstallPlugin:m,renderArtifact:g,renderInlineCode:x,hasRendererForArtifact:k,getThreadPanels:b}),[d,b,k,p,s,a,h,g,x,u,m]);return t.jsx(aa.Provider,{value:y,children:n})}function Ux(){return t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-4 w-4 fill-current",children:t.jsx("path",{d:"M2 3.25h12v1.5H2Zm0 4h12v1.5H2Zm0 4h12v1.5H2Z"})})}function Wx(){return t.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"h-4 w-4 fill-current",children:t.jsx("path",{d:"M3.22 2.47 8 7.25l4.78-4.78 1.06 1.06L9.06 8.31l4.78 4.78-1.06 1.06L8 9.37l-4.78 4.78-1.06-1.06 4.78-4.78-4.78-4.78 1.06-1.06Z"})})}function Rs(e=!1){return`flex w-full items-center rounded-[0.95rem] px-3 py-2 text-left text-sm transition ${e?"cursor-not-allowed bg-[var(--theme-muted)] text-[var(--theme-fg-muted)]":"text-[var(--theme-fg)] hover:bg-[var(--theme-hover)]"}`}function tb({className:e=""}){const r=ta();return r?t.jsx("button",{type:"button","aria-label":r.navOpen?"Close Navigation":"Open Navigation","aria-expanded":r.navOpen,"aria-controls":"app-shell-navigation-menu",onClick:r.toggleNav,className:`inline-flex h-10 w-10 shrink-0 items-center justify-center text-[var(--theme-fg)] transition hover:text-[var(--theme-fg-soft)] ${e}`.trim(),children:r.navOpen?t.jsx(Wx,{}):t.jsx(Ux,{})}):null}function rb({className:e="",currentPath:r="",items:n=[{label:"Workspaces",href:"/workspaces"}],onNavigate:a}){const o=ta(),s=c.useRef(null);return c.useEffect(()=>{if(!(o!=null&&o.navOpen))return;const l=o;function d(i){const h=i.target;if(!h)return;const u=s.current;u!=null&&u.contains(h)||h instanceof Element&&h.closest('[aria-controls="app-shell-navigation-menu"]')||l.closeNav()}return document.addEventListener("pointerdown",d),()=>{document.removeEventListener("pointerdown",d)}},[o]),o!=null&&o.navOpen?t.jsxs("div",{ref:s,id:"app-shell-navigation-menu",onPointerDown:l=>l.stopPropagation(),onMouseDown:l=>l.stopPropagation(),onTouchStart:l=>l.stopPropagation(),className:`rounded-[1.8rem] border border-[var(--theme-border)] bg-[var(--theme-panel)] p-4 shadow-2xl shadow-black/15 backdrop-blur ${e}`.trim(),children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-base font-semibold tracking-wide text-[var(--theme-accent-strong)]",children:"Remote Codex"}),t.jsx("p",{className:"mt-1 text-xs uppercase tracking-[0.24em] text-[var(--theme-fg-muted)]",children:"Navigation"})]}),t.jsxs("nav",{className:"mt-4 flex flex-col gap-1.5 text-sm",children:[n.map(l=>{const d=r===l.href;return t.jsx("button",{type:"button",disabled:d,onClick:()=>{d||(o.closeNav(),a==null||a(l.href))},className:Rs(d),children:l.label},l.href)}),t.jsx("button",{type:"button",onClick:o.openSettings,className:Rs(),children:"Settings"})]})]}):null}export{rb as A,Zx as C,Jx as E,ef as L,eb as P,Qx as T,sa as a,tb as b,Rx as c,Cl as d,Qp as e,ra as f,Jp as g,$p as h,Dp as t,ta as u};