blade-code 0.10.132 → 0.10.136

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 (138) hide show
  1. package/dist/blade.js +2 -2
  2. package/dist/chunk-0qq64xqm.js +25 -0
  3. package/dist/{chunk-gmqpfm52.js → chunk-13sdjfks.js} +2 -2
  4. package/dist/{chunk-t8rjxqp2.js → chunk-1cbaqh71.js} +2 -2
  5. package/dist/chunk-1dscf8xj.js +23 -0
  6. package/dist/chunk-1n5d6b5k.js +1 -0
  7. package/dist/{chunk-zwjrensv.js → chunk-1p9sjb8d.js} +1 -1
  8. package/dist/{chunk-dvb89529.js → chunk-1pmvyqed.js} +1 -1
  9. package/dist/chunk-1qdemrkr.js +1 -0
  10. package/dist/{chunk-6p6ts4kv.js → chunk-24rsvr6e.js} +2 -2
  11. package/dist/{chunk-qcydkn1n.js → chunk-46jmq302.js} +1 -1
  12. package/dist/{chunk-sx77dpxw.js → chunk-5sknjz9b.js} +1 -1
  13. package/dist/{chunk-td2jk2xn.js → chunk-6rvrx275.js} +2 -2
  14. package/dist/{chunk-g4xny949.js → chunk-77x1rrz9.js} +1 -1
  15. package/dist/{chunk-e371f7xk.js → chunk-82x77b2p.js} +2 -2
  16. package/dist/chunk-83nxcfz3.js +1 -0
  17. package/dist/{chunk-fag8rk53.js → chunk-91pb41e7.js} +1 -1
  18. package/dist/{chunk-g1bqjdeq.js → chunk-9y7j565j.js} +2 -2
  19. package/dist/{chunk-bavzm721.js → chunk-9z9v8v4j.js} +1 -1
  20. package/dist/{chunk-ajsw4te2.js → chunk-acsfh1cw.js} +2 -2
  21. package/dist/chunk-as8stb2j.js +10 -0
  22. package/dist/chunk-azaqc1b6.js +1 -0
  23. package/dist/{chunk-tkydv9k8.js → chunk-bdtpq7j9.js} +1 -1
  24. package/dist/chunk-c5rfnzhf.js +171 -0
  25. package/dist/{chunk-pqsvz99n.js → chunk-c85xvthj.js} +1 -1
  26. package/dist/{chunk-zssz8hc4.js → chunk-cgkbdh2m.js} +1 -1
  27. package/dist/chunk-e1warjkn.js +171 -0
  28. package/dist/{chunk-aaxc81jc.js → chunk-f7hsagj6.js} +1 -1
  29. package/dist/{chunk-prt6y5fv.js → chunk-ffh4c30x.js} +1 -1
  30. package/dist/chunk-fnc97xg7.js +2 -0
  31. package/dist/chunk-g13jmewd.js +1 -0
  32. package/dist/{chunk-9gs4eqt8.js → chunk-g45camrd.js} +1 -1
  33. package/dist/{chunk-6q3g5e3m.js → chunk-g4vgnxh4.js} +1 -1
  34. package/dist/{chunk-ar5np5h5.js → chunk-g7h0peka.js} +2 -2
  35. package/dist/{chunk-jkfkyedn.js → chunk-gdnyt8a7.js} +1 -1
  36. package/dist/chunk-gq7fdc8c.js +2 -0
  37. package/dist/chunk-gwjah260.js +1 -0
  38. package/dist/{chunk-7dy3mzgz.js → chunk-hqwpnb0x.js} +2 -2
  39. package/dist/{chunk-sbc90z9j.js → chunk-hx10bph0.js} +2 -2
  40. package/dist/{chunk-2y1qngw7.js → chunk-jb8stg10.js} +1 -1
  41. package/dist/{chunk-44jtpg8y.js → chunk-jc28ddt0.js} +1 -1
  42. package/dist/{chunk-a60cmnmz.js → chunk-kbnxbb23.js} +2 -2
  43. package/dist/{chunk-0bkhpd72.js → chunk-mm1atkae.js} +2 -2
  44. package/dist/{chunk-b5z1rec4.js → chunk-mq1mk3v5.js} +27 -27
  45. package/dist/{chunk-rj8mmwc6.js → chunk-mxe4pr8t.js} +2 -2
  46. package/dist/chunk-n238rdz8.js +1 -0
  47. package/dist/{chunk-pj69j4zp.js → chunk-na3nregt.js} +1 -1
  48. package/dist/{chunk-sj1dzeta.js → chunk-nfzad4te.js} +1 -1
  49. package/dist/{chunk-zkzhm39s.js → chunk-ntd69c0k.js} +1 -1
  50. package/dist/{chunk-sfe4810k.js → chunk-nzwh9v6t.js} +1 -1
  51. package/dist/chunk-pnanbvn3.js +1 -0
  52. package/dist/chunk-pz91qga3.js +1 -0
  53. package/dist/{chunk-mdew58v9.js → chunk-q0s3gcjm.js} +1 -1
  54. package/dist/chunk-qjydadex.js +14 -0
  55. package/dist/{chunk-r7kevfd3.js → chunk-qm96k94k.js} +3 -3
  56. package/dist/{chunk-grhsv55v.js → chunk-r51afpkk.js} +1 -1
  57. package/dist/{chunk-dfjmvj3d.js → chunk-s3a017q7.js} +2 -2
  58. package/dist/{chunk-mg1s861p.js → chunk-s4b1r3my.js} +1 -1
  59. package/dist/{chunk-93x9xbew.js → chunk-sv5z5sna.js} +1 -1
  60. package/dist/{chunk-xjrmq0pg.js → chunk-sy0vxdc3.js} +379 -377
  61. package/dist/{chunk-749jzrbk.js → chunk-t6cajkaj.js} +2 -2
  62. package/dist/chunk-tah2002b.js +1 -0
  63. package/dist/{chunk-mvm1rzc4.js → chunk-tev70rzj.js} +2 -2
  64. package/dist/chunk-tzfd2fza.js +1 -0
  65. package/dist/{chunk-y0kqkewg.js → chunk-v2qxszks.js} +2 -2
  66. package/dist/chunk-v3veeja5.js +1 -0
  67. package/dist/chunk-vptn8fhx.js +2 -0
  68. package/dist/{chunk-edtxcqxa.js → chunk-vvawhvea.js} +1 -1
  69. package/dist/chunk-w2n1vwzg.js +2 -0
  70. package/dist/{chunk-p00f53yq.js → chunk-wj16pvvn.js} +1 -1
  71. package/dist/chunk-wj813rcc.js +1 -0
  72. package/dist/{chunk-77efqpdc.js → chunk-wzkh3e6a.js} +1 -1
  73. package/dist/{chunk-8y08fytr.js → chunk-xtngc0th.js} +1 -1
  74. package/dist/{chunk-z03dtyh6.js → chunk-yacv7f7h.js} +1 -1
  75. package/dist/{chunk-53h87fmt.js → chunk-z3hpstky.js} +1 -1
  76. package/dist/{chunk-qcvxff27.js → chunk-zy2etr3v.js} +2 -2
  77. package/dist/web/assets/ChatView-Bc9twpWM.js +63 -0
  78. package/dist/web/assets/{CodeBlockHighlighter-DR5RLA1_.js → CodeBlockHighlighter-41xRPXs2.js} +1 -1
  79. package/dist/web/assets/{FilePreview-C4tqzUOM.js → FilePreview-lcc_hL7J.js} +15 -20
  80. package/dist/web/assets/{KanbanBoard-D7HJQXE2.js → KanbanBoard-BHgM338V.js} +4 -4
  81. package/dist/web/assets/{MarkdownRenderer-Ct8vtONO.js → MarkdownRenderer-BMAuTkc6.js} +3 -3
  82. package/dist/web/assets/{ScrollArea-CMSE6nO4.js → ScrollArea-DJq2Kdpi.js} +1 -1
  83. package/dist/web/assets/{SessionHistorySurface-BPwnF9ND.js → SessionHistorySurface-DSe8ePBJ.js} +2 -2
  84. package/dist/web/assets/{SettingsModal-KW5WYAov.js → SettingsModal-Cih4bWul.js} +1 -1
  85. package/dist/web/assets/{Sidebar-8BUNEHHQ.js → Sidebar-DnWlUKmO.js} +2 -2
  86. package/dist/web/assets/{TaskSwitcher-CZfkp2L_.js → TaskSwitcher-D3mrXv_i.js} +2 -2
  87. package/dist/web/assets/{TerminalPanel-DBBMaU_6.js → TerminalPanel-BNKHhBVM.js} +2 -2
  88. package/dist/web/assets/{archive-tBd5snSF.js → archive-Dof4YpyT.js} +1 -1
  89. package/dist/web/assets/{arrow-left-Cs_sFMp-.js → arrow-left-DGFXaGox.js} +1 -1
  90. package/dist/web/assets/{calendar-clock-C0ue6XTy.js → calendar-clock-BoxUNOvH.js} +1 -1
  91. package/dist/web/assets/{chevron-right-DZHCUfAH.js → chevron-right-Brb1rhaA.js} +1 -1
  92. package/dist/web/assets/chevrons-up-down-N-VshXV_.js +16 -0
  93. package/dist/web/assets/{clock-3-DstAM2AR.js → clock-3-gdZEKe2U.js} +1 -1
  94. package/dist/web/assets/{copy-BfnFXTgG.js → copy-d9M8JUfQ.js} +1 -1
  95. package/dist/web/assets/{download-XKyNtMnj.js → download-CQ-Pwfq0.js} +1 -1
  96. package/dist/web/assets/{external-link-3bcWFMya.js → external-link-GRAtjoO2.js} +1 -1
  97. package/dist/web/assets/{folder-D7hQLvy7.js → folder-CqLD0IBh.js} +1 -1
  98. package/dist/web/assets/index-CPpIFWLG.css +1 -0
  99. package/dist/web/assets/index-DiRs2_w4.js +203 -0
  100. package/dist/web/assets/{pause-CBR55GXy.js → pause-BqsFgQi0.js} +1 -1
  101. package/dist/web/assets/{pencil-8yqeFHC4.js → pencil-Ca9289F-.js} +1 -1
  102. package/dist/web/assets/{play-F_Spkp4p.js → play-DmEPnYDS.js} +1 -1
  103. package/dist/web/assets/{plus-CJCqq3rG.js → plus-kIBLgk0p.js} +1 -1
  104. package/dist/web/assets/session-events-BqQQkbAN.js +29 -0
  105. package/dist/web/assets/{settings-G6riyt4S.js → settings-BuSrJl6s.js} +1 -1
  106. package/dist/web/assets/teamService-B7Fp8Oyg.js +1 -0
  107. package/dist/web/assets/{terminal-_Nebc2yj.js → terminal-Qkr_gcNu.js} +1 -1
  108. package/dist/web/index.html +2 -2
  109. package/package.json +2 -2
  110. package/dist/chunk-0gmbvtpp.js +0 -1
  111. package/dist/chunk-0z9nqbd0.js +0 -2
  112. package/dist/chunk-14z94k0r.js +0 -1
  113. package/dist/chunk-3e0t25rq.js +0 -171
  114. package/dist/chunk-53j6nh8j.js +0 -1
  115. package/dist/chunk-64kg5a9r.js +0 -1
  116. package/dist/chunk-9d49tj9y.js +0 -2
  117. package/dist/chunk-9s8saznq.js +0 -1
  118. package/dist/chunk-dhzbac1c.js +0 -1
  119. package/dist/chunk-f8gb685p.js +0 -2
  120. package/dist/chunk-g12kqs1b.js +0 -1
  121. package/dist/chunk-j3nmt09e.js +0 -25
  122. package/dist/chunk-kd3k1q9z.js +0 -1
  123. package/dist/chunk-m9mw8ppy.js +0 -1
  124. package/dist/chunk-pkg1bvzc.js +0 -1
  125. package/dist/chunk-q7m0tvhw.js +0 -1
  126. package/dist/chunk-sf9sbm6y.js +0 -1
  127. package/dist/chunk-sm9p1fkf.js +0 -14
  128. package/dist/chunk-v52wc8yg.js +0 -2
  129. package/dist/chunk-xyxjcehh.js +0 -23
  130. package/dist/chunk-z28dcrr9.js +0 -10
  131. package/dist/chunk-z83xk6jn.js +0 -1
  132. package/dist/chunk-znqt5g8v.js +0 -170
  133. package/dist/web/assets/ChatView-CkmlibKO.js +0 -53
  134. package/dist/web/assets/chevrons-up-down-BSa16Scz.js +0 -11
  135. package/dist/web/assets/index-B4186fIT.css +0 -1
  136. package/dist/web/assets/index-CCdnLriX.js +0 -210
  137. package/dist/web/assets/session-events-C6fPz20c.js +0 -22
  138. package/dist/web/assets/teamService-Cixkq48S.js +0 -1
