@jean2/client 1.0.3 → 1.0.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 (69) hide show
  1. package/README.md +2 -2
  2. package/dist/assets/ServerContext-Dy9T5Mj8.js +1 -0
  3. package/dist/assets/SessionContent-DMPPyidM.js +11 -0
  4. package/dist/assets/{SessionMenuButton-Bg83zT6G.js → SessionMenuButton-DtN_qfRb.js} +3 -3
  5. package/dist/assets/_serverId-BOWHyoan.js +12 -0
  6. package/dist/assets/_serverId-DXVl_AFQ.js +1 -0
  7. package/dist/assets/_sessionId-BfVgqUBK.js +1 -0
  8. package/dist/assets/_sessionId-Bp7Qrc4O.js +1 -0
  9. package/dist/assets/add-server-BU3oc_j3.js +1 -0
  10. package/dist/assets/alert-BsN6ZzaK.js +31 -0
  11. package/dist/assets/archive-pL5uw9sg.js +1 -0
  12. package/dist/assets/arrow-left-DSvwF2mY.js +1 -0
  13. package/dist/assets/badge-Cjebg6Sp.js +1 -0
  14. package/dist/assets/button--1wnt03c.js +45 -0
  15. package/dist/assets/classPrivateFieldGet2-BGlEuFdn.js +1 -0
  16. package/dist/assets/confirmation-dialog-CFCxzDEX.js +1 -0
  17. package/dist/assets/dialog-BNCh4KEM.js +1 -0
  18. package/dist/assets/{dist-js-CnIJv7bh.js → dist-js-s36UjyQ4.js} +1 -1
  19. package/dist/assets/{event-Bg5mre8h.js → event-Crr43Eih.js} +1 -1
  20. package/dist/assets/index-Db3JxRbZ.js +10 -0
  21. package/dist/assets/index-DzEyMPKG.css +2 -0
  22. package/dist/assets/mutation-D4xtepYQ.js +1 -0
  23. package/dist/assets/overview-DbKX71kj.js +1 -0
  24. package/dist/assets/platform-cRBZ7eSy.js +1 -0
  25. package/dist/assets/popover-C8mm1NWm.js +1 -0
  26. package/dist/assets/preload-helper-D844vhe4.js +1 -0
  27. package/dist/assets/queries-C0JoQFZb.js +1 -0
  28. package/dist/assets/react-dom-DHWV5rS5.js +1 -0
  29. package/dist/assets/refresh-cw-BYRFQSBp.js +1 -0
  30. package/dist/assets/routes-Ck6V8B0w.js +1 -0
  31. package/dist/assets/sidebar-BqQ-fUFc.js +1 -0
  32. package/dist/assets/src-BALdofIU.js +1 -0
  33. package/dist/assets/{triangle-alert-BOCjiWM3.js → triangle-alert-Bil68MLf.js} +1 -1
  34. package/dist/assets/useNavigate-Ckup4lZi.js +1 -0
  35. package/dist/assets/useRouter-C67ywEA3.js +1 -0
  36. package/dist/assets/workspace-BzFUmInc.js +1 -0
  37. package/dist/cli.mjs +21 -9
  38. package/dist/index.html +11 -10
  39. package/package.json +1 -1
  40. package/dist/assets/ServerContext-CBFiY6IH.js +0 -1
  41. package/dist/assets/SessionContent-w-YQzt9T.js +0 -9
  42. package/dist/assets/_serverId-B4Rjk4iQ.js +0 -12
  43. package/dist/assets/_serverId-BwsJG6SV.js +0 -1
  44. package/dist/assets/_serverId-COhNW61b.js +0 -2
  45. package/dist/assets/_sessionId-CMkepspM.js +0 -1
  46. package/dist/assets/_sessionId-xZ5q7S0b.js +0 -1
  47. package/dist/assets/alert-qqwNRgnw.js +0 -31
  48. package/dist/assets/badge-CwZd07eA.js +0 -45
  49. package/dist/assets/confirmation-dialog-DGPNPL5O.js +0 -1
  50. package/dist/assets/index-BDTQdmk9.js +0 -10
  51. package/dist/assets/index-DF4q2PgJ.css +0 -2
  52. package/dist/assets/overview-CEkUAF73.js +0 -1
  53. package/dist/assets/platform-5d-ZQG2e.js +0 -1
  54. package/dist/assets/popover-BaZzl6-v.js +0 -1
  55. package/dist/assets/preload-helper-D-tEmku_.js +0 -1
  56. package/dist/assets/routes-WPmRqSvV.js +0 -1
  57. package/dist/assets/scroll-area-16Gq00WS.js +0 -1
  58. package/dist/assets/server-g7It7jLf.js +0 -1
  59. package/dist/assets/servers-GmYSnzvH.js +0 -1
  60. package/dist/assets/sidebar-DmGZgZwK.js +0 -1
  61. package/dist/assets/src-BiLzKNfl.js +0 -1
  62. package/dist/assets/useNavigate-Dxc8FNpV.js +0 -1
  63. package/dist/assets/useParams-RuFKFrOo.js +0 -1
  64. package/dist/assets/useRouterState-C1XfNwIo.js +0 -1
  65. package/dist/assets/workspace-B-9b8A58.js +0 -1
  66. /package/dist/assets/{core-B5tm5Pq5.js → core-BYcrozIP.js} +0 -0
  67. /package/dist/assets/{createLucideIcon-BYAVpx9Z.js → createLucideIcon-CuVT3KNW.js} +0 -0
  68. /package/dist/assets/{overview-B_ZDrH1J.js → overview-C91MPxfo.js} +0 -0
  69. /package/dist/assets/{workspace-_n12Hx4o.js → workspace-84xYPx6s.js} +0 -0