@@ -0,0 +1,63 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownRenderer-BMAuTkc6.js","assets/index-DiRs2_w4.js","assets/vendor-react-DofNRwfy.js","assets/vendor-radix-D6QrtXqd.js","assets/session-events-BqQQkbAN.js","assets/index-CPpIFWLG.css","assets/copy-d9M8JUfQ.js"])))=>i.map(i=>d[i]);
2
+ import{r as h,j as e}from"./vendor-react-DofNRwfy.js";import{c as J,u as U,a as p,s as Oe,b as it,d as le,H as Fe,P as ot,G as Ve,L as P,S as He,T as re,C as pe,D as Qe,e as Ke,f as lt,g as ze,h as qe,i as Ge,j as $,k as ct,l as ee,B as dt,m as ye,n as ce,R as me,F as ut,_ as We,o as mt,p as Je,q as ht,r as Ye,t as xt,X as Xe,v as pt,A as Ce,w as ft,W as bt,x as vt,y as gt}from"./index-DiRs2_w4.js";import{_ as Ee,M as ae,Z as L,a2 as kt,A as jt,a3 as yt,Q as wt,X as Nt,Y as St}from"./session-events-BqQQkbAN.js";import{A as Ct,E as Et}from"./external-link-GRAtjoO2.js";import{S as Tt}from"./ScrollArea-DJq2Kdpi.js";import{C as Ze}from"./copy-d9M8JUfQ.js";import{C as ne}from"./chevron-right-Brb1rhaA.js";import{A as Te,a as Mt,C as At}from"./chevrons-up-down-N-VshXV_.js";import{f as Ft,g as Rt,h as Dt,i as et}from"./vendor-radix-D6QrtXqd.js";import{P as $t}from"./pause-BqsFgQi0.js";import{P as It}from"./play-DmEPnYDS.js";import{P as tt}from"./pencil-Ca9289F-.js";import{C as Bt}from"./clock-3-gdZEKe2U.js";import{t as _}from"./team-QZ9byb3E.js";import{teamService as Re}from"./teamService-B7Fp8Oyg.js";/**
3
+ * @license lucide-react v0.300.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const _t=J("Files",[["path",{d:"M15.5 2H8.6c-.4 0-.8.2-1.1.5-.3.3-.5.7-.5 1.1v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8c.4 0 .8-.2 1.1-.5.3-.3.5-.7.5-1.1V6.5L15.5 2z",key:"cennsq"}],["path",{d:"M3 7.6v12.8c0 .4.2.8.5 1.1.3.3.7.5 1.1.5h9.8",key:"ms809a"}],["path",{d:"M15 2v5h5",key:"qq6kwv"}]]);/**
8
+ * @license lucide-react v0.300.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const Pt=J("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
13
+ * @license lucide-react v0.300.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const Ut=J("HelpCircle",[["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"}]]);/**
18
+ * @license lucide-react v0.300.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const Lt=J("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
23
+ * @license lucide-react v0.300.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const Ot=J("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/**
28
+ * @license lucide-react v0.300.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const Vt=J("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["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"}]]);/**
33
+ * @license lucide-react v0.300.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const Ht=J("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
38
+ * @license lucide-react v0.300.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const Qt=J("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
43
+ * @license lucide-react v0.300.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const Kt=J("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);function De(t){return t.split("/").filter(Boolean).at(-1)||t}function zt(){const t=U(),s=p(k=>k.sessions),r=p(k=>k.currentSessionRef),a=p(k=>k.historySurfaceSelection),o=p(k=>k.taskDeliveryActions),n=p(k=>k.deliverTask),u=Ee(k=>k.openFilePreview),[x,v]=h.useState(!1),l=s.find(k=>Oe({sessionId:k.sessionId,projectPath:k.projectPath},r));if(ae(a)||!(l!=null&&l.taskIsolation))return null;const f=l.taskDiffStat,b=l.taskIsolation==="worktree",c=it(l),j=o[le(c)],m=l.taskDelivery,w=(m==null?void 0:m.status)==="conflicted",i=!!(f&&(f.changedFiles>0||f.commits>0)),C=!["queued","running"].includes(l.taskStatus),g=(m==null?void 0:m.status)==="applied"||(m==null?void 0:m.status)==="discarded",T=b&&i&&C&&!g,d=f?f.additions+f.deletions:0,E=d>0&&f?f.additions/d*100:0,S=k=>{L(p.getState())||n(c,k).catch(()=>{})},D=()=>{L(p.getState())||u({tab:"diff"})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex min-h-10 flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]/60 px-3 py-1.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))] backdrop-blur-sm sm:px-5",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[e.jsx(Fe,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"truncate text-[hsl(var(--deck-ink))]",children:De(l.taskSourceProjectPath||l.projectPath)})]}),e.jsx("span",{className:"text-[hsl(var(--deck-ink-faint))]/60",children:"/"}),e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[b?e.jsx(ot,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-accent))]"}):e.jsx(Fe,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:b?"text-[hsl(var(--deck-accent))]":void 0,children:t(b?"artifact.env.isolated":"artifact.env.local")})]}),l.taskWorktreeBranch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[hsl(var(--deck-ink-faint))]/60",children:"/"}),e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 truncate",title:l.taskWorktreeBranch,children:[e.jsx(Ve,{className:"h-3 w-3 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"truncate",children:l.taskWorktreeBranch})]})]})]}),f&&e.jsxs("div",{className:"ml-auto flex max-w-full items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(_t,{className:"h-3 w-3 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"tabular-nums",children:f.changedFiles})]}),d>0&&e.jsxs("span",{className:"relative hidden h-1.5 w-14 overflow-hidden rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] sm:inline-flex","aria-hidden":"true",children:[e.jsx("span",{className:"h-full bg-[hsl(var(--deck-accent))]",style:{width:`${E}%`}}),e.jsx("span",{className:"h-full bg-red-500/80",style:{width:`${100-E}%`}})]}),e.jsxs("span",{className:"tabular-nums text-[hsl(var(--deck-accent))]",children:["+",f.additions]}),e.jsxs("span",{className:"tabular-nums text-red-600 dark:text-red-400",children:["-",f.deletions]}),f.commits>0&&e.jsx("span",{className:"hidden tabular-nums text-[hsl(var(--deck-ink-faint))] sm:inline",children:t("artifact.commits",{count:f.commits})}),i&&(m==null?void 0:m.status)!=="discarded"&&e.jsx("button",{type:"button",onClick:D,className:"inline-flex items-center gap-1 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 py-1 text-[hsl(var(--deck-ink))] transition hover:border-[hsl(var(--deck-accent)/0.55)] hover:text-[hsl(var(--deck-accent))]",children:t("artifact.review")}),T&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",disabled:!!j,onClick:()=>S("apply"),className:"inline-flex items-center gap-1 rounded-md bg-[hsl(var(--deck-accent))] px-2 py-1 font-semibold text-white transition hover:brightness-95 disabled:cursor-wait disabled:opacity-65",children:[j==="apply"?e.jsx(P,{className:"h-3 w-3 animate-spin"}):e.jsx(He,{className:"h-3 w-3"}),t(j==="apply"?"artifact.applying":w?"artifact.retryApply":"artifact.apply")]}),e.jsx("button",{type:"button",disabled:!!j,onClick:()=>v(!0),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[hsl(var(--deck-ink-faint))] transition hover:bg-red-500/10 hover:text-red-600 disabled:cursor-wait disabled:opacity-50 dark:hover:text-red-400","aria-label":t("artifact.discard"),title:t("artifact.discard"),children:j==="discard"?e.jsx(P,{className:"h-3 w-3 animate-spin"}):e.jsx(re,{className:"h-3 w-3"})})]}),(m==null?void 0:m.status)==="applied"&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-emerald-500/10 px-2 py-1 font-semibold text-emerald-700 dark:text-emerald-300",children:[e.jsx(pe,{className:"h-3 w-3"}),t("artifact.applied")]}),(m==null?void 0:m.status)==="discarded"&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-[hsl(var(--deck-surface-2))] px-2 py-1 text-[hsl(var(--deck-ink-faint))]",children:[e.jsx(re,{className:"h-3 w-3"}),t("artifact.discarded")]})]}),(m==null?void 0:m.status)==="conflicted"&&e.jsxs("div",{className:"flex w-full items-start gap-1.5 border-t border-amber-500/20 pt-1.5 text-amber-700 dark:text-amber-300",role:"alert",children:[e.jsx(Ct,{className:"mt-0.5 h-3 w-3 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 space-y-0.5",children:[e.jsx("span",{className:"block",children:m.message||t("artifact.conflict")}),e.jsx("span",{className:"block text-[hsl(var(--deck-ink-faint))]",children:t("artifact.conflictHint")})]})]})]}),e.jsx(Qe,{open:x,onOpenChange:v,children:e.jsxs(Ke,{className:"w-[calc(100%_-_2rem)] max-w-md border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink))]",children:[e.jsxs(lt,{children:[e.jsx(ze,{children:t("artifact.discardDialog.title")}),e.jsx(qe,{className:"text-[hsl(var(--deck-ink-muted))]",children:t("artifact.discardDialog.description",{project:De(l.taskSourceProjectPath||l.projectPath),count:(f==null?void 0:f.changedFiles)??0})})]}),e.jsx("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-2 text-xs leading-relaxed text-red-700 dark:text-red-300",children:t("artifact.discardDialog.warning")}),e.jsxs(Ge,{className:"gap-2 sm:space-x-0",children:[e.jsx("button",{type:"button",onClick:()=>v(!1),className:"rounded-md border border-[hsl(var(--deck-border))] px-3 py-2 text-sm hover:bg-[hsl(var(--deck-surface-2))]",children:t("artifact.discardDialog.cancel")}),e.jsxs("button",{type:"button",onClick:()=>{v(!1),S("discard")},className:"inline-flex items-center justify-center gap-1.5 rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white hover:bg-red-700",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),t("artifact.discardDialog.confirm")]})]})]})})]})}const qt=new Set(["completed","stale","failed","aborted","interrupted"]),Gt={completed:"chat.review.status.completed",stale:"chat.review.status.stale",failed:"chat.review.status.failed",aborted:"chat.review.status.aborted",interrupted:"chat.review.status.interrupted"},Wt={completed:"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300 border-emerald-500/20",stale:"bg-amber-500/10 text-amber-700 dark:text-amber-300 border-amber-500/20",failed:"bg-red-500/10 text-red-700 dark:text-red-300 border-red-500/20",aborted:"bg-zinc-500/10 text-zinc-700 dark:text-zinc-300 border-zinc-500/20",interrupted:"bg-amber-500/10 text-amber-700 dark:text-amber-300 border-amber-500/20"};function he(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:void 0}function Jt(t){const s=he(t),r=he(s==null?void 0:s.codeLocation),a=s==null?void 0:s.priority,o=s==null?void 0:s.confidenceScore,n=r==null?void 0:r.lineStart,u=r==null?void 0:r.lineEnd;if(!(typeof(s==null?void 0:s.title)!="string"||typeof s.body!="string"||a!==0&&a!==1&&a!==2&&a!==3||typeof o!="number"||!Number.isFinite(o)||typeof(r==null?void 0:r.path)!="string"||!Number.isInteger(n)||!Number.isInteger(u)))return{title:s.title,body:s.body,priority:a,confidenceScore:o,codeLocation:{path:r.path,lineStart:n,lineEnd:u}}}function Yt(t){const s=he(t),r=he(s==null?void 0:s.target);if((s==null?void 0:s.phase)!=="completed"||typeof s.status!="string"||!qt.has(s.status)||typeof(r==null?void 0:r.label)!="string"||r.kind!=="uncommitted"&&r.kind!=="base"&&r.kind!=="commit"||typeof s.overallExplanation!="string"||!Array.isArray(s.findings))return;const a=s.findings.map(Jt);if(!a.some(o=>o===void 0))return{status:s.status,target:{kind:r.kind,label:r.label,...typeof r.reference=="string"?{reference:r.reference}:{}},overallExplanation:s.overallExplanation,findings:a,...typeof s.error=="string"?{error:s.error}:{}}}function Xt(t){const{path:s,lineStart:r,lineEnd:a}=t.codeLocation;return r===a?`${s}:L${r}`:`${s}:L${r}-${a}`}function Zt({report:t}){const s=U(),r=t.target.kind==="uncommitted"?s("chat.review.target.uncommitted"):t.target.kind==="base"?s("chat.review.target.base",{ref:t.target.reference??t.target.label}):s("chat.review.target.commit",{ref:t.target.reference??t.target.label});return e.jsxs("section",{"data-code-review-report":!0,className:"overflow-hidden rounded-xl border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/60 px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-[hsl(var(--deck-ink))]",children:s("chat.review.title")}),e.jsxs("p",{className:"mt-0.5 font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:[s("chat.review.target"),": ",r]})]}),e.jsxs("span",{className:$("rounded-full border px-2.5 py-1 font-mono text-[10.5px] font-medium",Wt[t.status]),children:[s("chat.review.status"),": ",s(Gt[t.status])]})]}),e.jsxs("div",{className:"space-y-4 px-4 py-3.5",children:[e.jsx("p",{className:"whitespace-pre-wrap text-[13px] leading-6 text-[hsl(var(--deck-ink-muted))]",children:t.overallExplanation}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("h4",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:s("chat.review.findings")}),e.jsx("span",{className:"font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:t.findings.length})]}),t.findings.length===0?e.jsx("div",{className:"rounded-lg bg-[hsl(var(--deck-surface-2))] px-3 py-2.5 text-[12px] text-[hsl(var(--deck-ink-muted))]",children:s("chat.review.noFindings")}):e.jsx("ol",{className:"space-y-2",children:t.findings.map((a,o)=>e.jsxs("li",{className:"rounded-lg border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-3 py-2.5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsx("h5",{className:"text-[12.5px] font-medium leading-5 text-[hsl(var(--deck-ink))]",children:a.title}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:s("chat.review.confidence",{value:a.confidenceScore.toFixed(2)})})]}),e.jsx("code",{className:"mt-1 block text-[10.5px] text-[hsl(var(--deck-accent))]",children:Xt(a)}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-[12px] leading-5 text-[hsl(var(--deck-ink-muted))]",children:a.body})]},`${a.codeLocation.path}:${a.codeLocation.lineStart}:${o}`))})]}),t.error&&e.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 px-3 py-2 text-[11px] text-red-700 dark:text-red-300",children:[e.jsxs("span",{className:"font-medium",children:[s("chat.review.error"),":"]})," ",t.error]})]})]})}function es({elicitation:t,messageId:s}){const r=U(),a=p(g=>g.currentSessionRef),o=p(g=>g.setElicitation),[n,u]=h.useState(()=>ss(t.details.fields??[])),[x,v]=h.useState(()=>rs(t.details.fields??[])),[l,f]=h.useState(!1),[b,c]=h.useState(),j=t.details.fields??[],m=h.useMemo(()=>j.every(g=>{var d;if(!g.required)return!0;if(fe(g))return!!((d=x[g.name])!=null&&d.trim()||g.defaultValue!==void 0);const T=n[g.name]??g.defaultValue;return Array.isArray(T)?T.length>0:T!==void 0}),[j,x,n]);if(t.status!=="pending")return e.jsx("div",{className:"rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:r(t.status==="cancelled"?"interaction.elicitation.cancelled":"interaction.elicitation.responded")});const w=async(g,T)=>{if(!L(p.getState())&&!(!a||l)){f(!0),c(void 0);try{await ee.respondToElicitation(a,t.toolCallId,{action:g,...T?{content:T}:{}}),o(s,{...t,status:"responded"})}catch(d){c(d instanceof Error?d.message:r("interaction.elicitation.failed"))}finally{f(!1)}}},i=async()=>{try{await w("accept",as(j,n,x))}catch(g){c(g instanceof Error?g.message:String(g))}},C=()=>{if(L(p.getState()))return;const g=t.details.url;if(!g){c("MCP URL is unavailable");return}if(!window.open(g,"_blank","noopener,noreferrer")){c("The browser blocked the external window");return}w("accept")};return e.jsxs("div",{"data-pending-interaction":"elicitation",tabIndex:-1,role:"alert",className:"space-y-4 rounded-lg border border-amber-300/70 bg-amber-50/70 p-4 outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-800/70 dark:bg-amber-950/25",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ct,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{className:"font-mono text-[12px] font-semibold text-[hsl(var(--deck-ink))]",children:[r("interaction.elicitation.title")," · ",t.details.serverName]}),e.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:t.details.message}),e.jsx("div",{className:"font-mono text-[11px] text-amber-700 dark:text-amber-300",children:r("interaction.elicitation.warning")})]})]}),t.details.mode==="url"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] p-3 font-mono text-[11px]",children:[e.jsx("div",{className:"text-[hsl(var(--deck-ink-muted))]",children:t.details.domain}),e.jsx("div",{className:"mt-1 break-all text-[hsl(var(--deck-ink))]",children:t.details.url})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(se,{onClick:C,disabled:l,primary:!0,label:r("interaction.elicitation.open"),icon:e.jsx(Et,{className:"h-3.5 w-3.5"})}),e.jsx(se,{onClick:()=>void w("decline"),disabled:l,label:r("interaction.elicitation.decline")}),e.jsx(se,{onClick:()=>void w("cancel"),disabled:l,label:r("interaction.elicitation.cancel")})]})]}):e.jsxs("div",{className:"space-y-4",children:[j.map(g=>e.jsx(ts,{field:g,value:n[g.name],rawValue:x[g.name]??"",onValueChange:T=>u(d=>({...d,[g.name]:T})),onRawChange:T=>v(d=>({...d,[g.name]:T}))},g.name)),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(se,{onClick:()=>void i(),disabled:l||!m,primary:!0,label:r("interaction.elicitation.submit"),icon:l?e.jsx(P,{className:"h-3.5 w-3.5 animate-spin"}):null}),e.jsx(se,{onClick:()=>void w("decline"),disabled:l,label:r("interaction.elicitation.decline")}),e.jsx(se,{onClick:()=>void w("cancel"),disabled:l,label:r("interaction.elicitation.cancel")})]})]}),b&&e.jsx("div",{className:"rounded-md border border-red-300/70 bg-red-50 px-2.5 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:b})]})}function ts({field:t,value:s,rawValue:r,onValueChange:a,onRawChange:o}){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{htmlFor:`mcp-elicitation-${t.name}`,className:"block font-mono text-[12px] font-medium text-[hsl(var(--deck-ink))]",children:[t.title,t.required?" *":""]}),t.description&&e.jsx("div",{className:"font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:t.description}),t.type==="select"||t.type==="multi-select"||t.type==="boolean"?e.jsx("div",{id:`mcp-elicitation-${t.name}`,className:"flex flex-wrap gap-2",children:ns(t).map(n=>{const u=Array.isArray(s)?s.includes(n.value):s===n.typedValue;return e.jsx("button",{type:"button","aria-pressed":u,onClick:()=>{if(t.type==="multi-select"){const x=Array.isArray(s)?s:[];a(x.includes(n.value)?x.filter(v=>v!==n.value):[...x,n.value])}else a(n.typedValue)},className:$("rounded-md border px-3 py-2 font-mono text-[12px] transition-colors",u?"border-emerald-500 bg-emerald-50 text-emerald-800 dark:bg-emerald-950/40 dark:text-emerald-200":"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),children:n.label},n.value)})}):e.jsx("input",{id:`mcp-elicitation-${t.name}`,type:is(t),value:r,onChange:n=>o(n.target.value),min:t.minimum,max:t.maximum,minLength:t.minLength,maxLength:t.maxLength,required:t.required,placeholder:t.defaultValue===void 0?t.required?"Required":"Optional":String(t.defaultValue),className:"w-full rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2 font-mono text-[12px] text-[hsl(var(--deck-ink))] outline-none transition-colors focus:border-amber-500 focus:ring-1 focus:ring-amber-500"})]})}function se({onClick:t,disabled:s,primary:r=!1,label:a,icon:o}){return e.jsxs("button",{type:"button",onClick:t,disabled:s,className:$("inline-flex min-h-8 items-center gap-1.5 rounded-md px-3 py-1.5 font-mono text-[12px] transition-colors disabled:cursor-wait disabled:opacity-50",r?"bg-amber-600 text-white hover:bg-amber-700":"border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] text-[hsl(var(--deck-ink-muted))] hover:text-[hsl(var(--deck-ink))]"),children:[o,a]})}function ss(t){return Object.fromEntries(t.filter(s=>!fe(s)&&s.defaultValue!==void 0).map(s=>[s.name,Array.isArray(s.defaultValue)?[...s.defaultValue]:s.defaultValue]))}function rs(t){return Object.fromEntries(t.filter(s=>fe(s)&&s.defaultValue!==void 0).map(s=>[s.name,String(s.defaultValue)]))}function as(t,s,r){var o;const a={};for(const n of t){if(fe(n)){const x=((o=r[n.name])==null?void 0:o.trim())??"";if(!x){if(n.defaultValue!==void 0)a[n.name]=n.defaultValue;else if(n.required)throw new Error(`${n.title} is required`);continue}if(n.type==="number"||n.type==="integer"){const v=Number(x);if(!Number.isFinite(v))throw new Error(`${n.title} must be a finite number`);if(n.type==="integer"&&!Number.isSafeInteger(v))throw new Error(`${n.title} must be a safe integer`);a[n.name]=v}else a[n.name]=x;continue}const u=s[n.name]??n.defaultValue;if(u===void 0){if(n.required)throw new Error(`${n.title} is required`);continue}if(Array.isArray(u)){if(n.minItems!==void 0&&u.length<n.minItems)throw new Error(`${n.title} requires at least ${n.minItems} choices`);if(n.maxItems!==void 0&&u.length>n.maxItems)throw new Error(`${n.title} allows at most ${n.maxItems} choices`)}a[n.name]=u}return a}function ns(t){return t.type==="boolean"?[{value:"true",label:"Yes",typedValue:!0},{value:"false",label:"No",typedValue:!1}]:(t.options??[]).map(s=>({...s,typedValue:s.value}))}function fe(t){return t.type==="string"||t.type==="number"||t.type==="integer"}function is(t){return t.type==="number"||t.type==="integer"?"number":t.format==="email"?"email":t.format==="uri"?"url":t.format==="date"?"date":t.format==="date-time"?"datetime-local":"text"}function os(t){if(!t||typeof t!="object"||Array.isArray(t))return;const s=t;if(!(!s.output||typeof s.output!="object"||Array.isArray(s.output)))return{output:s.output,...typeof s.schemaDigest=="string"?{schemaDigest:s.schemaDigest}:{}}}function ls({report:t}){const s=U(),[r,a]=h.useState(!1),o=JSON.stringify(t.output,null,2),n=async()=>{try{await navigator.clipboard.writeText(o),a(!0),window.setTimeout(()=>a(!1),1400)}catch{}};return e.jsxs("section",{"data-structured-output":!0,className:"overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("header",{className:"flex min-h-9 items-center justify-between gap-3 border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(dt,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-accent))]"}),e.jsx("span",{className:"font-mono text-[11px] font-semibold text-[hsl(var(--deck-ink))]",children:s("chat.structuredOutput.title")}),t.schemaDigest&&e.jsxs("span",{title:t.schemaDigest,className:"truncate font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:["sha256:",t.schemaDigest.slice(0,10)]})]}),e.jsx("button",{type:"button",onClick:n,"aria-label":s("chat.structuredOutput.copy"),title:s("chat.structuredOutput.copy"),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:r?e.jsx(pe,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-accent))]"}):e.jsx(Ze,{className:"h-3.5 w-3.5"})})]}),e.jsx("pre",{className:"max-h-[440px] overflow-auto whitespace-pre p-3 font-mono text-[11px] leading-5 text-[hsl(var(--deck-ink))]",children:o})]})}const cs=h.lazy(()=>We(()=>import("./MarkdownRenderer-BMAuTkc6.js").then(t=>t.M),__vite__mapDeps([0,1,2,3,4,5,6])).then(t=>({default:t.MarkdownRenderer})));function $e({text:t,label:s}){const[r,a]=h.useState(!1);if(!t.trim())return null;const o=async()=>{try{await navigator.clipboard.writeText(t),a(!0),window.setTimeout(()=>a(!1),1400)}catch{}};return e.jsx("button",{type:"button","aria-label":s,title:s,onClick:o,className:"flex h-6 w-6 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:r?e.jsx(pe,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-accent))]"}):e.jsx(Ze,{className:"h-3.5 w-3.5"})})}function ds(){return e.jsx("div",{className:"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] shadow-[0_1px_0_hsl(var(--deck-hairline))]",children:e.jsx(ye,{size:20,pulse:!1})})}function us(){return e.jsx("div",{className:"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-full border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas-veil))]",children:e.jsx("span",{className:"font-mono text-[11px] font-medium text-[hsl(var(--deck-ink))]",children:"U"})})}function Ie(t){let s=t;return s=s.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g,""),s=s.replace(/<file path="[^"]*">[\s\S]*?<\/file>/g,""),s=s.replace(/<attached_files>[\s\S]*?<\/attached_files>/g,""),s=s.trim(),s}function ms(t){if(typeof t=="string")return{text:Ie(t),images:[]};const s=t.filter(a=>a.type==="text").map(a=>a.text).join(`
48
+ `),r=t.filter(a=>a.type==="image_url").map(a=>a.image_url.url);return{text:Ie(s),images:r}}function Me(t){return typeof t=="string"?t:t.filter(s=>s.type==="text").map(s=>s.text).join(`
49
+ `)}function hs(t){const s=t.agentContent;return s?kt(s):Me(t.content)}function Be({content:t,syntaxHighlight:s=!0}){return e.jsx(h.Suspense,{fallback:e.jsx("pre",{className:"text-[14px] text-[hsl(var(--deck-ink))] font-mono whitespace-pre-wrap",children:t}),children:e.jsx(cs,{content:t,syntaxHighlight:s})})}function Ae({status:t}){if(!t)return null;const s={running:"bg-[#FEF3C7] text-[#92400E] dark:bg-[#F59E0B]/20 dark:text-[#FBBF24]",success:"bg-[#DCFCE7] text-[#15803D] dark:bg-[#22C55E]/20 dark:text-[#22C55E]",error:"bg-[#FEE2E2] text-[#b91c1c] dark:bg-[#EF4444]/20 dark:text-[#fca5a5]",pending:"bg-[#E5E7EB] text-[#6B7280] dark:bg-[#27272a] dark:text-[#a1a1aa]",info:"bg-[#DBEAFE] text-[#1D4ED8] dark:bg-[#3B82F6]/20 dark:text-[#60A5FA]"},r={running:"Running",success:"Success",error:"Error",pending:"Pending",info:"Info"};return e.jsx("span",{className:$("text-[11px] px-2 py-0.5 rounded-full font-mono",s[t]),children:r[t]})}function xs(t){if(!t)return"";if(typeof t=="string")try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return JSON.stringify(t,null,2)}const _e=500;function st(t,s){if(t.length<=s)return t;let r=Math.max(0,s);return r>0&&/[\uD800-\uDBFF]/.test(t.charAt(r-1))&&(r-=1),t.slice(0,r)}function Pe(t,s){if(t.length<=s)return t;let r=Math.max(0,t.length-s);return/[\uDC00-\uDFFF]/.test(t.charAt(r))&&(r+=1),t.slice(r)}function ve(t,s){if(t.length<=s)return t;if(s<=0)return"";const r=`
50
+ ... (display clipped) ...
51
+ `,a=s-r.length;if(a<=0)return Pe(t,s);const o=Math.floor(a/3);return`${st(t,o)}${r}${Pe(t,a-o)}`}function ps(t){const s=t.split(`
52
+ `),r=s.at(-1),a=r!=null&&r.startsWith("Output truncated")?r:void 0,o=a?s.slice(0,-1).join(`
53
+ `):t,n=a?`
54
+ ${a}`:"",u=Math.max(0,_e-n.length),v=o.indexOf(`
55
+ stderr:
56
+ `);let l;if(v>=0&&o.includes(`
57
+ stdout:
58
+ `)){const f=o.slice(0,v),b=o.slice(v+1),c=Math.max(0,u-1),j=Math.floor(c/2);l=`${ve(f,j)}
59
+ ${ve(b,c-j)}`}else l=ve(o,u);return{body:st(l,u),...a?{notice:a}:{},truncated:!!a||t.length>_e}}function fs({tool:t}){const[s,r]=h.useState(!1),a=xs(t.arguments),o=t.output?ps(t.output):void 0;return e.jsxs("div",{"data-tool-name":t.toolName,"data-tool-status":t.status,"data-tool-truncated":o!=null&&o.truncated?"true":"false",className:"bg-white dark:bg-[#18181b] border border-[hsl(var(--deck-border))] rounded-lg overflow-hidden",children:[e.jsxs("button",{type:"button","aria-expanded":s,"data-tool-call-id":t.toolCallId,onClick:()=>r(n=>!n),className:"w-full flex items-center justify-between px-3 py-2 bg-[hsl(var(--deck-surface-2))] hover:bg-[hsl(var(--deck-surface))] transition-colors",children:[e.jsxs("div",{className:"flex gap-2 items-center min-w-0",children:[s?e.jsx(ce,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))] shrink-0"}):e.jsx(ne,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))] shrink-0"}),e.jsx("span",{className:"text-[12px] text-[hsl(var(--deck-ink))] font-mono shrink-0",children:t.toolName}),t.summary&&e.jsx("span",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono truncate",children:t.summary})]}),e.jsx(Ae,{status:t.status})]}),t.status==="running"&&t.progressMessage&&e.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))] px-3 py-2 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 font-mono text-[10px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsx("span",{className:"truncate",children:t.progressMessage}),t.progressTotal!==void 0&&t.progress!==void 0&&e.jsxs("span",{className:"shrink-0",children:[Math.max(0,Math.min(100,Math.round(t.progress/t.progressTotal*100))),"%"]})]}),t.progressTotal!==void 0&&t.progress!==void 0&&e.jsx("div",{role:"progressbar","aria-label":`${t.toolName} progress`,"aria-valuemin":0,"aria-valuemax":t.progressTotal,"aria-valuenow":Math.min(t.progress,t.progressTotal),className:"h-1 overflow-hidden rounded-full bg-[hsl(var(--deck-border))]",children:e.jsx("div",{className:"h-full rounded-full bg-amber-500 transition-[width] duration-150",style:{width:`${Math.max(0,Math.min(100,t.progress/t.progressTotal*100))}%`}})})]}),s&&e.jsxs("div",{className:"px-3 py-2 space-y-2 border-t border-[hsl(var(--deck-border))]",children:[a&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono",children:"Arguments"}),e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[120px] overflow-y-auto",children:a})]}),o&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono",children:"Output"}),e.jsxs("pre",{"data-tool-output":!0,className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[120px] overflow-y-auto",children:[o.body,o.notice&&e.jsxs(e.Fragment,{children:[`
60
+ `,e.jsx("span",{"data-tool-truncation-notice":!0,children:o.notice})]})]})]})]})]})}function rt({toolCalls:t}){return t.length===0?null:e.jsx("div",{className:"space-y-2",children:t.map(s=>e.jsx(fs,{tool:s},s.toolCallId))})}function bs({toolCalls:t,toolCallIds:s}){const r=U(),[a,o]=h.useState(!1),n=h.useMemo(()=>new Map(t.map(b=>[b.toolCallId,b])),[t]),u=s.flatMap(b=>{const c=n.get(b);return c?[c]:[]});if(u.length===0)return null;const x=u.filter(b=>b.status==="running").length,v=u.filter(b=>b.status==="error").length,l=[...u].reverse().find(b=>b.status==="running"&&!!b.progressMessage),f=x>0?r(u.length===1?"chat.timeline.tools.runningOne":"chat.timeline.tools.running",{count:u.length}):v>0?r(u.length===1?"chat.timeline.tools.completedOneWithError":"chat.timeline.tools.completedWithErrors",{count:u.length,errors:v}):r(u.length===1?"chat.timeline.tools.completedOne":"chat.timeline.tools.completed",{count:u.length});return e.jsxs("div",{"data-agent-tool-group":!0,className:"py-0.5",children:[e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>o(b=>!b),className:"group flex min-h-7 w-full items-center gap-1.5 rounded-md px-1.5 text-left font-mono text-[11.5px] text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))]/65 hover:text-[hsl(var(--deck-ink-muted))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[a?e.jsx(ce,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(ne,{className:"h-3.5 w-3.5 shrink-0"}),x>0&&e.jsx(P,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}),e.jsx("span",{children:f}),(l==null?void 0:l.progressMessage)&&e.jsxs("span",{className:"min-w-0 truncate text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:[l.progressMessage,l.progress!==void 0&&l.progressTotal!==void 0&&` · ${Math.max(0,Math.min(100,Math.round(l.progress/l.progressTotal*100)))}%`]})]}),(l==null?void 0:l.progress)!==void 0&&l.progressTotal!==void 0&&e.jsx("div",{role:"progressbar","aria-label":`${l.toolName} progress`,"aria-valuemin":0,"aria-valuemax":l.progressTotal,"aria-valuenow":Math.min(l.progress,l.progressTotal),className:"mx-1.5 h-0.5 overflow-hidden rounded-full bg-[hsl(var(--deck-border))]",children:e.jsx("div",{className:"h-full rounded-full bg-amber-500 transition-[width] duration-150",style:{width:`${Math.max(0,Math.min(100,l.progress/l.progressTotal*100))}%`}})}),a&&e.jsx("div",{"data-agent-tool-group-details":!0,className:"mt-2 space-y-2 pl-1",children:e.jsx(rt,{toolCalls:u})})]})}function vs({content:t}){const s=U(),[r,a]=h.useState(!1);return t?e.jsxs("div",{"data-agent-thinking":!0,className:"py-0.5",children:[e.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>a(o=>!o),className:"flex min-h-7 w-full items-center gap-1.5 rounded-md px-1.5 text-left font-mono text-[11.5px] text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))]/65 hover:text-[hsl(var(--deck-ink-muted))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[r?e.jsx(ce,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))]"}):e.jsx(ne,{className:"h-4 w-4 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{children:s("chat.timeline.thinking")})]}),r&&e.jsx("div",{className:"ml-1 mt-1 border-l border-[hsl(var(--deck-border))] py-1 pl-3",children:e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] leading-5 text-[hsl(var(--deck-ink-muted))]",children:t})})]}):null}function gs({tasks:t}){if(t.length===0)return null;const s=t.filter(a=>a.status==="completed").length,r=s===t.length;return e.jsx("div",{className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:e.jsx("div",{className:"flex gap-2 items-center",children:e.jsx("span",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:r?"✓ All tasks done":`Tasks: ${s}/${t.length}`})})})}function ks({toolCalls:t}){const s=Ee(n=>n.openFilePreview),r=p(n=>ae(n.historySurfaceSelection)),a=h.useMemo(()=>{const n=new Map,u=["Write","SearchReplace","Edit","ApplyPatch"];for(const x of t){if(x.status!=="success")continue;const v=x.metadata;if(x.toolName==="ApplyPatch"&&Array.isArray(v==null?void 0:v.changes)){for(const f of v.changes)f&&typeof f=="object"&&"path"in f&&typeof f.path=="string"&&n.set(f.path,{path:f.path,toolName:x.toolName});continue}const l=v==null?void 0:v.file_path;l&&u.includes(x.toolName)&&n.set(l,{path:l,toolName:x.toolName})}return Array.from(n.values())},[t]);if(r||a.length===0)return null;const o=n=>{L(p.getState())||s({tab:"diff",targetPath:n})};return e.jsxs("div",{className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:[e.jsxs("div",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono mb-1.5",children:["Changed files (",a.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(({path:n})=>{const u=n.split("/").pop()||n;return e.jsxs("button",{onClick:()=>o(n),className:"flex items-center gap-1 px-2 py-1 text-[11px] font-mono bg-[#E5E7EB] dark:bg-[#27272a] text-[hsl(var(--deck-ink))] rounded hover:bg-[#D1D5DB] dark:hover:bg-[#3f3f46] transition-colors",title:n,children:[e.jsx(ut,{className:"w-3 h-3"}),u]},n)})})]})}function js({subagent:t}){var Y,G,X,W;const s=U(),[r,a]=h.useState(null),[o,n]=h.useState(!1),[u,x]=h.useState(null),[v,l]=h.useState(!1),[f,b]=h.useState(""),[c,j]=h.useState(!1),[m,w]=h.useState(null),[i,C]=h.useState(null),[g,T]=h.useState(null),d=p(F=>F.currentSessionRef),E=p(F=>F.isStreaming),S=p(F=>F.isTemporarySession),D=p(F=>ae(F.historySurfaceSelection));if(!t)return null;const k=t.status==="running",I=r!==null?r:k,z=t.toolCalls||u||[],N=t.output||t.thinking||z.length>0||t.sessionId,M=i&&i.status!=="running"?i:g,R=(M==null?void 0:M.id)??t.sessionId,B=((Y=M==null?void 0:M.restartRecovery)==null?void 0:Y.outcome)==="failed",H=!k&&!E&&!S&&!D&&!B&&(i==null?void 0:i.status)!=="running"&&!!(R&&d);h.useEffect(()=>{if(D||!I||k||!t.sessionId||!(d!=null&&d.projectPath)||u!==null||t.toolCalls&&t.toolCalls.length>0)return;let F=!0;return n(!0),ee.getMessages({sessionId:t.sessionId,projectPath:d.projectPath}).then(Q=>{var V,A;if(!F)return;const q=wt(Q),K=new Map;for(const O of q)if((A=(V=O.agentContent)==null?void 0:V.toolCalls)!=null&&A.length)for(const y of O.agentContent.toolCalls)K.has(y.toolCallId)||K.set(y.toolCallId,y);x(Array.from(K.values()))}).finally(()=>{F&&n(!1)}),()=>{F=!1}},[I,D,k,t.sessionId,t.toolCalls,u,d==null?void 0:d.projectPath]),h.useEffect(()=>{if(D||!t.sessionId||!d)return;let F=!0;const Q=t.rootAgentId??t.sessionId,q=t.resumeDepth??0;return ee.listSubagents(d).then(K=>{if(!F)return;T(K.find(A=>A.id===t.sessionId)??null);const V=K.filter(A=>A.id!==t.sessionId&&A.rootAgentId===Q&&A.resumeDepth>q).sort((A,O)=>O.resumeDepth-A.resumeDepth||O.lastActiveAt-A.lastActiveAt)[0];V&&C(V)}).catch(()=>{}),()=>{F=!1}},[d==null?void 0:d.sessionId,d==null?void 0:d.projectPath,D,t.sessionId,t.rootAgentId,t.resumeDepth]),h.useEffect(()=>{if(D||!i||i.status!=="running"||!d)return;let F=!0;const Q=async()=>{try{const V=(await ee.listSubagents(d)).find(A=>A.id===i.id);F&&V&&C(V)}catch{}},q=window.setInterval(()=>{Q()},1e3);return()=>{F=!1,window.clearInterval(q)}},[d,D,i==null?void 0:i.id,i==null?void 0:i.status]);const te=async()=>{if(!L(p.getState())&&!(!d||!R||!f.trim()||c)){j(!0),w(null);try{const F=await ee.resumeSubagent(d,R,f.trim());C(F.session),b(""),l(!1),a(!0)}catch(F){w(F instanceof Error?F.message:s("chat.subagent.resumeFailed"))}finally{j(!1)}}};return e.jsxs("div",{"data-subagent-id":t.id,"data-subagent-session-id":t.sessionId,className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:[e.jsxs("button",{type:"button",onClick:()=>a(!I),className:"flex gap-2 justify-between items-center w-full transition-opacity cursor-pointer hover:opacity-80",children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[k&&e.jsx(P,{className:"h-3 w-3 animate-spin text-[hsl(var(--deck-ink-muted))]"}),e.jsxs("span",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:[t.type,": ",t.description]}),e.jsx(Ae,{status:t.status==="completed"?"success":t.status==="failed"?"error":"running"}),t.type==="verification"&&t.verificationVerdict&&e.jsx("span",{"data-verification-verdict":t.verificationVerdict,className:$("rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",t.verificationVerdict==="pass"?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":t.verificationVerdict==="fail"?"bg-red-500/10 text-red-600 dark:text-red-400":"bg-amber-500/10 text-amber-600 dark:text-amber-400"),children:t.verificationVerdict}),t.resumedFrom&&e.jsx("span",{className:"rounded bg-[#EDE9FE] px-1.5 py-0.5 text-[10px] font-mono text-[#6D28D9] dark:bg-[#2E1065] dark:text-[#C4B5FD]",title:s("chat.subagent.resumedFromTitle",{id:t.resumedFrom}),children:s("chat.subagent.resumedDepth",{depth:t.resumeDepth??1})})]}),N&&e.jsx(ce,{className:$("h-3.5 w-3.5 text-[hsl(var(--deck-ink-muted))] transition-transform",I&&"rotate-180")})]}),!I&&!k&&t.output&&e.jsx("div",{"data-subagent-output-summary":!0,className:"mt-2 max-h-10 overflow-hidden whitespace-pre-wrap break-words font-mono text-[11px] text-[hsl(var(--deck-ink))]",children:t.output}),I&&e.jsxs("div",{className:"mt-2 space-y-2",children:[(t.output||t.thinking)&&e.jsxs(e.Fragment,{children:[t.output&&e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[160px] overflow-y-auto",children:t.output}),t.thinking&&e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink-muted))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[120px] overflow-y-auto",children:t.thinking})]}),o&&e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[hsl(var(--deck-ink-muted))] font-mono",children:[e.jsx(P,{className:"w-3 h-3 animate-spin"}),s("chat.subagent.loadingLogs")]}),!o&&z.length>0&&e.jsx(rt,{toolCalls:z}),i&&e.jsxs("div",{className:"rounded-md border border-[#DDD6FE] bg-[#F5F3FF] p-2 text-[11px] font-mono text-[#5B21B6] dark:border-[#4C1D95] dark:bg-[#1E1B4B] dark:text-[#C4B5FD]",children:[e.jsx("div",{children:s("chat.subagent.resumedAs",{id:i.id,status:i.status,depth:i.resumeDepth??1})}),(((G=i.result)==null?void 0:G.message)||((X=i.result)==null?void 0:X.error))&&e.jsx("div",{className:"mt-1 whitespace-pre-wrap text-[hsl(var(--deck-ink))]",children:i.result.message||i.result.error})]}),B&&((W=M==null?void 0:M.result)==null?void 0:W.error)&&e.jsx("div",{role:"alert",className:"text-[11px] text-red-600",children:M.result.error}),H&&e.jsxs("div",{className:"space-y-2",children:[v?e.jsxs("div",{className:"space-y-2 rounded-md border border-[#E5E7EB] bg-white p-2 dark:border-[#27272a] dark:bg-[#111113]",children:[e.jsx("textarea",{"aria-label":s("chat.subagent.followUpAria"),value:f,onChange:F=>b(F.target.value),placeholder:s("chat.subagent.followUpPlaceholder"),rows:3,className:"w-full resize-y rounded border border-[#D1D5DB] bg-white p-2 text-[11px] text-[#111827] outline-none focus:border-[#8B5CF6] dark:border-[#3f3f46] dark:bg-[#18181b] dark:text-[#f4f4f5]"}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{type:"button",onClick:()=>{l(!1),w(null)},className:"rounded px-2 py-1 text-[11px] text-[#6B7280] hover:bg-[#F3F4F6] dark:hover:bg-[#27272a]",children:s("chat.subagent.cancel")}),e.jsxs("button",{type:"button",onClick:()=>void te(),disabled:!f.trim()||c,className:"flex items-center gap-1 rounded bg-[#7C3AED] px-2 py-1 text-[11px] font-medium text-white disabled:opacity-50",children:[c&&e.jsx(P,{className:"w-3 h-3 animate-spin"}),s("chat.subagent.resumeAgent")]})]})]}):e.jsxs("button",{type:"button","aria-label":s("chat.subagent.resumeAria"),onClick:()=>l(!0),className:"flex items-center gap-1.5 rounded-md border border-[#D1D5DB] px-2 py-1 text-[11px] font-medium text-[#374151] transition-colors hover:bg-[#F3F4F6] dark:border-[#3f3f46] dark:text-[#d4d4d8] dark:hover:bg-[#27272a]",children:[e.jsx(me,{className:"w-3 h-3"}),s("chat.subagent.resume")]}),m&&e.jsx("div",{role:"alert",className:"text-[11px] text-red-600",children:m})]})]})]})}function ys({confirmation:t,messageId:s}){const r=U(),[a,o]=h.useState(!1),[n,u]=h.useState(null),x=p(f=>f.currentSessionRef),v=p(f=>f.setConfirmation);if(!t)return null;const l=async(f,b)=>{if(!L(p.getState())&&!(!x||a)){o(!0),u(null);try{await ee.respondPermission(x,t.toolCallId,{approved:f,scope:b}),v(s,{...t,status:f?"approved":"denied"})}catch(c){u(c instanceof Error?c.message:r("interaction.permission.failed"))}finally{o(!1)}}};return t.status!=="pending"?null:e.jsxs("div",{"data-pending-interaction":"permission",tabIndex:-1,role:"alert",className:"space-y-3 rounded-lg border border-amber-300/70 bg-amber-50/70 p-4 outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-800/70 dark:bg-amber-950/25",children:[e.jsx("div",{className:"text-[13px] text-[hsl(var(--deck-ink))] font-mono",children:r("interaction.permission.title",{tool:t.toolName})}),e.jsx("div",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:t.description}),t.diff&&e.jsx("pre",{className:"text-[11px] text-[hsl(var(--deck-ink))] bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-md p-2 overflow-x-auto whitespace-pre-wrap font-mono max-h-[200px] overflow-y-auto",children:t.diff}),n&&e.jsx("div",{role:"alert",className:"rounded-md border border-red-300/70 bg-red-50 px-2.5 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:n}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:()=>void l(!0,"once"),disabled:a,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#22C55E] text-white rounded-md hover:bg-[#16A34A] disabled:cursor-wait disabled:opacity-50",children:a?e.jsx(P,{className:"h-3.5 w-3.5 animate-spin"}):r("interaction.permission.once")}),t.allowRemember!==!1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>void l(!0,"session"),disabled:a,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#3B82F6] text-white rounded-md hover:bg-[#2563EB] disabled:cursor-wait disabled:opacity-50",children:r("interaction.permission.session")}),e.jsx("button",{type:"button",onClick:()=>void l(!0,"project"),disabled:a,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#6366F1] text-white rounded-md hover:bg-[#4F46E5] disabled:cursor-wait disabled:opacity-50",children:r("interaction.permission.project")})]}),e.jsx("button",{type:"button",onClick:()=>void l(!1),disabled:a,className:"min-h-8 px-3 py-1.5 text-[12px] font-mono bg-[#EF4444] text-white rounded-md hover:bg-[#DC2626] disabled:cursor-wait disabled:opacity-50",children:r("interaction.permission.deny")})]})]})}function ws({question:t,messageId:s}){const r=U(),[a,o]=h.useState({}),[n,u]=h.useState({}),[x,v]=h.useState(!1),[l,f]=h.useState(null),b=p(i=>i.currentSessionRef),c=p(i=>i.setQuestion),j=h.useMemo(()=>t?t.questions.reduce((i,C)=>{var E;const g=(E=n[C.header])==null?void 0:E.trim(),T=a[C.header];if(C.multiSelect){const S=Array.isArray(T)?[...T]:[];return g&&S.push(g),S.length>0&&(i[C.header]=S),i}const d=g||(typeof T=="string"?T:"");return d&&(i[C.header]=d),i},{}):{},[a,n,t]),m=(t==null?void 0:t.questions.every(i=>i.header in j))??!1;if(!t)return null;const w=async()=>{if(!L(p.getState())&&!(!b||x||!m)){v(!0),f(null);try{await ee.respondToQuestion(b,t.toolCallId,j),c(s,{...t,status:"answered",answers:j})}catch(i){f(i instanceof Error?i.message:r("interaction.question.failed"))}finally{v(!1)}}};return t.status!=="pending"?e.jsx("div",{className:"bg-[hsl(var(--deck-surface-2))] border border-[hsl(var(--deck-border))] rounded-lg px-3 py-2",children:e.jsx("div",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:r("interaction.question.answered")})}):e.jsxs("div",{"data-pending-interaction":"question",tabIndex:-1,role:"alert",className:"space-y-4 rounded-lg border border-amber-300/70 bg-amber-50/70 p-4 outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-800/70 dark:bg-amber-950/25",children:[t.questions.map((i,C)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[13px] text-[hsl(var(--deck-ink))] font-mono",children:i.question}),e.jsxs("div",{className:"space-y-1",children:[i.options.map((g,T)=>e.jsxs("button",{type:"button",onClick:()=>{if(i.multiSelect){const d=a[i.header]||[],E=d.includes(g.label)?d.filter(S=>S!==g.label):[...d,g.label];o({...a,[i.header]:E})}else o({...a,[i.header]:g.label}),u({...n,[i.header]:""})},className:$("w-full text-left px-3 py-2 rounded-md border text-[12px] font-mono transition-colors","border-[hsl(var(--deck-border))]",(i.multiSelect?(a[i.header]||[]).includes(g.label):a[i.header]===g.label)?"bg-[#DCFCE7] text-[#166534] dark:bg-[#22C55E]/20 dark:text-[#E5E5E5]":"bg-[hsl(var(--deck-surface-2))] text-[hsl(var(--deck-ink-muted))]"),children:[e.jsx("div",{children:g.label}),e.jsx("div",{className:"text-[11px] text-[hsl(var(--deck-ink-faint))] mt-1",children:g.description})]},T)),e.jsx("input",{"aria-label":`${i.header} other response`,value:n[i.header]??"",onChange:g=>u({...n,[i.header]:g.target.value}),placeholder:r("interaction.question.other"),className:"w-full rounded-md border border-[#E5E7EB] bg-white px-3 py-2 text-[12px] text-[#111827] outline-none focus:border-[#22C55E] dark:border-[#27272a] dark:bg-[#111113] dark:text-[#E5E5E5]"})]})]},C)),l&&e.jsx("div",{role:"alert",className:"rounded-md border border-red-300/70 bg-red-50 px-2.5 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:l}),e.jsxs("button",{type:"button",onClick:()=>void w(),disabled:x||!m,className:"inline-flex min-h-8 items-center gap-1.5 px-3 py-1.5 text-[12px] font-mono bg-[#22C55E] text-white rounded-md hover:bg-[#16A34A] disabled:cursor-wait disabled:opacity-50",children:[x&&e.jsx(P,{className:"h-3.5 w-3.5 animate-spin"}),r("interaction.question.submit")]})]})}function Ns({message:t}){const s=t.agentContent,r=p(m=>m.isStreaming&&m.currentAssistantMessageId===t.id);if(!s){const m=Me(t.content);return m?e.jsx(Be,{content:m}):null}const{toolCalls:a,tasks:o,confirmation:n,question:u,elicitation:x}=s,v=jt(s),l=yt(s);if(!(l.length>0||o.length>0||v.length>0||n||u||x)&&r)return e.jsxs("div",{className:"flex items-center gap-2 text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(P,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{className:"text-[12px] font-mono",children:"Thinking..."})]});const c=a.length>0&&a.every(m=>m.status==="success"||m.status==="error")&&!r,j=!r;return e.jsxs("div",{className:"space-y-3",children:[l.map(m=>m.type==="thinking"?e.jsx("div",{"data-agent-timeline-block":"thinking",children:e.jsx(vs,{content:m.content})},m.id):m.type==="text"?e.jsx("div",{"data-agent-timeline-block":"text",children:e.jsx(Be,{content:m.content,syntaxHighlight:j})},m.id):e.jsx("div",{"data-agent-timeline-block":"tool_group",children:e.jsx(bs,{toolCalls:a,toolCallIds:m.toolCallIds})},m.id)),o.length>0&&e.jsx(gs,{tasks:o}),v.map(m=>e.jsx(js,{subagent:m},m.id)),n&&e.jsx(ys,{confirmation:n,messageId:t.id}),u&&e.jsx(ws,{question:u,messageId:t.id}),x&&e.jsx(es,{elicitation:x,messageId:t.id}),c&&e.jsx(ks,{toolCalls:a})]})}function Ss({message:t,showAvatar:s=!0}){var x,v,l,f;const r=t.role==="user";if(t.role==="system"){const b=Me(t.content);return e.jsx("div",{"data-chat-message-id":t.id,"data-chat-role":"system",className:"flex justify-center p-2 w-full",children:e.jsx("div",{className:"text-xs text-[hsl(var(--deck-ink-muted))] bg-[#F3F4F6] dark:bg-[#18181b] px-3 py-1 rounded-full font-mono",children:b})})}if(r){const b=(x=t.metadata)!=null&&x.userShellCommand&&typeof t.metadata.userShellCommand=="object"?t.metadata.userShellCommand:(v=t.metadata)!=null&&v.userShellExecution&&typeof t.metadata.userShellExecution=="object"?t.metadata.userShellExecution:void 0;if(b){const m=typeof b.command=="string"?b.command:"",w=b.status==="running"?"running":b.status==="completed"?"success":"error",i=typeof b.output=="string"?b.output:[typeof b.stdout=="string"?b.stdout:"",typeof b.stderr=="string"&&b.stderr?`stderr:
61
+ ${b.stderr}`:""].filter(Boolean).join(`
62
+ `);return e.jsx("div",{"data-chat-message-id":t.id,"data-chat-role":"user","data-user-shell-command":!0,className:"flex w-full justify-end p-4",children:e.jsxs("div",{className:"w-full max-w-[85%] overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 truncate font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:[e.jsx("span",{className:"mr-2 text-amber-600 dark:text-amber-400",children:"$"}),m]}),e.jsx(Ae,{status:w})]}),e.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap px-3 py-2 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:i||"(no output)"}),typeof b.exitCode=="number"&&e.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))] px-3 py-1.5 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:["exit ",b.exitCode,typeof b.durationMs=="number"?` · ${(b.durationMs/1e3).toFixed(3)}s`:"",b.truncated===!0?" · truncated":""]})]})})}const{text:c,images:j}=ms(t.content);return e.jsxs("div",{"data-chat-message-id":t.id,"data-chat-role":"user",className:"group flex gap-2 justify-end p-4 w-full items-start",children:[e.jsx("div",{className:"mt-1 flex shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:e.jsx($e,{text:c,label:"Copy message"})}),e.jsxs("div",{className:"bg-[hsl(var(--deck-surface-2))] rounded-lg px-4 py-3 max-w-[85%]",children:[c&&e.jsx("p",{className:"text-[14px] text-[hsl(var(--deck-ink))] font-mono leading-relaxed whitespace-pre-wrap",children:c}),j.length>0&&e.jsx("div",{className:$("grid gap-2",j.length===1?"grid-cols-1 mt-0":"grid-cols-2 mt-3"),children:j.map((m,w)=>e.jsx("img",{src:m,alt:`attachment-${w+1}`,className:"object-cover w-full max-h-64 rounded-md"},`${m}-${w}`))})]}),e.jsx(us,{})]})}const o=hs(t),n=Yt((l=t.metadata)==null?void 0:l.codeReview),u=os((f=t.metadata)==null?void 0:f.structuredOutput);return e.jsxs("div",{"data-chat-message-id":t.id,"data-chat-role":"assistant",className:$("group flex gap-4 justify-start w-full",s?"p-4":"px-4 pt-0 pb-3"),children:[s?e.jsx(ds,{}):e.jsx("div",{className:"w-8 shrink-0"}),e.jsxs("div",{className:"overflow-hidden flex-1 min-w-0",children:[n?e.jsx(Zt,{report:n}):u?e.jsx(ls,{report:u}):e.jsx(Ns,{message:t}),!u&&o.trim()&&e.jsx("div",{className:"mt-1.5 flex opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:e.jsx($e,{text:o,label:"Copy response"})})]})]})}const Cs=h.memo(Ss);function Es(t,s,r){return Math.max(0,t+(r-s))}function Ts(t,s,r){return Math.min(s,Math.max(0,t)+Math.max(0,r))}function Ms(t,s,r,a){const o=new Map(t.filter(u=>!!u.id).map(u=>[u.id,u])),n=new Set(r);for(const u of s){if(!u.id)continue;const x=o.get(u.id);x!==u&&(!x||!a||a(x)!==a(u))&&n.add(u.id)}return n}function Ue(t,s){return t?t.querySelector(`[data-chat-message-id="${CSS.escape(s)}"]`):null}function As({turns:t,viewportRef:s,containerRef:r,onRevealTurn:a}){const o=U(),[n,u]=h.useState(null),[x,v]=h.useState(!1),l=h.useRef(null),f=h.useCallback(()=>{var i;const c=s.current,j=r.current;if(!c||!j||t.length===0)return;const m=c.getBoundingClientRect().top;let w=((i=t[0])==null?void 0:i.id)??null;for(const C of t){const g=Ue(j,C.id);if(g)if(g.getBoundingClientRect().top-m<=24)w=C.id;else break}u(w)},[t,s,r]);h.useEffect(()=>{const c=s.current;if(!c)return;const j=()=>{l.current===null&&(l.current=window.requestAnimationFrame(()=>{l.current=null,f()}))};return f(),c.addEventListener("scroll",j,{passive:!0}),()=>{c.removeEventListener("scroll",j),l.current!==null&&(window.cancelAnimationFrame(l.current),l.current=null)}},[f,s]);const b=h.useCallback(c=>{const j=()=>{const w=Ue(r.current,c.id);w&&(w.scrollIntoView({behavior:"smooth",block:"start"}),u(c.id))};a(c.index)?j():window.requestAnimationFrame(()=>window.requestAnimationFrame(j))},[r,a]);return t.length<2?null:e.jsx("nav",{"aria-label":o("chat.turns.aria"),className:"absolute right-1 top-1/2 z-20 hidden -translate-y-1/2 sm:block",onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),onFocusCapture:()=>v(!0),onBlurCapture:c=>{c.currentTarget.contains(c.relatedTarget)||v(!1)},children:e.jsxs("div",{className:"relative flex items-center justify-end",children:[e.jsx("ul",{className:$("flex flex-col items-center gap-2 py-2 transition-opacity",x?"opacity-0":"opacity-100"),"aria-hidden":x,children:t.map(c=>e.jsx("li",{children:e.jsx("span",{className:$("block rounded-full transition-all",c.id===n?"h-2 w-2 bg-[hsl(var(--deck-accent))]":"h-1.5 w-1.5 bg-[hsl(var(--deck-ink-faint))]/40")})},c.id))}),e.jsx("div",{className:$("absolute right-0 max-h-[min(70vh,520px)] w-[280px] overflow-y-auto rounded-lg border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]/95 p-1 shadow-xl backdrop-blur transition-all",x?"pointer-events-auto translate-x-0 opacity-100":"pointer-events-none translate-x-2 opacity-0"),children:t.map((c,j)=>e.jsxs("button",{type:"button",onClick:()=>b(c),className:$("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors",c.id===n?"bg-[hsl(var(--deck-hairline))]/70 text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-hairline))]/50 hover:text-[hsl(var(--deck-ink))]"),children:[e.jsx("span",{className:$("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",c.id===n?"bg-[hsl(var(--deck-accent))]":"bg-[hsl(var(--deck-ink-faint))]/40")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block font-mono text-[9.5px] uppercase tracking-[0.12em] text-[hsl(var(--deck-ink-faint))]",children:o("chat.turns.label",{n:j+1})}),e.jsx("span",{className:"line-clamp-2 text-[12px] leading-4",children:c.preview})]})]},c.id))})]})})}const Le=80;function Fs(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(s=>s.type==="text").map(s=>s.text).join(" "):""}function Rs(t){const s=Fs(t).replace(/\s+/g," ").trim();return s?s.length>Le?`${s.slice(0,Le-1)}…`:s:""}function Ds(t){const s=[];for(let r=0;r<t.length;r+=1){const a=t[r];if(a.role!=="user"||!a.id)continue;const o=Rs(a.content);o&&s.push({id:a.id,index:r,preview:o})}return s}const ge=120,ke=80,$s=96;function ie(t){return(t==null?void 0:t.querySelector("[data-radix-scroll-area-viewport]"))??null}function Is(t){return JSON.stringify([t.role,t.content,t.metadata,t.agentContent])}function Bs({messages:t,isLoading:s}){const r=U(),a=h.useRef(null),o=h.useRef(null),n=h.useRef(!0),u=h.useRef(!1),x=h.useRef(t),v=h.useRef(t),l=h.useRef(new Set),f=h.useRef(t.length),b=h.useRef(null),[c,j]=h.useState(ge),[m,w]=h.useState(!1),[i,C]=h.useState(0),g=t.length>0;x.current=t,h.useEffect(()=>{const N=ie(a.current);if(!N||u.current&&!n.current)return;const M=window.requestAnimationFrame(()=>{N.scrollTop=N.scrollHeight,u.current=!0,n.current=!0,l.current=new Set,C(0),w(!1)});return()=>window.cancelAnimationFrame(M)},[t]),h.useEffect(()=>{const N=ie(a.current);if(!N)return;o.current=N;const M=()=>{if(!u.current)return;const B=N.scrollHeight-N.scrollTop-N.clientHeight<=$s,H=n.current;n.current=B,w(!B),B?(l.current=new Set,C(0)):H&&(v.current=x.current,l.current=new Set,C(0))};return M(),N.addEventListener("scroll",M,{passive:!0}),()=>N.removeEventListener("scroll",M)},[g,s]),h.useEffect(()=>{const N=v.current;if(v.current=t,n.current){l.current.size>0&&(l.current=new Set,C(0));return}const M=Ms(N,t,l.current,Is);l.current=M,C(M.size)},[t]),h.useEffect(()=>{const N=f.current;f.current=t.length,j(M=>M>=N&&t.length>N?t.length:Math.min(Math.max(M,ge),t.length||ge))},[t.length]);const T=Math.max(t.length-c,0),d=T,E=h.useMemo(()=>t.slice(d),[t,d]),S=h.useMemo(()=>Ds(t),[t]);if(h.useLayoutEffect(()=>{var R;const N=b.current;if(!N)return;const M=ie(a.current);if(b.current=null,!!M){if((R=N.element)!=null&&R.isConnected){const B=N.element.getBoundingClientRect().top-N.viewportTop;M.scrollTop+=B;return}M.scrollTop=Es(N.scrollTop,N.scrollHeight,M.scrollHeight)}},[c]),s)return e.jsx("div",{role:"status","aria-live":"polite","aria-busy":"true",className:"flex overflow-hidden flex-1 justify-center items-center px-5 py-8 min-h-0",children:e.jsxs("div",{className:"w-full max-w-[560px]",children:[e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 animate-pulse rounded-full bg-[hsl(var(--deck-accent-soft))] blur-xl"}),e.jsx(ye,{size:42,className:"relative"})]}),e.jsxs("div",{className:"mt-4 inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--deck-accent))]",children:[e.jsx(mt,{className:"w-3 h-3"}),r("chat.list.loading.eyebrow")]}),e.jsx("h2",{className:"mt-2 text-[15px] font-medium text-[hsl(var(--deck-ink))]",children:r("chat.list.loading.title")}),e.jsx("p",{className:"mt-1 max-w-sm text-[11.5px] leading-5 text-[hsl(var(--deck-ink-faint))]",children:r("chat.list.loading.hint")})]}),e.jsx("div",{"aria-hidden":"true",className:"mt-7 space-y-4 rounded-xl border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))]/45 px-4 py-5",children:[72,88,64].map((N,M)=>e.jsxs("div",{className:$("flex gap-3",M%2===1&&"flex-row-reverse"),children:[e.jsx("span",{className:"h-7 w-7 shrink-0 animate-pulse rounded-md bg-[hsl(var(--deck-surface-2))]"}),e.jsx("span",{className:"h-10 animate-pulse rounded-lg bg-[hsl(var(--deck-surface-2))]",style:{width:`${N}%`,animationDelay:`${M*120}ms`}})]},N))})]})});if(t.length===0&&!s)return e.jsx("div",{className:"flex flex-1 justify-center items-center",children:e.jsxs("div",{className:"flex flex-col gap-4 items-center text-center",children:[e.jsx(ye,{size:44}),e.jsxs("div",{children:[e.jsx("div",{className:"deck-eyebrow text-[hsl(var(--deck-accent))]",children:r("chat.list.empty.eyebrow")}),e.jsx("div",{className:"mt-2 text-[15px] font-medium text-[hsl(var(--deck-ink))]",children:r("chat.list.empty.title")}),e.jsx("div",{className:"mt-1 max-w-xs text-[12px] text-[hsl(var(--deck-ink-muted))]",children:r("chat.list.empty.hint")})]})]})});const D=()=>{const N=ie(a.current);N&&(N.scrollTop=N.scrollHeight,n.current=!0,u.current=!0,l.current=new Set,C(0),w(!1))},k=()=>{var M;const N=ie(a.current);if(N){const R=((M=a.current)==null?void 0:M.querySelector("[data-chat-message-id]"))??null;b.current={element:R,viewportTop:(R==null?void 0:R.getBoundingClientRect().top)??0,scrollHeight:N.scrollHeight,scrollTop:N.scrollTop}}j(R=>Ts(R,t.length,ke))},I=N=>N>=d?!0:(j(t.length),!1),z=i===1?r("chat.list.unreadMessage"):r("chat.list.unreadMessages",{count:i});return e.jsxs("div",{ref:a,className:"relative flex-1 min-h-0",children:[e.jsx(Tt,{className:"h-full",children:e.jsxs("div",{className:"flex flex-col px-4 pb-4 w-full md:px-6",children:[T>0&&e.jsx("div",{className:"flex justify-center py-3",children:e.jsx("button",{type:"button",onClick:k,"aria-label":r("chat.list.showEarlierWithRemaining",{count:Math.min(T,ke),remaining:T}),className:"rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-1.5 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:r("chat.list.showEarlier",{count:Math.min(T,ke)})})}),E.map((N,M)=>{const R=d+M,B=R>0?t[R-1]:null,H=!B||B.role!==N.role||B.role==="user";return e.jsx(Cs,{message:N,showAvatar:H},N.id||`msg-${R}`)})]})}),e.jsx(As,{turns:S,viewportRef:o,containerRef:a,onRevealTurn:I}),m&&e.jsxs("button",{type:"button",onClick:D,"aria-live":"polite","aria-label":i>0?z:r("chat.list.jumpLatest"),className:"absolute bottom-4 left-1/2 z-10 inline-flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-[hsl(var(--deck-border-strong))] bg-[hsl(var(--deck-surface))]/95 px-3 py-1.5 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] shadow-lg backdrop-blur transition-colors hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:[e.jsx(Te,{className:"h-3.5 w-3.5 text-[hsl(var(--deck-accent))]"}),i>0?z:r("chat.list.jumpLatest")]})]})}const at=h.memo(Bs);function _s({queue:t,mutation:s,onMutate:r,onRefresh:a}){const o=U(),[n,u]=h.useState(!1),x=h.useRef(null),v=h.useRef(null),l=h.useRef(null);h.useLayoutEffect(()=>{var m,w,i;if(s.pending||!x.current)return;const c=x.current;x.current=null,(i=Array.from(((m=v.current)==null?void 0:m.querySelectorAll("[data-follow-up-focus-id]"))??[]).find(C=>C.dataset.followUpFocusId===c)??((w=v.current)==null?void 0:w.querySelector("button")))==null||i.focus()},[s.pending,t==null?void 0:t.version]);const f=h.useCallback(async c=>{x.current=c.messageId,await r(c)},[r]),b=h.useCallback((c,j)=>{f({type:"move",messageId:c,toPosition:j})},[f]);return!t||t.pending===0&&!s.errorMessage?null:e.jsxs("section",{ref:v,"data-blade-follow-up-queue":!0,className:"mx-4 mb-2 overflow-hidden rounded-lg border border-amber-300/70 bg-amber-50/70 shadow-sm dark:border-amber-900/60 dark:bg-amber-950/25 md:mx-6","aria-label":o("chat.followUpQueue.title"),children:[e.jsxs("button",{type:"button","aria-label":o(n?"chat.followUpQueue.hide":"chat.followUpQueue.show"),"aria-expanded":n,onClick:()=>u(c=>!c),className:"flex min-h-10 w-full items-center gap-2 px-3 text-left font-mono text-[11px] text-amber-950 transition-colors hover:bg-amber-100/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-amber-500 dark:text-amber-100 dark:hover:bg-amber-900/35",children:[e.jsx(Lt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"font-semibold",children:o("chat.followUpQueue.count",{count:t.pending})}),t.locked>0&&e.jsx("span",{className:"text-amber-700/80 dark:text-amber-300/75",children:o("chat.followUpQueue.lockedCount",{count:t.locked})}),e.jsx(ne,{className:`ml-auto h-3.5 w-3.5 transition-transform ${n?"rotate-90":""}`,"aria-hidden":!0})]}),n&&e.jsxs("div",{className:"border-t border-amber-300/60 px-2 py-2 dark:border-amber-900/50",children:[s.errorMessage&&e.jsxs("div",{role:"alert",className:"mb-2 flex items-center gap-2 rounded-md border border-red-200 bg-red-50 px-2.5 py-2 text-[11px] text-red-700 dark:border-red-900/60 dark:bg-red-950/35 dark:text-red-300",children:[e.jsx("span",{className:"min-w-0 flex-1",children:s.errorCode==="revision_conflict"?o("chat.followUpQueue.stale"):s.errorMessage}),a&&e.jsx("button",{type:"button","aria-label":o("chat.followUpQueue.refresh"),onClick:()=>void a(),className:"rounded p-1 hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 dark:hover:bg-red-900/60",children:e.jsx(Je,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("ol",{className:"space-y-1.5",children:t.items.map((c,j)=>{const m=t.items[j-1],w=t.items[j+1],i=c.mutable&&(m==null?void 0:m.mutable)===!0,C=c.mutable&&(w==null?void 0:w.mutable)===!0,g=s.pending;return e.jsxs("li",{"data-follow-up-id":c.id,"data-follow-up-state":c.state,"data-follow-up-focus-id":c.id,tabIndex:-1,draggable:c.mutable&&!s.pending,onDragStart:()=>{l.current=c.mutable?c.id:null},onDragOver:T=>{const d=l.current,E=t.items.find(S=>S.id===d);E!=null&&E.mutable&&c.mutable&&T.preventDefault()},onDrop:T=>{T.preventDefault();const d=l.current;l.current=null;const E=t.items.find(k=>k.id===d);if(!(E!=null&&E.mutable)||!c.mutable||E.id===c.id)return;const S=Math.min(E.position,c.position),D=Math.max(E.position,c.position);t.items.slice(S,D+1).some(k=>!k.mutable)||b(E.id,c.position)},onDragEnd:()=>{l.current=null},className:"flex min-w-0 items-center gap-2 rounded-md border border-amber-200/70 bg-white/75 px-2.5 py-2 dark:border-amber-900/50 dark:bg-zinc-950/45",children:[e.jsx("span",{className:"w-5 shrink-0 text-center font-mono text-[10px] text-amber-700 dark:text-amber-400",children:j+1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-xs text-[hsl(var(--deck-ink))]",children:c.kind==="internal"?o("chat.followUpQueue.internal"):c.preview||o("chat.followUpQueue.attachmentOnly")}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 font-mono text-[9px] uppercase tracking-[0.08em] text-[hsl(var(--deck-ink-faint))]",children:[e.jsx("span",{children:o(`chat.followUpQueue.delivery.${c.delivery}`)}),!c.mutable&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Ot,{className:"h-2.5 w-2.5","aria-hidden":!0}),o("chat.followUpQueue.locked")]}),c.attachmentCount>0&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ht,{className:"h-2.5 w-2.5","aria-hidden":!0}),c.attachmentCount]})]})]}),g&&s.messageId===c.id?e.jsx(P,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-amber-600"}):e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx("button",{type:"button","aria-label":o("chat.followUpQueue.moveUp",{id:c.id}),disabled:g||!i,onClick:()=>b(c.id,j-1),className:"rounded p-1 text-amber-800 transition-colors hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-500 disabled:opacity-30 dark:text-amber-300 dark:hover:bg-amber-900/50",children:e.jsx(Mt,{className:"h-3.5 w-3.5","aria-hidden":!0})}),e.jsx("button",{type:"button","aria-label":o("chat.followUpQueue.moveDown",{id:c.id}),disabled:g||!C,onClick:()=>b(c.id,j+1),className:"rounded p-1 text-amber-800 transition-colors hover:bg-amber-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-500 disabled:opacity-30 dark:text-amber-300 dark:hover:bg-amber-900/50",children:e.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0})}),e.jsx("button",{type:"button","aria-label":o("chat.followUpQueue.remove",{id:c.id}),disabled:g||!c.mutable,onClick:()=>void f({type:"remove",messageId:c.id}),className:"rounded p-1 text-red-600 transition-colors hover:bg-red-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:opacity-30 dark:text-red-400 dark:hover:bg-red-950/60",children:e.jsx(re,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]},c.id)})})]})]})}const we=Ft,Ne=Rt,Se=Dt,xe=h.forwardRef(({className:t,sideOffset:s=4,...r},a)=>e.jsx(et,{ref:a,sideOffset:s,className:$("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...r}));xe.displayName=et.displayName;const Ps={active:{labelKey:"goal.status.active",dot:"bg-[hsl(var(--deck-accent))] shadow-[0_0_6px_hsl(var(--deck-accent-glow)/0.5)]",accent:"text-[hsl(var(--deck-accent))]"},verifying:{labelKey:"goal.status.active",dot:"animate-pulse bg-sky-400",accent:"text-sky-600 dark:text-sky-300"},paused:{labelKey:"goal.status.paused",dot:"bg-amber-400",accent:"text-amber-600 dark:text-amber-300"},blocked:{labelKey:"goal.status.blocked",dot:"bg-rose-500",accent:"text-rose-600 dark:text-rose-300"},usage_limited:{labelKey:"goal.status.usageLimited",dot:"bg-orange-500",accent:"text-orange-600 dark:text-orange-300"},budget_limited:{labelKey:"goal.status.budgetLimited",dot:"bg-orange-500",accent:"text-orange-600 dark:text-orange-300"},complete:{labelKey:"goal.status.complete",dot:"bg-emerald-500",accent:"text-emerald-600 dark:text-emerald-300"}};function de(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}function Us(t){if(t<60)return`${t}s`;const s=Math.floor(t/60),r=t%60;return r===0?`${s}m`:`${s}m ${r}s`}function Ls(){var N,M,R,B,H,te,Y,G,X,W,F,Q,q,K,V;const t=U(),{locale:s}=Ye(),r=p(A=>A.goal),a=p(A=>A.pauseGoal),o=p(A=>A.resumeGoal),n=p(A=>A.editGoal),u=p(A=>A.clearGoal),x=p(A=>ae(A.historySurfaceSelection)),[v,l]=h.useState(!1),[f,b]=h.useState(!1),[c,j]=h.useState(""),[m,w]=h.useState(null),[i,C]=h.useState(!1);if(h.useEffect(()=>{l(!1),b(!1),j((r==null?void 0:r.objective)??""),C(!1)},[r==null?void 0:r.goalId]),x||!r)return null;const g=Ps[r.status],T=["active","verifying","paused","blocked"].includes(r.status),d=r.status==="active"||r.status==="verifying",E=r.status==="paused"||r.status==="blocked",S=m!==null,D=async(A,O)=>{if(!L(p.getState())){w(A);try{await O()}finally{w(null)}}},k=()=>{j(r.objective),b(!0),l(!0)},I=async A=>{A.preventDefault();const O=c.trim();if(!O||O===r.objective){b(!1);return}await D("edit",()=>n(O)),b(!1)},z=async()=>{await D("delete",u),C(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(we,{delayDuration:250,children:e.jsxs("section",{"aria-label":t("goal.aria.section"),className:"mx-3 mb-1 shrink-0","data-blade-goal-status":r.status,"data-blade-goal-recovery":(N=r.prematureStop)==null?void 0:N.consecutiveCount,"data-blade-goal-recovery-pattern":(M=r.prematureStop)==null?void 0:M.pattern,"data-blade-goal-verification-stall":(R=r.verificationStall)==null?void 0:R.consecutiveCount,"data-blade-goal-frontier-task-list":(B=r.executionFrontier)==null?void 0:B.taskListId,"data-blade-goal-frontier-total":(H=r.executionFrontier)==null?void 0:H.total,"data-blade-goal-frontier-completed":(te=r.executionFrontier)==null?void 0:te.completed,"data-blade-goal-frontier-in-progress":(Y=r.executionFrontier)==null?void 0:Y.inProgress,"data-blade-goal-frontier-pending":(G=r.executionFrontier)==null?void 0:G.pending,"data-blade-goal-frontier-blocked":(X=r.executionFrontier)==null?void 0:X.blocked,"data-blade-goal-frontier-next-task":(F=(W=r.executionFrontier)==null?void 0:W.nextTask)==null?void 0:F.id,"data-blade-goal-frontier-digest":(Q=r.executionFrontier)==null?void 0:Q.digestSha256.slice(0,16),"data-blade-goal-frontier-stall":(q=r.frontierStall)==null?void 0:q.category,"data-blade-goal-frontier-stall-count":(K=r.frontierStall)==null?void 0:K.consecutiveCount,children:[e.jsxs("div",{className:$("flex h-9 items-center gap-2 rounded-lg border px-3 transition-colors","border-[hsl(var(--deck-border))]/60 bg-[hsl(var(--deck-surface))]/80 backdrop-blur-sm",v&&"rounded-b-none border-b-0"),children:[r.status==="complete"?e.jsx(xt,{className:"h-3.5 w-3.5 shrink-0 text-emerald-500"}):e.jsx(Ht,{className:$("h-3.5 w-3.5 shrink-0",g.accent)}),e.jsx("span",{className:$("h-1.5 w-1.5 shrink-0 rounded-full",g.dot)}),e.jsx("span",{className:$("shrink-0 text-[10px] font-medium leading-none",g.accent),children:r.status==="verifying"?s==="zh"?"验证中":"Verifying":t(g.labelKey)}),e.jsx("span",{className:"h-3 w-px shrink-0 bg-[hsl(var(--deck-hairline))]"}),e.jsx("button",{type:"button","aria-label":t(v?"goal.action.collapse":"goal.action.expand"),className:"min-w-0 flex-1 truncate text-left text-[12px] leading-5 text-[hsl(var(--deck-ink))]/85 outline-none transition-colors hover:text-[hsl(var(--deck-ink))]",onClick:()=>l(A=>!A),"aria-expanded":v,title:r.objective,children:r.objective}),r.tokensUsed>0&&e.jsxs("span",{className:"hidden shrink-0 text-[10px] tabular-nums text-[hsl(var(--deck-ink-muted))] sm:inline",children:[de(r.tokensUsed),r.tokenBudget!==void 0&&`/${de(r.tokenBudget)}`]}),e.jsxs("div",{className:"flex shrink-0 items-center",children:[d&&e.jsx(ue,{label:t("goal.action.pause"),disabled:S,onClick:()=>void D("pause",a),children:m==="pause"?e.jsx(P,{className:"animate-spin"}):e.jsx($t,{})}),E&&e.jsx(ue,{label:t("goal.action.resume"),disabled:S,onClick:()=>void D("resume",o),children:m==="resume"?e.jsx(P,{className:"animate-spin"}):e.jsx(It,{})}),e.jsx(ue,{label:t(T?"goal.action.edit":"goal.action.expand"),disabled:!T&&!v,onClick:T?k:()=>l(A=>!A),children:T?e.jsx(tt,{}):e.jsx(At,{})}),e.jsx(ue,{label:t("goal.action.delete"),disabled:S,destructive:!0,onClick:()=>C(!0),children:e.jsx(re,{})})]})]}),v&&e.jsx("div",{className:"rounded-b-lg border border-t-0 border-[hsl(var(--deck-border))]/60 bg-[hsl(var(--deck-surface))]/80 px-4 py-3 backdrop-blur-sm",children:f?e.jsxs("form",{onSubmit:I,children:[e.jsx("textarea",{id:"goal-objective",value:c,onChange:A=>j(A.target.value),onKeyDown:A=>{A.key==="Escape"&&b(!1)},rows:3,autoFocus:!0,className:"w-full resize-none rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-3 py-2 text-[12px] leading-5 text-[hsl(var(--deck-ink))] outline-none transition-shadow focus:border-[hsl(var(--deck-accent))] focus:ring-1 focus:ring-[hsl(var(--deck-accent-glow))]"}),e.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>b(!1),className:"inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-hairline))]/60",children:[e.jsx(Xe,{className:"h-3 w-3"}),t("goal.action.cancel")]}),e.jsxs("button",{type:"submit",disabled:!c.trim()||m==="edit",className:"inline-flex h-7 items-center gap-1 rounded-md bg-[hsl(var(--deck-accent))] px-2.5 text-[11px] font-medium text-white transition-colors hover:bg-[hsl(var(--deck-accent))]/90 disabled:cursor-not-allowed disabled:opacity-50",children:[m==="edit"?e.jsx(P,{className:"h-3 w-3 animate-spin"}):e.jsx(pe,{className:"h-3 w-3"}),t("goal.action.save")]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"whitespace-pre-wrap text-[12px] leading-5 text-[hsl(var(--deck-ink))]/90",children:r.objective}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[10px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Pt,{className:"h-3 w-3"}),de(r.tokensUsed),r.tokenBudget!==void 0&&` / ${de(r.tokenBudget)}`," ",t("goal.metrics.tokens")]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Qt,{className:"h-3 w-3"}),Us(r.timeUsedSeconds)]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(me,{className:"h-3 w-3"}),r.continuationCount===1?t("goal.metrics.continuationOne",{n:r.continuationCount}):t("goal.metrics.continuationMany",{n:r.continuationCount})]})]}),r.prematureStop&&e.jsxs("div",{className:"mt-2 inline-flex items-center gap-1.5 font-mono text-[10px] text-amber-700 dark:text-amber-300",children:[e.jsx(me,{className:"h-3 w-3"}),s==="zh"?"恢复提示":"Recovery nudge"," ",r.prematureStop.consecutiveCount," ·"," ",r.prematureStop.pattern.replaceAll("_"," ")]}),r.completionVerification&&e.jsxs("div",{"data-goal-verification":r.completionVerification.status,className:"mt-2 rounded-md border border-sky-200/50 bg-sky-50/60 px-2.5 py-2 text-[11px] text-sky-900 dark:border-sky-400/15 dark:bg-sky-400/[0.05] dark:text-sky-100",children:[e.jsxs("p",{className:"font-mono font-medium",children:["#",r.completionVerification.attempt," ·"," ",r.completionVerification.status.toUpperCase()," ·"," ",((V=r.completionVerification.verifierSessionId)==null?void 0:V.slice(0,12))??"-",r.verificationStall?s==="zh"?` · 重复 ${r.verificationStall.consecutiveCount}/3`:` · repeat ${r.verificationStall.consecutiveCount}/3`:""]}),r.completionVerification.summary&&e.jsx("p",{className:"mt-1 line-clamp-3 whitespace-pre-wrap opacity-80",children:r.completionVerification.summary}),r.completionVerification.evidenceSha256&&e.jsxs("p",{className:"mt-1 font-mono text-[10px] opacity-60",children:["sha256:",r.completionVerification.evidenceSha256.slice(0,12)]})]}),r.statusReason&&e.jsx("div",{className:"mt-2 rounded-md border border-amber-200/50 bg-amber-50/60 px-2.5 py-1.5 text-[11px] text-amber-800 dark:border-amber-400/15 dark:bg-amber-400/[0.05] dark:text-amber-200",children:r.statusReason})]})})]})}),e.jsx(Qe,{open:i,onOpenChange:C,children:e.jsxs(Ke,{className:"max-w-[400px] border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsx(ze,{children:t("goal.dialog.title")}),e.jsx(qe,{children:t("goal.dialog.description")}),e.jsxs(Ge,{className:"mt-2",children:[e.jsx("button",{type:"button",onClick:()=>C(!1),className:"inline-flex h-8 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] px-3 text-[12px] text-[hsl(var(--deck-ink))] hover:bg-[hsl(var(--deck-hairline))]/60",children:t("goal.action.cancel")}),e.jsxs("button",{type:"button",disabled:m==="delete",onClick:()=>void z(),className:"inline-flex gap-1.5 justify-center items-center px-3 h-8 text-[12px] font-medium text-white bg-rose-600 rounded-md hover:bg-rose-500 disabled:opacity-50",children:[m==="delete"&&e.jsx(P,{className:"w-3.5 h-3.5 animate-spin"}),t("goal.action.delete")]})]})]})})]})}function ue({label:t,children:s,disabled:r,destructive:a,onClick:o}){return e.jsxs(Ne,{children:[e.jsx(Se,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":t,disabled:r,onClick:o,className:$("flex h-6 w-6 items-center justify-center rounded-md text-[hsl(var(--deck-ink-muted))] outline-none transition-colors focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent-glow))]/50 disabled:cursor-not-allowed disabled:opacity-35 [&_svg]:h-3.5 [&_svg]:w-3.5",a?"hover:bg-rose-500/10 hover:text-rose-500":"hover:bg-[hsl(var(--deck-hairline))]/60 hover:text-[hsl(var(--deck-ink))]"),children:s})}),e.jsx(xe,{side:"top",className:"text-[10px]",children:t})]})}function Os(){const t=U(),s=p(l=>l.currentSessionRef),r=p(l=>l.sessions),a=p(l=>l.messages),o=p(l=>ae(l.historySurfaceSelection)),n=h.useMemo(()=>{var f,b,c,j,m;const l=s?(f=pt(r,s))==null?void 0:f.pendingInteraction:void 0;if(l)return l.type;for(let w=a.length-1;w>=0;w-=1){const i=(b=a[w])==null?void 0:b.agentContent;if(((c=i==null?void 0:i.confirmation)==null?void 0:c.status)==="pending")return"permission";if(((j=i==null?void 0:i.question)==null?void 0:j.status)==="pending")return"question";if(((m=i==null?void 0:i.elicitation)==null?void 0:m.status)==="pending")return"elicitation"}return null},[s,a,r]);if(o||!n)return null;const u=()=>{const l=document.querySelector(`[data-pending-interaction="${n}"]`);l==null||l.scrollIntoView({block:"center",behavior:"smooth"}),window.setTimeout(()=>l==null?void 0:l.focus(),250)},x=n==="question",v=n==="elicitation";return e.jsxs("div",{role:"alert",className:"mx-3 mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-amber-300/80 bg-amber-50/95 px-3 py-2 font-mono text-amber-950 shadow-sm backdrop-blur dark:border-amber-800/80 dark:bg-amber-950/90 dark:text-amber-100 sm:mx-5",children:[e.jsx(Ce,{className:"h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),e.jsxs("div",{className:"min-w-[180px] flex-1",children:[e.jsx("div",{className:"text-[11.5px] font-semibold",children:t(x?"interaction.bar.questionTitle":v?"interaction.bar.elicitationTitle":"interaction.bar.permissionTitle")}),e.jsx("div",{className:"mt-0.5 text-[10px] leading-4 text-amber-800 dark:text-amber-300",children:t(x?"interaction.bar.questionHint":v?"interaction.bar.elicitationHint":"interaction.bar.permissionHint")})]}),e.jsxs("button",{type:"button",onClick:u,className:"inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-md border border-amber-400/80 bg-white/80 px-2.5 text-[10.5px] font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/70 dark:hover:bg-amber-900",children:[e.jsx(Te,{className:"h-3 w-3"}),t("interaction.bar.review")]})]})}const Vs=h.lazy(()=>We(()=>import("./MarkdownRenderer-BMAuTkc6.js").then(t=>t.M),__vite__mapDeps([0,1,2,3,4,5,6])).then(t=>({default:t.MarkdownRenderer})));function Hs(t){return t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function Qs(){const t=U(),s=p(a=>a.sideConversation),r=p(a=>a.dismissSideConversation);return s?e.jsx("section",{"aria-label":t("chat.side.title"),"data-blade-side-conversation":!0,"data-status":s.status,className:"shrink-0 border-y border-[hsl(var(--deck-accent)/0.28)] bg-[hsl(var(--deck-accent-soft)/0.42)]",children:e.jsxs("div",{className:"px-4 py-3 md:px-6",children:[e.jsxs("header",{className:"flex min-h-7 items-start gap-2",children:[e.jsx(Vt,{"aria-hidden":!0,className:"mt-0.5 h-4 w-4 shrink-0 text-[hsl(var(--deck-accent))]"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[e.jsx("h2",{className:"font-mono text-[11px] font-semibold uppercase text-[hsl(var(--deck-accent))]",children:t("chat.side.title")}),s.durationMs!==void 0&&e.jsxs("span",{className:"inline-flex items-center gap-1 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[e.jsx(Bt,{"aria-hidden":!0,className:"h-3 w-3"}),Hs(s.durationMs)]})]}),e.jsx("p",{className:"mt-0.5 break-words font-mono text-[11px] leading-4 text-[hsl(var(--deck-ink-muted))]",children:s.question})]}),e.jsx("button",{type:"button",onClick:r,"aria-label":t("chat.side.dismiss"),title:t("chat.side.dismiss"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:e.jsx(Xe,{"aria-hidden":!0,className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{"aria-live":"polite","aria-busy":s.status==="loading",className:"mt-2 max-h-[min(36vh,320px)] overflow-y-auto border-l-2 border-[hsl(var(--deck-accent)/0.42)] pl-3 pr-1",children:[s.status==="loading"&&e.jsxs("div",{role:"status",className:"flex min-h-9 items-center gap-2 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(P,{"aria-hidden":!0,className:"h-3.5 w-3.5 animate-spin text-[hsl(var(--deck-accent))]"}),t("chat.side.loading")]}),s.status==="error"&&e.jsxs("div",{role:"alert",className:"flex min-h-9 items-start gap-2 font-mono text-[11px] leading-5 text-red-700 dark:text-red-300",children:[e.jsx(Ce,{"aria-hidden":!0,className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"break-words",children:s.error??t("chat.side.failed")})]}),s.status==="completed"&&s.response&&e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"whitespace-pre-wrap break-words font-mono text-[12px] leading-5 text-[hsl(var(--deck-ink))]",children:s.response}),children:e.jsx(Vs,{content:s.response,className:"text-[12px] leading-5 [&_h1]:text-[14px] [&_h2]:text-[13px] [&_h3]:text-[12px]"})})]})]})}):null}function je(t){return Number.isFinite(t)?Math.max(0,t):0}function Ks(t){const s=je(t.totalInputTokens),r=je(t.cacheReadTokens),a=je(t.cacheWriteTokens),o=Math.min(r,s),n=Math.min(a,Math.max(0,s-o)),u=Math.max(0,s-o-n),x=s>0&&(r>0||a>0);return{totalInputTokens:s,cacheReadTokens:o,cacheWriteTokens:n,uncachedInputTokens:u,...x?{hitRate:o/s}:{}}}function zs(t){return t===void 0||!Number.isFinite(t)?"—":`${Math.round(Math.max(0,Math.min(1,t))*100)}%`}const qs={running:"status.phase.running",compacting:"status.phase.compacting",recovering_context:"status.phase.recoveringContext",switching_model:"status.phase.switchingModel",waiting_permission:"status.phase.waitingPermission",error:"status.phase.error",idle:""},Gs={model_changed:"status.cacheBreak.model",system_prompt_changed:"status.cacheBreak.system",tools_changed:"status.cacheBreak.tools",request_policy_changed:"status.cacheBreak.policy",ttl_expired:"status.cacheBreak.ttl",server_side:"status.cacheBreak.server"},Z=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString(),oe=t=>{const s=Math.max(0,Math.ceil(t/1e3)),r=Math.floor(s/60),a=s%60;return r>0?`${r}m ${a}s`:`${a}s`};function nt(){const t=U(),s=p(S=>S.tokenUsage),r=p(S=>S.isStreaming),a=p(S=>S.agentPhase),o=p(S=>S.providerAdmission),n=p(S=>S.providerCircuit),u=p(S=>S.providerRetry),x=p(S=>S.pendingResume),v=p(S=>S.providerStall),l=p(S=>S.actionStationarity),f=p(S=>S.turnRecovery),b=qs[a]??"",c=(u==null?void 0:u.delayMs)!==void 0?` · ${Math.max(0,Math.ceil(u.delayMs/1e3))}s`:"",j=(x==null?void 0:x.delayMs)!==void 0?` · retry in ${oe(x.delayMs)}`:"",m=(f==null?void 0:f.state)==="requires_attention"?t("status.recovery.review"):"",w=(f==null?void 0:f.state)==="requires_attention"?t(f.reason==="interrupted_tool_call"?"status.recovery.interruptedTool":"status.recovery.successfulTool"):"",i=m||(l?`${t(l.phase==="halted"?"status.phase.actionStationarityStopped":"status.phase.actionStationarityRecovering")} · ${l.toolName} · ${l.runLength}/${l.haltThreshold}`:n?n.phase==="probe"?"Provider · Recovery probe":`Provider · Circuit open${n.retryAfterMs!==void 0?` · probe in ${oe(n.retryAfterMs)}`:""}${n.recoveryRemainingMs!==void 0?` · ${oe(n.recoveryRemainingMs)}`:""}`:o?`Provider · Capacity queue ${o.queuePosition}/${Math.max(o.queueDepth,o.queuePosition)} · ${o.scope} · ${oe(o.waitMs)}`:u?u.mode==="bounded_foreground"?`Provider · Bounded recovery · ${u.attempt}/${u.maxRetries} · ${oe(u.recoveryRemainingMs??0)}`:`Provider · ${t("chat.error.action.retryingTask")} · ${u.attempt}/${u.maxRetries}${c}`:x?`Recovery attempt ${x.attempt}/${x.maxAttempts}${j}`:v?`${t("status.phase.providerStall")} · ${Math.ceil(v.durationMs/1e3)}s / ${Math.ceil(v.timeoutMs/1e3)}s`:b?t(b):""),C=s.maxContextTokens>0?Math.round(s.totalTokens/s.maxContextTokens*100):0,g=Ks(s),T=zs(g.hitRate),d=Math.min(C,100),E=C>95?"danger":C>80?"warn":"safe";return e.jsxs("div",{"data-chat-status-bar":!0,className:"flex items-center gap-2 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))]/70 px-3 py-2 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] backdrop-blur-sm sm:gap-4 sm:px-5",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:t("status.context")}),e.jsxs("span",{className:"flex gap-1 items-baseline tabular-nums",children:[e.jsx("span",{className:$("text-[12px] font-medium",E==="safe"&&"text-[hsl(var(--deck-ink))]",E==="warn"&&"text-amber-600 dark:text-amber-400",E==="danger"&&"text-red-600 dark:text-red-400"),children:Z(s.totalTokens)}),e.jsxs("span",{className:"text-[hsl(var(--deck-ink-faint))]",children:["/ ",Z(s.maxContextTokens)]})]}),s.isDefaultMaxTokens&&e.jsx(we,{children:e.jsxs(Ne,{children:[e.jsx(Se,{asChild:!0,children:e.jsx(Ut,{className:"h-3 w-3 cursor-help text-[hsl(var(--deck-ink-faint))]"})}),e.jsx(xe,{side:"top",className:"max-w-[220px]",children:e.jsx("p",{className:"text-xs",children:t("status.tokenLimitTooltip")})})]})}),e.jsxs("div",{className:"relative hidden h-2 w-32 overflow-hidden rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] sm:block","aria-hidden":"true",children:[e.jsx("div",{className:$("absolute inset-y-0 left-0 transition-[width] duration-300",E==="safe"&&"bg-[hsl(var(--deck-accent))]",E==="warn"&&"bg-amber-500",E==="danger"&&"bg-red-500"),style:{width:`${d}%`}}),e.jsx("div",{className:"flex absolute inset-0 pointer-events-none",children:[25,50,75].map(S=>e.jsx("span",{className:"absolute inset-y-0 w-px bg-[hsl(var(--deck-canvas-veil))]/60",style:{left:`${S}%`}},S))})]}),e.jsxs("span",{className:$("w-10 text-right tabular-nums text-[hsl(var(--deck-ink-faint))]",E==="warn"&&"text-amber-600 dark:text-amber-400",E==="danger"&&"text-red-600 dark:text-red-400"),children:[C,"%"]})]}),e.jsx(we,{children:e.jsxs(Ne,{children:[e.jsx(Se,{asChild:!0,children:e.jsxs("div",{className:"flex shrink-0 cursor-help items-baseline gap-2 border-l border-[hsl(var(--deck-hairline))] pl-2 sm:pl-4","data-testid":"prompt-cache-hit-rate","aria-label":`${t("status.cache")} ${T}`,children:[e.jsx("span",{className:"deck-eyebrow text-[hsl(var(--deck-ink-faint))]",children:t("status.cache")}),e.jsx("span",{className:$("tabular-nums",g.hitRate===void 0?"text-[hsl(var(--deck-ink-faint))]":"font-medium text-[hsl(var(--deck-accent))]"),children:T})]})}),e.jsx(xe,{side:"top",className:"max-w-[280px]",children:g.hitRate===void 0?e.jsx("p",{className:"text-xs",children:t("status.cacheUnavailable")}):e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsx("p",{children:t("status.cacheTooltip")}),e.jsx("p",{className:"font-mono tabular-nums",children:t("status.cacheDetails",{read:Z(g.cacheReadTokens),write:Z(g.cacheWriteTokens),uncached:Z(g.uncachedInputTokens)})}),s.cacheBreak&&e.jsx("p",{className:"text-[hsl(var(--deck-accent))]",children:t("status.cacheBreak",{reason:t(Gs[s.cacheBreak.reason]??"status.cacheBreak.server"),previous:Z(s.cacheBreak.previousCacheReadTokens),current:Z(s.cacheBreak.cacheReadTokens)})})]})})]})}),e.jsx("div",{className:"flex-1"}),(m||r&&i)&&e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:$("shrink-0",m?"h-2 w-2 rounded-sm bg-amber-500":"deck-pulse-dot")}),e.jsxs("span",{className:$("truncate",m?"text-amber-600 dark:text-amber-400":"text-[hsl(var(--deck-accent))]"),children:[i,w?e.jsxs("span",{className:"hidden sm:inline",children:[" · ",w]}):null]})]})]})}function Ws(){const{locale:t}=Ye(),s=ft(d=>d.agentTeamsEnabled),r=p(d=>d.teams),a=p(d=>d.currentSessionRef),o=p(d=>ae(d.historySurfaceSelection)),n=p(d=>d.loadTeams),[u,x]=h.useState({}),[v,l]=h.useState({}),[f,b]=h.useState({}),[c,j]=h.useState(null),[m,w]=h.useState(null),[i,C]=h.useState(null);if(h.useEffect(()=>{o||n(a??void 0)},[s,a,o,n]),o||!s||!a||r.length===0)return null;const g=async d=>{var S;if(L(p.getState()))return;const E=(S=f[d])==null?void 0:S.trim();if(!(!E||c)){j(d),C(null);try{await Re.sendMessage(a,d,v[d]??"*",E),b(D=>({...D,[d]:""})),await n(a)}catch(D){C(D instanceof Error?D.message:_(t,"actionFailed"))}finally{j(null)}}},T=async d=>{if(!L(p.getState())&&!m){w(d),C(null);try{await Re.delete(a,d),await n(a)}catch(E){C(E instanceof Error?E.message:_(t,"actionFailed"))}finally{w(null)}}};return e.jsxs("section",{"aria-label":_(t,"title"),"data-blade-team-panel":!0,className:"shrink-0 border-y border-emerald-300/50 bg-emerald-50/55 dark:border-emerald-800/55 dark:bg-emerald-950/20",children:[i&&e.jsx("div",{role:"alert",className:"border-b border-red-200 bg-red-50 px-4 py-2 font-mono text-[10px] text-red-700 dark:border-red-900 dark:bg-red-950/30 dark:text-red-300 md:px-6",children:i}),r.filter(d=>d.status!=="deleted").map(d=>{var D;const E=u[d.name]??d.status==="running",S=d.tasks.filter(k=>k.status==="completed").length;return e.jsxs("div",{className:"border-b border-emerald-200/40 last:border-0 dark:border-emerald-900/40",children:[e.jsxs("div",{className:"flex min-h-11 items-center gap-2 px-4 py-2 md:px-6",children:[e.jsx("button",{type:"button",onClick:()=>x(k=>({...k,[d.name]:!E})),"aria-label":E?_(t,"collapse"):_(t,"expand"),className:"flex h-7 w-7 items-center justify-center rounded-md text-emerald-700 hover:bg-emerald-100 dark:text-emerald-300 dark:hover:bg-emerald-900/50",children:E?e.jsx(ce,{className:"h-4 w-4"}):e.jsx(ne,{className:"h-4 w-4"})}),e.jsx(Kt,{className:"h-4 w-4 shrink-0 text-emerald-700 dark:text-emerald-300"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[e.jsx("h2",{className:"truncate font-mono text-[11px] font-semibold uppercase text-emerald-800 dark:text-emerald-200",children:d.name}),e.jsxs("span",{className:"font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[d.status," · ",d.members.length-1," ",_(t,"members")," · ",S,"/",d.tasks.length," ",_(t,"tasks")]})]}),d.description&&e.jsx("p",{className:"truncate font-mono text-[10px] text-[hsl(var(--deck-ink-muted))]",children:d.description})]}),e.jsx("button",{type:"button",onClick:()=>void T(d.name),disabled:m===d.name,"aria-label":_(t,"delete"),title:_(t,"delete"),className:"flex h-7 w-7 items-center justify-center rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-red-50 hover:text-red-600 disabled:opacity-40 dark:hover:bg-red-950/40",children:e.jsx(re,{className:"h-3.5 w-3.5"})})]}),E&&e.jsxs("div",{className:"max-h-[min(40vh,360px)] overflow-y-auto border-t border-emerald-200/40 px-4 py-3 md:px-6 dark:border-emerald-900/40",children:[e.jsxs("div",{className:"grid gap-x-6 gap-y-2 lg:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 font-mono text-[9.5px] font-semibold uppercase text-[hsl(var(--deck-ink-faint))]",children:_(t,"members")}),d.members.map(k=>e.jsxs("div",{className:"flex min-h-7 items-center gap-2 border-b border-[hsl(var(--deck-hairline)/0.55)] py-1 last:border-0",children:[e.jsx("span",{"aria-label":k.status,className:`h-1.5 w-1.5 shrink-0 rounded-full ${k.status==="running"?"bg-emerald-500":k.status==="completed"||k.status==="leader"?"bg-sky-500":k.status==="failed"?"bg-red-500":"bg-zinc-400"}`}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink))]",children:k.name}),e.jsx("span",{className:"font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:k.subagentType}),k.worktreePath&&e.jsx(Ve,{className:"h-3 w-3 text-[hsl(var(--deck-ink-faint))]","aria-label":_(t,"worktree")})]},k.id))]}),e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 font-mono text-[9.5px] font-semibold uppercase text-[hsl(var(--deck-ink-faint))]",children:_(t,"tasks")}),d.tasks.length===0?e.jsx("p",{className:"font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:_(t,"noTasks")}):d.tasks.map(k=>e.jsxs("div",{className:"flex min-h-7 items-center gap-2 border-b border-[hsl(var(--deck-hairline)/0.55)] py-1 last:border-0",children:[e.jsxs("span",{className:"w-5 shrink-0 font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:["#",k.id]}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-[hsl(var(--deck-ink))]",children:k.subject}),e.jsx("span",{className:"font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:k.status})]},k.id))]})]}),d.peerMessagingEnabled&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-emerald-200/40 pt-3 dark:border-emerald-900/40",children:[e.jsxs("select",{"aria-label":_(t,"recipient"),value:v[d.name]??"*",onChange:k=>l(I=>({...I,[d.name]:k.target.value})),className:"h-8 max-w-32 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))] px-2 font-mono text-[10px]",children:[e.jsx("option",{value:"*",children:_(t,"broadcast")}),d.members.filter(k=>k.status!=="leader").map(k=>e.jsx("option",{value:k.name,children:k.name},k.id))]}),e.jsx("input",{value:f[d.name]??"",onChange:k=>b(I=>({...I,[d.name]:k.target.value})),onKeyDown:k=>{k.key==="Enter"&&g(d.name)},placeholder:_(t,"messagePlaceholder"),className:"h-8 min-w-0 flex-1 rounded-md border border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface))] px-2 font-mono text-[10.5px] outline-none focus:border-emerald-500"}),e.jsx("button",{type:"button",onClick:()=>void g(d.name),disabled:!((D=f[d.name])!=null&&D.trim())||c===d.name,"aria-label":_(t,"send"),title:_(t,"send"),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-emerald-700 text-white hover:bg-emerald-800 disabled:opacity-40 dark:bg-emerald-600",children:e.jsx(He,{className:"h-3.5 w-3.5"})})]})]})]},d.name)})]})}function Js(t){const s=[...t].reverse().find(o=>o.role==="user");if(!s)return null;if(typeof s.content=="string")return{content:s.content,attachments:[]};const r=s.content.filter(o=>o.type==="text").map(o=>o.text).join(`
63
+ `),a=s.content.filter(o=>o.type==="image_url").map((o,n)=>{var x;const u=((x=o.image_url.url.match(/^data:([^;,]+)[;,]/))==null?void 0:x[1])??"application/octet-stream";return{id:`recovery-${s.id}-${n}`,name:`attachment-${n+1}`,mimeType:u,dataUrl:o.image_url.url}});return{content:r,attachments:a}}function Ys({messages:t,isLoading:s,isStreaming:r,isStopping:a,errorMessage:o}){const n=U(),[u,x]=h.useState(!1),v=n(o?"status.phase.error":a?"chat.input.action.stopping":r?"status.phase.running":"preview.files.status.ready");return e.jsxs("details",{"data-preview-status-disclosure":!0,open:u,onToggle:l=>x(l.currentTarget.open),className:"group hidden",children:[e.jsxs("summary",{className:"flex h-9 cursor-pointer list-none items-center gap-2 px-3 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))]",children:[r&&e.jsx("span",{className:"deck-pulse-dot"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:v}),e.jsx(ne,{className:"h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-90"})]}),u&&e.jsxs("div",{"data-preview-activity-details":!0,className:"flex h-[min(44vh,420px)] min-h-0 flex-col border-t border-[hsl(var(--deck-hairline))]",children:[o&&e.jsx("div",{role:"alert",className:"border-b border-red-200/60 bg-red-50/80 px-3 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300",children:o}),e.jsx(at,{messages:t,isLoading:s}),e.jsx(nt,{})]})]})}function hr(){var O;const t=U(),s=p(y=>y.messages),r=p(y=>y.currentSessionRef),a=p(y=>y.isStreaming),o=p(y=>y.isStopping),n=p(y=>y.sessionEventConnectionState),u=p(y=>y.pendingSteeringCount),x=p(y=>y.pendingInputDelivery),v=p(y=>y.recoveredSteeringCount),l=p(y=>y.followUpQueue),f=p(y=>y.followUpQueueMutation),b=p(y=>y.mutateFollowUpQueue),c=p(y=>y.refreshFollowUpQueue),j=p(y=>!!y.historySurfaceSelection),m=p(y=>y.isLoading),w=p(y=>y.error),i=p(y=>y.errorContext),C=p(y=>y.sessions),g=p(y=>y.sendMessage),T=p(y=>y.abortSession),d=p(y=>y.retryTask),E=p(y=>y.retryingTaskKeys),S=Ee(y=>y.openSettings),D=p(y=>y.reconnectSessionEvents),k=p(y=>y.clearError),[I,z]=h.useState(null),N=r?C.find(y=>y.sessionId===r.sessionId&&y.projectPath===r.projectPath):void 0,M=!!w&&((i==null?void 0:i.kind)==="navigation"||!(i!=null&&i.sessionRef)||Oe(i.sessionRef,r)),R=(i==null?void 0:i.failureCode)??((O=N==null?void 0:N.taskFailure)==null?void 0:O.code),B=((i==null?void 0:i.kind)==="execution"||i!=null&&i.failureCode)&&R?t(Nt(R)):w==="queue_full"?t("chat.error.queueFull"):w==="turn_unavailable"||w==="turn_active"?t("chat.error.turnChanged"):w,H=n==="connecting"||n==="reconnecting",te=a&&n!=="connected",Y=r?`session:${le(r)}`:"session:temporary",G=h.useMemo(()=>Js(s),[s]),X=r?le(r):"temporary-session",W=!!(r&&(N!=null&&N.taskRetryAvailable)&&(!R||St(R)))&&((i==null?void 0:i.kind)==="execution"||(i==null?void 0:i.kind)==="task_action"),F=(i==null?void 0:i.kind)==="execution"&&(R==="authentication"||R==="permission"||R==="model_unavailable"),Q=r?E.includes(le(r)):!1;h.useEffect(()=>{z(null)},[X]);const q=async y=>L(p.getState())?!1:g({content:y.content,modelId:y.modelId,reasoningEffort:y.reasoningEffort,serviceTier:y.serviceTier,responseVerbosity:y.responseVerbosity,communicationStyle:y.communicationStyle,...y.outputSchema?{outputSchema:y.outputSchema}:{},attachments:y.attachments.map(be=>({type:"image",content:be.dataUrl,mimeType:be.mimeType,name:be.name}))}),K=()=>{if(!L(p.getState()))return T()},V=async()=>{if(!L(p.getState())){if(F){k(),S("models");return}if(W&&r){k(),await d(r).catch(()=>{});return}if((i==null?void 0:i.kind)==="execution"&&G){z({...G,revision:Date.now()}),k();return}k(),requestAnimationFrame(()=>gt())}},A=W?t(Q?"chat.error.action.retryingTask":"chat.error.action.retryTask"):F?t("chat.error.action.checkModels"):(i==null?void 0:i.kind)==="execution"&&G?t("chat.error.action.editResend"):(i==null?void 0:i.kind)==="submission"?t("chat.error.action.returnDraft"):null;return e.jsxs("div",{"data-chat-view":!0,className:"flex h-full flex-col bg-[hsl(var(--deck-canvas))]",children:[e.jsxs("div",{"data-chat-history":!0,className:"contents",children:[M&&e.jsxs("div",{role:"alert","data-blade-session-error":!0,className:"flex min-h-11 flex-wrap items-center gap-2 border-b border-red-200/60 bg-red-50/80 px-4 py-2 font-mono text-[11px] text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300 sm:px-5",children:[e.jsx(Ce,{className:"h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1 break-words",children:[e.jsx("span",{className:"font-semibold",children:t((i==null?void 0:i.kind)==="submission"?"chat.error.title.submission":(i==null?void 0:i.kind)==="execution"?"chat.error.title.execution":(i==null?void 0:i.kind)==="navigation"?"chat.error.title.navigation":"chat.error.title.generic")})," ",B]}),A&&e.jsxs("button",{type:"button",onClick:()=>void V(),disabled:Q,className:"inline-flex min-h-7 shrink-0 items-center gap-1.5 rounded-md border border-red-300/70 bg-white/65 px-2.5 font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60 dark:border-red-800 dark:bg-red-950/45 dark:hover:bg-red-900/60",children:[W?Q?e.jsx(P,{className:"h-3 w-3 animate-spin"}):e.jsx(me,{className:"h-3 w-3"}):e.jsx(tt,{className:"h-3 w-3"}),A]}),e.jsx("button",{type:"button",onClick:k,"aria-label":t("chat.error.dismiss"),className:"p-1 text-red-500 rounded transition-colors hover:bg-red-100/60 hover:text-red-700 dark:hover:bg-red-950/60 dark:hover:text-red-100",children:"✕"})]}),(H||n==="offline")&&e.jsxs("div",{role:n==="offline"?"alert":"status","aria-live":"polite",className:"flex min-h-10 flex-wrap items-center gap-2 border-b border-amber-300/60 bg-amber-50/80 px-4 py-2 font-mono text-[11px] text-amber-900 dark:border-amber-800/60 dark:bg-amber-950/35 dark:text-amber-200 sm:px-5",children:[H?e.jsx(P,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}):e.jsx(bt,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 flex-1",children:t(H?"chat.connection.reconnecting":"chat.connection.offline")}),n==="offline"&&e.jsxs("button",{type:"button",onClick:()=>{L(p.getState())||D().catch(()=>{})},className:"inline-flex min-h-7 items-center gap-1.5 rounded-md border border-amber-400/70 bg-white/60 px-2.5 font-medium transition-colors hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:border-amber-700 dark:bg-amber-950/50 dark:hover:bg-amber-900/50",children:[e.jsx(Je,{className:"h-3 w-3"}),t("chat.connection.retry")]})]}),e.jsx(zt,{}),e.jsx(at,{messages:s,isLoading:m},r?le(r):"temporary-session"),e.jsx(Ws,{}),e.jsx(Qs,{})]}),e.jsxs("div",{"data-chat-composer-dock":!0,className:"contents",children:[e.jsx(Ys,{messages:s,isLoading:m,isStreaming:a,isStopping:o,errorMessage:M?B:null},X),e.jsx(Os,{}),e.jsx(Ls,{}),e.jsx(_s,{queue:j?null:l,mutation:f,onMutate:b,onRefresh:c}),e.jsx(vt,{draftKey:Y,draft:I==null?void 0:I.content,draftAttachments:I==null?void 0:I.attachments,draftRevision:I==null?void 0:I.revision,onSend:q,onAbort:K,disabled:m||te,isStreaming:a,isStopping:o,pendingSteeringCount:u,pendingInputDelivery:x,recoveredSteeringCount:v,workspacePath:r==null?void 0:r.projectPath},Y),e.jsx("div",{"data-chat-primary-status":!0,className:"contents",children:e.jsx(nt,{})})]})]})}export{hr as ChatView};
@@ -1,4 +1,4 @@
1
- import{R as I,j as Ke}from"./vendor-react-DofNRwfy.js";import{f as Ve,p as Se,a as xe,n as Ae,h as Je,s as Qe,d as Ne}from"./MarkdownRenderer-Ct8vtONO.js";import"./index-CCdnLriX.js";import"./vendor-radix-D6QrtXqd.js";import"./session-events-C6fPz20c.js";import"./copy-BfnFXTgG.js";function Pe(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;n[a]=e[a]}return n}function et(e,t){if(e==null)return{};var n,a,o=Pe(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function tt(e){if(Array.isArray(e))return se(e)}function nt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function at(e,t){if(e){if(typeof e=="string")return se(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?se(e,t):void 0}}function ot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{R as I,j as Ke}from"./vendor-react-DofNRwfy.js";import{f as Ve,p as Se,a as xe,n as Ae,h as Je,s as Qe,d as Ne}from"./MarkdownRenderer-BMAuTkc6.js";import"./index-DiRs2_w4.js";import"./vendor-radix-D6QrtXqd.js";import"./session-events-BqQQkbAN.js";import"./copy-d9M8JUfQ.js";function Pe(e,t){if(e==null)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)!==-1)continue;n[a]=e[a]}return n}function et(e,t){if(e==null)return{};var n,a,o=Pe(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function se(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function tt(e){if(Array.isArray(e))return se(e)}function nt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function at(e,t){if(e){if(typeof e=="string")return se(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?se(e,t):void 0}}function ot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function le(e){return tt(e)||nt(e)||at(e)||ot()}function Z(e){"@babel/helpers - typeof";return Z=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Z(e)}function rt(e,t){if(Z(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(Z(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function it(e){var t=rt(e,"string");return Z(t)=="symbol"?t:t+""}function Te(e,t,n){return(t=it(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ce.apply(null,arguments)}function Ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,a)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ee(Object(n),!0).forEach(function(a){Te(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}function st(e){var t=e.length;if(t===0||t===1)return e;if(t===2)return[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])];if(t===3)return[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])];if(t>=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var ie={};function lt(e){if(e.length===0||e.length===1)return e;var t=e.join(".");return ie[t]||(ie[t]=st(e)),ie[t]}function ct(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,a=e.filter(function(r){return r!=="token"}),o=lt(a);return o.reduce(function(r,s){return H(H({},r),n[s])},t)}function Fe(e){return e.join(" ")}function ut(e,t){var n=0;return function(a){return n+=1,a.map(function(o,r){return Ie({node:o,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(r)})})}}function Ie(e){var t=e.node,n=e.stylesheet,a=e.style,o=a===void 0?{}:a,r=e.useInlineStyles,s=e.key,i=t.properties,c=t.type,l=t.tagName,u=t.value;if(c==="text")return u;if(l){var g=ut(n,r),d;if(!r)d=H(H({},i),{},{className:Fe(i.className)});else{var p=Object.keys(n).reduce(function(b,w){return w.split(".").forEach(function(N){b.includes(N)||b.push(N)}),b},[]),f=i.className&&i.className.includes("token")?["token"]:[],v=i.className&&f.concat(i.className.filter(function(b){return!p.includes(b)}));d=H(H({},i),{},{className:Fe(v)||void 0,style:ct(i.className,Object.assign({},i.style,o),n)})}var y=g(t.children);return I.createElement(l,ce({key:s},d),y)}}const dt=function(e,t){var n=e.listLanguages();return n.indexOf(t)!==-1};var gt=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function $e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,a)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$e(Object(n),!0).forEach(function(a){Te(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}var pt=/\n/g;function ft(e){return e.match(pt)}function ht(e){var t=e.lines,n=e.startingLineNumber,a=e.style;return t.map(function(o,r){var s=r+n;return I.createElement("span",{key:"line-".concat(r),className:"react-syntax-highlighter-line-number",style:typeof a=="function"?a(s):a},"".concat(s,`
3
3
  `))})}function bt(e){var t=e.codeString,n=e.codeStyle,a=e.containerStyle,o=a===void 0?{float:"left",paddingRight:"10px"}:a,r=e.numberStyle,s=r===void 0?{}:r,i=e.startingLineNumber;return I.createElement("code",{style:Object.assign({},n,o)},ht({lines:t.replace(/\n$/,"").split(`
4
4
  `),style:s,startingLineNumber:i}))}function mt(e){return"".concat(e.toString().length,".25em")}function Re(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function De(e,t,n){var a={display:"inline-block",minWidth:mt(n),paddingRight:"1em",textAlign:"right",userSelect:"none"},o=typeof e=="function"?e(t):e,r=R(R({},a),o);return r}function J(e){var t=e.children,n=e.lineNumber,a=e.lineNumberStyle,o=e.largestLineNumber,r=e.showInlineLineNumbers,s=e.lineProps,i=s===void 0?{}:s,c=e.className,l=c===void 0?[]:c,u=e.showLineNumbers,g=e.wrapLongLines,d=e.wrapLines,p=d===void 0?!1:d,f=p?R({},typeof i=="function"?i(n):i):{};if(f.className=f.className?[].concat(le(f.className.trim().split(/\s+/)),le(l)):l,n&&r){var v=De(a,n,o);t.unshift(Re(n,v))}return g&u&&(f.style=R({display:"flex"},f.style)),{type:"element",tagName:"span",properties:f,children:t}}function ze(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var a=0;a<e.length;a++){var o=e[a];if(o.type==="text")n.push(J({children:[o],className:le(new Set(t))}));else if(o.children){var r,s=t.concat(((r=o.properties)===null||r===void 0?void 0:r.className)||[]);ze(o.children,s).forEach(function(i){return n.push(i)})}}return n}function yt(e,t,n,a,o,r,s,i,c){var l,u=ze(e.value),g=[],d=-1,p=0;function f(S,k){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return J({children:S,lineNumber:k,lineNumberStyle:i,largestLineNumber:s,showInlineLineNumbers:o,lineProps:n,className:x,showLineNumbers:a,wrapLongLines:c,wrapLines:t})}function v(S,k){if(a&&k&&o){var x=De(i,k,s);S.unshift(Re(k,x))}return S}function y(S,k){var x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||x.length>0?f(S,k,x):v(S,k)}for(var b=function(){var k=u[p],x=k.children[0].value,E=ft(x);if(E){var j=x.split(`