@@ -0,0 +1 @@
1
+ import{o as e,r as t}from"./compiler-runtime-DZXZ41-q.js";import{t as n}from"./useRouter-C67ywEA3.js";var r=e(t(),1);function i(e){let t=n();return r.useCallback(n=>{var r;return t.navigate({...n,from:(r=n.from)==null?e==null?void 0:e.from:r})},[e==null?void 0:e.from,t])}export{i as t};
@@ -0,0 +1 @@
1
+ import{o as e,r as t}from"./compiler-runtime-DZXZ41-q.js";var n=e(t(),1),r=n.createContext(null);function i(e){return n.useContext(r)}export{r as n,i as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t,r as n,t as r}from"./compiler-runtime-DZXZ41-q.js";import{o as i}from"./platform-cRBZ7eSy.js";import{A as a,D as o,S as s,a as c,c as l,d as u,f as d,k as f,l as p,o as m,s as h}from"./sidebar-BqQ-fUFc.js";import{L as g,R as _,i as v,r as y,t as b}from"./queries-C0JoQFZb.js";import{A as x,D as S,J as C,T as w,U as ee,W as T,a as E,c as D,d as te,i as ne,n as O,q as k,r as A,s as j,t as re,v as ie}from"./badge-Cjebg6Sp.js";import{t as M}from"./createLucideIcon-CuVT3KNW.js";import{t as N}from"./archive-pL5uw9sg.js";import{a as ae,i as P,n as F,o as I,r as L,s as R,t as oe}from"./SessionMenuButton-DtN_qfRb.js";import{a as z,c as B,d as V,i as H,l as U,m as W,o as G,p as K,r as q,s as J,t as Y,u as X}from"./popover-C8mm1NWm.js";import{F as se,M as Z,N as ce,r as le,t as ue}from"./button--1wnt03c.js";import{a as de,o as fe,r as pe,s as me,t as he}from"./dialog-BNCh4KEM.js";import{t as ge}from"./confirmation-dialog-CFCxzDEX.js";var _e=M(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ve=M(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),ye=r(),Q=t(n(),1);function be(e){var t;let n=(0,ye.c)(20),{sdkClient:r,workspaceId:i,connected:o}=e,c=x(xe),l;n[0]===i?l=n[1]:(l=s.sessions.byWorkspace(i==null?``:i),n[0]=i,n[1]=l);let u;n[2]!==r||n[3]!==i?(u=()=>r.http.sessions.listByWorkspace({workspaceId:i}),n[2]=r,n[3]=i,n[4]=u):u=n[4];let d=!!r&&o&&!!i,f;n[5]!==l||n[6]!==u||n[7]!==d?(f={queryKey:l,queryFn:u,enabled:d,staleTime:1e4},n[5]=l,n[6]=u,n[7]=d,n[8]=f):f=n[8];let{isLoading:p,error:m,data:h}=a(f),g,_;n[9]!==c||n[10]!==i?(g=()=>{i||c([])},_=[i,c],n[9]=c,n[10]=i,n[11]=g,n[12]=_):(g=n[11],_=n[12]),(0,Q.useEffect)(g,_);let v,y;n[13]!==h||n[14]!==c?(v=()=>{h!=null&&h.sessions&&c(h.sessions)},y=[h,c],n[13]=h,n[14]=c,n[15]=v,n[16]=y):(v=n[15],y=n[16]),(0,Q.useEffect)(v,y);let b=(t=m==null?void 0:m.message)==null?null:t,S;return n[17]!==p||n[18]!==b?(S={isLoading:p,error:b},n[17]=p,n[18]=b,n[19]=S):S=n[19],S}function xe(e){return e.setSessions}function Se(...e){return e.map((e,t)=>t===0?e.replace(/\/+$/,``):e.replace(/^\/+|\/+$/g,``)).filter(Boolean).join(`/`)}var $=e();function Ce(e){var t,n,r,i;let a=(0,ye.c)(83),{open:o,onOpenChange:s,onSelect:c,initialPath:l,title:u,sdkClient:d}=e,f=u===void 0?`Select Folder`:u,[p,m]=(0,Q.useState)(l||``),[h,_]=(0,Q.useState)(l||``),[x,S]=(0,Q.useState)(0),[w,E]=(0,Q.useState)(``),[D,te]=(0,Q.useState)(!1),[ne,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useRef)(null),{data:j,isLoading:re,error:M,refetch:N}=b(d,h,o),{data:ae}=y(d),{error:P,refetch:F}=v(d,p,!1),I;if(a[0]!==(ae==null?void 0:ae.drives)){var L;I=(L=ae==null?void 0:ae.drives)==null?[]:L,a[0]=ae==null?void 0:ae.drives,a[1]=I}else I=a[1];let R=I,oe=(t=j==null||(n=j.files)==null?void 0:n.filter(De))==null?[]:t,z=(r=j==null?void 0:j.isRoot)==null?!1:r,B=re||ne,V=M||P,H;a[2]===w?H=a[3]:(H=e=>e.name.toLowerCase().includes(w.toLowerCase()),a[2]=w,a[3]=H);let U=oe.filter(H),W=(i=U[x])==null?null:i,G;a[4]===p?G=a[5]:(G=e=>Se(p,e.name),a[4]=p,a[5]=G);let q=G,J=W?q(W):p,Y=!W,X;a[6]!==z||a[7]!==F||a[8]!==d?(X=()=>{!d||z||(O(!0),F().then(e=>{e.data&&(m(e.data.currentPath),_(e.data.currentPath),S(0),E(``)),O(!1)}).catch(()=>{O(!1)}))},a[6]=z,a[7]=F,a[8]=d,a[9]=X):X=a[9];let se=X,Z;a[10]===q?Z=a[11]:(Z=e=>{let t=q(e);m(t),_(t),S(0),E(``),te(!1)},a[10]=q,a[11]=Z);let ce=Z,ge=()=>{J&&(c(J),s(!1))},be=e=>{if(U.length!==0)bb85:switch(e.key){case`ArrowDown`:e.preventDefault(),S(e=>Math.min(e+1,U.length-1));break bb85;case`ArrowRight`:U[x]&&(e.preventDefault(),ce(U[x]));break bb85;case`ArrowUp`:e.preventDefault(),S(Ee);break bb85;case`Enter`:e.preventDefault(),ge();break bb85;case`Escape`:w&&(e.preventDefault(),E(``))}},xe,Ce;a[12]!==l||a[13]!==o?(xe=()=>{if(o){let e=l||``;m(e),_(e),S(0),E(``)}},Ce=[o,l],a[12]=l,a[13]=o,a[14]=xe,a[15]=Ce):(xe=a[14],Ce=a[15]),(0,Q.useEffect)(xe,Ce);let Oe;a[16]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>{S(0)},a[16]=Oe):Oe=a[16];let ke;a[17]===w?ke=a[18]:(ke=[w],a[17]=w,a[18]=ke),(0,Q.useEffect)(Oe,ke),(0,Q.useEffect)(()=>{if(A.current&&U.length>0){let e=A.current.children[x];e&&e.scrollIntoView({block:`nearest`})}},[x,U.length]);let Ae,je;a[19]===o?(Ae=a[20],je=a[21]):(Ae=()=>{o&&setTimeout(()=>{var e;return(e=k.current)==null?void 0:e.focus()},100)},je=[o],a[19]=o,a[20]=Ae,a[21]=je),(0,Q.useEffect)(Ae,je);let Me;a[22]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>{te(!1)},a[22]=Me):Me=a[22];let Ne;a[23]===p?Ne=a[24]:(Ne=[p],a[23]=p,a[24]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=Te,Fe=he,Ie=pe,Le;a[25]===f?Le=a[26]:(Le=(0,$.jsx)(fe,{children:(0,$.jsx)(me,{children:f})}),a[25]=f,a[26]=Le);let Re=B||!p||z,ze;a[27]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,$.jsx)(_e,{className:`w-4 h-4`}),a[27]=ze):ze=a[27];let Be;a[28]!==se||a[29]!==Re?(Be=(0,$.jsx)(ue,{variant:`ghost`,size:`icon`,className:`h-7 w-7 flex-shrink-0`,onClick:se,disabled:Re,children:ze}),a[28]=se,a[29]=Re,a[30]=Be):Be=a[30];let Ve;a[31]!==p||a[32]!==R||a[33]!==B||a[34]!==D?(Ve=R.length>1&&(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ue,{variant:`ghost`,size:`icon`,className:`h-7 w-7 flex-shrink-0`,onClick:()=>te(we),disabled:B,children:(0,$.jsx)(ve,{className:`w-4 h-4`})}),D&&(0,$.jsx)(`div`,{className:`absolute top-full left-0 mt-1 bg-popover border rounded-md shadow-md z-50 min-w-[120px]`,children:R.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{m(e),_(e),te(!1),S(0),E(``)},className:le(`flex items-center gap-2 w-full px-3 py-1.5 text-sm text-left hover:bg-muted`,p===e&&`bg-primary/20 text-primary font-medium`),children:[(0,$.jsx)(T,{className:`w-3.5 h-3.5 text-amber-500`}),e]},e))})]}),a[31]=p,a[32]=R,a[33]=B,a[34]=D,a[35]=Ve):Ve=a[35];let He=W?(0,$.jsx)(`span`,{className:`text-primary`,children:Pe(q(W),45)}):Pe(p)||`Home`,Ue;a[36]!==He||a[37]!==J?(Ue=(0,$.jsx)(`span`,{className:`flex-1 text-sm font-mono truncate`,title:J,children:He}),a[36]=He,a[37]=J,a[38]=Ue):Ue=a[38];let We;a[39]!==Be||a[40]!==Ve||a[41]!==Ue?(We=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-muted rounded-md`,children:[Be,Ve,Ue]}),a[39]=Be,a[40]=Ve,a[41]=Ue,a[42]=We):We=a[42];let Ge;a[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,$.jsx)(K,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground`}),a[43]=Ge):Ge=a[43];let Ke;a[44]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=e=>E(e.target.value),a[44]=Ke):Ke=a[44];let qe;a[45]===w?qe=a[46]:(qe=(0,$.jsxs)(`div`,{className:`relative`,children:[Ge,(0,$.jsx)(ie,{ref:k,placeholder:`Filter folders...`,value:w,onChange:Ke,className:`pl-8`})]}),a[45]=w,a[46]=qe);let Je;a[47]!==p||a[48]!==V||a[49]!==U||a[50]!==ce||a[51]!==B||a[52]!==N||a[53]!==w||a[54]!==x?(Je=(0,$.jsx)(g,{className:`h-64 border rounded-md`,children:B?(0,$.jsxs)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:[(0,$.jsx)(ee,{className:`w-4 h-4 animate-spin mr-2`}),`Loading...`]}):V?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`text-destructive`,children:V.message}),(0,$.jsx)(ue,{variant:`ghost`,size:`sm`,onClick:()=>{_(p),N()},className:`mt-2`,children:`Retry`})]}):U.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-muted-foreground text-sm`,children:[(0,$.jsx)(T,{className:`w-8 h-8 mb-2 opacity-50`}),w?`No matching folders`:`No folders in this directory`]}):(0,$.jsx)(`div`,{className:`p-1`,ref:A,children:U.map((e,t)=>(0,$.jsxs)(`button`,{onClick:()=>S(t),onDoubleClick:()=>ce(e),className:le(`flex items-center gap-2 w-full px-2 py-1.5 rounded text-sm text-left`,`hover:bg-muted`,t===x&&`bg-primary/20 text-primary font-medium ring-1 ring-primary/50`),children:[(0,$.jsx)(T,{className:`w-4 h-4 text-amber-500 flex-shrink-0`}),(0,$.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),t===x&&(0,$.jsx)(C,{className:`w-4 h-4 text-primary`})]},e.path))})}),a[47]=p,a[48]=V,a[49]=U,a[50]=ce,a[51]=B,a[52]=N,a[53]=w,a[54]=x,a[55]=Je):Je=a[55];let Ye;a[56]===V?Ye=a[57]:(Ye=V&&(0,$.jsx)(`p`,{className:`text-xs text-destructive`,children:V.message}),a[56]=V,a[57]=Ye);let Xe;a[58]!==We||a[59]!==qe||a[60]!==Je||a[61]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`space-y-3`,children:[We,qe,Je,Ye]}),a[58]=We,a[59]=qe,a[60]=Je,a[61]=Ye,a[62]=Xe):Xe=a[62];let Ze;a[63]===s?Ze=a[64]:(Ze=(0,$.jsx)(ue,{variant:`outline`,onClick:()=>s(!1),children:`Cancel`}),a[63]=s,a[64]=Ze);let Qe=!J||B,$e=Y?`Use This Folder`:`Add Selected Folder`,et;a[65]!==ge||a[66]!==Qe||a[67]!==$e?(et=(0,$.jsx)(ue,{onClick:ge,disabled:Qe,children:$e}),a[65]=ge,a[66]=Qe,a[67]=$e,a[68]=et):et=a[68];let tt;a[69]!==Ze||a[70]!==et?(tt=(0,$.jsxs)(de,{children:[Ze,et]}),a[69]=Ze,a[70]=et,a[71]=tt):tt=a[71];let nt;a[72]!==Ie||a[73]!==be||a[74]!==Le||a[75]!==Xe||a[76]!==tt?(nt=(0,$.jsxs)(Ie,{className:`sm:max-w-lg`,onKeyDown:be,children:[Le,Xe,tt]}),a[72]=Ie,a[73]=be,a[74]=Le,a[75]=Xe,a[76]=tt,a[77]=nt):nt=a[77];let rt;return a[78]!==Fe||a[79]!==s||a[80]!==o||a[81]!==nt?(rt=(0,$.jsx)(Fe,{open:o,onOpenChange:s,children:nt}),a[78]=Fe,a[79]=s,a[80]=o,a[81]=nt,a[82]=rt):rt=a[82],rt}function we(e){return!e}function Te(e,t){let n=t===void 0?50:t;if(e.length<=n)return e;let r=e.split(/[/\\]/);return r.length<=2?e:`.../`+r.slice(-2).join(`/`)}function Ee(e){return Math.max(e-1,0)}function De(e){return e.type===`directory`}function Oe(e){let t=(0,ye.c)(67),{workspaces:n,activeWorkspace:r,onSelectWorkspace:i,onCreateVirtualWorkspace:a,onCreatePhysicalWorkspace:s,isWorkspaceFavorited:c,onToggleFavorite:l,onDeleteWorkspace:u,onRenameWorkspace:d,sdkClient:p}=e,[m,h]=(0,Q.useState)(!1),[g,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[w,ee]=(0,Q.useState)(``),ne=(0,Q.useRef)(null),O,k;t[0]===x?(O=t[1],k=t[2]):(O=()=>{x&&ne.current&&(ne.current.focus(),ne.current.select())},k=[x],t[0]=x,t[1]=O,t[2]=k),(0,Q.useEffect)(O,k);let A;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{ee(e.name),S(e.id)},t[3]=A):A=t[3];let re=A,ie;t[4]!==d||t[5]!==w||t[6]!==x?(ie=()=>{let e=w.trim();e&&x&&d(x,e),S(null)},t[4]=d,t[5]=w,t[6]=x,t[7]=ie):ie=t[7];let M=ie,N;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{S(null)},t[8]=N):N=t[8];let ae=N,P;t[9]===(r==null?void 0:r.isVirtual)?P=t[10]:(P=r!=null&&r.isVirtual?(0,$.jsx)(R,{className:`size-4 flex-shrink-0 text-muted-foreground`}):(0,$.jsx)(T,{className:`size-4 flex-shrink-0 text-muted-foreground`}),t[9]=r==null?void 0:r.isVirtual,t[10]=P);let F=(r==null?void 0:r.name)||`Select workspace`,I;t[11]===F?I=t[12]:(I=(0,$.jsx)(`span`,{className:`truncate`,children:F}),t[11]=F,t[12]=I);let L;t[13]!==P||t[14]!==I?(L=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 overflow-hidden`,children:[P,I]}),t[13]=P,t[14]=I,t[15]=L):L=t[15];let oe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(W,{className:`ml-auto size-4 shrink-0 opacity-50`}),t[16]=oe):oe=t[16];let K;t[17]!==m||t[18]!==L?(K=(0,$.jsx)(H,{asChild:!0,children:(0,$.jsxs)(ue,{variant:`outline`,role:`combobox`,"aria-expanded":m,"aria-label":`Select workspace`,className:`w-full justify-between h-9`,children:[L,oe]})}),t[17]=m,t[18]=L,t[19]=K):K=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,$.jsx)(B,{placeholder:`Search workspace...`}),t[20]=Z):Z=t[20];let de;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(G,{children:`No workspace found.`}),t[21]=de):de=t[21];let fe;t[22]!==(r==null?void 0:r.id)||t[23]!==M||t[24]!==c||t[25]!==i||t[26]!==l||t[27]!==w||t[28]!==x||t[29]!==n?(fe=n.map(e=>(0,$.jsxs)(U,{showCheck:!1,onSelect:()=>{x!==e.id&&(i(e),h(!1))},children:[(0,$.jsx)(`div`,{className:`flex-1 min-w-0 flex items-center gap-2`,children:x===e.id?(0,$.jsx)(`input`,{ref:ne,type:`text`,value:w,onChange:e=>ee(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),M()):e.key===`Escape`?(e.preventDefault(),ae()):[`ArrowUp`,`ArrowDown`].includes(e.key)&&e.stopPropagation()},onBlur:M,onClick:Ae,className:`flex-1 min-w-0 h-6 px-1 text-sm bg-background border border-input rounded focus:outline-none focus:ring-2 focus:ring-ring`}):(0,$.jsxs)($.Fragment,{children:[e.isVirtual?(0,$.jsx)(R,{className:`size-4 flex-shrink-0 text-muted-foreground`}):(0,$.jsx)(T,{className:`size-4 flex-shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]})}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,$.jsx)(`button`,{className:`p-1 rounded hover:bg-secondary transition-colors`,onClick:t=>{t.stopPropagation(),l(e.id,e.name)},title:c(e.id)?`Remove from favorites`:`Add to favorites`,children:c(e.id)?(0,$.jsx)(_,{className:`size-4 fill-primary text-primary`}):(0,$.jsx)(_,{className:`size-4 text-muted-foreground`})}),(0,$.jsx)(C,{className:le(`size-4`,(r==null?void 0:r.id)===e.id?`opacity-100`:`opacity-0`)}),(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsxs)(`button`,{className:`p-1 rounded hover:bg-secondary transition-colors`,onClick:ke,children:[(0,$.jsx)(f,{className:`size-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Workspace actions`})]})}),(0,$.jsxs)(j,{align:`end`,children:[(0,$.jsxs)(D,{onClick:t=>{t.stopPropagation(),re(e)},children:[(0,$.jsx)(o,{className:`size-4`}),`Rename`]}),(0,$.jsxs)(D,{onClick:t=>{t.stopPropagation(),b(e)},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(ce,{className:`size-4`}),`Delete`]})]})]})]})]},e.id)),t[22]=r==null?void 0:r.id,t[23]=M,t[24]=c,t[25]=i,t[26]=l,t[27]=w,t[28]=x,t[29]=n,t[30]=fe):fe=t[30];let pe;t[31]===fe?pe=t[32]:(pe=(0,$.jsx)(J,{heading:`Workspaces`,children:fe}),t[31]=fe,t[32]=pe);let me;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsx)(V,{}),t[33]=me):me=t[33];let he;t[34]===a?he=t[35]:(he=()=>{a(),h(!1)},t[34]=a,t[35]=he);let _e;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,$.jsx)(se,{className:`size-4`,"data-icon":`inline-start`}),t[36]=_e):_e=t[36];let ve;t[37]===he?ve=t[38]:(ve=(0,$.jsxs)(U,{onSelect:he,children:[_e,`Create virtual workspace`]}),t[37]=he,t[38]=ve);let be;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,$.jsxs)(U,{onSelect:()=>{h(!1),v(!0)},children:[(0,$.jsx)(T,{className:`size-4`,"data-icon":`inline-start`}),`Add existing folder`]}),t[39]=be):be=t[39];let xe;t[40]===ve?xe=t[41]:(xe=(0,$.jsxs)(J,{children:[ve,be]}),t[40]=ve,t[41]=xe);let Se;t[42]!==pe||t[43]!==xe?(Se=(0,$.jsx)(q,{className:`w-[240px] p-0 max-h-[80vh]`,children:(0,$.jsxs)(z,{children:[Z,(0,$.jsxs)(X,{className:`max-h-[50vh] overflow-y-auto`,children:[de,pe,me,xe]})]})}),t[42]=pe,t[43]=xe,t[44]=Se):Se=t[44];let we;t[45]!==m||t[46]!==K||t[47]!==Se?(we=(0,$.jsxs)(Y,{open:m,onOpenChange:h,children:[K,Se]}),t[45]=m,t[46]=K,t[47]=Se,t[48]=we):we=t[48];let Te;t[49]===s?Te=t[50]:(Te=e=>{s(e),v(!1)},t[49]=s,t[50]=Te);let Ee;t[51]!==p||t[52]!==g||t[53]!==Te?(Ee=(0,$.jsx)(Ce,{open:g,onOpenChange:v,onSelect:Te,title:`Select Workspace Folder`,sdkClient:p}),t[51]=p,t[52]=g,t[53]=Te,t[54]=Ee):Ee=t[54];let De=y!==null,Oe;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>!e&&b(null),t[55]=Oe):Oe=t[55];let je=y?`Are you sure you want to delete "${y.name}"? This will permanently remove the workspace and all associated Jean data, including sessions, messages, and temporary files. The actual files in "${y.name}" on disk will not be deleted.`:``,Me;t[56]!==u||t[57]!==y?(Me=()=>{y&&(u(y.id),b(null))},t[56]=u,t[57]=y,t[58]=Me):Me=t[58];let Ne;t[59]!==De||t[60]!==je||t[61]!==Me?(Ne=(0,$.jsx)(ge,{open:De,onOpenChange:Oe,title:`Delete Workspace`,description:je,confirmLabel:`Delete`,variant:`destructive`,onConfirm:Me}),t[59]=De,t[60]=je,t[61]=Me,t[62]=Ne):Ne=t[62];let Pe;return t[63]!==we||t[64]!==Ee||t[65]!==Ne?(Pe=(0,$.jsxs)($.Fragment,{children:[we,Ee,Ne]}),t[63]=we,t[64]=Ee,t[65]=Ne,t[66]=Pe):Pe=t[66],Pe}function ke(e){return e.stopPropagation()}function Ae(e){return e.stopPropagation()}function je(e){let t=(0,ye.c)(56),{activeSessions:n,archivedSessions:r,childrenMap:i,sessionDerivedValues:a,currentSessionId:o,onResumeSession:s,onCloseSession:l,onReopenSession:u,onDeleteSession:d,onRenameSession:g,onBulkCloseSessions:_,onBulkDeleteSessions:v}=e,[y,b]=(0,Q.useState)(!1),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=new Set,t[0]=x):x=t[0];let[S,C]=(0,Q.useState)(x),[w,ee]=(0,Q.useState)(!1),T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[1]=T):T=t[1];let ie=T,M;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{b(Ie),C(new Set)},t[2]=M):M=t[2];let ae=M,P;t[3]===n?P=t[4]:(P=()=>{C(new Set(n.map(Fe)))},t[3]=n,t[4]=P);let F=P,L;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{C(new Set)},t[5]=L):L=t[5];let R=L,z;t[6]!==_||t[7]!==S?(z=()=>{S.size>0&&(_(S),C(new Set),b(!1))},t[6]=_,t[7]=S,t[8]=z):z=t[8];let B=z,V;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{b(!1),C(new Set)},t[9]=V):V=t[9];let H=V,U;t[10]!==r||t[11]!==v?(U=()=>{let e=new Set(r.map(Pe));e.size>0&&v(e),ee(!1)},t[10]=r,t[11]=v,t[12]=U):U=t[12];let W=U,G,K;t[13]===y?(G=t[14],K=t[15]):(K=()=>{if(!y)return;let e=e=>{e.key===`Escape`&&H()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},G=[y,H],t[13]=y,t[14]=G,t[15]=K),(0,Q.useEffect)(K,G);let q;t[16]!==n||t[17]!==i||t[18]!==o||t[19]!==l||t[20]!==d||t[21]!==g||t[22]!==u||t[23]!==s||t[24]!==F||t[25]!==S||t[26]!==y||t[27]!==a?(q=(0,$.jsx)(O,{defaultOpen:!0,className:`group/collapsible`,children:(0,$.jsxs)(c,{children:[(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(ne,{asChild:!0,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(k,{className:`size-3 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`}),`Active`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:S.size>0?(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S.size===n.length?R():F()},className:`hover:underline cursor-pointer`,children:S.size===n.length?`Deselect all`:`Select all`}):(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),F()},className:`hover:underline cursor-pointer`,children:`Select all`})}),(0,$.jsx)(re,{variant:`secondary`,children:n.length}),(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Ne,className:`p-1 rounded-md hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors`,title:`Session actions`,children:(0,$.jsx)(f,{className:`size-4`})})}),(0,$.jsx)(j,{align:`end`,className:`min-w-48`,children:y?(0,$.jsxs)(D,{onClick:e=>{e.stopPropagation(),H()},children:[(0,$.jsx)(Z,{className:`size-4`}),`Cancel selection`]}):(0,$.jsxs)(D,{onClick:e=>{e.stopPropagation(),ae()},children:[(0,$.jsx)(I,{className:`size-4`}),`Select to archive`]})})]})]})]})})}),(0,$.jsx)(A,{children:(0,$.jsx)(m,{children:(0,$.jsx)(p,{children:n.map(e=>(0,$.jsx)(oe,{session:e,childrenMap:i,sessionDerivedValues:a,isActive:o===e.id,currentSessionId:o,onResumeSession:s,onCloseSession:l,onReopenSession:u,onDeleteSession:d,onRename:g,selectionMode:y,selected:S.has(e.id),onToggleSelect:ie},e.id))})})})]})}),t[16]=n,t[17]=i,t[18]=o,t[19]=l,t[20]=d,t[21]=g,t[22]=u,t[23]=s,t[24]=F,t[25]=S,t[26]=y,t[27]=a,t[28]=q):q=t[28];let J;t[29]!==r||t[30]!==i||t[31]!==o||t[32]!==l||t[33]!==d||t[34]!==g||t[35]!==u||t[36]!==s||t[37]!==a?(J=r.length>0&&(0,$.jsx)(O,{defaultOpen:!0,className:`group/collapsible`,children:(0,$.jsxs)(c,{children:[(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(ne,{asChild:!0,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(k,{className:`size-3 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`}),`Archived`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(re,{variant:`secondary`,children:r.length}),(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Me,className:`p-1 rounded-md hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors`,title:`Archived actions`,children:(0,$.jsx)(f,{className:`size-4`})})}),(0,$.jsx)(j,{align:`end`,className:`min-w-48`,children:(0,$.jsxs)(D,{onClick:e=>{e.stopPropagation(),ee(!0)},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(ce,{className:`size-4`}),`Delete all`]})})]})]})]})})}),(0,$.jsx)(A,{children:(0,$.jsx)(m,{children:(0,$.jsx)(p,{children:r.map(e=>(0,$.jsx)(oe,{session:e,childrenMap:i,sessionDerivedValues:a,isActive:o===e.id,currentSessionId:o,onResumeSession:s,onCloseSession:l,onReopenSession:u,onDeleteSession:d,onRename:g},e.id))})})})]})}),t[29]=r,t[30]=i,t[31]=o,t[32]=l,t[33]=d,t[34]=g,t[35]=u,t[36]=s,t[37]=a,t[38]=J):J=t[38];let Y;t[39]!==n.length||t[40]!==r.length?(Y=n.length===0&&r.length===0&&(0,$.jsxs)(`div`,{className:`p-4 text-center text-sm text-muted-foreground`,children:[`No sessions yet.`,(0,$.jsx)(`br`,{}),`Start a new chat to begin.`]}),t[39]=n.length,t[40]=r.length,t[41]=Y):Y=t[41];let X;t[42]!==B||t[43]!==S.size||t[44]!==y?(X=y&&S.size>0&&(0,$.jsxs)(`div`,{className:`sticky bottom-0 bg-sidebar border-t px-2 py-1.5 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground truncate min-w-0`,children:[S.size,` selected`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,$.jsx)(ue,{variant:`outline`,size:`icon`,onClick:B,title:`Archive`,className:`size-7`,children:(0,$.jsx)(N,{className:`size-4`})}),(0,$.jsx)(ue,{variant:`ghost`,size:`icon`,onClick:H,title:`Cancel`,className:`size-7`,children:(0,$.jsx)(Z,{className:`size-4`})})]})]}),t[42]=B,t[43]=S.size,t[44]=y,t[45]=X):X=t[45];let se=`This will permanently delete ${r.length} archived session${r.length===1?``:`s`}. This action cannot be undone.`,le;t[46]!==w||t[47]!==W||t[48]!==se?(le=(0,$.jsx)(ge,{open:w,onOpenChange:ee,title:`Delete all archived sessions?`,description:se,confirmLabel:`Delete all`,variant:`destructive`,onConfirm:W}),t[46]=w,t[47]=W,t[48]=se,t[49]=le):le=t[49];let de;return t[50]!==q||t[51]!==J||t[52]!==Y||t[53]!==X||t[54]!==le?(de=(0,$.jsxs)($.Fragment,{children:[q,J,Y,X,le]}),t[50]=q,t[51]=J,t[52]=Y,t[53]=X,t[54]=le,t[55]=de):de=t[55],de}function Me(e){return e.stopPropagation()}function Ne(e){return e.stopPropagation()}function Pe(e){return e.id}function Fe(e){return e.id}function Ie(e){return!e}function Le(){var e,t,n;let r=(0,ye.c)(61),a=w(),o=F(),{sidebarRef:s,chatInputRef:c,terminalPanelRef:f}=S(),{sdkClient:m,primaryPreconfigs:h,createSession:g,resumeSession:_,closeSession:v,reopenSession:y,permanentlyDeleteSession:b,handleRenameSession:x,selectWorkspace:C,handleCreateVirtualWorkspace:ee,handleCreatePhysicalWorkspace:T,deleteWorkspace:E,renameWorkspace:D}=a,te=(e=(t=o.activeWorkspace)==null?void 0:t.id)==null?null:e,ne;r[0]!==m||r[1]!==o.connected||r[2]!==te?(ne={sdkClient:m,workspaceId:te,connected:o.connected},r[0]=m,r[1]=o.connected,r[2]=te,r[3]=ne):ne=r[3],be(ne);let O=o.activeSessions,k=o.archivedSessions,A;r[4]!==E||r[5]!==T||r[6]!==ee||r[7]!==D||r[8]!==m||r[9]!==C||r[10]!==o.activeWorkspace||r[11]!==o.handleToggleWorkspaceFavorite||r[12]!==o.isWorkspaceFavorited||r[13]!==o.workspaces?(A=(0,$.jsx)(`div`,{className:`p-2 space-y-2`,children:(0,$.jsx)(Oe,{workspaces:o.workspaces,activeWorkspace:o.activeWorkspace,onSelectWorkspace:C,onCreateVirtualWorkspace:ee,onCreatePhysicalWorkspace:T,isWorkspaceFavorited:o.isWorkspaceFavorited,onToggleFavorite:o.handleToggleWorkspaceFavorite,onDeleteWorkspace:E,onRenameWorkspace:D,sdkClient:m})}),r[4]=E,r[5]=T,r[6]=ee,r[7]=D,r[8]=m,r[9]=C,r[10]=o.activeWorkspace,r[11]=o.handleToggleWorkspaceFavorite,r[12]=o.isWorkspaceFavorited,r[13]=o.workspaces,r[14]=A):A=r[14];let j;if(r[15]!==g||r[16]!==((n=h[0])==null?void 0:n.id)){var re;j=()=>{var e;return g((e=h[0])==null?void 0:e.id)},r[15]=g,r[16]=(re=h[0])==null?void 0:re.id,r[17]=j}else j=r[17];let ie=!o.connected,M,N;r[18]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(se,{className:`size-4`,"data-icon":`inline-start`}),N=(0,$.jsx)(`span`,{children:`New Chat`}),r[18]=M,r[19]=N):(M=r[18],N=r[19]);let I;r[20]!==j||r[21]!==ie?(I=(0,$.jsx)(p,{children:(0,$.jsx)(d,{children:(0,$.jsxs)(u,{onClick:j,disabled:ie,className:`w-full`,children:[M,N]})})}),r[20]=j,r[21]=ie,r[22]=I):I=r[22];let R;r[23]!==A||r[24]!==I?(R=(0,$.jsxs)(l,{children:[A,I]}),r[23]=A,r[24]=I,r[25]=R):R=r[25];let oe=R,z;r[26]===v?z=r[27]:(z=e=>{e.forEach(e=>v(e))},r[26]=v,r[27]=z);let B=z,V;r[28]===b?V=r[29]:(V=e=>{e.forEach(e=>b(e))},r[28]=b,r[29]=V);let H=V,U;r[30]!==O||r[31]!==k||r[32]!==v||r[33]!==B||r[34]!==H||r[35]!==x||r[36]!==b||r[37]!==y||r[38]!==_||r[39]!==o.childrenMap||r[40]!==o.currentSessionId||r[41]!==o.sessionDerivedValues?(U=(0,$.jsx)(je,{activeSessions:O,archivedSessions:k,childrenMap:o.childrenMap,sessionDerivedValues:o.sessionDerivedValues,currentSessionId:o.currentSessionId,onResumeSession:_,onCloseSession:v,onReopenSession:y,onDeleteSession:b,onRenameSession:x,onBulkCloseSessions:B,onBulkDeleteSessions:H}),r[30]=O,r[31]=k,r[32]=v,r[33]=B,r[34]=H,r[35]=x,r[36]=b,r[37]=y,r[38]=_,r[39]=o.childrenMap,r[40]=o.currentSessionId,r[41]=o.sessionDerivedValues,r[42]=U):U=r[42];let W=U,G;r[43]!==c||r[44]!==o.currentSessionId?(G=()=>{if(o.currentSessionId){var e;(e=c.current)==null||e.focus()}},r[43]=c,r[44]=o.currentSessionId,r[45]=G):G=r[45];let K;r[46]!==W||r[47]!==o.currentSessionId||r[48]!==oe||r[49]!==s||r[50]!==G?(K=(0,$.jsx)(ae,{ref:s,header:oe,currentSessionId:o.currentSessionId,onEscape:G,children:W}),r[46]=W,r[47]=o.currentSessionId,r[48]=oe,r[49]=s,r[50]=G,r[51]=K):K=r[51];let q;r[52]===Symbol.for(`react.memo_cache_sentinel`)?(q={paddingTop:`calc(0.5rem + env(safe-area-inset-top, 0px))`,paddingBottom:`calc(0.5rem + env(safe-area-inset-bottom, 0px))`},r[52]=q):q=r[52];let J,Y;r[53]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,$.jsx)(P,{}),Y=(0,$.jsx)(i,{}),r[53]=J,r[54]=Y):(J=r[53],Y=r[54]);let X;r[55]!==m||r[56]!==f?(X=(0,$.jsx)(`main`,{className:`flex-1 flex flex-col overflow-hidden min-h-0 p-2`,style:q,children:(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden min-h-0 rounded-xl bg-background shadow-sm ring-1 ring-border`,children:[J,Y,(0,$.jsx)(L,{sdkClient:m,terminalPanelRef:f})]})}),r[55]=m,r[56]=f,r[57]=X):X=r[57];let Z;return r[58]!==K||r[59]!==X?(Z=(0,$.jsxs)($.Fragment,{children:[K,X]}),r[58]=K,r[59]=X,r[60]=Z):Z=r[60],Z}var Re=Le;export{Re as component};
package/dist/cli.mjs CHANGED
@@ -6,7 +6,6 @@ import fs from "node:fs";
6
6
  import path from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { parseArgs } from "node:util";
9
- import open from "open";
10
9
  var __filename = fileURLToPath(import.meta.url);
11
10
  var __dirname = path.dirname(__filename);
12
11
  var distPath = __dirname;
@@ -56,13 +55,28 @@ var server = http.createServer((req, res) => {
56
55
  }
57
56
  const filePath = path.join(distPath, urlPath);
58
57
  fs.stat(filePath, (err, stats) => {
59
- if (err || !stats.isFile()) {
60
- const indexPath = path.join(distPath, "index.html");
61
- serveFile(res, indexPath, "text/html");
58
+ if (!err && stats.isFile()) {
59
+ const contentType = getContentType(filePath);
60
+ serveFile(res, filePath, contentType);
62
61
  return;
63
62
  }
64
- const contentType = getContentType(filePath);
65
- serveFile(res, filePath, contentType);
63
+ const ext = path.extname(urlPath).toLowerCase();
64
+ if (ext && ext !== ".html") {
65
+ const filename = path.basename(urlPath);
66
+ const assetPath = path.join(distPath, "assets", filename);
67
+ fs.stat(assetPath, (err2, stats2) => {
68
+ if (!err2 && stats2.isFile()) {
69
+ const contentType = getContentType(assetPath);
70
+ serveFile(res, assetPath, contentType);
71
+ return;
72
+ }
73
+ const indexPath2 = path.join(distPath, "index.html");
74
+ serveFile(res, indexPath2, "text/html");
75
+ });
76
+ return;
77
+ }
78
+ const indexPath = path.join(distPath, "index.html");
79
+ serveFile(res, indexPath, "text/html");
66
80
  });
67
81
  });
68
82
  server.on("error", (err) => {
@@ -70,9 +84,7 @@ server.on("error", (err) => {
70
84
  process.exit(1);
71
85
  });
72
86
  server.listen(PORT, () => {
73
- const url = `http://localhost:${PORT}`;
74
- console.log(`Jean2 client running at ${url}`);
75
- open(url);
87
+ console.log(`Jean2 client running at http://localhost:${PORT}`);
76
88
  });
77
89
  function shutdown() {
78
90
  console.log("\nShutting down...");
package/dist/index.html CHANGED
@@ -38,18 +38,19 @@
38
38
  root.classList.add(mode, scheme);
39
39
  })();
40
40
  </script>
41
- <script type="module" crossorigin src="./assets/index-BDTQdmk9.js"></script>
41
+ <script type="module" crossorigin src="./assets/index-Db3JxRbZ.js"></script>
42
+ <link rel="modulepreload" crossorigin href="./assets/classPrivateFieldGet2-BGlEuFdn.js">
42
43
  <link rel="modulepreload" crossorigin href="./assets/compiler-runtime-DZXZ41-q.js">
43
- <link rel="modulepreload" crossorigin href="./assets/src-BiLzKNfl.js">
44
- <link rel="modulepreload" crossorigin href="./assets/servers-GmYSnzvH.js">
45
- <link rel="modulepreload" crossorigin href="./assets/useParams-RuFKFrOo.js">
46
- <link rel="modulepreload" crossorigin href="./assets/preload-helper-D-tEmku_.js">
47
- <link rel="modulepreload" crossorigin href="./assets/platform-5d-ZQG2e.js">
48
- <link rel="modulepreload" crossorigin href="./assets/useNavigate-Dxc8FNpV.js">
49
- <link rel="modulepreload" crossorigin href="./assets/_serverId-COhNW61b.js">
44
+ <link rel="modulepreload" crossorigin href="./assets/useRouter-C67ywEA3.js">
45
+ <link rel="modulepreload" crossorigin href="./assets/src-BALdofIU.js">
46
+ <link rel="modulepreload" crossorigin href="./assets/ServerContext-Dy9T5Mj8.js">
47
+ <link rel="modulepreload" crossorigin href="./assets/platform-cRBZ7eSy.js">
48
+ <link rel="modulepreload" crossorigin href="./assets/mutation-D4xtepYQ.js">
49
+ <link rel="modulepreload" crossorigin href="./assets/preload-helper-D844vhe4.js">
50
+ <link rel="modulepreload" crossorigin href="./assets/useNavigate-Ckup4lZi.js">
51
+ <link rel="modulepreload" crossorigin href="./assets/react-dom-DHWV5rS5.js">
50
52
  <link rel="modulepreload" crossorigin href="./assets/ThemeProvider-Da23NPAS.js">
51
- <link rel="modulepreload" crossorigin href="./assets/ServerContext-CBFiY6IH.js">
52
- <link rel="stylesheet" crossorigin href="./assets/index-DF4q2PgJ.css">
53
+ <link rel="stylesheet" crossorigin href="./assets/index-DzEyMPKG.css">
53
54
  </head>
54
55
  <body>
55
56
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jean2/client",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Jean2 AI Agent Client - Run the Jean2 web UI locally via npx",
5
5
  "private": false,
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{n as e,o as t,r as n,t as r}from"./compiler-runtime-DZXZ41-q.js";import{a as i,c as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f}from"./servers-GmYSnzvH.js";var p=t(n(),1),m=r();function h(e){return/^[a-f0-9]{64}$/.test(e)}function g(e){return e.length<12?e:`${e.slice(0,4)}...${e.slice(-4)}`}function _(e){let t=e.trim(),n=/^https:\/\//i.test(t),r=t.replace(/^(https?:\/\/|wss?:\/\/)/i,``);return r=r.replace(/\/+$/,``),n&&(r=`https://${r}`),r}var v=e(),y=(0,p.createContext)(null),b=e=>{let t=(0,m.c)(18),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[h,g]=(0,p.useState)(r),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,p.useState)(b),[C,w]=(0,p.useState)(!1),T,E;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{let e=o(),t=u();g(e),S(t),w(!0)},E=[],t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,p.useEffect)(T,E);let D;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(e,t,n)=>{let r=_(t),i={id:crypto.randomUUID(),name:e,url:r,token:n,createdAt:new Date().toISOString()};return a(i),g(o()),i},t[4]=D):D=t[4];let O=D,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(k=(e,t)=>{s(e,{...t,...t.url&&{url:_(t.url)}}),g(o())},t[5]=k):k=t[5];let A=k,j;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{c(e),g(o()),S(u())},t[6]=j):j=t[6];let M=j,N;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(N=(e,t,n,r)=>{f({serverId:e,serverName:t,workspaceId:n,workspaceName:r}),S(u())},t[7]=N):N=t[7];let P=N,F;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{i(e),S(u())},t[8]=F):F=t[8];let I=F,L;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{l(e),S(u())},t[9]=L):L=t[9];let R=L,z;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{d(e),S(u())},t[10]=z):z=t[10];let B=z,V;t[11]!==C||t[12]!==x||t[13]!==h?(V={servers:h,quickConnections:x,isHydrated:C,addServer:O,editServer:A,removeServer:M,addToQuickConnections:P,removeFromQuickConnections:I,removeFromQuickConnectionsByWorkspace:R,reorderQuick:B},t[11]=C,t[12]=x,t[13]=h,t[14]=V):V=t[14];let H=V,U;return t[15]!==n||t[16]!==H?(U=(0,v.jsx)(y.Provider,{value:H,children:n}),t[15]=n,t[16]=H,t[17]=U):U=t[17],U},x=()=>{let e=(0,p.useContext)(y);if(e===null)throw Error(`useServerContext must be used within a ServerProvider`);return e};export{_ as a,g as i,x as n,h as r,b as t};
@@ -1,9 +0,0 @@
1
- import{n as e,o as t,r as n,t as r}from"./compiler-runtime-DZXZ41-q.js";import{i}from"./src-BiLzKNfl.js";import{n as a}from"./ThemeProvider-Da23NPAS.js";import{$ as o,Ct as s,Dt as c,Et as l,J as u,Q as d,S as f,Tt as p,Y as m,Z as h,_ as g,_t as _,a as v,b as y,bt as b,c as x,ct as S,d as C,f as w,ft as T,h as E,ht as D,i as O,j as k,jt as A,l as j,m as M,n as N,ot as P,p as F,pt as I,r as L,rt as R,s as z,st as ee,t as B,u as V,ut as H,v as U,vt as te,wt as W,x as G,xt as ne,y as K,yt as q}from"./badge-CwZd07eA.js";import{t as J}from"./createLucideIcon-BYAVpx9Z.js";import{n as re,t as ie}from"./confirmation-dialog-DGPNPL5O.js";import{C as ae,S as oe,T as se,_ as ce,a as le,b as ue,c as de,d as fe,f as pe,g as me,h as he,i as ge,l as _e,m as Y,n as ve,o as ye,p as be,r as xe,s as Se,t as Ce,u as we,v as Te,w as Ee,x as De,y as Oe}from"./alert-qqwNRgnw.js";import{a as ke,b as Ae,c as je,f as Me,i as X,l as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re,u as ze,x as Be}from"./popover-BaZzl6-v.js";import{i as Ve,n as He,r as Ue,t as We}from"./triangle-alert-BOCjiWM3.js";function Ge(e){return e.role===`assistant`}var Ke=J(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),qe=J(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Je=J(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Ye=J(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Xe=J(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ze=J(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=J(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),$e=J(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),et=J(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),tt=J(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),nt=J(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),rt=J(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),it=J(`hand`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),at=J(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ot=J(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),st=J(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),ct=J(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),lt=J(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),ut=J(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),dt=J(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),ft=J(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),Z=t(n(),1),Q=e(),pt=`Checkbox`,[mt,ht]=d(pt),[gt,_t]=mt(pt);function vt(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=m({prop:n,defaultProp:i==null?!1:i,onChange:c,caller:pt}),[h,g]=Z.useState(null),[_,v]=Z.useState(null),y=Z.useRef(!1),b=h?!!o||!!h.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:h,setControl:g,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:Dt(i)?!1:i,isFormControl:b,bubbleInput:_,setBubbleInput:v};return(0,Q.jsx)(gt,{scope:t,...x,children:Et(d)?d(x):r})}var yt=`CheckboxTrigger`,bt=Z.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:s,disabled:c,checked:l,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:m,bubbleInput:g}=_t(yt,e),_=R(i,d),v=Z.useRef(l);return Z.useEffect(()=>{let e=a==null?void 0:a.form;if(e){let t=()=>f(v.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,f]),(0,Q.jsx)(o.button,{type:`button`,role:`checkbox`,"aria-checked":Dt(l)?`mixed`:l,"aria-required":u,"data-state":Ot(l),"data-disabled":c?``:void 0,disabled:c,value:s,...r,ref:_,onKeyDown:h(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:h(n,e=>{f(e=>Dt(e)?!0:!e),g&&m&&(p.current=e.isPropagationStopped(),p.current||e.stopPropagation())})})});bt.displayName=yt;var xt=Z.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,Q.jsx)(vt,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(bt,{...d,ref:t,__scopeCheckbox:n}),e&&(0,Q.jsx)(Tt,{__scopeCheckbox:n})]})})});xt.displayName=pt;var St=`CheckboxIndicator`,Ct=Z.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=_t(St,n);return(0,Q.jsx)(u,{present:r||Dt(a.checked)||a.checked===!0,children:(0,Q.jsx)(o.span,{"data-state":Ot(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});Ct.displayName=St;var wt=`CheckboxBubbleInput`,Tt=Z.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:s,required:c,disabled:l,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:m}=_t(wt,e),h=R(n,m),g=Se(a),_=k(r);Z.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(g!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Dt(a),n.call(e,Dt(a)?!1:a),e.dispatchEvent(t)}},[p,g,a,i]);let v=Z.useRef(Dt(a)?!1:a);return(0,Q.jsx)(o.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s==null?v.current:s,required:c,disabled:l,name:u,value:d,form:f,...t,tabIndex:-1,ref:h,style:{...t.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Tt.displayName=wt;function Et(e){return typeof e==`function`}function Dt(e){return e===`indeterminate`}function Ot(e){return Dt(e)?`indeterminate`:e?`checked`:`unchecked`}var $=r();function kt(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex flex-col h-full items-center justify-center gap-4 text-muted-foreground`,children:[(0,Q.jsx)(ne,{className:`size-8 animate-spin`}),(0,Q.jsx)(`p`,{className:`text-sm`,children:`Loading conversation...`})]}),e[0]=t):t=e[0],t}function At(e){let t=(0,$.c)(3),{message:n}=e,r=n===void 0?`Connecting to server...`:n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(ne,{className:`size-8 animate-spin`}),t[0]=i):i=t[0];let a;return t[1]===r?a=t[2]:(a=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 text-muted-foreground`,children:[i,(0,Q.jsx)(`p`,{className:`text-sm`,children:r})]}),t[1]=r,t[2]=a),a}var jt=e=>{let t=(0,$.c)(26),{serverUrl:n,authError:r,retryCount:i,nextRetryIn:a,onRetry:o,onLogout:s}=e,c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(dt,{className:`size-12 text-destructive mb-4`}),l=(0,Q.jsx)(`h2`,{className:`text-xl font-semibold text-foreground mb-2`,children:`Unable to connect to server`}),t[0]=c,t[1]=l):(c=t[0],l=t[1]);let u=r||`Please check that the server is running.`,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4 max-w-[400px]`,children:u}),t[2]=u,t[3]=d);let f;t[4]===n?f=t[5]:(f=n&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground mb-6 font-mono bg-muted px-3 py-1.5 rounded`,children:n}),t[4]=n,t[5]=f);let p;t[6]===a?p=t[7]:(p=(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Retrying in `,a,`s...`]}),t[6]=a,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(he,{className:`size-4 mr-2`,"data-icon":`inline-start`}),t[8]=m):m=t[8];let h;t[9]===o?h=t[10]:(h=(0,Q.jsxs)(K,{onClick:o,variant:`default`,children:[m,`Retry Now`]}),t[9]=o,t[10]=h);let g;t[11]===s?g=t[12]:(g=(0,Q.jsx)(K,{onClick:s,variant:`ghost`,children:`Change Server`}),t[11]=s,t[12]=g);let _;t[13]!==h||t[14]!==g?(_=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,g]}),t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]===i?v=t[17]:(v=i>0&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Retry attempt: `,i]}),t[16]=i,t[17]=v);let y;t[18]!==_||t[19]!==v||t[20]!==p?(y=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[p,_,v]}),t[18]=_,t[19]=v,t[20]=p,t[21]=y):y=t[21];let b;return t[22]!==y||t[23]!==d||t[24]!==f?(b=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center min-h-[400px] px-4 text-center`,children:[c,l,d,f,y]}),t[22]=y,t[23]=d,t[24]=f,t[25]=b):b=t[25],b};function Mt(e){return e>=1e6?(e/1e6).toFixed(1)+`M`:e>=1e3?(e/1e3).toFixed(1)+`k`:e.toString()}function Nt(e){return e>=60?`critical`:e>=40?`warning`:`normal`}function Pt(e){let t=(0,$.c)(21),{totalTokens:n,contextWindow:r}=e,i=n===void 0?0:n,a=r===void 0?0:r,[o,s]=(0,Z.useState)(!1),c=i===0?0:a,l;t[0]!==c||t[1]!==i?(l=c===0?0:Math.min(100,Math.round(i/c*100)),t[0]=c,t[1]=i,t[2]=l):l=t[2];let u=l,d=Nt(u),f=2*Math.PI*8,p=f*(1-u/100),m=u===0?`text-muted-foreground/30`:d===`critical`?`text-destructive`:d===`warning`?`text-warning`:`text-primary`,h;t[3]===o?h=t[4]:(h=()=>s(!o),t[3]=o,t[4]=h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(`circle`,{cx:`10`,cy:`10`,r:8,stroke:`currentColor`,className:`text-muted-foreground/20`,strokeWidth:`3`}),t[5]=g):g=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_={transition:`stroke-dashoffset 0.3s ease`},t[6]=_):_=t[6];let v;t[7]!==m||t[8]!==p?(v=(0,Q.jsxs)(`svg`,{viewBox:`0 0 20 20`,className:`size-5`,fill:`none`,children:[g,(0,Q.jsx)(`circle`,{cx:`10`,cy:`10`,r:8,stroke:`currentColor`,className:m,strokeWidth:`3`,strokeDasharray:f,strokeDashoffset:p,strokeLinecap:`round`,transform:`rotate(-90 10 10)`,style:_})]}),t[7]=m,t[8]=p,t[9]=v):v=t[9];let y;t[10]!==c||t[11]!==u||t[12]!==o||t[13]!==i?(y=o?`${Mt(i)}/${Mt(c)}`:`${u}%`,t[10]=c,t[11]=u,t[12]=o,t[13]=i,t[14]=y):y=t[14];let b;t[15]===y?b=t[16]:(b=(0,Q.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground`,children:y}),t[15]=y,t[16]=b);let x;return t[17]!==h||t[18]!==v||t[19]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 cursor-pointer select-none`,onClick:h,children:[v,b]}),t[17]=h,t[18]=v,t[19]=b,t[20]=x):x=t[20],x}function Ft(e){switch(e){case`budget`:return`$`;case`standard`:return`$$`;case`premium`:return`$$$`;default:return``}}function It(e){let t=(0,$.c)(79),{models:n,selectedModelId:r,onChangeModel:i,disabled:a,compact:o,iconOnly:s}=e,c=o===void 0?!1:o,u=s===void 0?!1:s,[d,f]=(0,Z.useState)(!1),p,m,h,g,_,v,b,x,S,C,w,T,E;if(t[0]!==c||t[1]!==a||t[2]!==u||t[3]!==n||t[4]!==i||t[5]!==d||t[6]!==r){v=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.reduce(Lt,{}),o=e=>{let t=n.find(t=>t.id===e);t&&(i(e,t.providerId),f(!1))},s;if(t[20]!==n||t[21]!==r){let e;t[23]===r?e=t[24]:(e=e=>e.id===r,t[23]=r,t[24]=e),s=n.find(e),t[20]=n,t[21]=r,t[22]=s}else s=t[22];let D=s;if(u){let n;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(oe,{className:`size-4 text-muted-foreground`}),t[25]=n):n=t[25];let i;t[26]!==a||t[27]!==d?(i=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsx)(K,{variant:`ghost`,size:`icon-sm`,role:`combobox`,"aria-expanded":d,"aria-label":`Select model`,disabled:a,children:n})}),t[26]=a,t[27]=d,t[28]=i):i=t[28];let s;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(je,{placeholder:`Search model...`}),t[29]=s):s=t[29];let c;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(Fe,{children:`No model found.`}),t[30]=c):c=t[30];let u=(0,Q.jsxs)(ze,{className:`max-h-[50vh] overflow-y-auto`,children:[c,Object.entries(e).map(e=>{let[t,n]=e;return(0,Q.jsx)(Le,{heading:t,children:n.map(e=>(0,Q.jsxs)(Ne,{value:e.id,onSelect:()=>o(e.id),className:`justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:e.name}),(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:Ft(e.tier)})]}),(0,Q.jsx)(l,{className:y(`size-4`,r===e.id?`opacity-100`:`opacity-0`)})]},e.id))},t)})]}),p;t[31]===u?p=t[32]:(p=(0,Q.jsx)(Ie,{className:`w-[240px] p-0`,children:(0,Q.jsxs)(ke,{children:[s,u]})}),t[31]=u,t[32]=p);let m;t[33]!==d||t[34]!==i||t[35]!==p?(m=(0,Q.jsxs)(Re,{open:d,onOpenChange:f,children:[i,p]}),t[33]=d,t[34]=i,t[35]=p,t[36]=m):m=t[36],v=m;break bb0}if(c){let n,i;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(oe,{className:`size-4 flex-shrink-0 text-muted-foreground`}),i=(0,Q.jsx)(Be,{className:`size-3 shrink-0 opacity-50`}),t[37]=n,t[38]=i):(n=t[37],i=t[38]);let s;t[39]!==a||t[40]!==d?(s=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsxs)(K,{variant:`ghost`,size:`sm`,role:`combobox`,"aria-expanded":d,"aria-label":`Select model`,className:`h-8 gap-1.5 px-2 text-muted-foreground hover:bg-accent`,disabled:a,children:[n,i]})}),t[39]=a,t[40]=d,t[41]=s):s=t[41];let c;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(je,{placeholder:`Search model...`}),t[42]=c):c=t[42];let u;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(Fe,{children:`No model found.`}),t[43]=u):u=t[43];let p=(0,Q.jsxs)(ze,{className:`max-h-[50vh] overflow-y-auto`,children:[u,Object.entries(e).map(e=>{let[t,n]=e;return(0,Q.jsx)(Le,{heading:t,children:n.map(e=>(0,Q.jsxs)(Ne,{value:e.id,onSelect:()=>o(e.id),className:`justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:e.name}),(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:Ft(e.tier)})]}),(0,Q.jsx)(l,{className:y(`size-4`,r===e.id?`opacity-100`:`opacity-0`)})]},e.id))},t)})]}),m;t[44]===p?m=t[45]:(m=(0,Q.jsx)(Ie,{className:`w-[240px] p-0`,children:(0,Q.jsxs)(ke,{children:[c,p]})}),t[44]=p,t[45]=m);let h;t[46]!==d||t[47]!==s||t[48]!==m?(h=(0,Q.jsxs)(Re,{open:d,onOpenChange:f,children:[s,m]}),t[46]=d,t[47]=s,t[48]=m,t[49]=h):h=t[49],v=h;break bb0}g=Re,T=d,E=f;let O;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(oe,{className:`size-4 flex-shrink-0 text-muted-foreground`}),t[50]=O):O=t[50];let k=(D==null?void 0:D.name)||`Select model`,A;t[51]===k?A=t[52]:(A=(0,Q.jsx)(`span`,{className:`truncate`,children:k}),t[51]=k,t[52]=A);let j;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(Be,{className:`size-3 shrink-0 opacity-50`}),t[53]=j):j=t[53],t[54]!==a||t[55]!==d||t[56]!==A?(_=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsxs)(K,{variant:`ghost`,size:`sm`,role:`combobox`,"aria-expanded":d,"aria-label":`Select model`,className:`h-8 gap-1.5 px-2 text-muted-foreground hover:bg-accent`,disabled:a,children:[O,A,j]})}),t[54]=a,t[55]=d,t[56]=A,t[57]=_):_=t[57],h=Ie,w=`w-[240px] p-0`,m=ke,t[58]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(je,{placeholder:`Search model...`}),t[58]=C):C=t[58],p=ze,b=`max-h-[50vh] overflow-y-auto`,t[59]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(Fe,{children:`No model found.`}),t[59]=x):x=t[59],S=Object.entries(e).map(e=>{let[t,n]=e;return(0,Q.jsx)(Le,{heading:t,children:n.map(e=>(0,Q.jsxs)(Ne,{value:e.id,onSelect:()=>o(e.id),className:`justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:e.name}),(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:Ft(e.tier)})]}),(0,Q.jsx)(l,{className:y(`size-4`,r===e.id?`opacity-100`:`opacity-0`)})]},e.id))},t)})}t[0]=c,t[1]=a,t[2]=u,t[3]=n,t[4]=i,t[5]=d,t[6]=r,t[7]=p,t[8]=m,t[9]=h,t[10]=g,t[11]=_,t[12]=v,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=E}else p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],E=t[19];if(v!==Symbol.for(`react.early_return_sentinel`))return v;let D;t[60]!==p||t[61]!==b||t[62]!==x||t[63]!==S?(D=(0,Q.jsxs)(p,{className:b,children:[x,S]}),t[60]=p,t[61]=b,t[62]=x,t[63]=S,t[64]=D):D=t[64];let O;t[65]!==m||t[66]!==D||t[67]!==C?(O=(0,Q.jsxs)(m,{children:[C,D]}),t[65]=m,t[66]=D,t[67]=C,t[68]=O):O=t[68];let k;t[69]!==h||t[70]!==O||t[71]!==w?(k=(0,Q.jsx)(h,{className:w,children:O}),t[69]=h,t[70]=O,t[71]=w,t[72]=k):k=t[72];let A;return t[73]!==g||t[74]!==_||t[75]!==k||t[76]!==T||t[77]!==E?(A=(0,Q.jsxs)(g,{open:T,onOpenChange:E,children:[_,k]}),t[73]=g,t[74]=_,t[75]=k,t[76]=T,t[77]=E,t[78]=A):A=t[78],A}function Lt(e,t){return e[t.providerName]||(e[t.providerName]=[]),e[t.providerName].push(t),e}var Rt={low:`Low`,medium:`Medium`,high:`High`,xhigh:`X-High`,minimal:`Minimal`,max:`Max`};function zt(e){return Rt[e]||e.charAt(0).toUpperCase()+e.slice(1)}function Bt(e){let t=(0,$.c)(69),{variants:n,selectedVariant:r,onChangeVariant:i,disabled:a,compact:o,iconOnly:s}=e,c=o===void 0?!1:o,u=s===void 0?!1:s,[d,f]=(0,Z.useState)(!1);if(!n||Object.keys(n).length===0)return null;let p,m,h,g,_,v,b;if(t[0]!==i||t[1]!==r||t[2]!==n){let e=Object.keys(n),a;t[10]===i?a=t[11]:(a=e=>{i(e===`__none__`?null:e),f(!1)},t[10]=i,t[11]=a);let o=a,s;t[12]===r?s=t[13]:(s=r?zt(r):`Default`,t[12]=r,t[13]=s),h=s,m=ke,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(je,{placeholder:`Search...`}),t[14]=b):b=t[14],p=ze,g=`max-h-[50vh] overflow-y-auto`;let c;t[15]===o?c=t[16]:(c=()=>o(`__none__`),t[15]=o,t[16]=c);let u;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`span`,{children:`Default`}),t[17]=u):u=t[17];let d=r===null?`opacity-100`:`opacity-0`,x;t[18]===d?x=t[19]:(x=y(`size-4`,d),t[18]=d,t[19]=x);let S;t[20]===x?S=t[21]:(S=(0,Q.jsx)(l,{className:x}),t[20]=x,t[21]=S),t[22]!==S||t[23]!==c?(_=(0,Q.jsxs)(Ne,{value:`__none__`,onSelect:c,className:`justify-between`,children:[u,S]},`__none__`),t[22]=S,t[23]=c,t[24]=_):_=t[24],v=e.map(e=>(0,Q.jsxs)(Ne,{value:e,onSelect:()=>o(e),className:`justify-between`,children:[(0,Q.jsx)(`span`,{children:zt(e)}),(0,Q.jsx)(l,{className:y(`size-4`,r===e?`opacity-100`:`opacity-0`)})]},e)),t[0]=i,t[1]=r,t[2]=n,t[3]=p,t[4]=m,t[5]=h,t[6]=g,t[7]=_,t[8]=v,t[9]=b}else p=t[3],m=t[4],h=t[5],g=t[6],_=t[7],v=t[8],b=t[9];let x;t[25]!==p||t[26]!==g||t[27]!==_||t[28]!==v?(x=(0,Q.jsxs)(p,{className:g,children:[_,v]}),t[25]=p,t[26]=g,t[27]=_,t[28]=v,t[29]=x):x=t[29];let S;t[30]!==m||t[31]!==b||t[32]!==x?(S=(0,Q.jsxs)(m,{children:[b,x]}),t[30]=m,t[31]=b,t[32]=x,t[33]=S):S=t[33];let C=S;if(u){let e;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ye,{className:`size-4 text-muted-foreground`}),t[34]=e):e=t[34];let n;t[35]!==a||t[36]!==d?(n=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsx)(K,{variant:`ghost`,size:`icon-sm`,role:`combobox`,"aria-expanded":d,"aria-label":`Select variant`,disabled:a,children:e})}),t[35]=a,t[36]=d,t[37]=n):n=t[37];let r;t[38]===C?r=t[39]:(r=(0,Q.jsx)(Ie,{className:`w-[240px] p-0`,children:C}),t[38]=C,t[39]=r);let i;return t[40]!==d||t[41]!==n||t[42]!==r?(i=(0,Q.jsxs)(Re,{open:d,onOpenChange:f,children:[n,r]}),t[40]=d,t[41]=n,t[42]=r,t[43]=i):i=t[43],i}if(c){let e,n;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(Ye,{className:`size-4 flex-shrink-0 text-muted-foreground`}),e=(0,Q.jsx)(Be,{className:`size-3 shrink-0 opacity-50`}),t[44]=e,t[45]=n):(e=t[44],n=t[45]);let r;t[46]!==a||t[47]!==d?(r=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsxs)(K,{variant:`ghost`,size:`sm`,className:`h-8 gap-1.5 px-2 text-muted-foreground hover:bg-accent`,role:`combobox`,"aria-expanded":d,"aria-label":`Select variant`,disabled:a,children:[n,e]})}),t[46]=a,t[47]=d,t[48]=r):r=t[48];let i;t[49]===C?i=t[50]:(i=(0,Q.jsx)(Ie,{className:`w-[240px] p-0`,children:C}),t[49]=C,t[50]=i);let o;return t[51]!==d||t[52]!==r||t[53]!==i?(o=(0,Q.jsxs)(Re,{open:d,onOpenChange:f,children:[r,i]}),t[51]=d,t[52]=r,t[53]=i,t[54]=o):o=t[54],o}let w;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(Ye,{className:`size-4 flex-shrink-0 text-muted-foreground`}),t[55]=w):w=t[55];let T;t[56]===h?T=t[57]:(T=(0,Q.jsx)(`span`,{className:`truncate`,children:h}),t[56]=h,t[57]=T);let E;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(Be,{className:`size-3 shrink-0 opacity-50`}),t[58]=E):E=t[58];let D;t[59]!==a||t[60]!==d||t[61]!==T?(D=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsxs)(K,{variant:`ghost`,size:`sm`,className:`h-8 gap-1.5 px-2 text-muted-foreground hover:bg-accent`,role:`combobox`,"aria-expanded":d,"aria-label":`Select variant`,disabled:a,children:[w,T,E]})}),t[59]=a,t[60]=d,t[61]=T,t[62]=D):D=t[62];let O;t[63]===C?O=t[64]:(O=(0,Q.jsx)(Ie,{className:`w-[240px] p-0`,children:C}),t[63]=C,t[64]=O);let k;return t[65]!==d||t[66]!==D||t[67]!==O?(k=(0,Q.jsxs)(Re,{open:d,onOpenChange:f,children:[D,O]}),t[65]=d,t[66]=D,t[67]=O,t[68]=k):k=t[68],k}function Vt(e){let t=(0,$.c)(66),{preconfigs:n,selectedPreconfigId:r,onChangePreconfig:i,disabled:a,compact:o,iconOnly:s}=e,c=o===void 0?!1:o,u=s===void 0?!1:s,[d,f]=(0,Z.useState)(!1),p;if(t[0]!==n||t[1]!==r){let e;t[3]===r?e=t[4]:(e=e=>e.id===r,t[3]=r,t[4]=e),p=n.find(e),t[0]=n,t[1]=r,t[2]=p}else p=t[2];let m=p,h;t[5]===i?h=t[6]:(h=e=>{i(e),f(!1)},t[5]=i,t[6]=h);let g=h;if(u){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Y,{className:`size-4 text-muted-foreground`}),t[7]=e):e=t[7];let i;t[8]!==a||t[9]!==d?(i=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsx)(K,{variant:`ghost`,size:`icon-sm`,role:`combobox`,"aria-expanded":d,"aria-label":`Select config`,disabled:a,children:e})}),t[8]=a,t[9]=d,t[10]=i):i=t[10];let o;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(je,{placeholder:`Search config...`}),t[11]=o):o=t[11];let s;if(t[12]!==g||t[13]!==n||t[14]!==r){let e;t[16]!==g||t[17]!==r?(e=e=>(0,Q.jsxs)(Ne,{onSelect:()=>g(e.id),className:`justify-between`,children:[(0,Q.jsxs)(`span`,{children:[e.name,e.isDefault&&(0,Q.jsx)(`span`,{className:`ml-1 text-muted-foreground text-xs`,children:`(default)`})]}),(0,Q.jsx)(l,{className:y(`size-4`,r===e.id?`opacity-100`:`opacity-0`)})]},e.id),t[16]=g,t[17]=r,t[18]=e):e=t[18],s=n.map(e),t[12]=g,t[13]=n,t[14]=r,t[15]=s}else s=t[15];let c;t[19]===s?c=t[20]:(c=(0,Q.jsx)(Ie,{className:`w-[240px] p-0`,children:(0,Q.jsxs)(ke,{children:[o,(0,Q.jsx)(ze,{className:`max-h-[50vh] overflow-y-auto`,children:s})]})}),t[19]=s,t[20]=c);let u;return t[21]!==d||t[22]!==i||t[23]!==c?(u=(0,Q.jsxs)(Re,{open:d,onOpenChange:f,children:[i,c]}),t[21]=d,t[22]=i,t[23]=c,t[24]=u):u=t[24],u}if(c){let e,i;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Y,{className:`size-4 flex-shrink-0 text-muted-foreground`}),i=(0,Q.jsx)(Be,{className:`size-3 shrink-0 opacity-50`}),t[25]=e,t[26]=i):(e=t[25],i=t[26]);let o;t[27]!==a||t[28]!==d?(o=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsxs)(K,{variant:`ghost`,size:`sm`,className:`h-8 gap-1.5 px-2 text-muted-foreground hover:bg-accent`,role:`combobox`,"aria-expanded":d,"aria-label":`Select config`,disabled:a,children:[e,i]})}),t[27]=a,t[28]=d,t[29]=o):o=t[29];let s;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(je,{placeholder:`Search config...`}),t[30]=s):s=t[30];let c;if(t[31]!==g||t[32]!==n||t[33]!==r){let e;t[35]!==g||t[36]!==r?(e=e=>(0,Q.jsxs)(Ne,{onSelect:()=>g(e.id),className:`justify-between`,children:[(0,Q.jsxs)(`span`,{children:[e.name,e.isDefault&&(0,Q.jsx)(`span`,{className:`ml-1 text-muted-foreground text-xs`,children:`(default)`})]}),(0,Q.jsx)(l,{className:y(`size-4`,r===e.id?`opacity-100`:`opacity-0`)})]},e.id),t[35]=g,t[36]=r,t[37]=e):e=t[37],c=n.map(e),t[31]=g,t[32]=n,t[33]=r,t[34]=c}else c=t[34];let u;t[38]===c?u=t[39]:(u=(0,Q.jsx)(Ie,{className:`w-[240px] p-0`,children:(0,Q.jsxs)(ke,{children:[s,(0,Q.jsx)(ze,{className:`max-h-[50vh] overflow-y-auto`,children:c})]})}),t[38]=c,t[39]=u);let p;return t[40]!==d||t[41]!==u||t[42]!==o?(p=(0,Q.jsxs)(Re,{open:d,onOpenChange:f,children:[o,u]}),t[40]=d,t[41]=u,t[42]=o,t[43]=p):p=t[43],p}let _;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(Y,{className:`size-4 flex-shrink-0 text-muted-foreground`}),t[44]=_):_=t[44];let v=(m==null?void 0:m.name)||`Select config`,b;t[45]===v?b=t[46]:(b=(0,Q.jsx)(`span`,{className:`truncate`,children:v}),t[45]=v,t[46]=b);let x;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(Be,{className:`size-3 shrink-0 opacity-50`}),t[47]=x):x=t[47];let S;t[48]!==a||t[49]!==d||t[50]!==b?(S=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsxs)(K,{variant:`ghost`,size:`sm`,className:`h-8 gap-1.5 px-2 text-muted-foreground hover:bg-accent`,role:`combobox`,"aria-expanded":d,"aria-label":`Select config`,disabled:a,children:[_,b,x]})}),t[48]=a,t[49]=d,t[50]=b,t[51]=S):S=t[51];let C;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(je,{placeholder:`Search config...`}),t[52]=C):C=t[52];let w;if(t[53]!==g||t[54]!==n||t[55]!==r){let e;t[57]!==g||t[58]!==r?(e=e=>(0,Q.jsxs)(Ne,{onSelect:()=>g(e.id),className:`justify-between`,children:[(0,Q.jsxs)(`span`,{children:[e.name,e.isDefault&&(0,Q.jsx)(`span`,{className:`ml-1 text-muted-foreground text-xs`,children:`(default)`})]}),(0,Q.jsx)(l,{className:y(`size-4`,r===e.id?`opacity-100`:`opacity-0`)})]},e.id),t[57]=g,t[58]=r,t[59]=e):e=t[59],w=n.map(e),t[53]=g,t[54]=n,t[55]=r,t[56]=w}else w=t[56];let T;t[60]===w?T=t[61]:(T=(0,Q.jsx)(Ie,{className:`w-[240px] p-0`,children:(0,Q.jsxs)(ke,{children:[C,(0,Q.jsx)(ze,{className:`max-h-[50vh] overflow-y-auto`,children:w})]})}),t[60]=w,t[61]=T);let E;return t[62]!==d||t[63]!==T||t[64]!==S?(E=(0,Q.jsxs)(Re,{open:d,onOpenChange:f,children:[S,T]}),t[62]=d,t[63]=T,t[64]=S,t[65]=E):E=t[65],E}function Ht(e){switch(e){case`uncontrolled`:return{icon:q,tooltip:`No active controller`,label:`No client currently controls this session.`,ariaLabel:`Session control: no active controller`,variant:`ghost`,iconClass:`text-muted-foreground/60`};case`controller`:return{icon:q,tooltip:`You control this session`,label:`You are controlling this session.`,ariaLabel:`Session control: you control this session`,variant:`ghost`,iconClass:`text-muted-foreground`};case`observer`:return{icon:ue,tooltip:`Controlled on another device`,label:`Another client is controlling this session.`,ariaLabel:`Session control: controlled on another device`,variant:`ghost`,iconClass:`text-muted-foreground`};case`takeover_controller`:return{icon:it,tooltip:`Another client requested control`,label:`Another client wants to take control of this session.`,ariaLabel:`Session control: takeover requested`,variant:`ghost`,iconClass:`text-orange-500`};case`takeover_requester`:return{icon:it,tooltip:`Takeover request pending`,label:`Your control request is waiting for approval.`,ariaLabel:`Session control: takeover request pending`,variant:`ghost`,iconClass:`text-orange-500`};case`grace`:return{icon:ft,tooltip:`Waiting for previous controller to reconnect`,label:`The previous controller may still reconnect.`,ariaLabel:`Session control: waiting for reconnect`,variant:`ghost`,iconClass:`text-yellow-500`}}}function Ut(e){let t=(0,$.c)(54),{uiState:n,sessionId:r,pendingRequesterClientId:i,onClaimControl:a,onReleaseControl:o,onRequestTakeover:s,onRespondTakeover:c}=e,l;t[0]===n?l=t[1]:(l=Ht(n),t[0]=n,t[1]=l);let u=l,d=u.icon;if(!(n===`uncontrolled`&&a||n===`controller`&&o||n===`observer`&&s||n===`takeover_controller`&&c)){let e=`size-4 ${u.iconClass}`,n;t[2]!==d||t[3]!==e?(n=(0,Q.jsx)(d,{className:e}),t[2]=d,t[3]=e,t[4]=n):n=t[4];let r;t[5]!==u.ariaLabel||t[6]!==n?(r=(0,Q.jsx)(E,{asChild:!0,children:(0,Q.jsx)(K,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 hover:bg-accent`,"aria-label":u.ariaLabel,children:n})}),t[5]=u.ariaLabel,t[6]=n,t[7]=r):r=t[7];let i;t[8]===u.tooltip?i=t[9]:(i=(0,Q.jsx)(F,{children:u.tooltip}),t[8]=u.tooltip,t[9]=i);let a;return t[10]!==r||t[11]!==i?(a=(0,Q.jsxs)(w,{children:[r,i]}),t[10]=r,t[11]=i,t[12]=a):a=t[12],a}let f=`size-4 ${u.iconClass}`,p;t[13]!==d||t[14]!==f?(p=(0,Q.jsx)(d,{className:f}),t[13]=d,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==u.ariaLabel||t[17]!==u.variant||t[18]!==p?(m=(0,Q.jsx)(E,{asChild:!0,children:(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(K,{variant:u.variant,size:`sm`,className:`h-8 w-8 p-0 hover:bg-accent`,"aria-label":u.ariaLabel,children:p})})}),t[16]=u.ariaLabel,t[17]=u.variant,t[18]=p,t[19]=m):m=t[19];let h;t[20]===u.tooltip?h=t[21]:(h=(0,Q.jsx)(F,{children:u.tooltip}),t[20]=u.tooltip,t[21]=h);let g;t[22]!==m||t[23]!==h?(g=(0,Q.jsxs)(w,{children:[m,h]}),t[22]=m,t[23]=h,t[24]=g):g=t[24];let _;t[25]===u.label?_=t[26]:(_=(0,Q.jsx)(j,{children:u.label}),t[25]=u.label,t[26]=_);let y;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(V,{}),t[27]=y):y=t[27];let b;t[28]!==a||t[29]!==r||t[30]!==n?(b=n===`uncontrolled`&&a&&(0,Q.jsxs)(x,{onClick:()=>a(r),children:[(0,Q.jsx)(q,{className:`size-4`}),`Claim control`]}),t[28]=a,t[29]=r,t[30]=n,t[31]=b):b=t[31];let S;t[32]!==o||t[33]!==r||t[34]!==n?(S=n===`controller`&&o&&(0,Q.jsxs)(x,{onClick:()=>o(r),children:[(0,Q.jsx)(q,{className:`size-4`}),`Release control`]}),t[32]=o,t[33]=r,t[34]=n,t[35]=S):S=t[35];let T;t[36]!==s||t[37]!==r||t[38]!==n?(T=n===`observer`&&s&&(0,Q.jsxs)(x,{onClick:()=>s(r),children:[(0,Q.jsx)(it,{className:`size-4`}),`Request control`]}),t[36]=s,t[37]=r,t[38]=n,t[39]=T):T=t[39];let D;t[40]!==c||t[41]!==i||t[42]!==r||t[43]!==n?(D=n===`takeover_controller`&&c&&i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(x,{onClick:()=>c(r,i,`approve`),children:[(0,Q.jsx)(q,{className:`size-4 text-green-600`}),`Approve`]}),(0,Q.jsxs)(x,{variant:`destructive`,onClick:()=>c(r,i,`deny`),children:[(0,Q.jsx)(q,{className:`size-4`}),`Deny`]})]}),t[40]=c,t[41]=i,t[42]=r,t[43]=n,t[44]=D):D=t[44];let O;t[45]!==S||t[46]!==T||t[47]!==D||t[48]!==_||t[49]!==b?(O=(0,Q.jsxs)(z,{align:`end`,sideOffset:4,className:`w-56`,children:[_,y,b,S,T,D]}),t[45]=S,t[46]=T,t[47]=D,t[48]=_,t[49]=b,t[50]=O):O=t[50];let k;return t[51]!==O||t[52]!==g?(k=(0,Q.jsxs)(v,{children:[g,O]}),t[51]=O,t[52]=g,t[53]=k):k=t[53],k}function Wt(e,t){return!e||e===`uncontrolled`?`uncontrolled`:e===`grace`?`grace`:e===`takeover_requested`?t?`takeover_controller`:`takeover_requester`:e===`controlled`?t?`controller`:`observer`:`uncontrolled`}function Gt(e){var t;let n=(0,$.c)(110),{session:r,preconfigs:i,models:a,usage:o,modelName:s,onChangePreconfig:c,onChangeModel:l,onChangeVariant:u,onRename:d,onNavigateBack:p,isStreaming:m,onInterrupt:h,onCompact:_,isCompacting:v,canCompact:y,selectedVariant:b,variants:x,onClaimControl:S,onReleaseControl:C,onRequestTakeover:T,onRespondTakeover:D}=e,[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(r.title||``),N=(0,Z.useRef)(null),P=f(),I=G(),L;n[0]===r.id?L=n[1]:(L=e=>e.controlBySessionId[r.id],n[0]=r.id,n[1]=L);let R=de(L),z=_e(Kt),ee=(R==null?void 0:R.status)===`controlled`||(R==null?void 0:R.status)===`takeover_requested`,V=ee&&R.controllerClientId===z,H=ee&&R.controllerClientId!==z,U=R==null?void 0:R.status,te;n[2]!==V||n[3]!==U?(te=Wt(U,V),n[2]=V,n[3]=U,n[4]=te):te=n[4];let W=te,ne,q;n[5]===O?(ne=n[6],q=n[7]):(ne=()=>{O&&N.current&&(N.current.focus(),N.current.select())},q=[O],n[5]=O,n[6]=ne,n[7]=q),(0,Z.useEffect)(ne,q);let J;n[8]===r.title?J=n[9]:(J=()=>{j(r.title||``),k(!0)},n[8]=r.title,n[9]=J);let ie=J,ae;n[10]!==A||n[11]!==d||n[12]!==r.id||n[13]!==r.title?(ae=()=>{let e=A.trim();e&&e!==r.title&&d(r.id,e),k(!1)},n[10]=A,n[11]=d,n[12]=r.id,n[13]=r.title,n[14]=ae):ae=n[14];let oe=ae,ce;n[15]!==oe||n[16]!==r.title?(ce=e=>{e.key===`Enter`?oe():e.key===`Escape`&&(j(r.title||``),k(!1))},n[15]=oe,n[16]=r.title,n[17]=ce):ce=n[17];let le=ce,ue;if(n[18]!==s||n[19]!==i||n[20]!==r.preconfigId||n[21]!==r.selectedModel){var fe;ue=r.selectedModel||((fe=i.find(e=>e.id===r.preconfigId))==null?void 0:fe.model)||s,n[18]=s,n[19]=i,n[20]=r.preconfigId,n[21]=r.selectedModel,n[22]=ue}else ue=n[22];let pe=ue,me;if(n[23]!==a||n[24]!==pe){let e;n[26]===pe?e=n[27]:(e=e=>e.id===pe,n[26]=pe,n[27]=e),me=a.find(e),n[23]=a,n[24]=pe,n[25]=me}else me=n[25];let he=me,ge=he==null?void 0:he.contextWindow,Y;n[28]!==p||n[29]!==r.parentId?(Y=r.parentId&&p&&(0,Q.jsxs)(K,{variant:`ghost`,size:`sm`,onClick:p,className:`h-7`,children:[(0,Q.jsx)(se,{className:`size-4`,"data-icon":`inline-start`}),`Back`]}),n[28]=p,n[29]=r.parentId,n[30]=Y):Y=n[30];let ve;n[31]!==A||n[32]!==le||n[33]!==ie||n[34]!==oe||n[35]!==O||n[36]!==r.title?(ve=O?(0,Q.jsx)(`input`,{ref:N,type:`text`,value:A,onChange:e=>j(e.target.value),onBlur:oe,onKeyDown:le,className:`text-base font-semibold bg-background border border-primary rounded px-2 py-0.5 outline-none min-w-0 flex-1`,autoFocus:!0}):(0,Q.jsx)(`h2`,{className:`text-base font-semibold cursor-pointer px-2 py-0.5 -mx-2 rounded hover:bg-accent transition-colors truncate min-w-0`,onDoubleClick:ie,children:r.title||`Untitled Session`}),n[31]=A,n[32]=le,n[33]=ie,n[34]=oe,n[35]=O,n[36]=r.title,n[37]=ve):ve=n[37];let ye;n[38]!==ge||n[39]!==P||n[40]!==s||n[41]!==o.completionTokens||n[42]!==o.promptTokens||n[43]!==o.totalTokens?(ye=(0,Q.jsx)(Pt,{promptTokens:o.promptTokens,completionTokens:o.completionTokens,totalTokens:o.totalTokens,contextWindow:ge,modelName:s,compact:P}),n[38]=ge,n[39]=P,n[40]=s,n[41]=o.completionTokens,n[42]=o.promptTokens,n[43]=o.totalTokens,n[44]=ye):ye=n[44];let be;n[45]===r.status?be=n[46]:(be=r.status===`closed`&&(0,Q.jsxs)(B,{variant:`secondary`,children:[(0,Q.jsx)(re,{className:`size-3`,"data-icon":`inline-start`}),`Archived`]}),n[45]=r.status,n[46]=be);let xe;n[47]!==Y||n[48]!==ve||n[49]!==ye||n[50]!==be?(xe=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[Y,ve,ye,be]}),n[47]=Y,n[48]=ve,n[49]=ye,n[50]=be,n[51]=xe):xe=n[51];let Se;n[52]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Q.jsx)(g,{className:`md:hidden`}),n[52]=Se):Se=n[52];let Ce=r.status===`closed`||!!r.parentId||H,we;n[53]!==I||n[54]!==P||n[55]!==a||n[56]!==l||n[57]!==pe||n[58]!==Ce?(we=(0,Q.jsx)(It,{models:a,selectedModelId:pe,onChangeModel:l,disabled:Ce,iconOnly:P,compact:I}),n[53]=I,n[54]=P,n[55]=a,n[56]=l,n[57]=pe,n[58]=Ce,n[59]=we):we=n[59];let Te=r.status===`closed`||!!r.parentId||H,Ee;n[60]!==I||n[61]!==P||n[62]!==u||n[63]!==b||n[64]!==Te||n[65]!==x?(Ee=(0,Q.jsx)(Bt,{variants:x,selectedVariant:b,onChangeVariant:u,disabled:Te,iconOnly:P,compact:I}),n[60]=I,n[61]=P,n[62]=u,n[63]=b,n[64]=Te,n[65]=x,n[66]=Ee):Ee=n[66];let De=r.status===`closed`||!!r.parentId||H,Oe;n[67]!==I||n[68]!==P||n[69]!==c||n[70]!==i||n[71]!==r.preconfigId||n[72]!==De?(Oe=(0,Q.jsx)(Vt,{preconfigs:i,selectedPreconfigId:r.preconfigId,onChangePreconfig:c,disabled:De,iconOnly:P,compact:I}),n[67]=I,n[68]=P,n[69]=c,n[70]=i,n[71]=r.preconfigId,n[72]=De,n[73]=Oe):Oe=n[73];let ke;n[74]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Q.jsx)(g,{orientation:`vertical`,className:`hidden md:block`}),n[74]=ke):ke=n[74];let Ae;if(n[75]!==(R==null||(t=R.pendingTakeover)==null?void 0:t.requestedByClientId)||n[76]!==W||n[77]!==z||n[78]!==S||n[79]!==C||n[80]!==T||n[81]!==D||n[82]!==r.id){var je,Me;Ae=z&&(0,Q.jsx)(Ut,{uiState:W,sessionId:r.id,pendingRequesterClientId:R==null||(je=R.pendingTakeover)==null?void 0:je.requestedByClientId,onClaimControl:S,onReleaseControl:C,onRequestTakeover:T,onRespondTakeover:D}),n[75]=R==null||(Me=R.pendingTakeover)==null?void 0:Me.requestedByClientId,n[76]=W,n[77]=z,n[78]=S,n[79]=C,n[80]=T,n[81]=D,n[82]=r.id,n[83]=Ae}else Ae=n[83];let X;n[84]!==y||n[85]!==v||n[86]!==m||n[87]!==_?(X=_&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(w,{children:[(0,Q.jsx)(E,{asChild:!0,children:(0,Q.jsx)(K,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 text-muted-foreground hover:bg-accent`,onClick:_,disabled:m||v||!y,children:(0,Q.jsx)(st,{className:`size-4`})})}),(0,Q.jsx)(F,{children:v?`Compacting...`:`Compact older messages`})]}),(0,Q.jsx)(g,{orientation:`vertical`,className:`hidden md:block`})]}),n[84]=y,n[85]=v,n[86]=m,n[87]=_,n[88]=X):X=n[88];let Ne=m?`destructive`:`ghost`,Pe=`h-8 w-8 p-0 hover:bg-accent${m?``:` text-muted-foreground opacity-60 hover:opacity-100`}`,Fe=!h||H,Ie;n[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Q.jsx)(He,{className:`size-4`}),n[89]=Ie):Ie=n[89];let Le;n[90]!==h||n[91]!==Ne||n[92]!==Pe||n[93]!==Fe?(Le=(0,Q.jsx)(E,{asChild:!0,children:(0,Q.jsx)(K,{variant:Ne,size:`sm`,className:Pe,onClick:h,disabled:Fe,children:Ie})}),n[90]=h,n[91]=Ne,n[92]=Pe,n[93]=Fe,n[94]=Le):Le=n[94];let Re=m?`Interrupt operation`:`Interrupt`,ze;n[95]===Re?ze=n[96]:(ze=(0,Q.jsx)(F,{children:Re}),n[95]=Re,n[96]=ze);let Be;n[97]!==Le||n[98]!==ze?(Be=(0,Q.jsxs)(w,{children:[Le,ze]}),n[97]=Le,n[98]=ze,n[99]=Be):Be=n[99];let Ve;n[100]!==we||n[101]!==Ee||n[102]!==Oe||n[103]!==Ae||n[104]!==X||n[105]!==Be?(Ve=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 sm:gap-4 flex-wrap md:flex-nowrap shrink-0`,children:[we,Ee,Oe,ke,Ae,X,Be]}),n[100]=we,n[101]=Ee,n[102]=Oe,n[103]=Ae,n[104]=X,n[105]=Be,n[106]=Ve):Ve=n[106];let Ue;return n[107]!==xe||n[108]!==Ve?(Ue=(0,Q.jsx)(`header`,{className:`flex flex-col border-b border-border bg-card`,children:(0,Q.jsx)(M,{delayDuration:300,children:(0,Q.jsxs)(`div`,{className:`flex flex-col md:flex-row md:items-center md:justify-between px-4 py-1 gap-1`,children:[xe,Se,Ve]})})}),n[107]=xe,n[108]=Ve,n[109]=Ue):Ue=n[109],Ue}function Kt(e){return e.clientId}function qt(e){let t=(0,$.c)(25),{prompts:n,query:r,selectedIndex:i,onSelect:a}=e,o,s,c,l;if(t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e;if(t[8]===r?e=t[9]:(e=e=>e.name.toLowerCase().includes(r.toLowerCase()),t[8]=r,t[9]=e),o=n.filter(e),o.length===0){let e;t[10]===r?e=t[11]:(e=(0,Q.jsxs)(`div`,{className:`p-2 text-xs text-muted-foreground`,children:[`No prompts matching "/`,r,`"`]}),t[10]=r,t[11]=e),l=e;break bb0}s=`p-1`;let u;t[12]!==a||t[13]!==i?(u=(e,t)=>(0,Q.jsxs)(`button`,{onClick:()=>a(e),className:y(`flex items-center gap-2 w-full px-2 py-1.5 rounded text-sm text-left`,`hover:bg-muted`,t===i&&`bg-primary/20 text-primary font-medium ring-1 ring-primary/50`),children:[(0,Q.jsx)(ot,{className:`w-4 h-4 text-muted-foreground flex-shrink-0`}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`font-mono text-xs`,children:[`/`,e.name]}),(0,Q.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]})]},e.name),t[12]=a,t[13]=i,t[14]=u):u=t[14],c=o.map(u)}t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u=o.length===1?``:`s`,d;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`kbd`,{className:`ml-1 px-1 py-0.5 bg-muted rounded text-[10px]`,children:`↑↓`}),t[15]=d):d=t[15];let f;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`kbd`,{className:`ml-1 px-1 py-0.5 bg-muted rounded text-[10px]`,children:`↵`}),t[16]=f):f=t[16];let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`kbd`,{className:`ml-1 px-1 py-0.5 bg-muted rounded text-[10px]`,children:`esc`}),t[17]=p):p=t[17];let m;t[18]!==o.length||t[19]!==u?(m=(0,Q.jsxs)(`div`,{className:`mt-1 pt-1 border-t text-xs text-muted-foreground px-2`,children:[o.length,` prompt`,u,` •`,d,` navigate`,f,` select`,p,` close`]}),t[18]=o.length,t[19]=u,t[20]=m):m=t[20];let h;return t[21]!==s||t[22]!==c||t[23]!==m?(h=(0,Q.jsxs)(`div`,{className:s,children:[c,m]}),t[21]=s,t[22]=c,t[23]=m,t[24]=h):h=t[24],h}function Jt(e){let t=(0,$.c)(26),{id:n,kind:r,filename:i,size:a,previewUrl:o,isUploading:s,onRemove:c}=e,l=s&&`opacity-50`,u;t[0]===l?u=t[1]:(u=y(`flex items-center gap-2 px-2 py-1.5 bg-muted rounded-lg border border-border max-w-[180px]`,l),t[0]=l,t[1]=u);let d;t[2]!==i||t[3]!==r||t[4]!==o?(d=r===`image`&&o?(0,Q.jsx)(`img`,{src:o,alt:i,className:`size-8 rounded object-cover shrink-0`}):r===`image`?(0,Q.jsx)(at,{className:`size-4 text-muted-foreground shrink-0`}):(0,Q.jsx)(Te,{className:`size-4 text-muted-foreground shrink-0`}),t[2]=i,t[3]=r,t[4]=o,t[5]=d):d=t[5];let f;t[6]===i?f=t[7]:(f=(0,Q.jsx)(`div`,{className:`text-xs truncate`,children:i}),t[6]=i,t[7]=f);let p;t[8]===a?p=t[9]:(p=Yt(a),t[8]=a,t[9]=p);let m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:p}),t[10]=p,t[11]=m);let h;t[12]!==f||t[13]!==m?(h=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,m]}),t[12]=f,t[13]=m,t[14]=h):h=t[14];let g;t[15]!==n||t[16]!==c?(g=()=>c(n),t[15]=n,t[16]=c,t[17]=g):g=t[17];let v;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(_,{className:`size-3 text-muted-foreground`}),t[18]=v):v=t[18];let b;t[19]===g?b=t[20]:(b=(0,Q.jsx)(`button`,{type:`button`,onClick:g,className:`shrink-0 p-0.5 hover:bg-accent rounded`,children:v}),t[19]=g,t[20]=b);let x;return t[21]!==b||t[22]!==u||t[23]!==d||t[24]!==h?(x=(0,Q.jsxs)(`div`,{className:u,children:[d,h,b]}),t[21]=b,t[22]=u,t[23]=d,t[24]=h,t[25]=x):x=t[25],x}function Yt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Xt(e){let t=(0,$.c)(28),{path:n,onRemove:r,onPreview:i}=e,a;t[0]===n?a=t[1]:(a=n.split(`/`).pop()||n,t[0]=n,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=n.slice(0,n.lastIndexOf(`/`)+1),t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(Te,{className:`size-4 text-primary shrink-0`}),t[4]=l):l=t[4];let u;t[5]!==i||t[6]!==n?(u=()=>i==null?void 0:i(n),t[5]=i,t[6]=n,t[7]=u):u=t[7];let d;t[8]===c?d=t[9]:(d=(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:c}),t[8]=c,t[9]=d);let f;t[10]===o?f=t[11]:(f=(0,Q.jsx)(`span`,{children:o}),t[10]=o,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(`div`,{className:`text-xs truncate`,children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;t[15]!==u||t[16]!==p?(m=(0,Q.jsx)(`button`,{type:`button`,onClick:u,className:`min-w-0 flex-1 text-left cursor-pointer`,children:p}),t[15]=u,t[16]=p,t[17]=m):m=t[17];let h;t[18]!==r||t[19]!==n?(h=()=>r(n),t[18]=r,t[19]=n,t[20]=h):h=t[20];let g=`Remove ${o}`,v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(_,{className:`size-3 text-muted-foreground`}),t[21]=v):v=t[21];let y;t[22]!==g||t[23]!==h?(y=(0,Q.jsx)(`button`,{type:`button`,onClick:h,"aria-label":g,className:`shrink-0 p-0.5 hover:bg-accent rounded`,children:v}),t[22]=g,t[23]=h,t[24]=y):y=t[24];let b;return t[25]!==y||t[26]!==m?(b=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 bg-primary/15 rounded-lg border border-primary/30 max-w-[220px]`,children:[l,m,y]}),t[25]=y,t[26]=m,t[27]=b):b=t[27],b}var Zt={off:{icon:lt,iconClass:`text-muted-foreground/60`,tooltip:`Auto-approve: Off`,label:`Always ask for approval.`,ariaLabel:`Auto-approve: off`},none:{icon:q,iconClass:`text-muted-foreground`,tooltip:`Auto-approve: None`,label:`Auto-approve permissions with none risk.`,ariaLabel:`Auto-approve: none risk`},low:{icon:pe,iconClass:`text-success`,tooltip:`Auto-approve: Low`,label:`Auto-approve permissions with low risk and below.`,ariaLabel:`Auto-approve: low risk and below`},medium:{icon:pe,iconClass:`text-warning`,tooltip:`Auto-approve: Medium`,label:`Auto-approve permissions with medium risk and below.`,ariaLabel:`Auto-approve: medium risk and below`},high:{icon:be,iconClass:`text-destructive`,tooltip:`Auto-approve: High`,label:`Auto-approve permissions with high risk and below.`,ariaLabel:`Auto-approve: high risk and below`}},Qt=[`off`,`none`,`low`,`medium`,`high`];function $t(e){switch(e){case`off`:return``;case`none`:return`text-muted-foreground`;case`low`:return`text-success`;case`medium`:return`text-warning`;case`high`:return`text-destructive`}}function en(e){var t;let n=(0,$.c)(35),{sessionId:r,disabled:i}=e,a=ee(nn),o=ee(tn),s=(t=a[r])==null?`low`:t,c=Zt[s],l=c.icon;if(i){let e=`size-4 ${c.iconClass}`,t;n[0]!==l||n[1]!==e?(t=(0,Q.jsx)(l,{className:e}),n[0]=l,n[1]=e,n[2]=t):t=n[2];let r;n[3]!==c.ariaLabel||n[4]!==t?(r=(0,Q.jsx)(E,{asChild:!0,children:(0,Q.jsx)(K,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 hover:bg-accent`,disabled:!0,"aria-label":c.ariaLabel,children:t})}),n[3]=c.ariaLabel,n[4]=t,n[5]=r):r=n[5];let i;n[6]===c.tooltip?i=n[7]:(i=(0,Q.jsx)(F,{children:c.tooltip}),n[6]=c.tooltip,n[7]=i);let a;return n[8]!==r||n[9]!==i?(a=(0,Q.jsx)(M,{delayDuration:300,children:(0,Q.jsxs)(w,{children:[r,i]})}),n[8]=r,n[9]=i,n[10]=a):a=n[10],a}let u=`size-4 ${c.iconClass}`,d;n[11]!==l||n[12]!==u?(d=(0,Q.jsx)(l,{className:u}),n[11]=l,n[12]=u,n[13]=d):d=n[13];let f;n[14]!==c.ariaLabel||n[15]!==d?(f=(0,Q.jsx)(E,{asChild:!0,children:(0,Q.jsx)(C,{asChild:!0,children:(0,Q.jsx)(K,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0 hover:bg-accent`,"aria-label":c.ariaLabel,children:d})})}),n[14]=c.ariaLabel,n[15]=d,n[16]=f):f=n[16];let p;n[17]===c.tooltip?p=n[18]:(p=(0,Q.jsx)(F,{children:c.tooltip}),n[17]=c.tooltip,n[18]=p);let m;n[19]!==f||n[20]!==p?(m=(0,Q.jsx)(M,{delayDuration:300,children:(0,Q.jsxs)(w,{children:[f,p]})}),n[19]=f,n[20]=p,n[21]=m):m=n[21];let h;n[22]===c.label?h=n[23]:(h=(0,Q.jsx)(j,{children:c.label}),n[22]=c.label,n[23]=h);let g;n[24]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(V,{}),n[24]=g):g=n[24];let _;n[25]!==s||n[26]!==r||n[27]!==o?(_=Qt.map(e=>{let t=Zt[e],n=t.icon;return(0,Q.jsxs)(x,{onClick:()=>o(r,e),className:e===s?`bg-accent`:``,children:[(0,Q.jsx)(n,{className:`size-4 ${$t(e)}`}),(0,Q.jsx)(`span`,{className:`ml-2`,children:t.label})]},e)}),n[25]=s,n[26]=r,n[27]=o,n[28]=_):_=n[28];let y;n[29]!==h||n[30]!==_?(y=(0,Q.jsxs)(z,{align:`end`,sideOffset:4,className:`w-56`,children:[h,g,_]}),n[29]=h,n[30]=_,n[31]=y):y=n[31];let b;return n[32]!==m||n[33]!==y?(b=(0,Q.jsxs)(v,{children:[m,y]}),n[32]=m,n[33]=y,n[34]=b):b=n[34],b}function tn(e){return e.setAutoApproveMaxSeverity}function nn(e){return e.autoApproveBySession}function rn(e){let t=(0,$.c)(11),{debounceMs:n}=e,[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(!1),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[0]=s):s=t[0];let[c,l]=(0,Z.useState)(s),u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{let t={type:`file`,path:e.path,display:e.name};return l(e=>[...e,t]),o(!1),i(``),t},t[1]=u):u=t[1];let d=u,f=an,p;t[2]===c?p=t[3]:(p=e=>{let t=/@([^\s@]+)/g,n=[],r;for(;(r=t.exec(e))!==null;){let e=r[1];c.some(t=>t.path===e)&&!n.some(t=>t.path===e)&&n.push({type:`file`,path:e,display:e.split(`/`).pop()||e})}return n},t[2]=c,t[3]=p);let m=p,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>l([]),t[4]=h):h=t[4];let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{l(t=>t.filter(t=>t.path!==e))},t[5]=g):g=t[5];let _;return t[6]!==m||t[7]!==c||t[8]!==r||t[9]!==a?(_={query:r,setQuery:i,showAutocomplete:a,setShowAutocomplete:o,mentions:c,handleFileSelect:d,insertMention:f,extractMentions:m,clearMentions:h,removeMention:g},t[6]=m,t[7]=c,t[8]=r,t[9]=a,t[10]=_):_=t[10],_}function an(e,t,n){let r=e.lastIndexOf(`@`,t);return r===-1?{text:e,cursorPos:t}:{text:e.slice(0,r)+`@${n.path}`+e.slice(t),cursorPos:r+n.path.length+1}}function on(e){return`${c}${e}`}function sn(e,t){if(!(typeof window>`u`))try{localStorage.setItem(on(e),JSON.stringify({text:t,updatedAt:Date.now()}))}catch(e){console.warn(`Error saving draft:`,e)}}function cn(e){if(typeof window>`u`)return``;try{let t=localStorage.getItem(on(e));if(t===null)return``;let n=JSON.parse(t);return typeof n.text!=`string`||typeof n.updatedAt!=`number`||Date.now()-n.updatedAt>2592e6?(localStorage.removeItem(on(e)),``):n.text}catch{return``}}function ln(e){if(!(typeof window>`u`))try{localStorage.removeItem(on(e))}catch(e){console.warn(`Error clearing draft:`,e)}}function un(){A()}function dn(e){let t=(0,$.c)(12),[n,r]=(0,Z.useState)(``),i=(0,Z.useRef)(void 0),a=(0,Z.useRef)(``),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0],(0,Z.useEffect)(fn,o);let s;t[1]===e?s=t[2]:(s=t=>{r(t),a.current=t,e!==void 0&&(t===``?ln(e):sn(e,t))},t[1]=e,t[2]=s);let c=s,l;t[3]===e?l=t[4]:(l=()=>{r(``),a.current=``,e!==void 0&&ln(e)},t[3]=e,t[4]=l);let u=l,d,f;t[5]===e?(d=t[6],f=t[7]):(d=()=>{let t=i.current;if(t!==void 0&&t!==e){let e=a.current;e!==``&&sn(t,e)}if(e!==void 0){let t=cn(e);a.current=t,r(t)}else a.current=``,r(``);i.current=e},f=[e],t[5]=e,t[6]=d,t[7]=f),(0,Z.useEffect)(d,f);let p;return t[8]!==u||t[9]!==n||t[10]!==c?(p={input:n,setInput:c,clearInput:u},t[8]=u,t[9]=n,t[10]=c,t[11]=p):p=t[11],p}function fn(){un()}function pn(e,t){return t?e.content.includes(`ARG`)?e.content.replace(`ARG`,t):`${e.content}\n${t}`:e.content}function mn(e){let t=e.trimStart();if(!t.startsWith(`/`))return null;let n=t.indexOf(` `);return n===-1?{command:t.slice(1),rest:``}:{command:t.slice(1,n),rest:t.slice(n+1).trim()}}var hn=(0,Z.forwardRef)(function({onSendMessage:e,disabled:t,isStreaming:n,onStopStreaming:r,placeholder:i=`Type a message...`,workspaceId:a,sdkClient:o,prompts:s=[],sessionId:c,modelSupportsImage:l},u){let{input:d,setInput:f,clearInput:p}=dn(c),[m,h]=(0,Z.useState)(0),[g,_]=(0,Z.useState)([]),[v,b]=(0,Z.useState)(0),[x,S]=(0,Z.useState)(`none`),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(``),[D,O]=(0,Z.useState)([]),[k,A]=(0,Z.useState)(!1),j=(0,Z.useRef)(null),N=(0,Z.useRef)(null);(0,Z.useImperativeHandle)(u,()=>({focus:()=>{var e;return(e=j.current)==null?void 0:e.focus()}}),[]);let{query:P,setQuery:F,showAutocomplete:L,setShowAutocomplete:R,mentions:z,handleFileSelect:B,insertMention:V,clearMentions:H,removeMention:U}=rn({workspaceId:a||``}),te=ee(e=>e.openFilePreview),W=I(e=>e.activeWorkspace);(0,Z.useEffect)(()=>{if(z.length===0)return;let e=new Set(z.map(e=>e.path)),t=/@([^\s@]+)/g,n,r=new Set;for(;(n=t.exec(d))!==null;)e.has(n[1])&&r.add(n[1]);for(let e of z)r.has(e.path)||U(e.path)},[d,z,U]),(0,Z.useEffect)(()=>{b(0),w(null)},[g,T,s]),(0,Z.useEffect)(()=>{let e=j.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,150)}px`)},[d]);let G=s.filter(e=>e.name.toLowerCase().includes(T.toLowerCase())),ne=x===`prompts`&&s.length>0,q=x===`files`&&L&&!!a,J=(0,Z.useCallback)(e=>{let t=e.target.value,n=e.target.selectionStart||0;f(t),h(n);let r=t.lastIndexOf(`/`,n);if(r!==-1){let e=r>0?t[r-1]:`
2
- `,i=t.slice(r+1,n);if((e===`
3
- `||e===` `||e===``)&&!i.includes(` `)){E(i),S(`prompts`);return}}let i=t.lastIndexOf(`@`,n);if(i!==-1){let e=t.slice(i+1,n);if(!e.includes(` `)){F(e),R(!0),S(`files`);return}}S(`none`),R(!1)},[F,R,f]),re=(0,Z.useCallback)(e=>{let t=V(d,m,B(e));f(t.text),S(`none`),R(!1),_([]),setTimeout(()=>{j.current&&(j.current.focus(),j.current.setSelectionRange(t.cursorPos,t.cursorPos))},0)},[d,m,B,V,R,f]),ie=(0,Z.useCallback)(e=>{let t=d.lastIndexOf(`/`,m),n=d.slice(0,t),r=d.slice(t+1),i=r.indexOf(` `),a=i===-1?``:r.slice(i),o=`${n}/${e.name}${a}`,s=t+1+e.name.length+0;f(o),S(`none`),setTimeout(()=>{j.current&&(j.current.focus(),j.current.setSelectionRange(s,s))},0)},[d,m,f]),ae=(0,Z.useCallback)(()=>{for(let e of D)e.previewUrl&&URL.revokeObjectURL(e.previewUrl);O([]),p(),H()},[D,p,H]),oe=(0,Z.useCallback)(async e=>{if(!o||!c)return null;try{let t=await(o==null?void 0:o.http.attachments.upload(c,e));return{id:crypto.randomUUID(),kind:t.kind,filename:t.filename,size:t.size,previewUrl:e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,uploadedId:t.id,uploadedKind:t.kind}}catch(e){return console.error(`Upload error:`,e),null}},[o,c]),se=(0,Z.useCallback)(e=>{O(t=>{let n=t.find(t=>t.id===e);return n!=null&&n.previewUrl&&URL.revokeObjectURL(n.previewUrl),t.filter(t=>t.id!==e)})},[]),ce=(0,Z.useCallback)(e=>{let t=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),n=RegExp(`@${t}`,`g`);f(d.replace(n,``).replace(/\s+/g,` `).trim()),U(e)},[d,f,U]),le=(0,Z.useCallback)(e=>{W!=null&&W.id&&te({workspaceId:W.id,path:e,name:e.split(`/`).pop()||e})},[W==null?void 0:W.id,te]),ue=(0,Z.useCallback)(async e=>{let t=Array.from(e);for(let e of t){if(e.size>20*1024*1024)continue;let t=e.type.startsWith(`image/`)?`image`:e.type.startsWith(`video/`)?`video`:`file`,n={id:crypto.randomUUID(),kind:t,filename:e.name,size:e.size,previewUrl:e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,isUploading:!0};O(e=>[...e,n]);let r=await oe(e);O(r?e=>e.map(e=>e.id===n.id?(e.previewUrl&&e.previewUrl!==r.previewUrl&&URL.revokeObjectURL(e.previewUrl),{...r,isUploading:!1}):e):e=>e.filter(e=>e.id!==n.id))}},[oe]),de=(0,Z.useCallback)(e=>{var t;let n=(t=e.clipboardData)==null?void 0:t.files;n&&n.length>0&&(e.preventDefault(),ue(n))},[ue]),fe=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),A(!0)},[]),pe=(0,Z.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),A(!1)},[]),me=(0,Z.useCallback)(e=>{var t;e.preventDefault(),e.stopPropagation(),A(!1);let n=(t=e.dataTransfer)==null?void 0:t.files;n&&n.length>0&&ue(n)},[ue]),he=async n=>{n==null||n.preventDefault();let r=d.trim();if(!r&&D.length===0||t)return;let i=mn(d);if(i){let t=s.find(e=>e.name===i.command);if(t){let n=pn(t,i.rest),r=D.filter(e=>e.uploadedId).map(e=>({id:e.uploadedId,kind:e.uploadedKind}));e(n,r.length>0?r:void 0),ae();return}}let a=D.filter(e=>e.uploadedId).map(e=>({id:e.uploadedId,kind:e.uploadedKind}));e(r||``,a.length>0?a:void 0),ae()},ge=e=>{if(!e.nativeEvent.isComposing){if(ne&&G.length>0)switch(e.key){case`ArrowDown`:e.preventDefault(),b(e=>Math.min(e+1,G.length-1));return;case`ArrowUp`:e.preventDefault(),b(e=>Math.max(e-1,0));return;case`Enter`:if(e.shiftKey)return;e.preventDefault(),G[v]&&ie(G[v]);return;case`Tab`:e.preventDefault(),G[v]&&ie(G[v]);return;case`Escape`:e.preventDefault(),S(`none`);return}if(q&&g.length>0)switch(e.key){case`ArrowDown`:e.preventDefault(),b(e=>Math.min(e+1,g.length-1));return;case`ArrowUp`:e.preventDefault(),b(e=>Math.max(e-1,0));return;case`Enter`:e.preventDefault(),g[v]&&re(g[v]);return;case`ArrowRight`:e.preventDefault(),w(v);return;case`ArrowLeft`:e.preventDefault(),w(null);return;case`Escape`:e.preventDefault(),R(!1),S(`none`),w(null);return;case`Tab`:e.preventDefault(),g[v]&&re(g[v]),w(null);return}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),he())}},_e=(0,Z.useCallback)(e=>{_(e)},[]);if(n&&r)return(0,Q.jsx)(`div`,{className:`p-4 border-t border-border bg-background`,children:(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-3`,children:[(0,Q.jsxs)(`div`,{className:`animate-pulse flex items-center gap-2 text-muted-foreground`,children:[(0,Q.jsx)(`div`,{className:`size-2 rounded-full bg-primary animate-bounce`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-full bg-primary animate-bounce [animation-delay:0.1s]`}),(0,Q.jsx)(`div`,{className:`size-2 rounded-full bg-primary animate-bounce [animation-delay:0.2s]`}),(0,Q.jsx)(`span`,{className:`text-sm ml-2`,children:`Generating...`})]}),(0,Q.jsxs)(K,{variant:`outline`,size:`sm`,onClick:r,children:[(0,Q.jsx)(He,{className:`size-4`,"data-icon":`inline-start`}),`Stop`]})]})});let Y=d.trim(),ve=D.some(e=>e.isUploading),be=Y||D.length>0,xe=!be||t||ve;return(0,Q.jsx)(`form`,{onSubmit:he,onDragOver:fe,onDragLeave:pe,onDrop:me,className:y(`px-4 pt-2 pb-3 bg-background`,k&&`ring-2 ring-primary`),children:(0,Q.jsxs)(`div`,{className:y(`rounded-xl bg-input/30 overflow-hidden`,`focus-within:ring-1 focus-within:ring-ring/40`,`transition-shadow`,`border border-border`,k&&`ring-2 ring-primary border-primary`),children:[(D.length>0||!n)&&(0,Q.jsx)(`div`,{className:`flex gap-2 flex-wrap px-3 pt-3`,children:D.map(e=>(0,Q.jsx)(Jt,{id:e.id,kind:e.kind,filename:e.filename,size:e.size,previewUrl:e.previewUrl,isUploading:e.isUploading,onRemove:se},e.id))}),D.length>0&&l===!1&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 px-3 pt-2 text-xs text-amber-600 dark:text-amber-400`,children:[(0,Q.jsx)(We,{className:`size-3 shrink-0`}),(0,Q.jsx)(`span`,{children:`This model will not inspect images directly. They will be sent as file paths instead.`})]}),z.length>0&&(0,Q.jsx)(`div`,{className:`flex gap-2 flex-wrap px-3 pt-2`,children:z.map(e=>(0,Q.jsx)(Xt,{path:e.path,onRemove:ce,onPreview:le},e.path))}),(0,Q.jsx)(`div`,{className:`relative`,children:(0,Q.jsxs)(Re,{open:ne||q,onOpenChange:e=>{e||(S(`none`),R(!1),w(null))},children:[(0,Q.jsx)(Pe,{asChild:!0,children:(0,Q.jsx)(Me,{ref:j,value:d,onChange:J,onKeyDown:ge,onPaste:de,placeholder:i,disabled:t,className:y(`min-h-[52px] max-h-[200px] resize-none border-0 bg-transparent dark:bg-transparent shadow-none`,`px-3 pt-3 pb-0 chat-input-scrollbar`,`focus-visible:ring-0 focus-visible:shadow-none`,`placeholder:text-muted-foreground/60`,`disabled:bg-transparent disabled:opacity-100 dark:disabled:bg-transparent`),rows:1,"data-chat-input":`true`})}),(0,Q.jsx)(Ie,{className:y(`p-0`,q?`w-96`:`w-72`),align:`start`,side:`top`,sideOffset:8,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),children:q?(0,Q.jsx)(M,{children:(0,Q.jsx)(ye,{workspaceId:a||``,searchQuery:P,selectedIndex:v,tooltipIndex:C,onTooltipIndexChange:w,onSelect:re,onFilesChange:_e,sdkClient:o})}):(0,Q.jsx)(qt,{prompts:s,query:T,selectedIndex:v,onSelect:ie})})]})}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pb-2 pt-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`flex items-center justify-center size-8 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors disabled:opacity-50 disabled:pointer-events-none`,onClick:()=>{var e;return(e=N.current)==null?void 0:e.click()},disabled:t,"aria-label":`Attach file`,children:(0,Q.jsx)(ct,{className:`size-4`})}),(0,Q.jsx)(`input`,{ref:N,type:`file`,accept:`image/*,video/*,.pdf,.doc,.docx,.txt,.csv,.json,.xml,.md`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files&&ue(e.target.files),e.target.value=``}}),c&&(0,Q.jsx)(en,{sessionId:c,disabled:t})]}),(0,Q.jsxs)(`div`,{className:`hidden sm:flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-muted rounded text-[10px]`,children:`/`}),(0,Q.jsx)(`span`,{children:`prompts`}),(0,Q.jsx)(`span`,{className:`mx-1`,children:`•`}),(0,Q.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-muted rounded text-[10px]`,children:`@`}),(0,Q.jsx)(`span`,{children:`files`}),(0,Q.jsx)(`span`,{className:`mx-1`,children:`•`}),(0,Q.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-muted rounded text-[10px]`,children:`Enter`}),(0,Q.jsx)(`span`,{children:`to send`}),(0,Q.jsx)(`span`,{className:`mx-1`,children:`•`}),(0,Q.jsx)(`kbd`,{className:`px-1.5 py-0.5 bg-muted rounded text-[10px]`,children:`⇧ Enter`}),(0,Q.jsx)(`span`,{children:`new line`})]}),(0,Q.jsx)(K,{type:`submit`,disabled:xe,size:`icon`,className:y(`size-8 rounded-full`,be&&!t?`bg-primary text-primary-foreground hover:bg-primary/90`:`bg-muted text-muted-foreground`),"aria-label":`Send message`,children:(0,Q.jsx)(qe,{className:`size-4`})})]})]})})});function gn(e){return e.startsWith(`https://`)?`https`:`http`}function _n(e,t){return`${gn(e)}://${e.replace(/^https?:\/\//,``)}${t}`}function vn(e){let t=(0,$.c)(3),n=(0,Z.useRef)(e),r;t[0]===e?r=t[1]:(r=()=>{n.current=e},t[0]=e,t[1]=r),(0,Z.useLayoutEffect)(r);let i;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(...e)=>{let t=e;return n.current(...t)},t[2]=i):i=t[2],i}var yn=t(i(),1);function bn(e,t,n){var r;let i=(r=n.initialDeps)==null?[]:r,a,o=!0;function s(){var r,s,c;let l;n.key&&(r=n.debug)!=null&&r.call(n)&&(l=Date.now());let u=e();if(!(u.length!==i.length||u.some((e,t)=>i[t]!==e)))return a;i=u;let d;if(n.key&&(s=n.debug)!=null&&s.call(n)&&(d=Date.now()),a=t(...u),n.key&&(c=n.debug)!=null&&c.call(n)){let e=Math.round((Date.now()-l)*100)/100,t=Math.round((Date.now()-d)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
4
- font-size: .6rem;
5
- font-weight: bold;
6
- color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n==null?void 0:n.key)}return n!=null&&n.onChange&&!(o&&n.skipInitialOnChange)&&n.onChange(a),o=!1,a}return s.updateDeps=e=>{i=e},s}function xn(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var Sn=(e,t)=>Math.abs(e-t)<1.01,Cn=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},wn=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Tn=e=>e,En=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},Dn=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(wn(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e!=null&&e.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(wn(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},On={passive:!0},kn=typeof window>`u`?!0:`onscrollend`in window,An=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&kn?()=>void 0:Cn(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),o=r=>()=>{let{horizontal:o,isRtl:s}=e.options;i=o?n.scrollLeft*(s&&-1||1):n.scrollTop,a(),t(i,r)},s=o(!0),c=o(!1);n.addEventListener(`scroll`,s,On);let l=e.options.useScrollendEvent&&kn;return l&&n.addEventListener(`scrollend`,c,On),()=>{n.removeEventListener(`scroll`,s),l&&n.removeEventListener(`scrollend`,c)}},jn=(e,t,n)=>{if(t!=null&&t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},Mn=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;let o=e+t;(a=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:o,behavior:n})},Nn=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,t,n,r;return(e=(r=(n=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:n.now)==null?void 0:r.call(n))==null?Date.now():e},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>{var n;return(n=t())==null?void 0:n.observe(e,{box:`border-box`})},unobserve:e=>{var n;return(n=t())==null?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{n===void 0&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Tn,rangeExtractor:En,onChange:()=>{},measureElement:jn,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=bn(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t){this.maybeNotify();return}if(this.scrollElement=t,this.scrollElement&&`ownerDocument`in this.scrollElement)this.targetWindow=this.scrollElement.ownerDocument.defaultView;else{var n;this.targetWindow=(n=(e=this.scrollElement)==null?void 0:e.window)==null?null:n}this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>{var e;return this.options.enabled?(this.scrollRect=(e=this.scrollRect)==null?this.options.initialRect:e,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0)},this.getScrollOffset=()=>{var e;return this.options.enabled?(this.scrollOffset=(e=this.scrollOffset)==null?typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset:e,this.scrollOffset):(this.scrollOffset=null,0)},this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=bn(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,t,n,r,i,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a}),{key:!1}),this.getMeasurements=bn(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a},o)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let s=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let c=this.measurementsCache.slice(0,s),l=Array(a).fill(void 0);for(let e=0;e<s;e++){let t=c[e];t&&(l[t.lane]=e)}for(let i=s;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),s,u;if(a!==void 0&&this.options.lanes>1){s=a;let e=l[s],r=e===void 0?void 0:c[e];u=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?c[i-1]:this.getFurthestMeasurement(c,i);u=e?e.end+this.options.gap:t+n,s=e?e.lane:i%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(i,s)}let d=o.get(e),f=typeof d==`number`?d:this.options.estimateSize(i),p=u+f;c[i]={index:i,start:u,size:f,end:p,key:e,lane:s},l[s]=i}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=bn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?Fn({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=bn(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t,n;if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let r=(t=this.scrollState.index)==null?(n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index:t;if(r!==void 0&&this.range){let t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),n=Math.max(0,r-t),i=Math.min(this.options.count-1,r+t);return e>=n&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n,r;let i=this.measurementsCache[e];if(!i)return;let a=t-((n=this.itemSizeCache.get(i.key))==null?i.size:n);a!==0&&(((r=this.scrollState)==null?void 0:r.behavior)!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?i.start<this.getScrollOffset()+this.scrollAdjustments:this.shouldAdjustScrollPositionOnItemSizeChange(i,a,this))&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,t)),this.notify(!1))},this.getVirtualItems=bn(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length!==0)return xn(t[Pn(0,t.length-1,e=>xn(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t);this.scrollState={index:null,align:t,behavior:n,startedAt:this.now(),lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e;this.scrollState={index:null,align:`start`,behavior:t,startedAt:this.now(),lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;let t=this.getMeasurements(),n;if(t.length===0)n=this.options.paddingStart;else if(this.options.lanes===1){var r;n=(r=(e=t[t.length-1])==null?void 0:e.end)==null?0:r}else{let e=Array(this.options.lanes).fill(null),r=t.length-1;for(;r>=0&&e.some(e=>e===null);){let n=t[r];e[n.lane]===null&&(e[n.lane]=n.end),r--}n=Math.max(...e.filter(e=>e!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&Sn(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,n&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior=`auto`,this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}));this.scheduleScrollReconcile()}},Pn=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function Fn({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){let i=e.length-1,a=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:i};let o=Pn(0,i,a,n),s=o;if(r===1)for(;s<i&&e[s].end<n+t;)s++;else if(r>1){let a=Array(r).fill(0);for(;s<i&&a.some(e=>e<n+t);){let t=e[s];a[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(i,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var In=typeof document<`u`?Z.useLayoutEffect:Z.useEffect;function Ln({useFlushSync:e=!0,...t}){let n=Z.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,yn.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=Z.useState(()=>new Nn(r));return i.setOptions(r),In(()=>i._didMount(),[]),In(()=>i._willUpdate()),i}function Rn(e){return Ln({observeElementRect:Dn,observeElementOffset:An,scrollToFn:Mn,...e})}function zn(e){let t=(0,$.c)(50),{message:n,textContent:r,children:i,isQueued:a,onRemove:o,onRevert:s,canRevert:c,onFork:u,canFork:d,isClearAll:f}=e,p=a===void 0?!1:a,m=c===void 0?!1:c,h=d===void 0?!1:d,g=f===void 0?!1:f,[v,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(!1),T=n.role===`user`,E;t[0]===r?E=t[1]:(E=async()=>{let e=r||``;await navigator.clipboard.writeText(e),b(!0),setTimeout(()=>b(!1),2e3)},t[0]=r,t[1]=E);let D=E,O=T?`items-end`:`items-stretch`,k;t[2]===O?k=t[3]:(k=y(`flex flex-col gap-1 animate-slide-up min-w-0`,O),t[2]=O,t[3]=k);let A=T?`mr-3`:`ml-3`,j;t[4]===A?j=t[5]:(j=y(`flex items-center gap-1.5 text-xs uppercase tracking-wide text-muted-foreground`,A),t[4]=A,t[5]=j);let M;t[6]!==h||t[7]!==m||t[8]!==v||t[9]!==D||t[10]!==p||t[11]!==T||t[12]!==n.role||t[13]!==u||t[14]!==s?(M=T?(0,Q.jsxs)(Q.Fragment,{children:[!p&&(0,Q.jsxs)(Q.Fragment,{children:[m&&s&&(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:()=>S(!0),className:`size-5 text-muted-foreground hover:text-foreground`,title:`Revert to this point`,children:(0,Q.jsx)(ut,{className:`size-3`})}),h&&u&&(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:()=>w(!0),className:`size-5 text-muted-foreground hover:text-foreground`,title:`Fork from this point`,children:(0,Q.jsx)(rt,{className:`size-3`})}),(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:D,className:`size-5 text-muted-foreground hover:text-foreground`,children:v?(0,Q.jsx)(l,{className:`size-3`}):(0,Q.jsx)(ae,{className:`size-3`})})]}),(0,Q.jsx)(fe,{className:`size-3`}),n.role]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Je,{className:`size-3`}),n.role,(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:D,className:`size-5 text-muted-foreground hover:text-foreground`,children:v?(0,Q.jsx)(l,{className:`size-3`}):(0,Q.jsx)(ae,{className:`size-3`})})]}),t[6]=h,t[7]=m,t[8]=v,t[9]=D,t[10]=p,t[11]=T,t[12]=n.role,t[13]=u,t[14]=s,t[15]=M):M=t[15];let N;t[16]!==M||t[17]!==j?(N=(0,Q.jsx)(`div`,{className:j,children:M}),t[16]=M,t[17]=j,t[18]=N):N=t[18];let P=T?`rounded-2xl px-4 py-3 max-w-[90%] bg-primary text-primary-foreground rounded-br-md`:`w-full overflow-visible`,F=p&&`rounded-2xl px-4 py-3 bg-muted border-2 border-dashed border-muted-foreground/30 opacity-80`,I;t[19]!==P||t[20]!==F?(I=y(`relative group min-w-0 overflow-hidden`,P,F),t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]!==p||t[23]!==o?(L=p&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2 pb-2 border-b border-muted-foreground/20`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(et,{className:`size-3 animate-pulse`}),(0,Q.jsx)(`span`,{children:`Pending`})]}),o&&(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:o,className:`size-6 text-muted-foreground hover:text-destructive hover:bg-destructive/10`,title:`Remove from queue`,children:(0,Q.jsx)(_,{className:`size-3`})})]}),t[22]=p,t[23]=o,t[24]=L):L=t[24];let R;t[25]===i?R=t[26]:(R=(0,Q.jsx)(`div`,{className:`min-w-0`,children:i}),t[25]=i,t[26]=R);let z;t[27]!==I||t[28]!==L||t[29]!==R?(z=(0,Q.jsxs)(`div`,{className:I,children:[L,R]}),t[27]=I,t[28]=L,t[29]=R,t[30]=z):z=t[30];let ee=g?`Clear Conversation`:`Revert Conversation`,B=g?`This will delete all messages in this session, leaving it completely empty. Are you sure you want to continue?`:`This will delete this message and all messages after it. Are you sure you want to continue?`,V=g?`Clear All`:`Revert`,H;t[31]===s?H=t[32]:(H=()=>{s==null||s()},t[31]=s,t[32]=H);let U;t[33]!==x||t[34]!==ee||t[35]!==B||t[36]!==V||t[37]!==H?(U=(0,Q.jsx)(ie,{open:x,onOpenChange:S,title:ee,description:B,confirmLabel:V,cancelLabel:`Cancel`,onConfirm:H,variant:`destructive`}),t[33]=x,t[34]=ee,t[35]=B,t[36]=V,t[37]=H,t[38]=U):U=t[38];let te;t[39]===u?te=t[40]:(te=()=>{u==null||u()},t[39]=u,t[40]=te);let W;t[41]!==C||t[42]!==te?(W=(0,Q.jsx)(ie,{open:C,onOpenChange:w,title:`Fork Conversation`,description:`This will create a new session with messages up to and including this point. The original session will be unchanged.`,confirmLabel:`Fork`,cancelLabel:`Cancel`,onConfirm:te}),t[41]=C,t[42]=te,t[43]=W):W=t[43];let G;return t[44]!==N||t[45]!==z||t[46]!==U||t[47]!==W||t[48]!==k?(G=(0,Q.jsxs)(`div`,{className:k,children:[N,z,U,W]}),t[44]=N,t[45]=z,t[46]=U,t[47]=W,t[48]=k,t[49]=G):G=t[49],G}var Bn=le.oneDark,Vn=le.oneLight;function Hn(e){var t;let n=(t=e.split(`.`).pop())==null?void 0:t.toLowerCase();return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,html:`html`,py:`python`,go:`go`,rs:`rust`,sh:`bash`,yaml:`yaml`,yml:`yaml`}[n||``]||n||`text`}var Un=(0,Z.memo)(function(e){let t=(0,$.c)(35),{type:n,content:r,lineNumber:i,newLineNumber:o,language:s,codeTheme:c}=e,{resolvedMode:l}=a(),u=l===`dark`,d=n===`added`&&(u?`bg-green-500/20`:`bg-green-500/15`),f=n===`removed`&&(u?`bg-red-500/20`:`bg-red-500/15`),p=n===`context`&&`bg-muted/30`,m;t[0]!==d||t[1]!==f||t[2]!==p?(m=y(`flex font-mono text-xs`,d,f,p),t[0]=d,t[1]=f,t[2]=p,t[3]=m):m=t[3];let h=m,g=n===`added`&&(u?`text-green-400`:`text-green-600`),_=n===`removed`&&(u?`text-red-400`:`text-red-600`),v=n===`context`&&`text-muted-foreground/50`,b;t[4]!==g||t[5]!==_||t[6]!==v?(b=y(`font-bold w-4 select-none`,g,_,v),t[4]=g,t[5]=_,t[6]=v,t[7]=b):b=t[7];let x=b,S=u?`border-white/10`:`border-border`,C;t[8]===S?C=t[9]:(C=y(`w-10 text-right pr-2 text-muted-foreground select-none border-r`,S),t[8]=S,t[9]=C);let w=i==null?``:i,T;t[10]!==C||t[11]!==w?(T=(0,Q.jsx)(`span`,{className:C,children:w}),t[10]=C,t[11]=w,t[12]=T):T=t[12];let E=u?`border-white/10`:`border-border`,D;t[13]===E?D=t[14]:(D=y(`w-10 text-right pr-2 text-muted-foreground select-none border-r`,E),t[13]=E,t[14]=D);let O=o==null?``:o,k;t[15]!==D||t[16]!==O?(k=(0,Q.jsx)(`span`,{className:D,children:O}),t[15]=D,t[16]=O,t[17]=k):k=t[17];let A=n===`added`&&`+`,j=n===`removed`&&`-`,M=n===`context`&&` `,N;t[18]!==x||t[19]!==A||t[20]!==j||t[21]!==M?(N=(0,Q.jsxs)(`span`,{className:x,children:[A,j,M]}),t[18]=x,t[19]=A,t[20]=j,t[21]=M,t[22]=N):N=t[22];let P;t[23]!==c||t[24]!==r||t[25]!==s?(P=(0,Q.jsx)(ge,{theme:c,code:r,language:s,children:Gn}),t[23]=c,t[24]=r,t[25]=s,t[26]=P):P=t[26];let F;t[27]!==N||t[28]!==P?(F=(0,Q.jsxs)(`span`,{className:`pl-2 flex-1 whitespace-pre overflow-hidden flex`,children:[N,P]}),t[27]=N,t[28]=P,t[29]=F):F=t[29];let I;return t[30]!==T||t[31]!==k||t[32]!==F||t[33]!==h?(I=(0,Q.jsxs)(`div`,{className:h,children:[T,k,F]}),t[30]=T,t[31]=k,t[32]=F,t[33]=h,t[34]=I):I=t[34],I}),Wn=(0,Z.memo)(function(e){let t=(0,$.c)(35),{hunks:n,path:r,language:i,additions:o,deletions:s}=e,[c,l]=(0,Z.useState)(!0),u;t[0]!==r||t[1]!==i?(u=i||Hn(r),t[0]=r,t[1]=i,t[2]=u):u=t[2];let d=u,f=ee(Kn),m=I(qn),{resolvedMode:h}=a(),g=h===`dark`,_=g?Bn:Vn,v;t[3]!==m||t[4]!==f||t[5]!==r?(v=()=>{m&&f({workspaceId:m.id,path:r,name:r.split(`/`).pop()||r})},t[3]=m,t[4]=f,t[5]=r,t[6]=v):v=t[6];let b=v,x;t[7]===c?x=t[8]:(x=()=>l(!c),t[7]=c,t[8]=x);let S;t[9]===c?S=t[10]:(S=c?(0,Q.jsx)(Xe,{className:`size-3`}):(0,Q.jsx)(p,{className:`size-3`}),t[9]=c,t[10]=S);let C;t[11]!==x||t[12]!==S?(C=(0,Q.jsx)(`button`,{onClick:x,className:`px-1 py-1 hover:bg-muted rounded`,children:S}),t[11]=x,t[12]=S,t[13]=C):C=t[13];let w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(Oe,{className:`size-3`}),t[14]=w):w=t[14];let T;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(De,{className:`size-2.5 opacity-0 group-hover/path:opacity-100 transition-opacity`}),t[15]=T):T=t[15];let E;t[16]!==b||t[17]!==r?(E=(0,Q.jsxs)(`button`,{type:`button`,onClick:b,className:`flex items-center gap-1 font-mono pr-2 hover:text-foreground transition-colors cursor-pointer rounded px-1 py-0.5 -mx-1 hover:bg-muted min-w-0 truncate`,title:r,children:[r,T]}),t[16]=b,t[17]=r,t[18]=E):E=t[18];let D;t[19]!==o||t[20]!==s?(D=o!==void 0&&s!==void 0&&(0,Q.jsxs)(`span`,{className:`ml-auto mr-2 text-muted-foreground`,children:[`+`,o,` -`,s]}),t[19]=o,t[20]=s,t[21]=D):D=t[21];let O;t[22]!==C||t[23]!==E||t[24]!==D?(O=(0,Q.jsxs)(`div`,{className:`group/path flex items-center gap-2 px-1 bg-muted/50 text-xs text-muted-foreground`,children:[C,w,E,D]}),t[22]=C,t[23]=E,t[24]=D,t[25]=O):O=t[25];let k;t[26]!==_||t[27]!==c||t[28]!==n||t[29]!==g||t[30]!==d?(k=c&&(0,Q.jsx)(`div`,{style:{backgroundColor:_.plain.backgroundColor||(g?`#282c34`:`#fafafa`)},children:n.map((e,t)=>(0,Q.jsx)(`div`,{className:y(`divide-y`,g?`divide-white/5`:`divide-border`),children:e.changes.map((e,t)=>(0,Q.jsx)(Un,{...e,language:d,codeTheme:_},t))},t))}),t[26]=_,t[27]=c,t[28]=n,t[29]=g,t[30]=d,t[31]=k):k=t[31];let A;return t[32]!==O||t[33]!==k?(A=(0,Q.jsx)(`div`,{className:`visualization-container max-w-full overflow-x-auto border border-border rounded-md`,children:(0,Q.jsxs)(`div`,{children:[O,k]})}),t[32]=O,t[33]=k,t[34]=A):A=t[34],A});function Gn(e){let{tokens:t,getTokenProps:n}=e;return(0,Q.jsx)(Q.Fragment,{children:t.map((e,t)=>(0,Q.jsx)(`span`,{children:e.map((e,t)=>(0,Q.jsx)(`span`,{...n({token:e})},t))},t))})}function Kn(e){return e.openFilePreview}function qn(e){return e.activeWorkspace}var Jn=le.oneDark,Yn=le.oneLight,Xn=20;function Zn(e){var t;let n=(t=e.split(`.`).pop())==null?void 0:t.toLowerCase();return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,html:`html`,py:`python`,go:`go`,rs:`rust`,sh:`bash`,yaml:`yaml`,yml:`yaml`}[n||``]||n||`text`}var Qn=(0,Z.memo)(e=>{let t=(0,$.c)(52),{content:n,path:r,language:i,created:o,highlightLines:s}=e,c;t[0]===s?c=t[1]:(c=s===void 0?[]:s,t[0]=s,t[1]=c);let u=c,[d,f]=(0,Z.useState)(!1),m=ee($n),h=I(er),{resolvedMode:g}=a(),_=g===`dark`,v=_?Jn:Yn,b;t[2]!==h||t[3]!==m||t[4]!==r?(b=()=>{h&&m({workspaceId:h.id,path:r,name:r.split(`/`).pop()||r})},t[2]=h,t[3]=m,t[4]=r,t[5]=b):b=t[5];let x=b,S;t[6]!==i||t[7]!==r?(S=i||Zn(r),t[6]=i,t[7]=r,t[8]=S):S=t[8];let C=S,w;t[9]===u?w=t[10]:(w=new Set(u),t[9]=u,t[10]=w);let T=w,E;t[11]===n?E=t[12]:(E=n.split(`
7
- `),t[11]=n,t[12]=E);let D=E.length,O;t[13]===d?O=t[14]:(O=()=>f(!d),t[13]=d,t[14]=O);let k;t[15]===d?k=t[16]:(k=d?(0,Q.jsx)(Xe,{className:`size-3`}):(0,Q.jsx)(p,{className:`size-3`}),t[15]=d,t[16]=k);let A;t[17]!==O||t[18]!==k?(A=(0,Q.jsx)(`button`,{onClick:O,className:`flex items-center gap-2 px-2 py-1 hover:bg-muted`,children:k}),t[17]=O,t[18]=k,t[19]=A):A=t[19];let j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(Oe,{className:`size-3`}),t[20]=j):j=t[20];let M;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(De,{className:`size-2.5 opacity-0 group-hover/path:opacity-100 transition-opacity`}),t[21]=M):M=t[21];let N;t[22]!==x||t[23]!==r?(N=(0,Q.jsxs)(`button`,{type:`button`,onClick:x,className:`flex items-center gap-1 font-mono pr-2 hover:text-foreground transition-colors cursor-pointer rounded px-1 py-0.5 -mx-1 hover:bg-muted min-w-0 truncate`,title:r,children:[r,M]}),t[22]=x,t[23]=r,t[24]=N):N=t[24];let P;t[25]!==d||t[26]!==D?(P=!d&&(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground/70`,children:[D,` lines`]}),t[25]=d,t[26]=D,t[27]=P):P=t[27];let F;t[28]===o?F=t[29]:(F=o===!1?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-warning ml-auto mr-2`,children:[(0,Q.jsx)(Ee,{className:`size-3`}),`Overwrote`]}):(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-success ml-auto mr-2`,children:[(0,Q.jsx)(l,{className:`size-3`}),`Created`]}),t[28]=o,t[29]=F);let L;t[30]!==N||t[31]!==P||t[32]!==F||t[33]!==A?(L=(0,Q.jsxs)(`div`,{className:`group/path flex items-center gap-2 px-1 bg-muted/50 text-xs text-muted-foreground`,children:[A,j,N,P,F]}),t[30]=N,t[31]=P,t[32]=F,t[33]=A,t[34]=L):L=t[34];let R;t[35]===v.plain.backgroundColor?R=t[36]:(R={backgroundColor:v.plain.backgroundColor},t[35]=v.plain.backgroundColor,t[36]=R);let z;t[37]!==d||t[38]!==T||t[39]!==_?(z=e=>{let{tokens:t,getTokenProps:n}=e;return(0,Q.jsx)(Q.Fragment,{children:(d?t:t.slice(0,Xn)).map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex font-mono text-xs ${T.has(t+1)?`bg-yellow-500/20`:``}`,children:[(0,Q.jsx)(`span`,{className:y(`w-10 text-right pr-2 select-none border-r`,_?`text-muted-foreground border-white/10`:`text-muted-foreground border-border`),children:t+1}),(0,Q.jsx)(`span`,{className:`pl-2 flex-1 whitespace-pre overflow-hidden`,children:e.map((e,t)=>(0,Q.jsx)(`span`,{...n({token:e})},t))})]},t))})},t[37]=d,t[38]=T,t[39]=_,t[40]=z):z=t[40];let B;t[41]!==v||t[42]!==n||t[43]!==C||t[44]!==z?(B=(0,Q.jsx)(ge,{theme:v,code:n,language:C,children:z}),t[41]=v,t[42]=n,t[43]=C,t[44]=z,t[45]=B):B=t[45];let V;t[46]!==R||t[47]!==B?(V=(0,Q.jsx)(`div`,{style:R,children:B}),t[46]=R,t[47]=B,t[48]=V):V=t[48];let H;return t[49]!==L||t[50]!==V?(H=(0,Q.jsx)(`div`,{className:`visualization-container max-w-full overflow-x-auto border border-border rounded-md`,children:(0,Q.jsxs)(`div`,{children:[L,V]})}),t[49]=L,t[50]=V,t[51]=H):H=t[51],H});function $n(e){return e.openFilePreview}function er(e){return e.activeWorkspace}function tr(e){let t=(0,$.c)(3),{message:n}=e,r=n===void 0?`Success`:n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(W,{className:`size-4`}),t[0]=i):i=t[0];let a;return t[1]===r?a=t[2]:(a=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[i,(0,Q.jsx)(`span`,{className:`break-all`,children:r})]}),t[1]=r,t[2]=a),a}var nr={edit:nt,plus:b,trash:te,search:Ae};function rr(e){let t=(0,$.c)(7),{text:n}=e,[r,i]=(0,Z.useState)(!1),a;t[0]===n?a=t[1]:(a=async()=>{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1500)},t[0]=n,t[1]=a);let o=a,s;t[2]===r?s=t[3]:(s=r?(0,Q.jsx)(`span`,{className:`text-success text-xs`,children:`Copied!`}):(0,Q.jsx)(ae,{className:`size-3`}),t[2]=r,t[3]=s);let c;return t[4]!==o||t[5]!==s?(c=(0,Q.jsx)(`button`,{onClick:o,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Copy path`,children:s}),t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function ir(e){let t=(0,$.c)(16),{title:n,groups:r,files:i,total:a}=e,o;t[0]===i?o=t[1]:(o=i||[],t[0]=i,t[1]=o);let s;t[2]===o?s=t[3]:(s={label:`Files`,files:o,icon:void 0},t[2]=o,t[3]=s);let c=s,l;t[4]!==c||t[5]!==i||t[6]!==r?(l=r||(i?[c]:[]),t[4]=c,t[5]=i,t[6]=r,t[7]=l):l=t[7];let u=l;if(u.length===0)return null;let d;t[8]!==n||t[9]!==a?(d=n&&(0,Q.jsxs)(`div`,{className:`text-sm font-medium text-foreground`,children:[n,a!==void 0&&(0,Q.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[`(`,a,` files)`]})]}),t[8]=n,t[9]=a,t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=u.map(ar),t[11]=u,t[12]=f);let p;return t[13]!==d||t[14]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function ar(e,t){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.icon&&(0,Q.jsx)(`span`,{className:`flex items-center`,children:(()=>{let t=nr[e.icon];return(0,Q.jsx)(t,{className:`size-3`})})()}),(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[`(`,e.files.length,`)`]})]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5 pl-5`,children:e.files.map(or)})]},t)}function or(e,t){return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs group`,children:[(0,Q.jsx)(Oe,{className:`size-3 text-muted-foreground shrink-0`}),(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80 truncate`,children:e.path}),e.line!==void 0&&(0,Q.jsxs)(`span`,{className:`text-muted-foreground shrink-0`,children:[`:`,e.line]}),e.action&&(0,Q.jsx)(`span`,{className:y(`text-xs px-1 rounded shrink-0`,e.action===`created`&&`bg-success/20 text-success`,e.action===`modified`&&`bg-warning/20 text-warning`,e.action===`deleted`&&`bg-destructive/20 text-destructive`),children:e.action}),(0,Q.jsx)(rr,{text:e.path})]},t)}function sr(e){let t=(0,$.c)(15),{command:n,stdout:r,stderr:i,exitCode:a}=e,o=a===0,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`$ `}),t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=(0,Q.jsxs)(`div`,{className:`font-mono text-xs text-muted-foreground truncate flex-1 mr-2`,children:[s,(0,Q.jsx)(`span`,{className:`text-foreground`,children:n})]}),t[1]=n,t[2]=c);let l=`text-xs font-mono px-2 py-0.5 rounded ${o?`bg-muted text-muted-foreground`:`bg-red-500/20 text-red-400`}`,u;t[3]!==a||t[4]!==l?(u=(0,Q.jsxs)(`span`,{className:l,children:[`[`,a,`]`]}),t[3]=a,t[4]=l,t[5]=u):u=t[5];let d;t[6]!==c||t[7]!==u?(d=(0,Q.jsxs)(`div`,{className:`bg-muted px-3 py-2 flex items-center justify-between`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f;t[9]!==i||t[10]!==r?(f=(r||i)&&(0,Q.jsxs)(`div`,{className:`bg-black px-3 py-2 font-mono text-xs overflow-x-auto`,children:[r&&(0,Q.jsx)(`pre`,{className:`text-gray-300 whitespace-pre-wrap`,children:r}),i&&(0,Q.jsx)(`pre`,{className:`text-red-400 whitespace-pre-wrap mt-1`,children:i})]}),t[9]=i,t[10]=r,t[11]=f):f=t[11];let p;return t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(`div`,{className:`visualization-container border border-border rounded-md overflow-hidden`,children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14],p}var cr={pending:{icon:$e,color:`text-muted-foreground`},in_progress:{icon:ne,color:`text-warning`,animate:!0},completed:{icon:W,color:`text-success`},cancelled:{icon:s,color:`text-destructive`}},lr={high:{label:`high`,className:`bg-destructive/20 text-destructive`},medium:{label:``,className:``},low:{label:`low`,className:`text-muted-foreground`}};function ur(e){let t=(0,$.c)(13),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===r?i=t[1]:(i=r.filter(mr),t[0]=r,t[1]=i);let a=i.length;r.filter(pr),r.filter(fr);let o;t[2]!==a||t[3]!==r.length||t[4]!==n?(o=(n||r.length>0)&&(0,Q.jsxs)(`div`,{className:`text-sm font-medium text-foreground`,children:[n||`Todo List`,(0,Q.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[`(`,r.length,`)`]}),a>0&&(0,Q.jsxs)(`span`,{className:`ml-2 text-success text-xs`,children:[a,` completed`]})]}),t[2]=a,t[3]=r.length,t[4]=n,t[5]=o):o=t[5];let s;t[6]===r?s=t[7]:(s=r.map(dr),t[6]=r,t[7]=s);let c;t[8]===s?c=t[9]:(c=(0,Q.jsx)(`div`,{className:`flex flex-col gap-1 w-full`,children:s}),t[8]=s,t[9]=c);let l;return t[10]!==o||t[11]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 w-full overflow-hidden`,children:[o,c]}),t[10]=o,t[11]=c,t[12]=l):l=t[12],l}function dr(e,t){let n=cr[e.status],r=n.icon,i=lr[e.priority];return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm min-w-0`,children:[(0,Q.jsx)(r,{className:y(`size-4 shrink-0`,n.color,n.animate&&`animate-spin`)}),(0,Q.jsx)(`span`,{className:y(`flex-1 break-all`,e.status===`completed`&&`line-through text-muted-foreground`,e.status===`cancelled`&&`text-muted-foreground`),children:e.content}),i.label&&e.priority===`high`&&(0,Q.jsx)(`span`,{className:y(`text-xs px-1.5 py-0.5 rounded shrink-0`,i.className),children:i.label}),e.priority===`low`&&e.status!==`completed`&&e.status!==`cancelled`&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:i.label})]},t)}function fr(e){return e.status===`pending`}function pr(e){return e.status===`in_progress`}function mr(e){return e.status===`completed`}var hr=(0,Z.memo)(function(e){let t=(0,$.c)(38),{visualization:n}=e;if(!n)return null;switch(n.type){case`diff`:{let e;return t[0]!==n.additions||t[1]!==n.deletions||t[2]!==n.hunks||t[3]!==n.language||t[4]!==n.matchInfo||t[5]!==n.path?(e=(0,Q.jsx)(Wn,{path:n.path,hunks:n.hunks,language:n.language,additions:n.additions,deletions:n.deletions,matchInfo:n.matchInfo}),t[0]=n.additions,t[1]=n.deletions,t[2]=n.hunks,t[3]=n.language,t[4]=n.matchInfo,t[5]=n.path,t[6]=e):e=t[6],e}case`diffs`:{let e;t[7]===n.items?e=t[8]:(e=n.items.map(gr),t[7]=n.items,t[8]=e);let r;return t[9]===e?r=t[10]:(r=(0,Q.jsx)(`div`,{className:`space-y-3`,children:e}),t[9]=e,t[10]=r),r}case`code`:{let e;return t[11]!==n.content||t[12]!==n.created||t[13]!==n.highlightLines||t[14]!==n.language||t[15]!==n.path?(e=(0,Q.jsx)(Qn,{path:n.path,content:n.content,language:n.language,created:n.created,highlightLines:n.highlightLines}),t[11]=n.content,t[12]=n.created,t[13]=n.highlightLines,t[14]=n.language,t[15]=n.path,t[16]=e):e=t[16],e}case`file-list`:{let e;return t[17]!==n.files||t[18]!==n.groups||t[19]!==n.title||t[20]!==n.total?(e=(0,Q.jsx)(ir,{title:n.title,groups:n.groups,files:n.files,total:n.total}),t[17]=n.files,t[18]=n.groups,t[19]=n.title,t[20]=n.total,t[21]=e):e=t[21],e}case`table`:{let e;t[22]===n.rows?e=t[23]:(e=JSON.stringify(n.rows,null,2),t[22]=n.rows,t[23]=e);let r;return t[24]===e?r=t[25]:(r=(0,Q.jsx)(`pre`,{className:`text-xs bg-muted/50 border rounded-md p-2 overflow-x-auto`,children:e}),t[24]=e,t[25]=r),r}case`markdown`:{let e;return t[26]===n.content?e=t[27]:(e=(0,Q.jsx)(`div`,{className:`prose prose-sm dark:prose-invert`,children:n.content}),t[26]=n.content,t[27]=e),e}case`none`:{let e;return t[28]===n.message?e=t[29]:(e=(0,Q.jsx)(tr,{message:n.message}),t[28]=n.message,t[29]=e),e}case`shell-output`:{let e;return t[30]!==n.command||t[31]!==n.exitCode||t[32]!==n.stderr||t[33]!==n.stdout?(e=(0,Q.jsx)(sr,{command:n.command,stdout:n.stdout,stderr:n.stderr,exitCode:n.exitCode}),t[30]=n.command,t[31]=n.exitCode,t[32]=n.stderr,t[33]=n.stdout,t[34]=e):e=t[34],e}case`todo-list`:{let e;return t[35]!==n.items||t[36]!==n.title?(e=(0,Q.jsx)(ur,{title:n.title,items:n.items}),t[35]=n.items,t[36]=n.title,t[37]=e):e=t[37],e}default:return null}});function gr(e,t){return(0,Q.jsx)(Wn,{path:e.path,hunks:e.hunks,language:e.language,additions:e.additions,deletions:e.deletions,matchInfo:e.matchInfo},`${e.path}-${t}`)}function _r(e){let t=(0,$.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=y(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Ct,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,Q.jsx)(l,{})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Q.jsx)(xt,{"data-slot":`checkbox`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function vr(e){let t=(0,$.c)(16),{question:n,onSelect:r}=e,[i,a]=(0,Z.useState)(null),o;t[0]===n.description?o=t[1]:(o=n.description&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[0]=n.description,t[1]=o);let s;if(t[2]!==n.options||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e.value),className:`flex flex-col items-start gap-1 p-3 rounded-lg border transition-colors text-left ${i===e.value?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border hover:border-primary/50 hover:bg-muted/50`}`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 w-full`,children:[(0,Q.jsx)(`div`,{className:`size-4 rounded-full border-2 flex items-center justify-center transition-colors ${i===e.value?`border-primary bg-primary`:`border-muted-foreground`}`,children:i===e.value&&(0,Q.jsx)(`div`,{className:`size-2 rounded-full bg-primary-foreground`})}),(0,Q.jsx)(`span`,{className:`font-medium`,children:e.label})]}),e.description&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground pl-6`,children:e.description})]},e.value),t[5]=i,t[6]=e),s=n.options.map(e),t[2]=n.options,t[3]=i,t[4]=s}else s=t[4];let c;t[7]===s?c=t[8]:(c=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:s}),t[7]=s,t[8]=c);let l;t[9]!==r||t[10]!==i?(l=i!==null&&(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(K,{size:`sm`,onClick:()=>r(i),children:`Confirm`})}),t[9]=r,t[10]=i,t[11]=l):l=t[11];let u;return t[12]!==o||t[13]!==c||t[14]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[o,c,l]}),t[12]=o,t[13]=c,t[14]=l,t[15]=u):u=t[15],u}function yr(e){let t=(0,$.c)(36),{question:n,onSelect:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=new Set,t[0]=i):i=t[0];let[a,o]=(0,Z.useState)(i),s;t[1]===n.max?s=t[2]:(s=e=>{o(t=>{let r=new Set(t);if(r.has(e))r.delete(e);else{if(n.max&&r.size>=n.max)return t;r.add(e)}return r})},t[1]=n.max,t[2]=s);let c=s,l;t[3]!==r||t[4]!==n.min||t[5]!==a?(l=()=>{let e=Array.from(a);n.min&&e.length<n.min||r(e)},t[3]=r,t[4]=n.min,t[5]=a,t[6]=l):l=t[6];let u=l,d=!n.min||a.size>=n.min,f=n.max?a.size>=n.max:!1,p;t[7]===n.description?p=t[8]:(p=n.description&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[7]=n.description,t[8]=p);let m;if(t[9]!==f||t[10]!==n.options||t[11]!==a||t[12]!==c){let e;t[14]!==f||t[15]!==a||t[16]!==c?(e=e=>{let t=f&&!a.has(e.value);return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>c(e.value),disabled:t,className:`flex flex-col items-start gap-1 p-3 rounded-lg border transition-colors text-left ${t?`border-border opacity-50 cursor-not-allowed`:a.has(e.value)?`border-primary bg-primary/5 hover:bg-primary/10`:`border-border hover:border-primary/50 hover:bg-muted/50`}`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 w-full`,children:[(0,Q.jsx)(_r,{checked:a.has(e.value),disabled:t,onCheckedChange:()=>c(e.value),className:`pointer-events-none`}),(0,Q.jsx)(`span`,{className:`font-medium pointer-events-none`,children:e.label})]}),e.description&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground pl-6`,children:e.description})]},e.value)},t[14]=f,t[15]=a,t[16]=c,t[17]=e):e=t[17],m=n.options.map(e),t[9]=f,t[10]=n.options,t[11]=a,t[12]=c,t[13]=m}else m=t[13];let h;t[18]===m?h=t[19]:(h=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:m}),t[18]=m,t[19]=h);let g;t[20]!==n.max||t[21]!==n.min?(g=n.min!==void 0&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Select at least `,n.min,` option`,n.min>1?`s`:``,n.max!==void 0&&` (up to ${n.max})`]}),t[20]=n.max,t[21]=n.min,t[22]=g):g=t[22];let _;t[23]!==n.max||t[24]!==n.min?(_=n.max!==void 0&&!n.min&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Select up to `,n.max,` option`,n.max>1?`s`:``]}),t[23]=n.max,t[24]=n.min,t[25]=_):_=t[25];let v=!d,y;t[26]!==u||t[27]!==a.size||t[28]!==v?(y=(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsxs)(K,{size:`sm`,onClick:u,disabled:v,children:[`Confirm Selection (`,a.size,`)`]})}),t[26]=u,t[27]=a.size,t[28]=v,t[29]=y):y=t[29];let b;return t[30]!==y||t[31]!==p||t[32]!==h||t[33]!==g||t[34]!==_?(b=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p,h,g,_,y]}),t[30]=y,t[31]=p,t[32]=h,t[33]=g,t[34]=_,t[35]=b):b=t[35],b}function br(e){let t=(0,$.c)(26),{question:n,onSubmit:r}=e,[i,a]=(0,Z.useState)(n.defaultValue||``),o;t[0]===n.description?o=t[1]:(o=n.description&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[0]=n.description,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>a(e.target.value),t[2]=s):s=t[2];let c;t[3]!==n.placeholder||t[4]!==i?(c=(0,Q.jsx)(U,{type:`text`,value:i,onChange:s,placeholder:n.placeholder}),t[3]=n.placeholder,t[4]=i,t[5]=c):c=t[5];let l;t[6]!==r||t[7]!==i?(l=(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>r(i),children:`Skip`}),t[6]=r,t[7]=i,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==i?(u=()=>r(i),t[9]=r,t[10]=i,t[11]=u):u=t[11];let d;t[12]===i?d=t[13]:(d=i.trim(),t[12]=i,t[13]=d);let f=d.length===0,p;t[14]!==u||t[15]!==f?(p=(0,Q.jsx)(K,{size:`sm`,onClick:u,disabled:f,children:`Submit`}),t[14]=u,t[15]=f,t[16]=p):p=t[16];let m;t[17]!==l||t[18]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[l,p]}),t[17]=l,t[18]=p,t[19]=m):m=t[19];let h;t[20]!==c||t[21]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c,m]}),t[20]=c,t[21]=m,t[22]=h):h=t[22];let g;return t[23]!==o||t[24]!==h?(g=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[o,h]}),t[23]=o,t[24]=h,t[25]=g):g=t[25],g}function xr(e){var t;let n=(0,$.c)(22),{question:r,onConfirm:i}=e,a=(t=r.defaultValue)==null?!1:t,[o,s]=(0,Z.useState)(null),c;n[0]===r.description?c=n[1]:(c=r.description&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r.description}),n[0]=r.description,n[1]=c);let l=o===!1?`default`:`outline`,u;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>s(!1),n[2]=u):u=n[2];let d=a?`No`:`Cancel`,f;n[3]!==l||n[4]!==d?(f=(0,Q.jsx)(K,{variant:l,size:`sm`,onClick:u,children:d}),n[3]=l,n[4]=d,n[5]=f):f=n[5];let p=o===!0?`default`:`outline`,m;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>s(!0),n[6]=m):m=n[6];let h=a?`Yes`:`Confirm`,g;n[7]!==p||n[8]!==h?(g=(0,Q.jsx)(K,{variant:p,size:`sm`,onClick:m,children:h}),n[7]=p,n[8]=h,n[9]=g):g=n[9];let _;n[10]!==f||n[11]!==g?(_=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[f,g]}),n[10]=f,n[11]=g,n[12]=_):_=n[12];let v;n[13]!==i||n[14]!==o?(v=o!==null&&(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(K,{size:`sm`,onClick:()=>i(o),children:`Submit`})}),n[13]=i,n[14]=o,n[15]=v):v=n[15];let y;n[16]!==_||n[17]!==v?(y=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[_,v]}),n[16]=_,n[17]=v,n[18]=y):y=n[18];let b;return n[19]!==c||n[20]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[c,y]}),n[19]=c,n[20]=y,n[21]=b):b=n[21],b}function Sr(e){let t=(0,$.c)(29),{question:n,onSubmit:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={},t[0]=i):i=t[0];let[a,o]=(0,Z.useState)(i),s;if(t[1]!==a||t[2]!==n.questions){let e;t[4]===a?e=t[5]:(e=(e,t)=>a[t]!==void 0,t[4]=a,t[5]=e),s=n.questions.every(e),t[1]=a,t[2]=n.questions,t[3]=s}else s=t[3];let c=s,l;t[6]!==a||t[7]!==r||t[8]!==n.questions?(l=()=>{r({type:`form`,answers:n.questions.map((e,t)=>({question:e.question,answer:a[t]}))})},t[6]=a,t[7]=r,t[8]=n.questions,t[9]=l):l=t[9];let u=l,d;t[10]===n.description?d=t[11]:(d=n.description&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[10]=n.description,t[11]=d);let f;if(t[12]!==n.questions){let e;t[14]===n.questions.length?e=t[15]:(e=(e,t)=>(0,Q.jsxs)(`div`,{className:`border-l-2 border-primary/30 pl-3`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-2`,children:[`Question `,t+1,` of `,n.questions.length]}),(0,Q.jsx)(Cr,{question:e,onAnswer:e=>o(n=>({...n,[t]:e}))})]},t),t[14]=n.questions.length,t[15]=e),f=n.questions.map(e),t[12]=n.questions,t[13]=f}else f=t[13];let p;t[16]===f?p=t[17]:(p=(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:f}),t[16]=f,t[17]=p);let m=!c,h;t[18]===a?h=t[19]:(h=Object.keys(a),t[18]=a,t[19]=h);let g;t[20]!==u||t[21]!==n.questions.length||t[22]!==m||t[23]!==h.length?(g=(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsxs)(K,{size:`sm`,onClick:u,disabled:m,children:[`Submit All (`,h.length,`/`,n.questions.length,`)`]})}),t[20]=u,t[21]=n.questions.length,t[22]=m,t[23]=h.length,t[24]=g):g=t[24];let _;return t[25]!==d||t[26]!==p||t[27]!==g?(_=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d,p,g]}),t[25]=d,t[26]=p,t[27]=g,t[28]=_):_=t[28],_}function Cr(e){let t=(0,$.c)(61),{question:n,onAnswer:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=new Set,t[0]=i):i=t[0];let[a,o]=(0,Z.useState)(i),[s,c]=(0,Z.useState)(null);switch(n.type){case`single_select`:{let e;t[1]===n.question?e=t[2]:(e=(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:n.question}),t[1]=n.question,t[2]=e);let i;if(t[3]!==r||t[4]!==n.options||t[5]!==a){let e;t[7]!==r||t[8]!==a?(e=e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{o(new Set([e.value])),r(e.value)},className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${a.has(e.value)?`border-primary bg-primary/10`:`border-border hover:border-primary/50`}`,children:e.label},e.value),t[7]=r,t[8]=a,t[9]=e):e=t[9],i=n.options.map(e),t[3]=r,t[4]=n.options,t[5]=a,t[6]=i}else i=t[6];let s;t[10]===i?s=t[11]:(s=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i}),t[10]=i,t[11]=s);let c;return t[12]!==e||t[13]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e,s]}),t[12]=e,t[13]=s,t[14]=c):c=t[14],c}case`multi_select`:{let e;t[15]!==r||t[16]!==n.max?(e=e=>{o(t=>{let i=new Set(t);if(i.has(e))i.delete(e);else if(!n.max||i.size<n.max)i.add(e);else return t;return r(Array.from(i)),i})},t[15]=r,t[16]=n.max,t[17]=e):e=t[17];let i=e,s;t[18]===n.question?s=t[19]:(s=(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:n.question}),t[18]=n.question,t[19]=s);let c;if(t[20]!==n.options||t[21]!==a||t[22]!==i){let e;t[24]!==a||t[25]!==i?(e=e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>i(e.value),className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${a.has(e.value)?`border-primary bg-primary/10`:`border-border hover:border-primary/50`}`,children:e.label},e.value),t[24]=a,t[25]=i,t[26]=e):e=t[26],c=n.options.map(e),t[20]=n.options,t[21]=a,t[22]=i,t[23]=c}else c=t[23];let l;t[27]===c?l=t[28]:(l=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c}),t[27]=c,t[28]=l);let u;return t[29]!==s||t[30]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[s,l]}),t[29]=s,t[30]=l,t[31]=u):u=t[31],u}case`text`:{let e;t[32]===n.question?e=t[33]:(e=(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:n.question}),t[32]=n.question,t[33]=e);let i;t[34]===r?i=t[35]:(i=e=>r(e.target.value),t[34]=r,t[35]=i);let a;t[36]!==n.defaultValue||t[37]!==n.placeholder||t[38]!==i?(a=(0,Q.jsx)(U,{type:`text`,placeholder:n.placeholder,defaultValue:n.defaultValue,onChange:i}),t[36]=n.defaultValue,t[37]=n.placeholder,t[38]=i,t[39]=a):a=t[39];let o;return t[40]!==e||t[41]!==a?(o=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e,a]}),t[40]=e,t[41]=a,t[42]=o):o=t[42],o}case`confirm`:{let e;t[43]===n.question?e=t[44]:(e=(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:n.question}),t[43]=n.question,t[44]=e);let i=s===!1?`default`:`outline`,a;t[45]===r?a=t[46]:(a=()=>{c(!1),r(!1)},t[45]=r,t[46]=a);let o;t[47]!==i||t[48]!==a?(o=(0,Q.jsx)(K,{variant:i,size:`sm`,onClick:a,children:`No`}),t[47]=i,t[48]=a,t[49]=o):o=t[49];let l=s===!0?`default`:`outline`,u;t[50]===r?u=t[51]:(u=()=>{c(!0),r(!0)},t[50]=r,t[51]=u);let d;t[52]!==l||t[53]!==u?(d=(0,Q.jsx)(K,{variant:l,size:`sm`,onClick:u,children:`Yes`}),t[52]=l,t[53]=u,t[54]=d):d=t[54];let f;t[55]!==o||t[56]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[o,d]}),t[55]=o,t[56]=d,t[57]=f):f=t[57];let p;return t[58]!==e||t[59]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e,f]}),t[58]=e,t[59]=f,t[60]=p):p=t[60],p}}}function wr(e){var t,n,r,i;let a=(0,$.c)(79),{ask:o,onRespond:s}=e,c;a[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={none:`text-muted-foreground`,low:`text-success`,medium:`text-warning`,high:`text-destructive`,critical:`text-destructive`},a[0]=c):c=a[0];let l=c,u=(t=o.intents)==null?void 0:t[0],d=(n=o.action)==null?u==null?void 0:u.action:n,f=(r=(i=o.resource)==null?u==null?void 0:u.resource:i)==null?`shell-command`:r,p=d===`read`?`Reading`:d===`write`?`Writing to`:d===`delete`?`Deleting`:d===`request`?`Requesting`:d===`execute`?`Executing`:null,m,h,g,_,v,y,b,x,S,C,w,T;if(a[1]!==o.allowedScopes||a[2]!==o.description||a[3]!==o.metadata||a[4]!==o.paths||a[5]!==o.risk||a[6]!==d||a[7]!==f||a[8]!==s||a[9]!==p||a[10]!==u){var E;let e=(E=o.allowedScopes)==null?[`once`,`session`,`workspace`]:E,t=(u==null?void 0:u.persistable)===!1?u.nonPersistableReason:void 0,n={};f===`file`&&d===`read`?(n.session=`Allow for This Session`,n.workspace=`Always Allow Reading This File`):f===`file`&&d===`write`?(n.session=`Allow for This Session`,n.workspace=`Always Allow Writing This File`):f===`file`&&d===`delete`?n.session=`Allow for This Session`:f===`network`?(n.session=`Allow for This Session`,n.workspace=`Always Allow This Network Request`):f===`shell-command`&&(n.session=`Allow for This Session`);let r=e=>{if(n[e])return n[e];switch(e){case`once`:return`Allow Once`;case`session`:return`Allow for This Session`;case`workspace`:return`Allow for Workspace`;case`always`:return`Allow for Workspace`;default:return`Allow (${e})`}};if(a[23]!==o.description||a[24]!==o.metadata||a[25]!==o.paths||a[26]!==o.risk||a[27]!==f||a[28]!==p||a[29]!==(u==null?void 0:u.targets)){var D;let e=(D=u==null?void 0:u.targets)==null?[]:D,t=e.length>0?e.map(Er):[],n;a[37]!==o.metadata||a[38]!==f?(n=()=>{var e;return f!==`shell-command`||typeof((e=o.metadata)==null?void 0:e.command)!=`string`?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground mb-1`,children:`Command`}),(0,Q.jsx)(`pre`,{className:`text-xs bg-muted/50 border rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all font-mono`,children:o.metadata.command})]})},a[37]=o.metadata,a[38]=f,a[39]=n):n=a[39];let r=n,i;a[40]!==o.paths||a[41]!==f||a[42]!==p?(i=()=>{let e=o.paths,t=f===`file`||f===`path`||f===`directory`;return!e||e.length===0||!t?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground mb-1`,children:p==null?`Accessing`:p}),(0,Q.jsx)(`pre`,{className:`text-xs bg-muted/50 border rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all font-mono`,children:e.join(`
8
- `)})]})},a[40]=o.paths,a[41]=f,a[42]=p,a[43]=i):i=a[43];let s=i,c;a[44]!==o.metadata||a[45]!==f?(c=()=>{var e;return f!==`network`||typeof((e=o.metadata)==null?void 0:e.url)!=`string`?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground mb-1`,children:`URL`}),(0,Q.jsx)(`pre`,{className:`text-xs bg-muted/50 border rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all font-mono`,children:o.metadata.url})]})},a[44]=o.metadata,a[45]=f,a[46]=c):c=a[46];let d=c,g=()=>t.length===0||f===`shell-command`?null:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(Tr)});if(x=`flex flex-col gap-3`,a[47]===o.description?S=a[48]:(S=o.description&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.description}),a[47]=o.description,a[48]=S),a[49]!==o.risk){var O,k;C=o.risk&&(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Q.jsxs)(`span`,{className:`text-xs font-medium uppercase ${(O=l[(k=o.risk)==null?`none`:k])==null?`text-muted-foreground`:O}`,children:[`Risk: `,o.risk]})}),a[49]=o.risk,a[50]=C}else C=a[50];a[51]===r?w=a[52]:(w=r(),a[51]=r,a[52]=w),a[53]===s?T=a[54]:(T=s(),a[53]=s,a[54]=T),a[55]===d?m=a[56]:(m=d(),a[55]=d,a[56]=m),h=g(),a[23]=o.description,a[24]=o.metadata,a[25]=o.paths,a[26]=o.risk,a[27]=f,a[28]=p,a[29]=u==null?void 0:u.targets,a[30]=m,a[31]=h,a[32]=x,a[33]=S,a[34]=C,a[35]=w,a[36]=T}else m=a[30],h=a[31],x=a[32],S=a[33],C=a[34],w=a[35],T=a[36];if(a[57]!==o.description||a[58]!==o.metadata){var A;g=(A=o.metadata)!=null&&A.description&&typeof o.metadata.description==`string`&&!o.description?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o.metadata.description}):null,a[57]=o.description,a[58]=o.metadata,a[59]=g}else g=a[59];a[60]===t?_=a[61]:(_=t&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground italic`,children:[`This command is too dynamic to save as a reusable permission (`,t,`).`]}),a[60]=t,a[61]=_),v=`flex flex-wrap gap-2`,a[62]===s?y=a[63]:(y=(0,Q.jsx)(K,{variant:`destructive`,size:`sm`,onClick:()=>s({type:`permission`,grant:`deny`}),children:`Block`}),a[62]=s,a[63]=y),b=e.map(e=>(0,Q.jsx)(K,{variant:e===`workspace`?`default`:`outline`,size:`sm`,onClick:()=>s({type:`permission`,grant:e}),children:r(e)},e)),a[1]=o.allowedScopes,a[2]=o.description,a[3]=o.metadata,a[4]=o.paths,a[5]=o.risk,a[6]=d,a[7]=f,a[8]=s,a[9]=p,a[10]=u,a[11]=m,a[12]=h,a[13]=g,a[14]=_,a[15]=v,a[16]=y,a[17]=b,a[18]=x,a[19]=S,a[20]=C,a[21]=w,a[22]=T}else m=a[11],h=a[12],g=a[13],_=a[14],v=a[15],y=a[16],b=a[17],x=a[18],S=a[19],C=a[20],w=a[21],T=a[22];let j;a[64]!==v||a[65]!==y||a[66]!==b?(j=(0,Q.jsxs)(`div`,{className:v,children:[y,b]}),a[64]=v,a[65]=y,a[66]=b,a[67]=j):j=a[67];let M;return a[68]!==m||a[69]!==h||a[70]!==g||a[71]!==_||a[72]!==j||a[73]!==x||a[74]!==S||a[75]!==C||a[76]!==w||a[77]!==T?(M=(0,Q.jsxs)(`div`,{className:x,children:[S,C,w,T,m,h,g,_,j]}),a[68]=m,a[69]=h,a[70]=g,a[71]=_,a[72]=j,a[73]=x,a[74]=S,a[75]=C,a[76]=w,a[77]=T,a[78]=M):M=a[78],M}function Tr(e,t){return(0,Q.jsx)(`code`,{className:`text-xs bg-muted/50 border rounded px-1.5 py-0.5 font-mono`,children:e},t)}function Er(e){return e.target.split(`/`).pop()||e.target}function Dr(e){let t=(0,$.c)(15),{ask:n,onRespond:r}=e,i;t[0]===n.capability?i=t[1]:(i=(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Client capability request: `,(0,Q.jsx)(`code`,{className:`text-xs bg-muted px-1.5 py-0.5 rounded`,children:n.capability})]}),t[0]=n.capability,t[1]=i);let a;t[2]===n.metadata?a=t[3]:(a=n.metadata&&(0,Q.jsx)(`pre`,{className:`text-xs bg-background border rounded-md p-2 overflow-x-auto`,children:JSON.stringify(n.metadata,null,2)}),t[2]=n.metadata,t[3]=a);let o;t[4]===r?o=t[5]:(o=(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>r(void 0),children:`Not Available`}),t[4]=r,t[5]=o);let s;t[6]===r?s=t[7]:(s=(0,Q.jsx)(K,{size:`sm`,onClick:()=>r(null),children:`Confirm`}),t[6]=r,t[7]=s);let c;t[8]!==o||t[9]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[o,s]}),t[8]=o,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==i||t[12]!==a||t[13]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[i,a,c]}),t[11]=i,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function Or(e){let t=(0,$.c)(78),{request:n,onRespond:r}=e,{toolCallId:i,toolName:a,ask:o,requestId:s}=n,c;t[0]!==r||t[1]!==s||t[2]!==i?(c=e=>{r(i,{type:`single_select`,value:e},s)},t[0]=r,t[1]=s,t[2]=i,t[3]=c):c=t[3];let l=c,u;t[4]!==r||t[5]!==s||t[6]!==i?(u=e=>{r(i,{type:`multi_select`,values:e},s)},t[4]=r,t[5]=s,t[6]=i,t[7]=u):u=t[7];let d=u,f;t[8]!==r||t[9]!==s||t[10]!==i?(f=e=>{r(i,{type:`text`,value:e},s)},t[8]=r,t[9]=s,t[10]=i,t[11]=f):f=t[11];let p=f,m;t[12]!==r||t[13]!==s||t[14]!==i?(m=e=>{r(i,{type:`confirm`,confirmed:e},s)},t[12]=r,t[13]=s,t[14]=i,t[15]=m):m=t[15];let h=m,g;t[16]!==r||t[17]!==s||t[18]!==i?(g=e=>{r(i,e,s)},t[16]=r,t[17]=s,t[18]=i,t[19]=g):g=t[19];let _=g,v;t[20]!==r||t[21]!==s||t[22]!==i?(v=e=>{r(i,e,s)},t[20]=r,t[21]=s,t[22]=i,t[23]=v):v=t[23];let y=v,b;t[24]!==o.capability||t[25]!==o.type||t[26]!==r||t[27]!==s||t[28]!==i?(b=e=>{r(i,{type:`client_capability`,capability:o.type===`client_capability`?o.capability:``,result:e},s)},t[24]=o.capability,t[25]=o.type,t[26]=r,t[27]=s,t[28]=i,t[29]=b):b=t[29];let x=b,S;bb0:{if(`type`in o)switch(o.type){case`single_select`:case`multi_select`:case`text`:case`confirm`:case`form`:{let e;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e={icon:Qe,borderClass:`border-primary/30 bg-primary/5`,iconClass:`text-primary`},t[30]=e):e=t[30],S=e;break bb0}case`permission`:{let e;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(e={icon:q,borderClass:`border-warning/30 bg-warning/5`,iconClass:`text-warning`},t[31]=e):e=t[31],S=e;break bb0}case`client_capability`:{let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e={icon:me,borderClass:`border-info/30 bg-info/5`,iconClass:`text-info`},t[32]=e):e=t[32],S=e;break bb0}}let e;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(e={icon:q,borderClass:`border-warning/30 bg-warning/5`,iconClass:`text-warning`},t[33]=e):e=t[33],S=e}let C=S,w=C.icon,T=`border ${C.borderClass} rounded-lg p-4 flex flex-col gap-4`,E=`flex items-start gap-2 ${C.iconClass}`,D;t[34]===w?D=t[35]:(D=(0,Q.jsx)(w,{className:`size-4 mt-0.5 shrink-0`}),t[34]=w,t[35]=D);let O;t[36]===a?O=t[37]:(O=(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase tracking-wide`,children:a}),t[36]=a,t[37]=O);let k;t[38]===o?k=t[39]:(k=`question`in o&&(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:o.question}),t[38]=o,t[39]=k);let A;t[40]!==O||t[41]!==k?(A=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,k]}),t[40]=O,t[41]=k,t[42]=A):A=t[42];let j;t[43]!==E||t[44]!==D||t[45]!==A?(j=(0,Q.jsxs)(`div`,{className:E,children:[D,A]}),t[43]=E,t[44]=D,t[45]=A,t[46]=j):j=t[46];let M;t[47]!==o||t[48]!==l?(M=o.type===`single_select`&&(0,Q.jsx)(vr,{question:o,onSelect:l}),t[47]=o,t[48]=l,t[49]=M):M=t[49];let N;t[50]!==o||t[51]!==d?(N=o.type===`multi_select`&&(0,Q.jsx)(yr,{question:o,onSelect:d}),t[50]=o,t[51]=d,t[52]=N):N=t[52];let P;t[53]!==o||t[54]!==p?(P=o.type===`text`&&(0,Q.jsx)(br,{question:o,onSubmit:p}),t[53]=o,t[54]=p,t[55]=P):P=t[55];let F;t[56]!==o||t[57]!==h?(F=o.type===`confirm`&&(0,Q.jsx)(xr,{question:o,onConfirm:h}),t[56]=o,t[57]=h,t[58]=F):F=t[58];let I;t[59]!==o||t[60]!==_?(I=o.type===`form`&&(0,Q.jsx)(Sr,{question:o,onSubmit:_}),t[59]=o,t[60]=_,t[61]=I):I=t[61];let L;t[62]!==o||t[63]!==y?(L=(o.type===`permission`||!(`type`in o))&&(0,Q.jsx)(wr,{ask:o,onRespond:y}),t[62]=o,t[63]=y,t[64]=L):L=t[64];let R;t[65]!==o||t[66]!==x?(R=o.type===`client_capability`&&(0,Q.jsx)(Dr,{ask:o,onRespond:x}),t[65]=o,t[66]=x,t[67]=R):R=t[67];let z;return t[68]!==j||t[69]!==M||t[70]!==N||t[71]!==P||t[72]!==F||t[73]!==I||t[74]!==L||t[75]!==R||t[76]!==T?(z=(0,Q.jsxs)(`div`,{className:T,children:[j,M,N,P,F,I,L,R]}),t[68]=j,t[69]=M,t[70]=N,t[71]=P,t[72]=F,t[73]=I,t[74]=L,t[75]=R,t[76]=T,t[77]=z):z=t[77],z}var kr=1536,Ar=(0,Z.memo)(function(e){let t=(0,$.c)(16),{content:n,className:r}=e,[i,a]=(0,Z.useState)(!1),o;t[0]===n?o=t[1]:(o=new Blob([n]),t[0]=n,t[1]=o);let s=o.size,c=s>kr,l=c?n.slice(0,kr)+`
9
- ...`:null;if(!c){let e;return t[2]!==r||t[3]!==n?(e=(0,Q.jsx)(`pre`,{className:r,children:n}),t[2]=r,t[3]=n,t[4]=e):e=t[4],e}let u;t[5]===s?u=t[6]:(u=s>1048576?`${(s/1048576).toFixed(1)} MB`:s>1024?`${(s/1024).toFixed(1)} KB`:`${s} bytes`,t[5]=s,t[6]=u);let d=u,f=i?n:l,p;t[7]!==r||t[8]!==f?(p=(0,Q.jsx)(`pre`,{className:r,children:f}),t[7]=r,t[8]=f,t[9]=p):p=t[9];let m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>a(Ir),t[10]=m):m=t[10];let h=i?`Show less`:`Show full output (${d})`,g;t[11]===h?g=t[12]:(g=(0,Q.jsx)(`button`,{type:`button`,className:`text-xs text-muted-foreground hover:text-foreground mt-1 transition-colors cursor-pointer`,onClick:m,children:h}),t[11]=h,t[12]=g);let _;return t[13]!==p||t[14]!==g?(_=(0,Q.jsxs)(`div`,{children:[p,g]}),t[13]=p,t[14]=g,t[15]=_):_=t[15],_});function jr(e){switch(e){case`pending`:return(0,Q.jsx)(et,{className:`size-3 text-warning`});case`running`:return(0,Q.jsx)(ne,{className:`size-3 text-warning animate-spin`});case`completed`:return(0,Q.jsx)(W,{className:`size-3 text-success`});case`error`:return(0,Q.jsx)(s,{className:`size-3 text-destructive`});case`interrupted`:return(0,Q.jsx)(Ve,{className:`size-3 text-warning`});default:return null}}function Mr(e){if(e.name!==`task`)return null;let t=e.state;if(`childSessionId`in t&&t.childSessionId)return t.childSessionId;let n=`output`in t?t.output:`partialOutput`in t?t.partialOutput:null;if(n&&typeof n==`string`){let e=n.match(/task_id:\s*([a-f0-9-]{36})/i);if(e)return e[1]}return null}function Nr(e){if(e&&typeof e==`object`&&`_visualization`in e)return e._visualization}function Pr(e,t){let n=new Set,r=[e];for(;r.length>0;){let e=r.shift();for(let i of t)i.parentId===e&&!n.has(i.id)&&(n.add(i.id),r.push(i.id))}return n}var Fr=(0,Z.memo)(function({part:e,pendingAskRequests:t,onAskResponse:n,onNavigateToSubagent:r}){let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),c=e.state,u=c.status,d=(0,Z.useMemo)(()=>{if(!i)return``;try{return JSON.stringify(c.input,null,2)}catch{return String(c.input)}},[c.input,i]),f=(0,Z.useMemo)(()=>!i||u!==`completed`||!(`output`in c)?null:typeof c.output==`string`?c.output:JSON.stringify(c.output,null,2),[u,c,i]),m=u===`completed`&&`output`in c?Nr(c.output):void 0,h=Mr(e),g=D(e=>e.sessions),_=[];if(u===`pending`||u===`running`){let n=t.find(t=>t.toolCallId===e.callId);if(n&&_.push(n),h){let n=Pr(h,g);n.add(h);let r=t.filter(t=>{let r=t.originSessionId&&n.has(t.originSessionId),i=t.sessionId===h;return(r||i)&&t.toolCallId!==e.callId});_.push(...r)}}let v=async()=>{if(`output`in c){let e=typeof c.output==`string`?c.output:JSON.stringify(c.output,null,2);await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3)}},y=(()=>{try{let e=JSON.stringify(c.input);return e.length>50?e.slice(0,47)+`...`:e}catch{return String(c.input)}})();return(0,Q.jsxs)(`div`,{className:`my-1`,children:[(0,Q.jsxs)(N,{open:i,onOpenChange:a,children:[(0,Q.jsx)(O,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-1 cursor-pointer hover:text-foreground transition-colors text-muted-foreground`,children:[jr(u),i?(0,Q.jsx)(Xe,{className:`size-4 text-muted-foreground`}):(0,Q.jsx)(p,{className:`size-4 text-muted-foreground`}),(0,Q.jsx)(we,{className:`size-3`}),(0,Q.jsx)(`span`,{className:`text-xs truncate max-w-[120px] sm:max-w-none`,children:e.name}),!i&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground font-mono truncate flex-1 min-w-0 hidden sm:block`,children:y}),h&&r&&(0,Q.jsxs)(K,{variant:`ghost`,size:`sm`,className:`ml-auto h-6 w-6 p-0 sm:w-auto sm:px-2`,onClick:e=>{e.stopPropagation(),r(h)},title:`View session`,children:[(0,Q.jsx)(De,{className:`size-3`}),(0,Q.jsx)(`span`,{className:`hidden sm:inline ml-1`,children:`View`})]})]})}),i&&(0,Q.jsx)(L,{children:(0,Q.jsxs)(`div`,{className:`pl-5 pb-2 flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground mb-1`,children:`Input`}),(0,Q.jsx)(Ar,{content:d,className:`text-xs bg-background border rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-words`})]}),(u===`running`||u===`completed`||u===`interrupted`)&&h&&r&&(0,Q.jsxs)(K,{variant:`outline`,className:`w-full`,size:`sm`,onClick:()=>r(h),children:[(0,Q.jsx)(De,{className:`size-4`,"data-icon":`inline-start`}),u===`running`?`Watch Subagent`:`View Session`]}),u===`completed`&&f!==null&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,Q.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground`,children:`Output`}),(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:v,className:`size-6`,children:o?(0,Q.jsx)(l,{className:`size-3 text-success`}):(0,Q.jsx)(ae,{className:`size-3`})})]}),(0,Q.jsx)(Ar,{content:f,className:`text-xs bg-success/10 border border-success/20 rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-words`})]}),u===`error`&&`error`in c&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs uppercase text-muted-foreground mb-1`,children:`Error`}),(0,Q.jsx)(`pre`,{className:`text-xs bg-destructive/10 border border-destructive/20 rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-words text-destructive`,children:c.error})]})]})})]}),_.length>0&&(0,Q.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:_.map(e=>{var t;return(0,Q.jsx)(Or,{request:e,onRespond:n},(t=e.requestId)==null?e.toolCallId:t)})}),u===`completed`&&m&&(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(hr,{visualization:m})})]})},(e,t)=>{if(e.part!==t.part||e.onNavigateToSubagent!==t.onNavigateToSubagent||e.onAskResponse!==t.onAskResponse||e.pendingAskRequests.find(t=>t.toolCallId===e.part.callId)!==t.pendingAskRequests.find(e=>e.toolCallId===t.part.callId))return!1;let n=Mr(e.part),r=Mr(t.part);if(n||r){let i=e.pendingAskRequests.filter(e=>e.originSessionId===n||e.originSessionId===r||e.sessionId===n||e.sessionId===r),a=t.pendingAskRequests.filter(e=>e.originSessionId===n||e.originSessionId===r||e.sessionId===n||e.sessionId===r);if(i.length!==a.length||i.some((e,t)=>e!==a[t]))return!1}return!0});function Ir(e){return!e}var Lr=60,Rr=300,zr=16;function Br(e){if(e.length===0)return!1;let t=e[e.length-1];return Ge(t.message)&&t.message.status===`streaming`}function Vr(e){return e.filter(e=>e.type===`text`).map(e=>e.text).join(``)}function Hr(e,t){let n=t.findIndex(t=>t.message.id===e);if(n<0)return null;if(n===0)return e;for(let e=n-1;e>=0;e--){let n=t[e];if(n.message.role===`assistant`&&n.message.status!==`streaming`)return n.message.id}return null}function Ur(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-foreground bg-muted rounded-lg px-3 py-2 border border-border shadow-sm`,children:[(0,Q.jsx)(st,{className:`size-4 animate-pulse`}),(0,Q.jsx)(`span`,{children:`Compacting conversation...`})]}),e[0]=t):t=e[0],t}function Wr(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-green-700 dark:text-green-400 bg-green-500/15 rounded-lg px-3 py-2 border border-green-500/30 shadow-sm`,children:[(0,Q.jsx)(Ze,{className:`size-4`}),(0,Q.jsx)(`span`,{children:`Compaction complete`})]}),e[0]=t):t=e[0],t}function Gr(e){let t=(0,$.c)(8),{message:n,textContent:r,onRetry:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs uppercase tracking-wide text-destructive ml-3`,children:[(0,Q.jsx)(We,{className:`size-3`}),`Compaction Failed`]}),t[0]=a):a=t[0];let o=r||n.error||`Compaction failed. The conversation could not be summarized.`,s;t[1]===o?s=t[2]:(s=(0,Q.jsx)(`p`,{className:`text-sm text-destructive/90`,children:o}),t[1]=o,t[2]=s);let c;t[3]===i?c=t[4]:(c=i&&(0,Q.jsxs)(K,{variant:`outline`,size:`sm`,onClick:i,className:`mt-2 h-7 text-xs gap-1.5`,children:[(0,Q.jsx)(Ue,{className:`size-3`}),`Retry`]}),t[3]=i,t[4]=c);let l;return t[5]!==s||t[6]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[a,(0,Q.jsxs)(`div`,{className:`rounded-2xl px-4 py-3 max-w-full bg-destructive/10 border border-destructive/30 rounded-bl-md`,children:[s,c]})]}),t[5]=s,t[6]=c,t[7]=l):l=t[7],l}function Kr(e,t){var n;return(e==null?void 0:e.split(`/`).pop())||(t==null||(n=t.split(`.`).pop())==null?void 0:n.toLowerCase())||``}function qr(e){let t=(0,$.c)(15),{part:n}=e,[r,i]=(0,Z.useState)(!1),a=n.overflow?`overflow`:n.auto?`auto`:`manual`,o;t[0]===r?o=t[1]:(o=()=>i(!r),t[0]=r,t[1]=o);let s;t[2]===r?s=t[3]:(s=r?(0,Q.jsx)(Xe,{className:`size-3`}):(0,Q.jsx)(p,{className:`size-3`}),t[2]=r,t[3]=s);let c=a===`overflow`?`Context overflow`:a===`auto`?`Auto`:`Manual`,l;t[4]===c?l=t[5]:(l=(0,Q.jsxs)(`span`,{className:`border-b border-dashed border-muted-foreground/40 pb-px`,children:[c,` compaction`]}),t[4]=c,t[5]=l);let u;t[6]!==o||t[7]!==s||t[8]!==l?(u=(0,Q.jsxs)(`button`,{onClick:o,className:`flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,children:[s,l]}),t[6]=o,t[7]=s,t[8]=l,t[9]=u):u=t[9];let d;t[10]===r?d=t[11]:(d=r&&(0,Q.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground italic`,children:`Summary available in the assistant message below`}),t[10]=r,t[11]=d);let f;return t[12]!==u||t[13]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col items-center py-3`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14],f}var Jr=(0,Z.memo)(function(e){let t=(0,$.c)(15),{parts:n,pendingAskRequests:r,onAskResponse:i,onNavigateToSubagent:a,inverted:o,serverUrl:s}=e,c=o===void 0?!1:o,l;if(t[0]!==c||t[1]!==i||t[2]!==a||t[3]!==n||t[4]!==r||t[5]!==s){let e=[...n].sort(Zr),o;t[7]!==c||t[8]!==i||t[9]!==a||t[10]!==r||t[11]!==s?(o=e=>{switch(e.type){case`text`:return(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(xe,{inverted:c,children:e.text||`...`})},e.id);case`reasoning`:return(0,Q.jsx)(`div`,{className:`visualization-container text-muted-foreground text-sm italic border-l-2 border-muted-foreground/30 pl-3 my-2 wrap-break-word`,children:e.text},e.id);case`tool`:return(0,Q.jsx)(Fr,{part:e,pendingAskRequests:r,onAskResponse:i,onNavigateToSubagent:a},e.id);case`image`:return(0,Q.jsx)(`img`,{src:s?_n(s,e.url):e.url,alt:``,className:y(`max-w-full max-h-64 rounded-xl mt-2 object-contain`,c&&`ring-2 ring-white/20`)},e.id);case`file`:{let t=s?_n(s,e.url):e.url,n=Kr(e.mimeType,e.filename),r=e.filename||``,i=r.length>30?r.slice(0,27)+`...`:r||`unnamed`;return(0,Q.jsxs)(`a`,{href:t,className:y(`mt-2 p-2 rounded-lg text-sm flex items-center gap-2 transition-colors`,c?`bg-white/15 hover:bg-white/25 text-primary-foreground`:`bg-muted hover:bg-accent`),target:`_blank`,rel:`noopener noreferrer`,children:[(0,Q.jsx)(Te,{className:`size-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:i}),n&&(0,Q.jsx)(`span`,{className:y(`px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ml-auto shrink-0`,c?`bg-white/25 text-primary-foreground`:`bg-secondary text-secondary-foreground`),children:n}),(0,Q.jsx)(tt,{className:`size-3.5 shrink-0 opacity-60`})]},e.id)}default:return null}},t[7]=c,t[8]=i,t[9]=a,t[10]=r,t[11]=s,t[12]=o):o=t[12],l=e.map(o),t[0]=c,t[1]=i,t[2]=a,t[3]=n,t[4]=r,t[5]=s,t[6]=l}else l=t[6];let u;return t[13]===l?u=t[14]:(u=(0,Q.jsx)(Q.Fragment,{children:l}),t[13]=l,t[14]=u),u},(e,t)=>!(e.parts!==t.parts||e.inverted!==t.inverted||e.onNavigateToSubagent!==t.onNavigateToSubagent||e.serverUrl!==t.serverUrl||e.pendingAskRequests!==t.pendingAskRequests)),Yr=(0,Z.memo)(function(e){let t=(0,$.c)(47),{item:n,messagesWithParts:r,sessionId:i,pendingAskRequests:a,onAskResponse:o,onNavigateToSubagent:s,onRemoveFromQueue:c,onRevert:l,onFork:u,isMainActiveSession:d,isCompacting:f,onCompact:p,serverUrl:m}=e,h=d===void 0?!1:d,g=f===void 0?!1:f,_;t[0]===n.parts?_=t[1]:(_=n.parts.find(Qr),t[0]=n.parts,t[1]=_);let v=_;if(Ge(n.message)&&n.message.mode===`compact_failed`){let e=n.message,r;t[2]===n.parts?r=t[3]:(r=Vr(n.parts),t[2]=n.parts,t[3]=r);let i=h&&!g?p:void 0,a;return t[4]!==e||t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(Gr,{message:e,textContent:r,onRetry:i}),t[4]=e,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}if(v){let e;return t[8]===v?e=t[9]:(e=(0,Q.jsx)(qr,{part:v}),t[8]=v,t[9]=e),e}let y=!n.isQueued&&n.message.role===`user`,b;t[10]!==y||t[11]!==n.message.id||t[12]!==r?(b=y?Hr(n.message.id,r):null,t[10]=y,t[11]=n.message.id,t[12]=r,t[13]=b):b=t[13];let x=b,S=x===n.message.id,C=n.message,w;t[14]===n.parts?w=t[15]:(w=Vr(n.parts),t[14]=n.parts,t[15]=w);let T;t[16]!==n.isQueued||t[17]!==n.queueId||t[18]!==c?(T=n.isQueued?()=>c(n.queueId):void 0,t[16]=n.isQueued,t[17]=n.queueId,t[18]=c,t[19]=T):T=t[19];let E=y&&x!==null,D;t[20]!==l||t[21]!==x||t[22]!==i?(D=x?()=>l==null?void 0:l(i,x):void 0,t[20]=l,t[21]=x,t[22]=i,t[23]=D):D=t[23];let O=y&&x!==null,k;t[24]!==n.message.id||t[25]!==u||t[26]!==x||t[27]!==i?(k=x?()=>u==null?void 0:u(i,n.message.id):void 0,t[24]=n.message.id,t[25]=u,t[26]=x,t[27]=i,t[28]=k):k=t[28];let A;t[29]!==n.message.role||t[30]!==n.parts||t[31]!==o||t[32]!==s||t[33]!==a||t[34]!==m?(A=n.parts.length===0?(0,Q.jsx)(`span`,{className:`opacity-50`,children:`...`}):(0,Q.jsx)(Jr,{parts:n.parts,pendingAskRequests:a,onAskResponse:o,onNavigateToSubagent:s,inverted:n.message.role===`user`,serverUrl:m}),t[29]=n.message.role,t[30]=n.parts,t[31]=o,t[32]=s,t[33]=a,t[34]=m,t[35]=A):A=t[35];let j;return t[36]!==S||t[37]!==n.isQueued||t[38]!==n.message||t[39]!==O||t[40]!==k||t[41]!==A||t[42]!==w||t[43]!==T||t[44]!==E||t[45]!==D?(j=(0,Q.jsx)(zn,{message:C,textContent:w,isQueued:n.isQueued,onRemove:T,canRevert:E,onRevert:D,canFork:O,onFork:k,isClearAll:S,children:A}),t[36]=S,t[37]=n.isQueued,t[38]=n.message,t[39]=O,t[40]=k,t[41]=A,t[42]=w,t[43]=T,t[44]=E,t[45]=D,t[46]=j):j=t[46],j});function Xr({displayItems:e,messagesWithParts:t,sessionId:n,sessionStatus:r,pendingAskRequests:i,isCompacting:a=!1,compactionSuccess:o=!1,onClearCompactionSuccess:s,onAskResponse:c,onNavigateToSubagent:l,onRemoveFromQueue:u,onRevert:d,onFork:f,onCompact:p,isMainActiveSession:m=!1,autoFollow:h=!0,onAutoScrollChange:g,scrollToBottomRef:_,serverUrl:v}){var y,b;let x=(0,Z.useRef)(null),[S,C]=(0,Z.useState)(!1),w=(0,Z.useRef)(h),T=(0,Z.useRef)(e.length),E=(0,Z.useRef)(0),D=(0,Z.useRef)(!1),O=(0,Z.useRef)(!1),k=(0,Z.useRef)(``),A=(0,Z.useCallback)(e=>{if(e.length===0)return``;let t=e[e.length-1],n=t.parts.filter(e=>e.type===`text`).reduce((e,t)=>e+t.text.length,0);return`${t.message.id}:${Ge(t.message)?t.message.status:`n/a`}:${t.parts.length}:${n}`},[]),j=(0,Z.useRef)(null),M=(0,Z.useRef)(null),N=(0,Z.useRef)(new Map),P=(0,Z.useRef)(e);P.current=e;let F=(0,Z.useCallback)(e=>{let t=P.current[e];if(!t)return Lr+zr;if(t.message.role===`assistant`){let e=100;return t.parts.some(e=>{var t,n;return e.type===`text`&&((t=e.text)==null?void 0:t.includes("```"))||e.type===`tool`&&((n=e.state.input)==null?void 0:n.command)})&&(e=180),t.parts.some(e=>e.type===`tool`)&&(e=Math.max(e,150)),t.parts.some(e=>e.type===`compaction`)&&(e=60),t.message.mode===`compact_failed`&&(e=100),Math.min(Math.max(e+zr,Lr+zr),Rr+zr)}let n=t.parts.length>1?80:60;return Math.min(Math.max(n+zr,Lr+zr),Rr+zr)},[]);(0,Z.useLayoutEffect)(()=>{let e=x.current;if(!e)return;let t=requestAnimationFrame(()=>{e.querySelectorAll(`[data-index]`).forEach(e=>{let t=e.getAttribute(`data-index`);if(t===null)return;let n=parseInt(t,10);N.current.set(n,e.offsetHeight)})});return()=>cancelAnimationFrame(t)},[e.length]);let I=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{let e=x.current;if(!e)return;I.current&&I.current.disconnect();let t=new ResizeObserver(e=>{e.forEach(e=>{let t=e.target,n=t.getAttribute(`data-index`);if(n===null)return;let r=parseInt(n,10),i=t.offsetHeight;N.current.set(r,i)})});return I.current=t,e.querySelectorAll(`[data-index]`).forEach(e=>t.observe(e)),()=>t.disconnect()},[e.length]);let L=Rn({count:e.length,getScrollElement:()=>x.current,estimateSize:F,overscan:5,getItemKey:t=>{var n,r;let i=e[t];return(n=i==null||(r=i.message)==null?void 0:r.id)==null?`fallback-${t}`:n}});(0,Z.useLayoutEffect)(()=>{w.current=h,T.current=e.length,E.current=0,D.current=!1,k.current=``,e.length!==0&&(L.scrollToIndex(e.length-1,{align:`end`}),D.current=!0)},[n]),(0,Z.useEffect)(()=>{let e=x.current;if(!e)return;let t=e=>{w.current&&e.deltaY<0&&(w.current=!1,g==null||g(!1))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[g]);let R=vn(()=>{if(O.current)return;let e=x.current;if(e)if(w.current){let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;n-t-r>0&&(O.current=!0,e.scrollTop=n,requestAnimationFrame(()=>{O.current=!1}))}else{let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;n-t-r<=5&&(w.current=!0,g==null||g(!0))}});(0,Z.useLayoutEffect)(()=>{C(a)},[a]);let z=A(e);(0,Z.useLayoutEffect)(()=>{let t=e.length,n=T.current,r=t!==n,i=z,a=i!==k.current;k.current=i;let o=t-1,s=0;if(o>=0){var c;s=(c=N.current.get(o))==null?0:c}let l=E.current,u=o>=0&&s>l&&l>0;if(T.current=t,E.current=s,!(t===0||!r&&!a&&!u)){if(n===0&&t>0&&l===0&&!D.current){L.scrollToIndex(t-1,{align:`end`}),D.current=!0;return}w.current&&(x.current.scrollTop=x.current.scrollHeight)}},[e.length,z,L]),(0,Z.useEffect)(()=>{var t;let n=L.getVirtualItems(),r=n.length-1;if(r<0)return;let i=n[r],a=(t=x.current)==null?void 0:t.querySelector(`[data-index="${i.index}"]`);if(j.current&&j.current.disconnect(),a&&(M.current=a,!(!Br(e)||!w.current)))return j.current=new ResizeObserver(t=>{w.current&&Br(e)&&requestAnimationFrame(()=>{w.current&&(x.current.scrollTop=x.current.scrollHeight)})}),j.current.observe(a),()=>{j.current&&(j.current.disconnect(),j.current=null)}},[e,L]),(0,Z.useEffect)(()=>{if(o){let e=setTimeout(()=>{s==null||s()},3e3);return()=>clearTimeout(e)}},[o,s]),(0,Z.useLayoutEffect)(()=>{_&&(_.current=()=>{w.current=!0,O.current=!0,x.current.scrollTop=x.current.scrollHeight,requestAnimationFrame(()=>{O.current=!1})})},[_]),(0,Z.useLayoutEffect)(()=>{w.current=h},[h]);let ee=L.getVirtualItems();return(0,Q.jsxs)(`div`,{ref:x,className:`flex-1 min-h-0 overflow-y-auto relative chat-transcript-scrollbar`,style:{WebkitOverflowScrolling:`touch`},onScroll:R,children:[S&&(0,Q.jsx)(`div`,{className:`sticky top-0 z-10 px-4 pt-4 pb-1 bg-gradient-to-b from-background via-background/95 to-transparent`,children:(0,Q.jsx)(Ur,{})}),o&&(0,Q.jsx)(`div`,{className:`sticky top-0 z-10 px-4 pt-4 pb-1 bg-gradient-to-b from-background via-background/95 to-transparent`,children:(0,Q.jsx)(Wr,{})}),r===`closed`&&(0,Q.jsx)(Ce,{className:`mx-4 mt-4`,children:(0,Q.jsx)(ve,{children:`This session is archived. You can reopen it from the sidebar.`})}),(0,Q.jsx)(`div`,{className:`relative w-full`,style:{height:`${L.getTotalSize()}px`},children:e.length===0?(0,Q.jsxs)(`div`,{className:`text-center py-16 text-muted-foreground px-4`,children:[(0,Q.jsx)(`p`,{className:`text-lg mb-2`,children:`Start a conversation`}),(0,Q.jsx)(`p`,{className:`text-sm`,children:`Send a message below to begin.`})]}):(0,Q.jsx)(`div`,{className:`absolute top-0 left-0 w-full`,style:{transform:`translateY(${(y=(b=ee[0])==null?void 0:b.start)==null?0:y}px)`},children:ee.map(r=>{let o=e[r.index];return(0,Q.jsx)(`div`,{"data-index":r.index,ref:L.measureElement,className:`px-4 py-4`,children:(0,Q.jsx)(Yr,{item:o,messagesWithParts:t,sessionId:n,pendingAskRequests:i,onAskResponse:c,onNavigateToSubagent:l,onRemoveFromQueue:u,onRevert:d,onFork:f,isMainActiveSession:m,isCompacting:a,onCompact:p,serverUrl:v})},o.message.id)})})})]})}function Zr(e,t){return e.createdAt-t.createdAt}function Qr(e){return e.type===`compaction`}function $r(e,t,n){let r=e.map(e=>({message:e.message,parts:e.parts,isQueued:!1})),i=t.map(e=>{let t=(e.attachments||[]).map(t=>{var r;let i=n(e.sessionId,t.id,(r=t.accessKey)==null?``:r);return t.kind===`image`?{id:`${e.id}-att-${t.id}`,messageId:e.id,createdAt:e.createdAt,type:`image`,url:i,mimeType:t.mimeType}:{id:`${e.id}-att-${t.id}`,messageId:e.id,createdAt:e.createdAt,type:`file`,url:i,mimeType:t.mimeType||``,filename:t.filename}});return{message:{id:e.id,role:`user`,sessionId:e.sessionId,createdAt:e.createdAt},parts:[...t,...e.content.trim()?[{id:`${e.id}-part`,messageId:e.id,createdAt:e.createdAt,type:`text`,text:e.content}]:[]],isQueued:!0,queueId:e.id}}),a=[...r].sort((e,t)=>e.message.createdAt-t.message.createdAt),o=[...i].sort((e,t)=>e.message.createdAt-t.message.createdAt);return[...a,...o]}function ei(e){var t;let n=(0,$.c)(97),{session:r,messagesWithParts:i,queuedMessages:a,preconfigs:o,prompts:s,models:c,defaultModel:l,onSendMessage:u,onRemoveFromQueue:d,onChangePreconfig:f,onChangeModel:p,onChangeVariant:m,pendingAskRequests:h,onAskResponse:g,onRename:_,usage:v,modelName:y,modelSupportsImage:b,onNavigateToSubagent:x,onNavigateBack:S,isStreaming:C,onInterrupt:w,onRevert:T,onFork:E,onCompact:D,isCompacting:O,compactionSuccess:k,onClearCompactionSuccess:A,serverUrl:j,sdkClient:M,selectedVariant:N,variants:P,inputRef:F,scrollToBottomRef:I,autoFollowToggleRef:L,onClaimControl:R,onReleaseControl:z,onRequestTakeover:ee,onRespondTakeover:B}=e,V=!r.parentId&&r.status===`active`,H;n[0]===r.id?H=n[1]:(H=e=>e.controlBySessionId[r.id],n[0]=r.id,n[1]=H);let U=de(H),te=_e(ni),W=(U==null?void 0:U.status)===`controlled`&&U.controllerClientId!==te,G=(U==null?void 0:U.status)===`grace`,ne=W||G,[K,q]=(0,Z.useState)(null),J=(0,Z.useRef)(null),re;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(re=e=>{J.current&&clearTimeout(J.current),q(e),J.current=setTimeout(()=>{q(null),J.current=null},4e3)},n[2]=re):re=n[2];let ie=re,ae,oe;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>()=>{J.current&&clearTimeout(J.current)},oe=[],n[3]=ae,n[4]=oe):(ae=n[3],oe=n[4]),(0,Z.useEffect)(ae,oe);let se,le;n[5]===r.id?(se=n[6],le=n[7]):(se=()=>{let e=null;return de.subscribe(t=>{t.lastActionRejection!==e&&(e=t.lastActionRejection,e&&e.sessionId===r.id&&ie(e.message))})},le=[r.id,ie],n[5]=r.id,n[6]=se,n[7]=le),(0,Z.useEffect)(se,le);let[fe,pe]=(0,Z.useState)(!0),me;n[8]===I?me=n[9]:(me=()=>{pe(e=>{let t=!e;if(t){var n;I==null||(n=I.current)==null||n.call(I)}return t})},n[8]=I,n[9]=me);let he=me,ge,Y;n[10]!==L||n[11]!==he?(ge=()=>{L&&(L.current={toggle:()=>{he()}})},Y=[L,he],n[10]=L,n[11]=he,n[12]=ge,n[13]=Y):(ge=n[12],Y=n[13]),(0,Z.useEffect)(ge,Y);let ve=(t=M==null?void 0:M.http.attachments.getUrl)==null?ti:t,ye;n[14]!==i||n[15]!==a||n[16]!==ve?(ye=$r(i,a,ve),n[14]=i,n[15]=a,n[16]=ve,n[17]=ye):ye=n[17];let be=ye,xe=i.length>=2,Se;n[18]!==l||n[19]!==O||n[20]!==C||n[21]!==y||n[22]!==c||n[23]!==p||n[24]!==f||n[25]!==m||n[26]!==R||n[27]!==D||n[28]!==w||n[29]!==S||n[30]!==z||n[31]!==_||n[32]!==ee||n[33]!==B||n[34]!==o||n[35]!==N||n[36]!==r||n[37]!==xe||n[38]!==v||n[39]!==P?(Se=(0,Q.jsx)(Gt,{session:r,preconfigs:o,models:c,defaultModel:l,usage:v,modelName:y,onChangePreconfig:f,onChangeModel:p,onChangeVariant:m,onRename:_,onNavigateBack:S,isStreaming:C,onInterrupt:w,onCompact:D,isCompacting:O,canCompact:xe,selectedVariant:N,variants:P,onClaimControl:R,onReleaseControl:z,onRequestTakeover:ee,onRespondTakeover:B}),n[18]=l,n[19]=O,n[20]=C,n[21]=y,n[22]=c,n[23]=p,n[24]=f,n[25]=m,n[26]=R,n[27]=D,n[28]=w,n[29]=S,n[30]=z,n[31]=_,n[32]=ee,n[33]=B,n[34]=o,n[35]=N,n[36]=r,n[37]=xe,n[38]=v,n[39]=P,n[40]=Se):Se=n[40];let Ce;n[41]!==E||n[42]!==T||n[43]!==fe||n[44]!==k||n[45]!==be||n[46]!==O||n[47]!==V||n[48]!==i||n[49]!==g||n[50]!==A||n[51]!==D||n[52]!==x||n[53]!==d||n[54]!==h||n[55]!==I||n[56]!==j||n[57]!==r.id||n[58]!==r.status?(Ce=(0,Q.jsx)(Xr,{displayItems:be,messagesWithParts:i,sessionId:r.id,sessionStatus:r.status,pendingAskRequests:h,isCompacting:O,compactionSuccess:k,onClearCompactionSuccess:A,onAskResponse:g,onNavigateToSubagent:x,onRemoveFromQueue:d,onRevert:T,onFork:E,onCompact:D,isMainActiveSession:V,autoFollow:fe,onAutoScrollChange:pe,scrollToBottomRef:I,serverUrl:j}),n[41]=E,n[42]=T,n[43]=fe,n[44]=k,n[45]=be,n[46]=O,n[47]=V,n[48]=i,n[49]=g,n[50]=A,n[51]=D,n[52]=x,n[53]=d,n[54]=h,n[55]=I,n[56]=j,n[57]=r.id,n[58]=r.status,n[59]=Ce):Ce=n[59];let we=fe?`Auto-follow enabled (Cmd+Shift+F)`:`Auto-follow disabled (Cmd+Shift+F)`,Te;n[60]===fe?Te=n[61]:(Te=fe?(0,Q.jsx)(Ke,{className:`size-3.5`}):(0,Q.jsx)(ue,{className:`size-3.5`}),n[60]=fe,n[61]=Te);let Ee;n[62]!==he||n[63]!==we||n[64]!==Te?(Ee=(0,Q.jsx)(`button`,{onClick:he,className:`absolute bottom-4 right-4 z-50 flex items-center p-1.5 text-xs rounded-full transition-colors cursor-pointer bg-background/80 backdrop-blur-sm hover:bg-background border border-border/50 shadow-sm pointer-events-auto`,title:we,children:Te}),n[62]=he,n[63]=we,n[64]=Te,n[65]=Ee):Ee=n[65];let De;n[66]!==Ce||n[67]!==Ee?(De=(0,Q.jsxs)(`div`,{className:`relative flex flex-col flex-1 min-h-0`,children:[Ce,Ee]}),n[66]=Ce,n[67]=Ee,n[68]=De):De=n[68];let Oe;n[69]!==F||n[70]!==O||n[71]!==ne||n[72]!==b||n[73]!==u||n[74]!==s||n[75]!==M||n[76]!==r.id||n[77]!==r.parentId||n[78]!==r.status||n[79]!==r.workspaceId?(Oe=r.status===`active`&&!r.parentId&&(0,Q.jsx)(hn,{ref:F,onSendMessage:u,disabled:O||ne,workspaceId:r.workspaceId,sdkClient:M,prompts:s,sessionId:r.id,modelSupportsImage:b}),n[69]=F,n[70]=O,n[71]=ne,n[72]=b,n[73]=u,n[74]=s,n[75]=M,n[76]=r.id,n[77]=r.parentId,n[78]=r.status,n[79]=r.workspaceId,n[80]=Oe):Oe=n[80];let ke;n[81]===r.parentId?ke=n[82]:(ke=r.parentId&&(0,Q.jsxs)(`div`,{className:`p-4 border-t border-border bg-muted/50 text-center flex items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,Q.jsx)(ce,{className:`size-4`}),`This is a subagent session (read-only)`]}),n[81]=r.parentId,n[82]=ke);let Ae;n[83]===W?Ae=n[84]:(Ae=W&&(0,Q.jsxs)(`div`,{className:`px-4 py-2 border-t border-border bg-muted/30 text-center flex items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(lt,{className:`size-3.5`}),`You are observing this session. Input is disabled.`]}),n[83]=W,n[84]=Ae);let je;n[85]===G?je=n[86]:(je=G&&(0,Q.jsxs)(`div`,{className:`px-4 py-2 border-t border-yellow-500/30 bg-yellow-50 dark:bg-yellow-950/30 text-center flex items-center justify-center gap-2 text-xs text-yellow-600 dark:text-yellow-400`,children:[(0,Q.jsx)(ft,{className:`size-3.5`}),`Reconnecting to session… waiting for control to be restored.`]}),n[85]=G,n[86]=je);let Me;n[87]===K?Me=n[88]:(Me=K&&(0,Q.jsxs)(`div`,{className:`px-4 py-2 border-t border-orange-500/30 bg-orange-50 dark:bg-orange-950/30 text-center flex items-center justify-center gap-2 text-xs text-orange-600 dark:text-orange-400`,children:[(0,Q.jsx)(lt,{className:`size-3.5`}),K]}),n[87]=K,n[88]=Me);let X;return n[89]!==Se||n[90]!==De||n[91]!==Oe||n[92]!==ke||n[93]!==Ae||n[94]!==je||n[95]!==Me?(X=(0,Q.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 relative`,children:[Se,De,Oe,ke,Ae,je,Me]}),n[89]=Se,n[90]=De,n[91]=Oe,n[92]=ke,n[93]=Ae,n[94]=je,n[95]=Me,n[96]=X):X=n[96],X}function ti(e,t,n){return`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content?key=${encodeURIComponent(n)}`}function ni(e){return e.clientId}function ri(e){var t,n,r;let i=(0,$.c)(77),{serverUrl:a,messagesWithParts:o,inputRef:s,sdkClient:c,onRetry:l,onLogout:u,onSendMessage:d,onRemoveFromQueue:f,onChangePreconfig:p,onChangeModel:m,onChangeVariant:h,onAskResponse:g,onRename:_,onNavigateToSubagent:v,onNavigateBack:y,onInterrupt:b,onRevert:x,onFork:C,onCompact:w,onClearCompactionSuccess:T,scrollToBottomRef:E,autoFollowToggleRef:O,onClaimControl:k,onReleaseControl:A,onRequestTakeover:j,onRespondTakeover:M}=e,N=P(Si),F=P(xi),L=P(bi),R=P(yi),z=P(vi),ee=P(_i),B=D(gi),V=D(hi),H=D(mi),U=D(pi),te=D(fi),W=D(di),G=I(ui),ne=I(li),q=I(ci),J=I(si),re=S(oi),ie;i[0]===G?ie=i[1]:(ie=G.filter(ai),i[0]=G,i[1]=ie);let ae=ie,oe=!(B!=null&&B.parentId),se=(t=B==null?void 0:B.compacting)==null?!1:t,ce;i[2]===p?ce=i[3]:(ce=e=>{p(e)},i[2]=p,i[3]=ce);let le=ce,ue;i[4]===h?ue=i[5]:(ue=e=>{h(e)},i[4]=h,i[5]=ue);let de=ue,fe;i[6]===b?fe=i[7]:(fe=()=>{b()},i[6]=b,i[7]=fe);let pe=fe;if(!N){if(L){let e;return i[8]!==F||i[9]!==z||i[10]!==u||i[11]!==l||i[12]!==R||i[13]!==a?(e=(0,Q.jsx)(`div`,{className:`flex w-full h-full items-center justify-center bg-background`,children:(0,Q.jsx)(jt,{serverUrl:a,authError:F,retryCount:R,nextRetryIn:z,onRetry:l,onLogout:u})}),i[8]=F,i[9]=z,i[10]=u,i[11]=l,i[12]=R,i[13]=a,i[14]=e):e=i[14],e}let e;i[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(At,{}),i[15]=e):e=i[15];let t;return i[16]===u?t=i[17]:(t=(0,Q.jsxs)(`div`,{className:`flex flex-col w-full h-full items-center justify-center bg-background gap-4`,children:[e,(0,Q.jsx)(K,{variant:`ghost`,size:`sm`,onClick:u,className:`text-muted-foreground`,children:`Change Server`})]}),i[16]=u,i[17]=t),t}if(!B){let e;return i[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-center text-muted-foreground px-6`,children:[(0,Q.jsx)(`h2`,{className:`mb-2`,children:`Select or create a session`}),(0,Q.jsx)(`p`,{children:`Choose a session from the sidebar or create a new one to start chatting.`})]}),i[18]=e):e=i[18],e}let me;i[19]===o?me=i[20]:(me=o.filter(ii),i[19]=o,i[20]=me);let he=me.length>=2,ge;if(i[21]!==U||i[22]!==q){let e;i[24]===U?e=i[25]:(e=e=>e.id===U,i[24]=U,i[25]=e),ge=q.find(e),i[21]=U,i[22]=q,i[23]=ge}else ge=i[23];let _e=ge,Y;i[26]!==B.id||i[27]!==V?(Y=V[B.id]||[],i[26]=B.id,i[27]=V,i[28]=Y):Y=i[28];let ve=oe?ae:G,ye=_e==null?void 0:_e.variants,be=(n=_e==null||(r=_e.capabilities)==null||(r=r.input)==null?void 0:r.image)==null?!1:n,xe;i[29]!==B.id||i[30]!==B.runningAt||i[31]!==ee?(xe=ee.has(B.id)||!!B.runningAt,i[29]=B.id,i[30]=B.runningAt,i[31]=ee,i[32]=xe):xe=i[32];let Se;i[33]!==he||i[34]!==B.id||i[35]!==w?(Se=he?()=>w(B.id):void 0,i[33]=he,i[34]=B.id,i[35]=w,i[36]=Se):Se=i[36];let Ce=a==null?void 0:a,we;return i[37]!==O||i[38]!==W||i[39]!==U||i[40]!==B||i[41]!==J||i[42]!==le||i[43]!==de||i[44]!==pe||i[45]!==s||i[46]!==se||i[47]!==o||i[48]!==q||i[49]!==g||i[50]!==m||i[51]!==k||i[52]!==T||i[53]!==C||i[54]!==y||i[55]!==v||i[56]!==A||i[57]!==f||i[58]!==_||i[59]!==j||i[60]!==M||i[61]!==x||i[62]!==d||i[63]!==re||i[64]!==ne||i[65]!==E||i[66]!==c||i[67]!==te||i[68]!==H||i[69]!==be||i[70]!==xe||i[71]!==Se||i[72]!==Ce||i[73]!==Y||i[74]!==ve||i[75]!==ye?(we=(0,Q.jsx)(ei,{inputRef:s,session:B,messagesWithParts:o,queuedMessages:Y,preconfigs:ve,prompts:ne,models:q,defaultModel:J,onSendMessage:d,onRemoveFromQueue:f,onChangePreconfig:le,onChangeModel:m,onChangeVariant:de,selectedVariant:te,variants:ye,pendingAskRequests:re,onAskResponse:g,onRename:_,usage:H,modelName:U,modelSupportsImage:be,onNavigateToSubagent:v,onNavigateBack:y,isStreaming:xe,onInterrupt:pe,onRevert:x,onFork:C,onCompact:Se,isCompacting:se,compactionSuccess:W,onClearCompactionSuccess:T,serverUrl:Ce,sdkClient:c,scrollToBottomRef:E,autoFollowToggleRef:O,onClaimControl:k,onReleaseControl:A,onRequestTakeover:j,onRespondTakeover:M}),i[37]=O,i[38]=W,i[39]=U,i[40]=B,i[41]=J,i[42]=le,i[43]=de,i[44]=pe,i[45]=s,i[46]=se,i[47]=o,i[48]=q,i[49]=g,i[50]=m,i[51]=k,i[52]=T,i[53]=C,i[54]=y,i[55]=v,i[56]=A,i[57]=f,i[58]=_,i[59]=j,i[60]=M,i[61]=x,i[62]=d,i[63]=re,i[64]=ne,i[65]=E,i[66]=c,i[67]=te,i[68]=H,i[69]=be,i[70]=xe,i[71]=Se,i[72]=Ce,i[73]=Y,i[74]=ve,i[75]=ye,i[76]=we):we=i[76],we}function ii(e){return e.message.role!==`system`}function ai(e){return e.mode!==`subagent`}function oi(e){return e.pendingRequests}function si(e){return e.defaultModel}function ci(e){return e.models}function li(e){return e.prompts}function ui(e){return e.preconfigs}function di(e){return e.compactionSuccess}function fi(e){return e.selectedVariant}function pi(e){return e.currentModel}function mi(e){return e.sessionUsage}function hi(e){return e.queuedMessages}function gi(e){return e.currentSession}function _i(e){return e.streamingSessionIds}function vi(e){return e.nextRetryIn}function yi(e){return e.retryCount}function bi(e){return e.connectionTimedOut}function xi(e){return e.authError}function Si(e){return e.connected}function Ci(){let e=(0,$.c)(30),t=H(),{chatInputRef:n,scrollToBottomRef:r,autoFollowToggleRef:i}=T(),{sdkClient:a,messagesWithParts:o,serverUrl:s,currentSession:c,isSessionLoading:l,resumeSession:u,revertSession:d,forkSession:f,compactSession:p,removeFromQueue:m,sendChatMessage:h,handleAskResponse:g,handleInterruptSession:_,updateSessionPreconfig:v,updateSessionModel:y,updateSessionVariant:b,handleNavigateBack:x,handleRenameSession:S,setCompactionSuccess:C}=t;if(l){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(kt,{}),e[0]=t):t=e[0],t}if(!c)return null;let w;e[1]===C?w=e[2]:(w=()=>C(!1),e[1]=C,e[2]=w);let E;return e[3]!==i||e[4]!==n||e[5]!==p||e[6]!==f||e[7]!==g||e[8]!==_||e[9]!==x||e[10]!==S||e[11]!==o||e[12]!==m||e[13]!==u||e[14]!==d||e[15]!==r||e[16]!==a||e[17]!==h||e[18]!==s||e[19]!==t.claimControl||e[20]!==t.handleLogout||e[21]!==t.handleRetry||e[22]!==t.releaseControl||e[23]!==t.requestTakeover||e[24]!==t.respondTakeover||e[25]!==w||e[26]!==y||e[27]!==v||e[28]!==b?(E=(0,Q.jsx)(ri,{sdkClient:a,inputRef:n,messagesWithParts:o,serverUrl:s,onRetry:t.handleRetry,onLogout:t.handleLogout,onSendMessage:h,onRemoveFromQueue:m,onChangePreconfig:v,onChangeModel:y,onChangeVariant:b,onAskResponse:g,onRename:S,onNavigateToSubagent:u,onNavigateBack:x,onInterrupt:_,onRevert:d,onFork:f,onCompact:p,onClearCompactionSuccess:w,scrollToBottomRef:r,autoFollowToggleRef:i,onClaimControl:t.claimControl,onReleaseControl:t.releaseControl,onRequestTakeover:t.requestTakeover,onRespondTakeover:t.respondTakeover}),e[3]=i,e[4]=n,e[5]=p,e[6]=f,e[7]=g,e[8]=_,e[9]=x,e[10]=S,e[11]=o,e[12]=m,e[13]=u,e[14]=d,e[15]=r,e[16]=a,e[17]=h,e[18]=s,e[19]=t.claimControl,e[20]=t.handleLogout,e[21]=t.handleRetry,e[22]=t.releaseControl,e[23]=t.requestTakeover,e[24]=t.respondTakeover,e[25]=w,e[26]=y,e[27]=v,e[28]=b,e[29]=E):E=e[29],E}export{Ci as t};