blade-code 0.10.127 → 0.10.129

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 (147) hide show
  1. package/dist/blade.js +2 -2
  2. package/dist/chunk-0z9nqbd0.js +2 -0
  3. package/dist/chunk-1c11sbk3.js +2 -0
  4. package/dist/{chunk-g7f3nhg2.js → chunk-1q6sasj0.js} +2 -2
  5. package/dist/chunk-1y8x5q68.js +1 -0
  6. package/dist/chunk-2bnpn8be.js +1 -0
  7. package/dist/{chunk-hbafhk9y.js → chunk-2y1qngw7.js} +1 -1
  8. package/dist/{chunk-s20hq62y.js → chunk-440v1nhy.js} +3 -3
  9. package/dist/{chunk-s6562rsq.js → chunk-44jtpg8y.js} +1 -1
  10. package/dist/{chunk-q265drks.js → chunk-53h87fmt.js} +1 -1
  11. package/dist/chunk-54yagjc7.js +2 -0
  12. package/dist/chunk-606343xt.js +1 -0
  13. package/dist/{chunk-a552m4hx.js → chunk-651cnx1s.js} +2 -2
  14. package/dist/{chunk-p0khbmbc.js → chunk-67qdrjyy.js} +1 -1
  15. package/dist/chunk-6czf04er.js +1 -0
  16. package/dist/{chunk-zm2bbagg.js → chunk-6p6ts4kv.js} +2 -2
  17. package/dist/{chunk-sca5q3tt.js → chunk-77efqpdc.js} +1 -1
  18. package/dist/{chunk-85bamng3.js → chunk-93x9xbew.js} +1 -1
  19. package/dist/chunk-9gs4eqt8.js +1 -0
  20. package/dist/{chunk-hhmhs2q1.js → chunk-9kt66etm.js} +1 -1
  21. package/dist/chunk-9pzfv6nb.js +1 -0
  22. package/dist/{chunk-eq1anf88.js → chunk-9rj01jd1.js} +2 -2
  23. package/dist/chunk-9s8saznq.js +1 -0
  24. package/dist/{chunk-gna6njws.js → chunk-9snmrjg8.js} +2 -2
  25. package/dist/{chunk-pezzyyyk.js → chunk-a60cmnmz.js} +2 -2
  26. package/dist/{chunk-adkpwx6c.js → chunk-aaxc81jc.js} +1 -1
  27. package/dist/{chunk-7n7swtwg.js → chunk-ajsw4te2.js} +2 -2
  28. package/dist/{chunk-rw2sq3mf.js → chunk-amc5d34g.js} +1 -1
  29. package/dist/{chunk-68sf54n4.js → chunk-ar5np5h5.js} +2 -2
  30. package/dist/{chunk-t727txa9.js → chunk-bamj4e6v.js} +2 -2
  31. package/dist/{chunk-sv833k2e.js → chunk-dfjmvj3d.js} +2 -2
  32. package/dist/{chunk-dknmpacf.js → chunk-dg54m1y3.js} +2 -2
  33. package/dist/{chunk-8qp8v96d.js → chunk-edtxcqxa.js} +1 -1
  34. package/dist/chunk-f8gb685p.js +2 -0
  35. package/dist/chunk-fhafrrvs.js +1 -0
  36. package/dist/{chunk-2t6b962t.js → chunk-g4xny949.js} +1 -1
  37. package/dist/chunk-gfbkrk60.js +338 -0
  38. package/dist/{chunk-1b2dkwpv.js → chunk-gmqpfm52.js} +2 -2
  39. package/dist/{chunk-2xezz3nt.js → chunk-grhsv55v.js} +2 -2
  40. package/dist/{chunk-y94239bb.js → chunk-jkfkyedn.js} +1 -1
  41. package/dist/chunk-jxh9wf3c.js +1708 -0
  42. package/dist/{chunk-a3ewfebr.js → chunk-kbxqsf93.js} +2 -2
  43. package/dist/chunk-kd3k1q9z.js +1 -0
  44. package/dist/{chunk-ve4kvj1n.js → chunk-m5vpmvrs.js} +20 -20
  45. package/dist/chunk-m9mw8ppy.js +1 -0
  46. package/dist/{chunk-r5nvt35e.js → chunk-mawx6fa5.js} +2 -2
  47. package/dist/{chunk-ye4wyq1k.js → chunk-mdew58v9.js} +1 -1
  48. package/dist/{chunk-mpwyf1fe.js → chunk-mkzze9aq.js} +2 -2
  49. package/dist/{chunk-dh03cybw.js → chunk-mvm1rzc4.js} +2 -2
  50. package/dist/chunk-nz8wbcf1.js +1 -0
  51. package/dist/{chunk-g2jx4y8f.js → chunk-p00f53yq.js} +1 -1
  52. package/dist/{chunk-wmds1jq3.js → chunk-pa636c8e.js} +1 -1
  53. package/dist/chunk-pd1b8jrv.js +1 -0
  54. package/dist/chunk-pj69j4zp.js +2 -0
  55. package/dist/{chunk-t23n4wn0.js → chunk-q6xsfm60.js} +2 -2
  56. package/dist/{chunk-1g0d9yw0.js → chunk-qcvxff27.js} +2 -2
  57. package/dist/chunk-r1b4pnce.js +94 -0
  58. package/dist/{chunk-gqv0vkg9.js → chunk-rnmt44jm.js} +2 -2
  59. package/dist/chunk-s51h6n70.js +23 -0
  60. package/dist/chunk-s6158tg7.js +170 -0
  61. package/dist/{chunk-xvn80fge.js → chunk-sfe4810k.js} +1 -1
  62. package/dist/{chunk-cw2b3383.js → chunk-sj1dzeta.js} +1 -1
  63. package/dist/{chunk-0zzh482s.js → chunk-sx77dpxw.js} +1 -1
  64. package/dist/chunk-t6bg5b37.js +1 -0
  65. package/dist/{chunk-w7n73ag8.js → chunk-tkydv9k8.js} +1 -1
  66. package/dist/{chunk-z1zr4wts.js → chunk-v52wc8yg.js} +2 -2
  67. package/dist/chunk-wzcwxhhz.js +1 -0
  68. package/dist/{chunk-shd1ec3n.js → chunk-xcmadwjv.js} +2 -2
  69. package/dist/chunk-xdphpfrg.js +14 -0
  70. package/dist/chunk-xsjtjrt9.js +10 -0
  71. package/dist/{chunk-m76jmvsf.js → chunk-y4f99y85.js} +2 -2
  72. package/dist/{chunk-xdvn6yrd.js → chunk-z03dtyh6.js} +1 -1
  73. package/dist/chunk-za8gyypy.js +171 -0
  74. package/dist/{chunk-hmwz31tc.js → chunk-zkzhm39s.js} +1 -1
  75. package/dist/{chunk-6kwg4hcv.js → chunk-zwjrensv.js} +1 -1
  76. package/dist/chunk-zzgxy86p.js +1 -0
  77. package/dist/web/assets/ChatView-Bg36FUaj.js +53 -0
  78. package/dist/web/assets/{CodeBlockHighlighter-0VOa5Mes.js → CodeBlockHighlighter-D5rB73Eo.js} +2 -2
  79. package/dist/web/assets/FilePreview-BxaBSmap.js +65 -0
  80. package/dist/web/assets/KanbanBoard-B4gx3JMo.js +16 -0
  81. package/dist/web/assets/{MarkdownRenderer-3g4TPTeI.js → MarkdownRenderer-BRH7LHhN.js} +3 -3
  82. package/dist/web/assets/ScrollArea-DikU3QeQ.js +1 -0
  83. package/dist/web/assets/SessionHistorySurface-DG80d6-F.js +6 -0
  84. package/dist/web/assets/{SettingsModal-3GMy6V-E.js → SettingsModal-Bxqkok81.js} +3 -3
  85. package/dist/web/assets/Sidebar-DGaHGcHx.js +31 -0
  86. package/dist/web/assets/TaskSwitcher-DOnLPurk.js +26 -0
  87. package/dist/web/assets/TerminalPanel-BzhCF9vw.js +6 -0
  88. package/dist/web/assets/archive-BiDGrqry.js +6 -0
  89. package/dist/web/assets/{arrow-left-03GxbYI7.js → arrow-left-BY-esOAP.js} +1 -1
  90. package/dist/web/assets/{calendar-clock-8W4ostX1.js → calendar-clock-BCyxvfVt.js} +1 -1
  91. package/dist/web/assets/chevron-right-Bg-10yuN.js +6 -0
  92. package/dist/web/assets/{chevrons-up-down-BboZzEAk.js → chevrons-up-down-M5SAJq7T.js} +1 -1
  93. package/dist/web/assets/{clock-3-aXgeptZP.js → clock-3-v-nHTA0A.js} +1 -1
  94. package/dist/web/assets/copy-p1zc_rjZ.js +6 -0
  95. package/dist/web/assets/download-D_-kbJXR.js +6 -0
  96. package/dist/web/assets/{external-link-UkIIC2ds.js → external-link-wSGTIqe3.js} +1 -1
  97. package/dist/web/assets/{folder-BOCc5dv2.js → folder-Ltm9jCS5.js} +1 -1
  98. package/dist/web/assets/index-B4186fIT.css +1 -0
  99. package/dist/web/assets/index-_xnlrekR.js +210 -0
  100. package/dist/web/assets/{pause-DVIT6IIr.js → pause-_LvCZkxM.js} +1 -1
  101. package/dist/web/assets/pencil-DB6ICr_h.js +6 -0
  102. package/dist/web/assets/{play-DsdF5dji.js → play-BRXP1rHJ.js} +1 -1
  103. package/dist/web/assets/plus-BqvjEpLw.js +6 -0
  104. package/dist/web/assets/session-events-AGMXvPey.js +22 -0
  105. package/dist/web/assets/settings-LfQbDvBA.js +6 -0
  106. package/dist/web/assets/teamService-B5FnUcet.js +1 -0
  107. package/dist/web/assets/terminal-By4sO9Gw.js +6 -0
  108. package/dist/web/assets/vendor-radix-D6QrtXqd.js +45 -0
  109. package/dist/web/index.html +3 -3
  110. package/package.json +1 -1
  111. package/dist/chunk-23wg4jvz.js +0 -8
  112. package/dist/chunk-2a0vs0a0.js +0 -1
  113. package/dist/chunk-2j2mnzdg.js +0 -2
  114. package/dist/chunk-462sbp8t.js +0 -171
  115. package/dist/chunk-54f7t2g3.js +0 -1
  116. package/dist/chunk-8k26rhcp.js +0 -1
  117. package/dist/chunk-8zftskf2.js +0 -2
  118. package/dist/chunk-9cvq8w6k.js +0 -10
  119. package/dist/chunk-9hm3hy8d.js +0 -1
  120. package/dist/chunk-9rj1may5.js +0 -1
  121. package/dist/chunk-9xzw649r.js +0 -2
  122. package/dist/chunk-a0t558d4.js +0 -169
  123. package/dist/chunk-az5eb47t.js +0 -1
  124. package/dist/chunk-d4z5cp40.js +0 -2
  125. package/dist/chunk-d71gxct6.js +0 -118
  126. package/dist/chunk-hxfqcy5r.js +0 -23
  127. package/dist/chunk-k0n2028d.js +0 -1
  128. package/dist/chunk-mg4jnq0p.js +0 -1
  129. package/dist/chunk-mxkezzj9.js +0 -1
  130. package/dist/chunk-mzxwhhnc.js +0 -1
  131. package/dist/chunk-tqjrt537.js +0 -1
  132. package/dist/chunk-xba79vkf.js +0 -1703
  133. package/dist/chunk-xgp318dt.js +0 -1
  134. package/dist/chunk-xnbzrh8b.js +0 -140
  135. package/dist/chunk-y3jbc2xx.js +0 -1
  136. package/dist/chunk-yc64nfym.js +0 -1
  137. package/dist/chunk-yqh061d8.js +0 -1
  138. package/dist/web/assets/ChatView-DCHnicTP.js +0 -58
  139. package/dist/web/assets/FilePreview-C_3KHzzj.js +0 -65
  140. package/dist/web/assets/KanbanBoard-D_NTkUnD.js +0 -16
  141. package/dist/web/assets/TaskSwitcher-eCdxu5Eo.js +0 -26
  142. package/dist/web/assets/TerminalPanel-9q9Trmv9.js +0 -6
  143. package/dist/web/assets/index-DGf6Z2kM.css +0 -1
  144. package/dist/web/assets/index-DaiT-mmo.js +0 -275
  145. package/dist/web/assets/session-events-CWzF04l4.js +0 -22
  146. package/dist/web/assets/teamService-BliaDj1Z.js +0 -1
  147. package/dist/web/assets/vendor-radix-Bc1_Q9tz.js +0 -45
@@ -1,65 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B5mUEr6D.js","assets/vendor-react-DofNRwfy.js"])))=>i.map(i=>d[i]);
2
- import{c as ee,j as $,a3 as Ge,am as xr,r as rt,L as ze,U as q,an as br,ao as vr,S as gr,y as Ot,R as Ht,B as kr,N as Gt,d as wr,ap as yr,E as jr,u as ke,$ as ft,n as Vt,o as Kt,F as Jt,aq as Nr,a as _e,s as Ve,ar as it,l as Sr,X as Cr,x as Er,_ as Tr}from"./index-DaiT-mmo.js";import{r as i,j as e}from"./vendor-react-DofNRwfy.js";import{o as jt,l as Nt}from"./session-events-CWzF04l4.js";import{A as Rr,C as Lr}from"./chevrons-up-down-BboZzEAk.js";import{A as Pr,E as St}from"./external-link-UkIIC2ds.js";import{A as Ir}from"./arrow-left-03GxbYI7.js";import{A as Dr,F as Fr}from"./folder-BOCc5dv2.js";import"./vendor-radix-Bc1_Q9tz.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 $r=ee("AppWindow",[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]);/**
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 Mr=ee("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
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 Ar=ee("ChevronsDownUp",[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]);/**
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 et=ee("FileCode",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"m10 13-2 2 2 2",key:"17smn8"}],["path",{d:"m14 17 2-2-2-2",key:"14mezr"}]]);/**
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 _r=ee("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
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 Wr=ee("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
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 Ct=ee("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/**
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 Et=ee("MousePointer2",[["path",{d:"m4 4 7.07 17 2.51-7.39L21 11.07z",key:"1vqm48"}]]);/**
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 zr=ee("TerminalSquare",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
48
- * @license lucide-react v0.300.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */const Ur=ee("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/**
53
- * @license lucide-react v0.300.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */const Br=ee("Wifi",[["path",{d:"M5 13a10 10 0 0 1 14 0",key:"6v8j51"}],["path",{d:"M8.5 16.5a5 5 0 0 1 7 0",key:"sej527"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["line",{x1:"12",x2:"12.01",y1:"20",y2:"20",key:"of4bc4"}]]),Qt=i.createContext(null);function Xt(t){const n=i.useContext(Qt);if(!n)throw new Error(`${t} must be used within <Tabs>`);return n}function qr({value:t,onValueChange:n,className:r,children:s}){const a=i.useMemo(()=>({value:t,setValue:n}),[t,n]);return e.jsx(Qt.Provider,{value:a,children:e.jsx("div",{className:r,children:s})})}function Or({className:t,children:n}){return e.jsx("div",{role:"tablist",className:$("inline-flex items-center",t),children:n})}function Xe({value:t,className:n,children:r}){const{value:s,setValue:a}=Xt("TabsTrigger"),l=s===t;return e.jsx("button",{type:"button",role:"tab","aria-selected":l,"data-state":l?"active":"inactive",onClick:()=>a(t),className:$("inline-flex items-center justify-center whitespace-nowrap rounded-sm transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))]",n),children:r})}function Ye({value:t,className:n,children:r,forceMount:s=!1}){const{value:a}=Xt("TabsContent"),l=a===t;return!l&&!s?null:e.jsx("div",{role:"tabpanel",hidden:!l,className:n,children:r})}const Hr={"ayu-dark":{background:{primary:"#0f1419",secondary:"#14191f"},text:{primary:"#e6e1cf",secondary:"#bae67e",muted:"#5c6773"},border:{light:"#2d323b"},syntax:{comment:"#5c6773",string:"#bae67e",number:"#ffcc66",keyword:"#ff8f40",function:"#73d0ff",variable:"#e6e1cf",operator:"#f29e74",type:"#73d0ff",tag:"#ff8f40",attr:"#ffd580",default:"#e6e1cf"}},dracula:{background:{primary:"#282a36",secondary:"#44475a"},text:{primary:"#f8f8f2",secondary:"#f1fa8c",muted:"#6272a4"},border:{light:"#44475a"},syntax:{comment:"#6272a4",string:"#f1fa8c",number:"#bd93f9",keyword:"#ff79c6",function:"#50fa7b",variable:"#f8f8f2",operator:"#ff79c6",type:"#8be9fd",tag:"#ff79c6",attr:"#50fa7b",default:"#f8f8f2"}},monokai:{background:{primary:"#272822",secondary:"#3e3d32"},text:{primary:"#f8f8f2",secondary:"#e6db74",muted:"#75715e"},border:{light:"#3e3d32"},syntax:{comment:"#75715e",string:"#e6db74",number:"#ae81ff",keyword:"#f92672",function:"#a6e22e",variable:"#f8f8f2",operator:"#f92672",type:"#66d9ef",tag:"#f92672",attr:"#a6e22e",default:"#f8f8f2"}},nord:{background:{primary:"#2e3440",secondary:"#3b4252"},text:{primary:"#eceff4",secondary:"#d8dee9",muted:"#4c566a"},border:{light:"#434c5e"},syntax:{comment:"#616e88",string:"#a3be8c",number:"#b48ead",keyword:"#81a1c1",function:"#88c0d0",variable:"#d8dee9",operator:"#81a1c1",type:"#8fbcbb",tag:"#81a1c1",attr:"#8fbcbb",default:"#eceff4"}},"solarized-light":{background:{primary:"#fdf6e3",secondary:"#eee8d5"},text:{primary:"#586e75",secondary:"#657b83",muted:"#93a1a1"},border:{light:"#eee8d5"},syntax:{comment:"#93a1a1",string:"#2aa198",number:"#d33682",keyword:"#859900",function:"#268bd2",variable:"#657b83",operator:"#859900",type:"#b58900",tag:"#268bd2",attr:"#93a1a1",default:"#657b83"}},"solarized-dark":{background:{primary:"#002b36",secondary:"#073642"},text:{primary:"#839496",secondary:"#93a1a1",muted:"#586e75"},border:{light:"#073642"},syntax:{comment:"#586e75",string:"#2aa198",number:"#d33682",keyword:"#859900",function:"#268bd2",variable:"#839496",operator:"#859900",type:"#b58900",tag:"#268bd2",attr:"#93a1a1",default:"#839496"}},"tokyo-night":{background:{primary:"#1a1b26",secondary:"#292e42"},text:{primary:"#a9b1d6",secondary:"#c0caf5",muted:"#565f89"},border:{light:"#292e42"},syntax:{comment:"#565f89",string:"#9ece6a",number:"#ff9e64",keyword:"#bb9af7",function:"#7aa2f7",variable:"#c0caf5",operator:"#89ddff",type:"#7dcfff",tag:"#f7768e",attr:"#7aa2f7",default:"#a9b1d6"}},github:{background:{primary:"#ffffff",secondary:"#f6f8fa"},text:{primary:"#24292f",secondary:"#57606a",muted:"#6e7781"},border:{light:"#d0d7de"},syntax:{comment:"#6e7781",string:"#0a3069",number:"#0550ae",keyword:"#cf222e",function:"#8250df",variable:"#24292f",operator:"#cf222e",type:"#0550ae",tag:"#116329",attr:"#0550ae",default:"#24292f"}},gruvbox:{background:{primary:"#282828",secondary:"#3c3836"},text:{primary:"#ebdbb2",secondary:"#d5c4a1",muted:"#928374"},border:{light:"#3c3836"},syntax:{comment:"#928374",string:"#b8bb26",number:"#d3869b",keyword:"#fb4934",function:"#b8bb26",variable:"#ebdbb2",operator:"#fe8019",type:"#fabd2f",tag:"#fb4934",attr:"#fabd2f",default:"#ebdbb2"}},"one-dark":{background:{primary:"#282c34",secondary:"#21252b"},text:{primary:"#abb2bf",secondary:"#e5c07b",muted:"#5c6370"},border:{light:"#3e4451"},syntax:{comment:"#5c6370",string:"#98c379",number:"#d19a66",keyword:"#c678dd",function:"#61afef",variable:"#e06c75",operator:"#56b6c2",type:"#e5c07b",tag:"#e06c75",attr:"#d19a66",default:"#abb2bf"}},catppuccin:{background:{primary:"#1e1e2e",secondary:"#313244"},text:{primary:"#cdd6f4",secondary:"#f5e0dc",muted:"#6c7086"},border:{light:"#313244"},syntax:{comment:"#6c7086",string:"#a6e3a1",number:"#fab387",keyword:"#cba6f7",function:"#89b4fa",variable:"#f5e0dc",operator:"#89dceb",type:"#f9e2af",tag:"#f38ba8",attr:"#f9e2af",default:"#cdd6f4"}},"rose-pine":{background:{primary:"#191724",secondary:"#1f1d2e"},text:{primary:"#e0def4",secondary:"#908caa",muted:"#6e6a86"},border:{light:"#26233a"},syntax:{comment:"#6e6a86",string:"#f6c177",number:"#ebbcba",keyword:"#c4a7e7",function:"#9ccfd8",variable:"#e0def4",operator:"#31748f",type:"#eb6f92",tag:"#eb6f92",attr:"#c4a7e7",default:"#e0def4"}},kanagawa:{background:{primary:"#1f1f28",secondary:"#2a2a37"},text:{primary:"#dcd7ba",secondary:"#c8c093",muted:"#727169"},border:{light:"#2a2a37"},syntax:{comment:"#727169",string:"#98bb6c",number:"#d27e99",keyword:"#957fb8",function:"#7e9cd8",variable:"#dcd7ba",operator:"#c0a36e",type:"#7aa89f",tag:"#e46876",attr:"#ffa066",default:"#dcd7ba"}}};function Gr(t){const n=t.replace("#",""),r=parseInt(n.substring(0,2),16),s=parseInt(n.substring(2,4),16),a=parseInt(n.substring(4,6),16);return(.299*r+.587*s+.114*a)/255<.5}function Vr(t){return{base:Gr(t.background.primary)?"vs-dark":"vs",inherit:!0,rules:[{token:"",foreground:t.text.primary.replace("#",""),background:t.background.primary.replace("#","")},{token:"comment",foreground:t.syntax.comment.replace("#",""),fontStyle:"italic"},{token:"string",foreground:t.syntax.string.replace("#","")},{token:"number",foreground:t.syntax.number.replace("#","")},{token:"keyword",foreground:t.syntax.keyword.replace("#","")},{token:"type",foreground:t.syntax.type.replace("#","")},{token:"identifier",foreground:t.syntax.variable.replace("#","")},{token:"function",foreground:t.syntax.function.replace("#","")},{token:"variable",foreground:t.syntax.variable.replace("#","")},{token:"operator",foreground:t.syntax.operator.replace("#","")},{token:"delimiter",foreground:t.syntax.operator.replace("#","")},{token:"tag",foreground:t.syntax.tag.replace("#","")},{token:"attribute.name",foreground:t.syntax.attr.replace("#","")},{token:"attribute.value",foreground:t.syntax.string.replace("#","")}],colors:{"editor.background":t.background.primary,"editor.foreground":t.text.primary,"editor.lineHighlightBackground":t.background.secondary,"editor.selectionBackground":`${t.syntax.function}40`,"editorLineNumber.foreground":t.text.muted,"editorLineNumber.activeForeground":t.text.secondary,"editorCursor.foreground":t.text.primary,"editorIndentGuide.background":t.border.light,"editorWidget.background":t.background.secondary,"editorWidget.border":t.border.light,"scrollbarSlider.background":`${t.text.muted}40`,"scrollbarSlider.hoverBackground":`${t.text.muted}60`}}}const Tt=new Set;function Rt(t,n){const r=n.toLowerCase().replace(/\s+/g,"-"),s=Hr[r];if(!s)return"vs-dark";if(!Tt.has(r)){const a=Vr(s);t.editor.defineTheme(r,a),Tt.add(r)}return r}function Me(t,n,r={}){const s=xr.parse(t),a=new URLSearchParams({projectPath:s.projectPath});for(const[l,d]of Object.entries(r))d!==void 0&&a.set(l,String(d));return`/sessions/${encodeURIComponent(s.sessionId)}/browser/${n}?${a.toString()}`}const xe={navigate:async(t,n)=>Ge(Me(t,"navigate"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),snapshot:async(t,n={})=>Ge(Me(t,"snapshot",n)),interact:async(t,n)=>Ge(Me(t,"interact"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),inspect:async(t,n)=>Ge(Me(t,"inspect",n)),screenshot:async(t,n={})=>{var s;const r=await fetch(Me(t,"inspect",{...n,target:"screenshot"}));if(!r.ok){const a=await r.json().catch(()=>{});throw new Error(((s=a==null?void 0:a.error)==null?void 0:s.message)||"Failed to capture browser image")}return r.blob()},reset:async t=>{await Ge(Me(t,"reset"),{method:"POST"})}},Kr={en:{frameTitle:"Project preview",empty:"No preview open",loading:"Loading preview…"},zh:{frameTitle:"项目预览",empty:"未打开项目预览",loading:"正在加载预览…"}};function Jr({url:t,revision:n,loadState:r,onLoad:s,onError:a}){const{locale:l}=rt(),d=Kr[l];return e.jsx("section",{"data-preview-browser":!0,className:"relative h-full min-h-0 overflow-hidden bg-white",children:t?e.jsxs(e.Fragment,{children:[e.jsx("iframe",{"data-preview-browser-frame":!0,src:t,title:d.frameTitle,sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts",referrerPolicy:"no-referrer",onLoad:s,onError:a,className:"block h-full w-full border-0 bg-white"},`${t}:${n}`),r==="loading"&&e.jsxs("div",{className:"pointer-events-none absolute inset-x-0 top-0 flex h-8 items-center justify-center border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas)/0.92)] backdrop-blur-sm",children:[e.jsx(ze,{className:"mr-2 h-3.5 w-3.5 animate-spin text-[hsl(var(--deck-accent))]"}),e.jsx("span",{className:"font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))]",children:d.loading})]})]}):e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 bg-[hsl(var(--deck-canvas-veil))] text-center",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-faint))]",children:e.jsx(et,{className:"h-5 w-5"})}),e.jsx("span",{className:"font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:d.empty})]})})}const Qr={en:{unavailable:"No active Session",empty:"No Test page",screenshotAlt:"Chromium page",selectedRef:"Selected ref",noRef:"No ref selected",valuePlaceholder:"Input value",click:"Click selected element",fill:"Fill selected control",scrollUp:"Scroll up",scrollDown:"Scroll down",snapshot:"Refresh snapshot",reset:"Reset Test browser",dom:"DOM",console:"Console",network:"Network",errors:"Errors",noEntries:"No entries",user:"User",agent:"Agent",sourceAria:"Test browser source",selectElement:"Select element from page",stopSelecting:"Stop selecting elements",addToConversation:"Add to conversation"},zh:{unavailable:"没有活动 Session",empty:"未打开测试页面",screenshotAlt:"Chromium 页面",selectedRef:"已选 ref",noRef:"未选择 ref",valuePlaceholder:"输入内容",click:"点击已选元素",fill:"填入已选控件",scrollUp:"向上滚动",scrollDown:"向下滚动",snapshot:"刷新快照",reset:"重置测试浏览器",dom:"DOM",console:"控制台",network:"网络",errors:"错误",noEntries:"暂无记录",user:"用户",agent:"Agent",sourceAria:"测试浏览器来源",selectElement:"从页面选择元素",stopSelecting:"停止选择元素",addToConversation:"添加到对话"}};function Xr(t){return t.split(`
58
- `).map(n=>{var a;const r=n.match(/\[box=(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)\]/),s=r==null?void 0:r.slice(1).map(Number);return{text:n,ref:(a=n.match(/\[ref=([a-z][a-z0-9]*)\]/))==null?void 0:a[1],...s&&s.length===4&&s.every(Number.isFinite)&&s[2]>0&&s[3]>0?{box:{x:s[0],y:s[1],width:s[2],height:s[3]}}:{}}})}function lt(t){return JSON.stringify(t.slice(0,2048)).replaceAll("<","\\u003c").replaceAll(">","\\u003e")}function Yr(t,n){const r=t.text.replace(/\s+\[ref=[^\]]+\]/g,"").replace(/\s+\[box=[^\]]+\]/g,"").trim();return['<browser_element_context trust="untrusted">',`url: ${lt(n.url)}`,`title: ${lt(n.title)}`,`element: ${lt(r)}`,...n.viewport?[`viewport: [${n.viewport.width}, ${n.viewport.height}]`]:[],...t.box?[`viewport_box: [${t.box.x}, ${t.box.y}, ${t.box.width}, ${t.box.height}]`]:[],"</browser_element_context>"].join(`
59
- `)}function Zr(t){return[t.kind,t.level,t.method,t.status,t.url,t.text].filter(n=>n!==void 0&&n!=="").join(" · ")}function es({source:t,agentAvailable:n,sessionAvailable:r,observation:s,screenshotUrl:a,interaction:l,pointerRevision:d,busy:f,error:p,diagnostics:g,diagnosticsLoading:w,onInteract:u,onInspect:k,onSnapshot:_,onReset:m,onSourceChange:j,pickerActive:v,onPickerChange:P,onAddToConversation:I}){var ce,re,de,ye;const{locale:J}=rt(),y=Qr[J],[N,O]=i.useState(null),[be,we]=i.useState(""),[Q,Re]=i.useState("dom"),ae=i.useRef(null),oe=i.useRef(null),[L,te]=i.useState({left:0,top:0,width:0,height:0,sourceWidth:0,sourceHeight:0}),M=t==="agent",W=i.useMemo(()=>Xr((s==null?void 0:s.snapshot)??""),[s==null?void 0:s.snapshot]),ie=Q==="dom"?[]:g[Q]??[],F=i.useMemo(()=>W.filter(c=>!!(c.ref&&c.box)).sort((c,E)=>E.box.width*E.box.height-c.box.width*c.box.height),[W]),H=i.useMemo(()=>W.find(c=>c.ref===N),[N,W]);i.useEffect(()=>{O(null)},[s==null?void 0:s.snapshotId]),i.useEffect(()=>{M&&Re("dom")},[M]);const A=i.useCallback(()=>{var Z,K,je,se;const c=ae.current,E=oe.current,U=((Z=s==null?void 0:s.viewport)==null?void 0:Z.width)??((K=l==null?void 0:l.viewport)==null?void 0:K.width)??(E==null?void 0:E.naturalWidth),G=((je=s==null?void 0:s.viewport)==null?void 0:je.height)??((se=l==null?void 0:l.viewport)==null?void 0:se.height)??(E==null?void 0:E.naturalHeight);if(!c||!U||!G){te({left:0,top:0,width:0,height:0,sourceWidth:0,sourceHeight:0});return}const B=c.getBoundingClientRect(),Le=Math.min(B.width/U,B.height/G),V=U*Le,ue=G*Le;te({left:(B.width-V)/2,top:(B.height-ue)/2,width:V,height:ue,sourceWidth:U,sourceHeight:G})},[(ce=l==null?void 0:l.viewport)==null?void 0:ce.height,(re=l==null?void 0:l.viewport)==null?void 0:re.width,(de=s==null?void 0:s.viewport)==null?void 0:de.height,(ye=s==null?void 0:s.viewport)==null?void 0:ye.width]);i.useEffect(()=>{A();const c=ae.current;if(!c||typeof ResizeObserver>"u")return;const E=new ResizeObserver(A);return E.observe(c),()=>E.disconnect()},[A,a]);const X=i.useMemo(()=>{const c=l==null?void 0:l.targetBox,E=l==null?void 0:l.viewport;if(!c||!E||L.width<=0||L.height<=0)return null;const U=Math.min(E.width,Math.max(0,c.x+c.width/2)),G=Math.min(E.height,Math.max(0,c.y+c.height/2));return{left:L.left+U/E.width*L.width,top:L.top+G/E.height*L.height}},[l,L]),le=c=>{M&&c!=="dom"||(Re(c),c!=="dom"&&k(c))};return e.jsxs("section",{"data-browser-test":!0,"data-browser-source":t,"data-browser-snapshot-id":s==null?void 0:s.snapshotId,className:"flex h-full min-h-0 flex-col bg-[hsl(var(--deck-canvas))]",children:[e.jsxs("div",{ref:ae,className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-neutral-950",children:[a?e.jsx("img",{ref:oe,"data-browser-test-screenshot":!0,src:a,alt:y.screenshotAlt,onLoad:A,className:"h-full w-full object-contain"}):e.jsxs("div",{className:"flex flex-col items-center gap-3 text-[hsl(var(--deck-ink-faint))]",children:[e.jsx($r,{className:"h-7 w-7"}),e.jsx("span",{className:"font-mono text-[11px]",children:r?y.empty:y.unavailable})]}),!M&&a&&L.width>0&&L.height>0&&e.jsxs("div",{"data-browser-element-layer":!0,className:"pointer-events-none absolute z-20",style:{left:L.left,top:L.top,width:L.width,height:L.height},children:[v&&!f&&F.map(c=>e.jsx("button",{type:"button","data-browser-pick-ref":c.ref,"aria-label":`${y.selectElement}: ${c.text}`,title:c.text,onClick:()=>O(c.ref),className:$("pointer-events-auto absolute cursor-crosshair border border-cyan-300/70 bg-cyan-300/5 transition-colors hover:border-cyan-300 hover:bg-cyan-300/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300",N===c.ref&&"border-2 border-cyan-300 bg-cyan-300/15"),style:{left:`${c.box.x/L.sourceWidth*100}%`,top:`${c.box.y/L.sourceHeight*100}%`,width:`${c.box.width/L.sourceWidth*100}%`,height:`${c.box.height/L.sourceHeight*100}%`}},c.ref)),!v&&(H==null?void 0:H.box)&&e.jsx("div",{"data-browser-selected-element":H.ref,className:"absolute border-2 border-cyan-300 bg-cyan-300/10 shadow-[0_0_0_1px_rgba(8,145,178,0.35)]",style:{left:`${H.box.x/L.sourceWidth*100}%`,top:`${H.box.y/L.sourceHeight*100}%`,width:`${H.box.width/L.sourceWidth*100}%`,height:`${H.box.height/L.sourceHeight*100}%`}})]}),!M&&H&&a&&e.jsxs(q,{type:"button","data-browser-add-to-composer":!0,disabled:f,onClick:()=>{s&&(I(Yr(H,s)),O(null),P(!1))},className:"absolute bottom-3 left-3 z-30 h-8 rounded-md bg-neutral-950 px-3 font-mono text-[10.5px] text-white shadow-lg hover:bg-neutral-800",children:[e.jsx(Wr,{className:"mr-1.5 h-3.5 w-3.5"}),y.addToConversation]}),M&&X&&e.jsxs("div",{"data-browser-agent-pointer":!0,"data-browser-action":l==null?void 0:l.action,className:"pointer-events-none absolute z-10 transition-[left,top] duration-300 ease-out",style:X,children:[e.jsx("span",{className:"absolute -left-2 -top-2 h-4 w-4 animate-ping rounded-full bg-cyan-400/70"},d),e.jsx(Et,{className:"relative h-5 w-5 fill-white text-neutral-950 drop-shadow-[0_1px_2px_rgba(0,0,0,0.8)]"})]}),f&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/35",children:e.jsx(ze,{className:"h-5 w-5 animate-spin text-white"})}),p&&e.jsx("div",{role:"alert",className:"absolute inset-x-0 bottom-0 border-t border-red-500/30 bg-red-950/90 px-3 py-2 font-mono text-[10.5px] text-red-200",children:p})]}),e.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-y border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-2",children:[e.jsx("div",{role:"group","aria-label":y.sourceAria,className:"flex h-7 shrink-0 items-center border border-[hsl(var(--deck-border))]",children:[["user",y.user,Ur],["agent",y.agent,br]].map(([c,E,U])=>e.jsxs("button",{type:"button",disabled:c==="agent"&&!n,"aria-pressed":t===c,onClick:()=>j(c),className:$("flex h-full items-center gap-1 border-r border-[hsl(var(--deck-border))] px-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-muted))] last:border-r-0 disabled:opacity-40",t===c&&"bg-[hsl(var(--deck-canvas-veil))] text-[hsl(var(--deck-ink))]"),children:[e.jsx(U,{className:"h-3 w-3"}),e.jsx("span",{children:E})]},c))}),e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:M||!s||!a||f,"aria-pressed":v,title:v?y.stopSelecting:y.selectElement,"aria-label":v?y.stopSelecting:y.selectElement,onClick:()=>void P(!v),className:$("h-7 w-7 rounded-md",v&&"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]"),children:e.jsx(vr,{className:"h-3.5 w-3.5"})}),e.jsx("span",{title:N?`${y.selectedRef}: ${N}`:y.noRef,className:"w-20 shrink-0 truncate font-mono text-[10px] text-[hsl(var(--deck-ink-muted))]",children:N??"ref"}),e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:M||!N||f,title:y.click,"aria-label":y.click,onClick:()=>{N&&u({kind:"click"},N)},className:"h-7 w-7 rounded-md",children:e.jsx(Et,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"flex h-7 min-w-0 flex-1 items-center border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-2",children:[e.jsx("input",{value:be,onChange:c=>we(c.target.value),disabled:M,placeholder:y.valuePlaceholder,"aria-label":y.valuePlaceholder,className:"min-w-0 flex-1 bg-transparent font-mono text-[10.5px] outline-none"}),e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:M||!N||!be||f,title:y.fill,"aria-label":y.fill,onClick:()=>{N&&u({kind:"fill",value:be},N)},className:"h-6 w-6 rounded-md",children:e.jsx(gr,{className:"h-3 w-3"})})]}),e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:M||!s||f,title:y.scrollUp,"aria-label":y.scrollUp,onClick:()=>void u({kind:"scroll",direction:"up",amount:560}),className:"h-7 w-7 rounded-md",children:e.jsx(Mr,{className:"h-3.5 w-3.5"})}),e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:M||!s||f,title:y.scrollDown,"aria-label":y.scrollDown,onClick:()=>void u({kind:"scroll",direction:"down",amount:560}),className:"h-7 w-7 rounded-md",children:e.jsx(Rr,{className:"h-3.5 w-3.5"})}),e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:M||!s||f,title:y.snapshot,"aria-label":y.snapshot,onClick:()=>void _(),className:"h-7 w-7 rounded-md",children:e.jsx(Ot,{className:"h-3.5 w-3.5"})}),e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:M||!r||f,title:y.reset,"aria-label":y.reset,onClick:()=>{O(null),m()},className:"h-7 w-7 rounded-md",children:e.jsx(Ht,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex h-[38%] min-h-32 shrink-0 flex-col overflow-hidden",children:[e.jsx("div",{role:"tablist",className:"grid h-8 shrink-0 grid-cols-4 border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[["dom",y.dom,kr],["console",y.console,zr],["network",y.network,Br],["page-errors",y.errors,Pr]].map(([c,E,U])=>e.jsxs("button",{type:"button",role:"tab",disabled:M&&c!=="dom","aria-selected":Q===c,onClick:()=>le(c),className:$("flex min-w-0 items-center justify-center gap-1 border-r border-[hsl(var(--deck-border))] px-1 font-mono text-[10px] text-[hsl(var(--deck-ink-muted))] last:border-r-0",Q===c&&"bg-[hsl(var(--deck-canvas-veil))] text-[hsl(var(--deck-ink))]"),children:[e.jsx(U,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:E})]},c))}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-[hsl(var(--deck-canvas-veil))] p-2 font-mono text-[10px] leading-5 text-[hsl(var(--deck-ink-muted))]",children:Q==="dom"?W.length>0?W.map((c,E)=>c.ref?e.jsx("button",{type:"button","data-browser-ref":c.ref,disabled:M,onClick:()=>O(c.ref??null),className:$("block w-full whitespace-pre-wrap px-1 text-left hover:bg-[hsl(var(--deck-accent)/0.08)]",N===c.ref&&"bg-[hsl(var(--deck-accent)/0.12)] text-[hsl(var(--deck-ink))]"),children:c.text},`${c.ref}:${E}`):e.jsx("div",{className:"whitespace-pre-wrap px-1",children:c.text},`${c.text}:${E}`)):e.jsx("div",{className:"flex h-full items-center justify-center",children:y.noEntries}):w===Q?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(ze,{className:"h-4 w-4 animate-spin"})}):ie.length>0?ie.map(c=>e.jsx("div",{className:"border-b border-[hsl(var(--deck-border))] px-1 py-1 last:border-b-0",children:Zr(c)},c.sequence)):e.jsx("div",{className:"flex h-full items-center justify-center",children:y.noEntries})})]})]})}const ts="http://localhost:3000",rs=2048,ss=/^(?:localhost|127(?:\.\d{1,3}){3}|0\.0\.0\.0|\[::1\]|10(?:\.\d{1,3}){3}|192\.168(?:\.\d{1,3}){2}|172\.(?:1[6-9]|2\d|3[01])(?:\.\d{1,3}){2})(?::\d+)?$/i,ns=/^[a-z\d.-]+:\d+$/i;function Yt(){return typeof window>"u"?void 0:window.location.origin}function dt(t,n=Yt(),r=!1){const s=t.trim();if(!s)return{ok:!1,reason:"empty"};if(s.length>rs)return{ok:!1,reason:"invalid"};let a=s;const l=a.split(/[/?#]/,1)[0]??"";ss.test(l)||ns.test(l)?a=`http://${a}`:a.startsWith("//")?a=`https:${a}`:/^[a-z][a-z\d+.-]*:/i.test(a)||(a=`https://${a}`);let d;try{d=new URL(a)}catch{return{ok:!1,reason:"invalid"}}return d.protocol!=="http:"&&d.protocol!=="https:"?{ok:!1,reason:"protocol"}:d.username||d.password?{ok:!1,reason:"credentials"}:r&&n&&d.origin===n?{ok:!1,reason:"same_origin"}:{ok:!0,url:d.href}}function as(t,n=Yt()){return dt(t,n,!0)}function os(t,n){if(t.entries[t.index]===n)return t;const r=[...t.entries.slice(0,t.index+1),n].slice(-50);return{entries:r,index:r.length-1}}function is(t){try{const n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}const ls={en:{modeAria:"Browser mode",preview:"Preview",test:"Test",external:"External",noSession:"No active Session",snapshotRefreshed:"The page changed. Snapshot refreshed; select the element again.",toolbarAria:"Browser navigation",addressAria:"Browser address",addressPlaceholder:"Enter an HTTP or HTTPS URL",back:"Go back",forward:"Go forward",reload:"Reload page",go:"Open address",openExternal:"Open in system browser",externalEmpty:"No external page selected",status:{idle:"Idle",loading:"Loading…",ready:"Ready",error:"Failed"},error:{empty:"Enter a URL.",invalid:"Enter a valid URL.",protocol:"Only HTTP and HTTPS URLs are supported.",credentials:"URLs containing credentials are not allowed.",same_origin:"The Blade Web origin cannot be embedded in itself."}},zh:{modeAria:"浏览器模式",preview:"预览",test:"测试",external:"外部",noSession:"没有活动 Session",snapshotRefreshed:"页面已变化,快照已刷新,请重新选择元素。",toolbarAria:"浏览器导航",addressAria:"浏览器地址",addressPlaceholder:"输入 HTTP 或 HTTPS 地址",back:"后退",forward:"前进",reload:"刷新页面",go:"打开地址",openExternal:"在系统浏览器中打开",externalEmpty:"未选择外部页面",status:{idle:"空闲",loading:"正在加载…",ready:"就绪",error:"失败"},error:{empty:"请输入地址。",invalid:"请输入有效地址。",protocol:"仅支持 HTTP 与 HTTPS 地址。",credentials:"不允许使用包含凭据的地址。",same_origin:"不能在面板中嵌套 Blade Web 自身地址。"}}};function cs({sessionRef:t=null,onElementAdded:n}){const{locale:r}=rt(),s=ls[r],a=jt(h=>h.agentActivity),l=t!==null&&a!==null&&a.sessionRef.sessionId===t.sessionId&&a.sessionRef.projectPath===t.projectPath,[d,f]=i.useState("preview"),[p,g]=i.useState("user"),[w,u]=i.useState(ts),[k,_]=i.useState({entries:[],index:-1}),m=i.useRef(k),[j,v]=i.useState(0),[P,I]=i.useState("idle"),[J,y]=i.useState(null),[N,O]=i.useState(null),[be,we]=i.useState(null),[Q,Re]=i.useState(null),[ae,oe]=i.useState(!1),[L,te]=i.useState(null),[M,W]=i.useState(!1),[ie,F]=i.useState(null),[H,A]=i.useState(!1),[X,le]=i.useState(null),[ce,re]=i.useState({}),[de,ye]=i.useState(null),c=i.useRef(0),E=i.useRef(null),U=i.useRef(null),G=k.entries[k.index]??null,B=d==="preview"?G:d==="test"?p==="agent"&&l?(a==null?void 0:a.url)??null:(N==null?void 0:N.url)??null:X,Le=i.useMemo(()=>{if(!B)return"";try{return new URL(B).host}catch{return""}},[B]),V=d==="preview"?P:d==="test"?p==="agent"&&l?ae||(a==null?void 0:a.phase)==="running"?"loading":L||(a==null?void 0:a.phase)==="error"?"error":Q?"ready":"idle":M?"loading":ie?"error":N?"ready":"idle":X?"ready":"idle",ue=J!==null?s.error[J]:d==="test"?p==="agent"&&l?L??(a==null?void 0:a.errorCode)??null:ie:null,Z=h=>{E.current&&URL.revokeObjectURL(E.current),E.current=h,we(h)},K=h=>{U.current&&URL.revokeObjectURL(U.current),U.current=h,Re(h)};i.useEffect(()=>{const h=c.current+1;return c.current=h,O(null),g("user"),F(null),te(null),oe(!1),A(!1),re({}),Z(null),K(null),()=>{c.current===h&&(c.current+=1)}},[t==null?void 0:t.projectPath,t==null?void 0:t.sessionId]),i.useEffect(()=>()=>{E.current&&URL.revokeObjectURL(E.current),U.current&&URL.revokeObjectURL(U.current)},[]),i.useEffect(()=>{!t||!l||!a||(f("test"),g("agent"),y(null),a.url&&u(a.url))},[a==null?void 0:a.revision,l,t]),i.useEffect(()=>{if(!t||!l||!a||!a.pageId||!a.origin||a.frameRevision===0)return;if(!is(a.origin)){oe(!1),te(null),K(null);return}const h=c.current,x=a.frameRevision,S=()=>{const R=jt.getState().agentActivity;return c.current===h&&(R==null?void 0:R.frameRevision)===x&&R.sessionRef.sessionId===t.sessionId&&R.sessionRef.projectPath===t.projectPath};oe(!0),te(null),xe.screenshot(t,{source:"agent",pageId:a.pageId,expectedOrigin:a.origin}).then(R=>{S()&&K(URL.createObjectURL(R))}).catch(R=>{S()&&te(R instanceof Error?R.message:String(R))}).finally(()=>{S()&&oe(!1)})},[a==null?void 0:a.frameRevision,a==null?void 0:a.origin,a==null?void 0:a.pageId,l,t]);const je=async(h,x,S)=>{const R=await xe.screenshot(h,{pageId:x.pageId,expectedOrigin:x.origin});c.current===S&&Z(URL.createObjectURL(R))},se=async(h,x,S)=>{c.current===S&&(O(x),u(x.url),re({}),await je(h,x,S))},Pe=async h=>{if(!t){F(s.noSession);return}const x=c.current;A(!1),W(!0),F(null);try{const S=await xe.navigate(t,h);await se(t,S,x)}catch(S){c.current===x&&F(S instanceof Error?S.message:String(S))}finally{c.current===x&&W(!1)}},Ue=h=>{const x=os(m.current,h);m.current=x,_(x),u(h),I("loading")},Be=h=>{h.preventDefault();const x=d==="preview"?as(w):dt(w);if(!x.ok){y(x.reason);return}if(y(null),d==="preview"){x.url===G&&v(S=>S+1),Ue(x.url);return}if(d==="test"){if(p==="agent")return;Pe({action:"goto",url:x.url});return}le(x.url),u(x.url),window.open(x.url,"_blank","noopener,noreferrer")},Ie=h=>{const x=m.current.index+h,S=m.current.entries[x];if(!S)return;const R={...m.current,index:x};m.current=R,_(R),u(S),I("loading")},Ne=h=>{if(d==="preview"){h==="back"?Ie(-1):h==="forward"?Ie(1):G&&(I("loading"),v(x=>x+1));return}d==="test"&&p==="user"&&N&&Pe({action:h,pageId:N.pageId,expectedOrigin:N.origin})},Ke=h=>{A(!1),f(h),y(null),F(null);const x=h==="preview"?G:h==="test"?p==="agent"&&l?a==null?void 0:a.url:N==null?void 0:N.url:X;x&&u(x)},qe=h=>{if(h==="agent"&&!l)return;g(h),A(!1),y(null),F(null),te(null);const x=h==="agent"?a==null?void 0:a.url:N==null?void 0:N.url;x&&u(x)},Je=async(h,x)=>{if(!t||!N)return;const S=N,R=c.current;A(!1),W(!0),F(null);try{const Y=await xe.interact(t,{pageId:S.pageId,snapshotId:S.snapshotId,expectedOrigin:S.origin,...x?{ref:x}:{},action:h});if(Y.outcome==="applied")await se(t,Y.observation,R);else if(Y.outcome==="applied_observation_failed"){const ge=await xe.snapshot(t,{pageId:Y.pageId});await se(t,ge,R)}else F(Y.errorCode)}catch(Y){if(c.current===R){const ge=Y instanceof Error?Y.message:String(Y);if(/snapshot is stale/i.test(ge))try{const Ce=await xe.snapshot(t,{pageId:S.pageId});await se(t,Ce,R),c.current===R&&F(s.snapshotRefreshed)}catch(Ce){c.current===R&&F(Ce instanceof Error?Ce.message:String(Ce))}else F(ge)}}finally{c.current===R&&W(!1)}},fe=async(h=!1)=>{if(!t||!N)return!1;const x=c.current;W(!0),F(null);try{const S=await xe.snapshot(t,{pageId:N.pageId,...h?{includeBoxes:!0}:{}});return await se(t,S,x),c.current===x}catch(S){return c.current===x&&F(S instanceof Error?S.message:String(S)),!1}finally{c.current===x&&W(!1)}},De=async h=>{if(!t||!N)return;const x=c.current;ye(h);try{const S=await xe.inspect(t,{target:h,pageId:N.pageId,expectedOrigin:N.origin});c.current===x&&re(R=>({...R,[h]:S.entries??[]}))}catch(S){c.current===x&&F(S instanceof Error?S.message:String(S))}finally{c.current===x&&ye(null)}},ve=async h=>{if(!h){A(!1);return}if(p==="agent")return;await fe(!0)&&A(!0)},Oe=h=>{const x=t?`session:${wr(t)}`:"session:temporary";yr(x,h)&&(A(!1),n==null||n(),requestAnimationFrame(()=>jr()))},Fe=async()=>{if(!t)return;const h=c.current;A(!1),W(!0),F(null);try{await xe.reset(t),c.current===h&&(O(null),re({}),Z(null))}catch(x){c.current===h&&F(x instanceof Error?x.message:String(x))}finally{c.current===h&&W(!1)}},he=()=>{const x=dt(B??w);if(!x.ok){y(x.reason);return}le(x.url),window.open(x.url,"_blank","noopener,noreferrer")},ne=d==="preview"?k.index>0:d==="test"&&p==="user"&&!!N,$e=d==="preview"?k.index>=0&&k.index<k.entries.length-1:d==="test"&&p==="user"&&!!N,Se=d==="test"&&p==="agent",pe=p==="agent"?ae||(a==null?void 0:a.phase)==="running":M;return e.jsxs("section",{"data-browser-panel":!0,"data-browser-mode":d,"data-browser-test-source":p,"data-browser-history-count":k.entries.length,"data-browser-history-index":k.index,className:"flex h-full min-h-0 flex-col bg-[hsl(var(--deck-canvas))]",children:[e.jsx("div",{role:"tablist","aria-label":s.modeAria,className:"grid h-9 shrink-0 grid-cols-3 border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[["preview",s.preview,et],["test",s.test,_r],["external",s.external,Ct]].map(([h,x,S])=>e.jsxs("button",{type:"button",role:"tab","aria-selected":d===h,onClick:()=>Ke(h),className:$("flex min-w-0 items-center justify-center gap-1.5 border-r border-[hsl(var(--deck-border))] px-2 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] last:border-r-0",d===h&&"bg-[hsl(var(--deck-canvas-veil))] text-[hsl(var(--deck-ink))]"),children:[e.jsx(S,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:x})]},h))}),e.jsxs("form",{"aria-label":s.toolbarAria,onSubmit:Be,className:"flex h-12 shrink-0 items-center gap-1 border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-2",children:[e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:!ne||d==="test"&&pe,"aria-label":s.back,title:s.back,onClick:()=>Ne("back"),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-muted))]",children:e.jsx(Ir,{className:"h-4 w-4"})}),e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:!$e||d==="test"&&pe,"aria-label":s.forward,title:s.forward,onClick:()=>Ne("forward"),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-muted))]",children:e.jsx(Dr,{className:"h-4 w-4"})}),e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:d==="external"||Se||!B||d==="test"&&pe,"aria-label":s.reload,title:s.reload,onClick:()=>Ne("reload"),className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-muted))]",children:e.jsx(Ot,{className:$("h-4 w-4",V==="loading"&&"animate-spin")})}),e.jsxs("div",{className:$("flex h-8 min-w-0 flex-1 items-center gap-2 rounded-md border bg-[hsl(var(--deck-canvas))] px-2",ue?"border-red-500/70":"border-[hsl(var(--deck-border))] focus-within:border-[hsl(var(--deck-accent)/0.65)]"),children:[e.jsx(et,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{"data-browser-panel-address":!0,"data-preview-browser-address":d==="preview"||void 0,value:w,readOnly:Se,onChange:h=>{u(h.target.value),y(null)},onKeyDown:h=>{h.key==="Escape"&&B&&(h.preventDefault(),u(B),y(null))},"aria-label":s.addressAria,placeholder:s.addressPlaceholder,autoCapitalize:"none",autoComplete:"off",spellCheck:!1,className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))]"})]}),e.jsx(q,{type:"submit",variant:"ghost",size:"icon","aria-label":s.go,title:s.go,disabled:Se||d==="test"&&pe,className:"h-8 w-8 rounded-md text-[hsl(var(--deck-accent))]",children:V==="loading"?e.jsx(ze,{className:"h-4 w-4 animate-spin"}):e.jsx(Gt,{className:"h-4 w-4"})}),e.jsx(q,{type:"button",variant:"ghost",size:"icon",disabled:!B,"aria-label":s.openExternal,title:s.openExternal,onClick:he,className:"h-8 w-8 rounded-md text-[hsl(var(--deck-ink-muted))]",children:e.jsx(St,{className:"h-4 w-4"})})]}),ue&&d!=="test"&&e.jsx("div",{role:"alert",className:"shrink-0 border-b border-red-500/25 bg-red-500/10 px-3 py-2 font-mono text-[10.5px] text-red-700 dark:text-red-300",children:ue}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:d==="preview"?e.jsx(Jr,{url:G,revision:j,loadState:P,onLoad:()=>I("ready"),onError:()=>I("error")}):d==="test"?e.jsx(es,{source:p,agentAvailable:l,sessionAvailable:!!t,observation:p==="agent"?null:N,screenshotUrl:p==="agent"?Q:be,interaction:p==="agent"?a==null?void 0:a.interaction:void 0,pointerRevision:p==="agent"?(a==null?void 0:a.pointerRevision)??0:0,busy:pe,error:ue,diagnostics:p==="agent"?{}:ce,diagnosticsLoading:p==="agent"?null:de,onInteract:Je,onInspect:De,onSnapshot:async()=>{await fe()},onReset:Fe,onSourceChange:qe,pickerActive:H,onPickerChange:ve,onAddToConversation:Oe}):e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 bg-[hsl(var(--deck-canvas-veil))]",children:[e.jsx(Ct,{className:"h-7 w-7 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:X?new URL(X).host:s.externalEmpty}),e.jsxs(q,{type:"button",variant:"outline",onClick:he,disabled:!w.trim(),className:"h-8 rounded-md font-mono text-[11px]",children:[e.jsx(St,{className:"mr-2 h-3.5 w-3.5"}),s.openExternal]})]})}),e.jsxs("div",{"data-browser-panel-status":V,"data-preview-browser-status":d==="preview"?V:void 0,"aria-live":"polite",className:"flex h-7 shrink-0 items-center justify-between border-t border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:$("h-1.5 w-1.5 shrink-0 rounded-full bg-[hsl(var(--deck-ink-faint))]",V==="loading"&&"bg-amber-500",V==="ready"&&"bg-emerald-500",V==="error"&&"bg-red-500")}),e.jsx("span",{children:s.status[V]})]}),e.jsx("span",{className:"ml-3 truncate",children:Le||s[d]})]})]})}function tt(t){return t.normalize("NFKC").toLocaleLowerCase().trim()}function ds(t,n,r){const s=tt(n).split(/\s+/).filter(Boolean);return t.filter(a=>{if(r!=="all"&&a.status!==r)return!1;if(s.length===0)return!0;const l=tt([a.title,a.subtitle,a.content].filter(Boolean).join(" "));return s.every(d=>l.includes(d))})}function Zt(t){return t.replace(/\/+$/,"").split("/").filter(Boolean).at(-1)||t}function us(t,n){const r=tt(n).split(/\s+/).filter(Boolean);return r.length===0?t:t.filter(s=>{const a=tt([s.filePath,s.summary].filter(Boolean).join(" "));return r.every(l=>a.includes(l))})}function fs(t,n,r){return n===0?0:(t+r+n)%n}const Lt=20,Pt=20,It=160,Dt=240;function Ft(t,n){const r=l=>l.replace(/\\/g,"/").replace(/^\.?\//,"").replace(/\/+/g,"/"),s=r(t),a=r(n);return s===a||s.endsWith(`/${a}`)||a.endsWith(`/${s}`)}function hs({diffs:t,expanded:n,targetPath:r,onToggle:s,onSetAllExpanded:a}){var m,j;const l=ke(),[d,f]=i.useState(""),p=`${d}\0${t.length}\0${((m=t[0])==null?void 0:m.filePath)??""}\0${((j=t.at(-1))==null?void 0:j.filePath)??""}`,[g,w]=i.useState({key:p,count:Lt}),u=g.key===p?g.count:Lt,k=i.useMemo(()=>us(t,d),[t,d]),_=i.useMemo(()=>{const v=k.slice(0,u);if(!r)return v;const P=k.find(I=>I.filePath&&Ft(I.filePath,r));return P&&!v.includes(P)?[...v,P]:v},[k,r,u]);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"sticky top-0 z-10 space-y-2 bg-[hsl(var(--deck-canvas))] pb-1",children:[e.jsxs("div",{className:"flex h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 focus-within:border-[hsl(var(--deck-accent)/0.6)]",children:[e.jsx(ft,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{type:"search","aria-label":l("preview.diff.searchAria"),placeholder:l("preview.diff.searchPlaceholder"),value:d,onChange:v=>f(v.target.value),className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))]"}),e.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-[hsl(var(--deck-ink-faint))]",children:[k.length,"/",t.length]})]}),e.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[e.jsx("span",{children:l("preview.diff.changedFiles",{count:t.length})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("button",{type:"button",onClick:()=>a(!0),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(Lr,{className:"h-3 w-3"}),l("preview.diff.expandAll")]}),e.jsxs("button",{type:"button",onClick:()=>a(!1),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(Ar,{className:"h-3 w-3"}),l("preview.diff.collapseAll")]})]})]})]}),k.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-[hsl(var(--deck-border))] p-6 text-center font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:l("preview.diff.noMatches")}):_.map(v=>{const P=v.filePath||"unknown",I=t.indexOf(v),J=n[P]??I===0,y=!!(r&&Ft(P,r));return e.jsxs("div",{"data-preview-diff-path":v.filePath,className:$("overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] transition-colors",y&&"border-[hsl(var(--deck-accent)/0.7)] bg-[hsl(var(--deck-accent-soft))] ring-1 ring-[hsl(var(--deck-accent)/0.2)]"),children:[e.jsxs("button",{type:"button","aria-expanded":J,onClick:()=>s(P),className:"flex w-full items-center gap-2 bg-[hsl(var(--deck-surface-2))] px-3 py-2 transition-colors hover:bg-[hsl(var(--deck-surface))] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent)/0.65)]",children:[J?e.jsx(Vt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}):e.jsx(Kt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),e.jsx(Jt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-left font-mono text-[13px] text-[hsl(var(--deck-ink))]",children:Zt(P)}),v.summary&&e.jsx("span",{className:"shrink-0 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:v.summary})]}),J&&e.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))]",children:[e.jsx("div",{className:"truncate px-3 py-1 font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:v.filePath}),e.jsx(ps,{diff:v.diff})]})]},P)}),u<k.length&&e.jsx("div",{className:"flex justify-center pt-1",children:e.jsx("button",{type:"button",onClick:()=>w({key:p,count:Math.min(k.length,u+Pt)}),className:"rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-1.5 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:l("preview.diff.showMoreFiles",{count:Math.min(Pt,k.length-u)})})})]})}function ps({diff:t}){const n=ke(),r=i.useMemo(()=>t.patch.split(`
60
- `),[t.patch]),[s,a]=i.useState({patch:t.patch,count:It}),l=s.patch===t.patch?s.count:It,d=r.slice(0,l);let f=0,p=0;return e.jsxs("div",{className:"overflow-hidden rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b 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:[e.jsx("span",{children:n("preview.diff.patch")}),t.matchLine&&e.jsx("span",{children:n("preview.diff.line",{line:t.matchLine})})]}),e.jsx("div",{className:"overflow-x-auto font-mono text-[12px]",children:d.map((g,w)=>{if(g.startsWith("@@")){const u=/@@ -(?<old>\d+),?(?<oldCount>\d*) \+(?<new>\d+),?(?<newCount>\d*) @@/.exec(g);return u!=null&&u.groups&&(f=Number.parseInt(u.groups.old,10),p=Number.parseInt(u.groups.new,10)),e.jsx(Ae,{line:g},`${g}-${w}`)}if(g.startsWith("---")||g.startsWith("+++")||g.startsWith("Index:")||g.startsWith("==="))return e.jsx(Ae,{line:g},`${g}-${w}`);if(g.startsWith("+")){const u=p++;return e.jsx(Ae,{line:g,oldLine:null,newLine:u},`${g}-${w}`)}if(g.startsWith("-")){const u=f++;return e.jsx(Ae,{line:g,oldLine:u,newLine:null},`${g}-${w}`)}return g.startsWith(" ")?e.jsx(Ae,{line:g,oldLine:f++,newLine:p++},`${g}-${w}`):e.jsx(Ae,{line:g},`${g}-${w}`)})}),l<r.length&&e.jsx("div",{className:"flex justify-center border-t border-[hsl(var(--deck-border))] p-2",children:e.jsx("button",{type:"button",onClick:()=>a({patch:t.patch,count:Math.min(r.length,l+Dt)}),className:"rounded-md border border-[hsl(var(--deck-border))] px-3 py-1 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))]",children:n("preview.diff.showMoreLines",{count:Math.min(Dt,r.length-l)})})})]})}function Ae({line:t,oldLine:n,newLine:r}){const s=t.startsWith("---")||t.startsWith("+++")||t.startsWith("Index:")||t.startsWith("==="),a=t.startsWith("@@"),l=t[0],d=s||a?t:t.slice(1),f=s?"text-[hsl(var(--deck-ink-muted))]":l==="+"?"bg-[#22C55E]/10 text-[#166534] dark:bg-[#22C55E]/10 dark:text-[#86efac]":l==="-"?"bg-[#EF4444]/10 text-[#b91c1c] dark:bg-[#EF4444]/10 dark:text-[#fca5a5]":a?"bg-[#DBEAFE] text-[#1d4ed8] dark:bg-[#1e3a8a]/30 dark:text-[#93c5fd]":"text-[hsl(var(--deck-ink))]";return e.jsxs("div",{"data-preview-diff-line":!0,className:$("grid min-w-max grid-cols-[40px_40px_1fr] gap-2 px-3 py-0.5",f),children:[e.jsx("span",{className:"text-right text-[hsl(var(--deck-ink-faint))]",children:n?String(n).padStart(2," "):""}),e.jsx("span",{className:"text-right text-[hsl(var(--deck-ink-faint))]",children:r?String(r).padStart(2," "):""}),e.jsx("span",{className:"whitespace-pre",children:d})]})}function ms({nodes:t,expandedDirs:n,childrenCache:r,directoryStates:s,selectedPath:a,onToggleDir:l,onRetryDir:d,onSelectFile:f}){return e.jsx(e.Fragment,{children:t.map(p=>e.jsx(er,{node:p,depth:0,expandedDirs:n,childrenCache:r,directoryStates:s,selectedPath:a,onToggleDir:l,onRetryDir:d,onSelectFile:f},p.path))})}function er({node:t,depth:n,expandedDirs:r,childrenCache:s,directoryStates:a,selectedPath:l,onToggleDir:d,onRetryDir:f,onSelectFile:p}){const g=ke(),w=t.type==="dir",u=!!r[t.path],k=!w&&l===t.path,_=s[t.path]??[],m=a[t.path],j=n*14+24;return e.jsxs("div",{children:[e.jsxs("button",{type:"button","aria-expanded":w?u:void 0,"aria-busy":w&&(m==null?void 0:m.status)==="loading",onClick:()=>w?d(t.path):p(t.path),className:$("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left font-mono text-[12px] transition-colors",k?"border border-[#16A34A]/30 bg-[#16A34A]/10 text-[#111827] dark:border-[#22C55E]/30 dark:bg-[#22C55E]/10 dark:text-[#E5E5E5]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))]",w&&"cursor-pointer"),style:{paddingLeft:n*14+8},children:[w?(m==null?void 0:m.status)==="loading"?e.jsx(ze,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}):u?e.jsx(Nr,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink))]"}):e.jsx(Fr,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-muted))]"}):e.jsx(Jt,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("span",{className:"truncate text-[hsl(var(--deck-ink))]",children:t.name})]}),w&&u&&e.jsxs("div",{children:[(m==null?void 0:m.status)==="loading"&&e.jsx("div",{role:"status",style:{paddingLeft:j},className:"py-1 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:g("preview.files.directoryLoading")}),(m==null?void 0:m.status)==="error"&&e.jsxs("div",{role:"alert",style:{marginLeft:j},className:"my-1 mr-1 rounded-md border border-red-200 bg-red-50/70 px-2 py-1.5 font-mono text-[10px] text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-300",children:[e.jsx("div",{className:"truncate",title:m.message,children:m.message}),e.jsxs("button",{type:"button",onClick:()=>f(t.path),className:"mt-1 inline-flex items-center gap-1 font-medium underline-offset-2 hover:underline",children:[e.jsx(Ht,{className:"h-2.5 w-2.5"}),g("preview.action.retry")]})]}),(m==null?void 0:m.status)==="loaded"&&_.length===0&&e.jsx("div",{style:{paddingLeft:j},className:"py-1 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:g("preview.files.directoryEmpty")}),_.map(v=>e.jsx(er,{node:v,depth:n+1,expandedDirs:r,childrenCache:s,directoryStates:a,selectedPath:l,onToggleDir:d,onRetryDir:f,onSelectFile:p},v.path))]})]})}const $t=80,Mt=80;function xs({logs:t}){var m,j;const n=ke(),[r,s]=i.useState(""),[a,l]=i.useState("all"),[d,f]=i.useState({}),p=`${a}\0${r}\0${t.length}\0${((m=t[0])==null?void 0:m.id)??""}\0${((j=t.at(-1))==null?void 0:j.id)??""}`,[g,w]=i.useState({key:p,count:$t}),u=i.useMemo(()=>ds(t,r,a),[a,t,r]),k=g.key===p?g.count:$t,_=u.slice(0,k);return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"space-y-2 border-b border-[hsl(var(--deck-border))] px-4 py-3",children:[e.jsxs("div",{className:"flex h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 focus-within:border-[hsl(var(--deck-accent)/0.6)]",children:[e.jsx(ft,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{type:"search","aria-label":n("preview.logs.searchAria"),placeholder:n("preview.logs.searchPlaceholder"),value:r,onChange:v=>s(v.target.value),className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))]"}),e.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-[hsl(var(--deck-ink-faint))]",children:[u.length,"/",t.length]})]}),e.jsx("div",{className:"flex items-center gap-1","aria-label":n("preview.logs.filterAria"),children:["all","running","error","success"].map(v=>e.jsx("button",{type:"button","aria-pressed":a===v,onClick:()=>l(v),className:$("rounded-md border px-2 py-1 font-mono text-[9.5px] transition-colors",a===v?"border-[hsl(var(--deck-accent)/0.45)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-[hsl(var(--deck-border))] text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-ink-muted))]"),children:n(`preview.logs.filter.${v}`)},v))})]}),e.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-4",children:[t.length===0?e.jsx(At,{title:n("preview.logs.emptyTitle"),subtitle:n("preview.logs.emptyHint")}):u.length===0?e.jsx(At,{title:n("preview.logs.noMatches"),subtitle:n("preview.logs.noMatchesHint")}):_.map(v=>{var N;const P=d[v.id],I=(v.content||"").split(`
61
- `),J=I.length>10||(((N=v.content)==null?void 0:N.length)||0)>800,y=P||!J?I:I.slice(0,8);return e.jsxs("div",{"data-preview-log-id":v.id,className:"overflow-hidden rounded-lg border border-[hsl(var(--deck-border))]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:v.title}),v.subtitle&&e.jsx("div",{className:"font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:v.subtitle})]}),e.jsx(bs,{status:v.status})]}),v.content&&e.jsxs("div",{className:"space-y-2 px-3 py-3",children:[e.jsxs("pre",{className:"overflow-x-auto whitespace-pre-wrap rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] p-3 font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:[y.join(`
62
- `),!P&&J&&`
63
- …`]}),J&&e.jsxs("button",{type:"button",onClick:()=>f(O=>({...O,[v.id]:!O[v.id]})),className:"flex items-center gap-1 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:text-[hsl(var(--deck-ink))]",children:[P?e.jsx(Vt,{className:"h-3 w-3"}):e.jsx(Kt,{className:"h-3 w-3"}),n(P?"preview.logs.collapse":"preview.logs.expand")]})]})]},v.id)}),k<u.length&&e.jsx("div",{className:"flex justify-center",children:e.jsx("button",{type:"button",onClick:()=>w({key:p,count:Math.min(u.length,k+Mt)}),className:"rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-3 py-1.5 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:border-[hsl(var(--deck-border-strong))] hover:text-[hsl(var(--deck-ink))]",children:n("preview.logs.showMore",{count:Math.min(Mt,u.length-k)})})})]})]})}function At({title:t,subtitle:n}){return e.jsxs("div",{className:"rounded-lg border border-dashed border-[hsl(var(--deck-border))] p-6 text-center",children:[e.jsx("div",{className:"font-mono text-[13px] text-[hsl(var(--deck-ink))]",children:t}),e.jsx("div",{className:"mt-1 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:n})]})}function bs({status:t}){const n=ke(),r=n(t==="success"?"preview.logs.status.success":t==="error"?"preview.logs.status.error":"preview.logs.status.running"),s=t==="success"?"bg-[#22C55E] text-white":t==="error"?"bg-[#FEE2E2] text-[#b91c1c] dark:bg-[#EF4444]/20 dark:text-[#fca5a5]":"bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-muted))]";return e.jsx("span",{className:$("rounded-full px-2 py-0.5 font-mono text-[11px]",s),children:r})}const vs=640,tr=360,ut=960,Is=i.forwardRef(function({open:n,maximized:r,disabled:s,onToggleMaximized:a,onTogglePreview:l},d){const f=ke(),{locale:p}=rt(),g=p==="zh"?{maximize:"全屏预览",restore:"还原分栏预览"}:{maximize:"Maximize preview",restore:"Restore split preview"},w=r?g.restore:g.maximize;return e.jsxs(e.Fragment,{children:[n&&e.jsx(q,{variant:"ghost",size:"icon","aria-pressed":!!r,"aria-label":w,title:w,onClick:a,className:$("hidden h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))] lg:inline-flex",r&&"bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink))]"),children:e.jsx(Gt,{className:$("h-4 w-4 transition-transform",r&&"rotate-180")})}),e.jsx(q,{ref:d,variant:"ghost",size:"icon",onClick:l,disabled:s,title:f("preview.title"),"aria-label":p==="zh"?"切换预览面板":"Toggle preview panel",className:$("h-8 w-8 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",n&&"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))] hover:text-[hsl(var(--deck-accent))]"),children:e.jsx(et,{className:"h-4 w-4"})})]})});function _t(t){const n=typeof window>"u"?ut:Math.max(280,Math.floor(window.innerWidth*.72));return Math.min(ut,n,Math.max(tr,Math.round(t)))}function rr(t,n,r){var s;if(t){const a=(s=r==null?void 0:r.taskDelivery)==null?void 0:s.status;return(r==null?void 0:r.taskIsolation)==="worktree"&&r.taskSourceProjectPath&&(a==="applied"||a==="discarded")?{sessionId:t.sessionId,projectPath:r.taskSourceProjectPath}:t}return n?{sessionId:`project:${n}`,projectPath:n}:null}function ct(){const t=_e.getState(),n=t.sessions.find(r=>Ve({sessionId:r.sessionId,projectPath:r.projectPath},t.currentSessionRef));return rr(t.currentSessionRef,t.selectedProjectPath,n)}function Wt(t,n){const r=l=>l.replace(/\\/g,"/").replace(/^\.?\//,"").replace(/\/+/g,"/"),s=r(t),a=r(n);return s===a||s.endsWith(`/${a}`)||a.endsWith(`/${s}`)}const gs=i.lazy(async()=>({default:(await Tr(()=>import("./index-B5mUEr6D.js"),__vite__mapDeps([0,1]))).Editor}));function Ze(t,n){return t instanceof Error?t.message:n}function Ds({returnFocusElement:t,maximized:n=!1}={}){var wt,yt;const r=ke(),{toggleFilePreview:s,previewWidth:a,setPreviewWidth:l,previewTab:d,setPreviewTab:f,previewTargetPath:p,previewRequestId:g}=Nt(),w=_e(o=>o.messages),u=_e(o=>o.currentSessionRef),k=_e(o=>o.sessions),_=_e(o=>o.selectedProjectPath),m=i.useMemo(()=>k.find(o=>Ve({sessionId:o.sessionId,projectPath:o.projectPath},u)),[u,k]),j=i.useMemo(()=>rr(u,_,m),[m,u,_]),[v,P]=i.useState(d),[I,J]=i.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),[y,N]=i.useState(null),[O,be]=i.useState(!1),[we,Q]=i.useState([]),[Re,ae]=i.useState({}),[oe,L]=i.useState({}),[te,M]=i.useState(0),[W,ie]=i.useState(!1),[F,H]=i.useState(null),[A,X]=i.useState(""),[le,ce]=i.useState([]),[re,de]=i.useState(!1),[ye,c]=i.useState(!1),[E,U]=i.useState(0),[G,B]=i.useState(0),[Le,V]=i.useState({}),[ue,Z]=i.useState({}),[K,je]=i.useState(null),[se,Pe]=i.useState(""),[Ue,Be]=i.useState(!1),[Ie,Ne]=i.useState(null),[Ke,qe]=i.useState(!1),Je=i.useRef(j),fe=i.useRef(0),De=i.useRef(0),ve=i.useRef({}),Oe=i.useRef(0),Fe=i.useRef(0),he=i.useRef(0),ne=i.useRef({}),$e=i.useRef({}),Se=i.useRef({}),pe=i.useRef(null),h=i.useRef(null),x=i.useRef(null),S=i.useRef(null),R=i.useRef(a),Y=i.useRef(u),ge=i.useRef(null);i.useLayoutEffect(()=>{Ve(Je.current,j)||(fe.current+=1),Je.current=j},[j]),i.useEffect(()=>{if(typeof window.matchMedia!="function")return;const o=window.matchMedia("(max-width: 1023px)"),b=()=>J(o.matches);return b(),o.addEventListener("change",b),()=>o.removeEventListener("change",b)},[]),i.useEffect(()=>(S.current=t??(document.activeElement instanceof HTMLElement?document.activeElement:null),()=>{const o=S.current;requestAnimationFrame(()=>{o!=null&&o.isConnected&&o.focus({preventScroll:!0})})}),[t]),i.useEffect(()=>{var o;I&&((o=x.current)==null||o.focus({preventScroll:!0}))},[I]);const Ce=o=>{var z;if(!I)return;if(o.key==="Escape"){o.preventDefault(),s();return}if(o.key!=="Tab")return;const b=Array.from(((z=h.current)==null?void 0:z.querySelectorAll('button:not([disabled]), input:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]).filter(D=>!D.closest("[hidden]"));if(b.length===0)return;const T=b[0],C=b[b.length-1];o.shiftKey&&document.activeElement===T?(o.preventDefault(),C==null||C.focus()):!o.shiftKey&&document.activeElement===C&&(o.preventDefault(),T==null||T.focus())},He=(o,b)=>b===fe.current&&Ve(ct(),o),ht=async(o,b="")=>{const T=b?`/suggestions/files/tree?path=${encodeURIComponent(b)}`:"/suggestions/files/tree",C=await fetch(T,{headers:it(o)});if(!C.ok)throw new Error(r("preview.files.treeFailed"));return(await C.json()).map(D=>({...D,children:D.type==="dir"?[]:void 0}))};i.useEffect(()=>{const o=++De.current;return(async()=>{if(!j){Q([]),ie(!1),H(null);return}const T={...j},C=fe.current,z=()=>o===De.current&&He(T,C);if(z()){Q([]),ie(!0),H(null);try{const D=await ht(T);z()&&Q(D)}catch(D){z()&&H(Ze(D,r("preview.files.treeFailed")))}finally{z()&&ie(!1)}}})(),()=>{De.current===o&&(De.current+=1)}},[te,j==null?void 0:j.projectPath,j==null?void 0:j.sessionId]),i.useEffect(()=>{pe.current=null,ne.current={},$e.current={},Se.current={},ve.current={},Oe.current+=1,je(null),Pe(""),Be(!1),Ne(null),qe(!1),V({}),ae({}),L({}),X(""),ce([]),de(!1),c(!1),B(0),Z({})},[j==null?void 0:j.projectPath,j==null?void 0:j.sessionId]);const sr=i.useMemo(()=>ws(w),[w]),[nr,pt]=i.useState(null),[ar,st]=i.useState(!1),[mt,xt]=i.useState(null),[or,ir]=i.useState(0),nt=(m==null?void 0:m.taskIsolation)==="worktree"&&((wt=m.taskDelivery)==null?void 0:wt.status)==="discarded",bt=(m==null?void 0:m.taskIsolation)==="worktree"&&!!m.taskDiffStat&&!nt,vt=bt&&!!(m!=null&&m.taskDiffStat&&m.taskDiffStat.changedFiles>0),Ee=nt?[]:bt?nr??[]:sr,lr=i.useMemo(()=>ks(w),[w]);i.useEffect(()=>{const o=A.trim(),b=++Fe.current;if(B(0),c(!1),!o||v!=="files"||!j){ce([]),de(!1);return}const T={...j},C=fe.current;de(!0);const z=window.setTimeout(()=>{fetch(`/suggestions/files?q=${encodeURIComponent(o)}&limit=100&type=file`,{headers:it(T)}).then(async D=>{if(!D.ok)throw new Error(r("preview.files.searchFailed"));return await D.json()}).then(D=>{b===Fe.current&&He(T,C)&&(ce(D.filter(me=>!me.endsWith("/"))),c(!1))}).catch(()=>{b===Fe.current&&He(T,C)&&(ce([]),c(!0))}).finally(()=>{b===Fe.current&&de(!1)})},160);return()=>window.clearTimeout(z)},[v,A,E,j==null?void 0:j.projectPath,j==null?void 0:j.sessionId]),i.useEffect(()=>{P(Nt.getState().previewTab)},[g]),i.useEffect(()=>{const o=Y.current;if(Y.current=u,u||!_){ge.current=null;return}const b=!!o||ge.current!==_;ge.current=_,b&&v==="diff"&&(P("files"),f("files"))},[v,u==null?void 0:u.projectPath,u==null?void 0:u.sessionId,_,f]),i.useEffect(()=>{var T;if(!p||v!=="diff")return;const o=(T=Ee.find(C=>C.filePath&&Wt(C.filePath,p)))==null?void 0:T.filePath;if(!o)return;Z(C=>({...C,[o]:!0}));const b=requestAnimationFrame(()=>{var z,D;const C=Array.from(((z=h.current)==null?void 0:z.querySelectorAll("[data-preview-diff-path]"))??[]).find(me=>Wt(me.dataset.previewDiffPath??"",p));typeof(C==null?void 0:C.scrollIntoView)=="function"&&C.scrollIntoView({block:"nearest",behavior:"smooth"}),(D=C==null?void 0:C.querySelector("button"))==null||D.focus({preventScroll:!0})});return()=>cancelAnimationFrame(b)},[v,Ee,g,p]),i.useEffect(()=>{const o=++he.current;if(pt(null),xt(null),st(!1),!u||!vt)return;const b={...u};return st(!0),Sr.getTaskDiff(b).then(T=>{o!==he.current||!Ve(_e.getState().currentSessionRef,b)||pt(T.files.map(C=>({filePath:C.path,diff:{patch:C.patch},summary:C.binary?"binary":`+${C.additions} -${C.deletions}${C.truncated?" (truncated)":""}`})))}).catch(T=>{o===he.current&&xt(Ze(T,r("preview.diff.failedTitle")))}).finally(()=>{o===he.current&&st(!1)}),()=>{he.current===o&&(he.current+=1)}},[m==null?void 0:m.taskCompletedAt,(yt=m==null?void 0:m.taskDelivery)==null?void 0:yt.status,m==null?void 0:m.taskDiffStat,m==null?void 0:m.taskIsolation,u,vt,or]);const cr=o=>{Z(b=>({...b,[o]:!b[o]}))},dr=o=>{Z(Object.fromEntries(Ee.map(b=>[b.filePath||"unknown",o])))},Qe=async o=>{const b=ct();if(!b)return;const T=fe.current,C=++Oe.current,z=()=>C===Oe.current&&pe.current===o&&He(b,T);pe.current=o,je(o),Pe(""),Be(!0),Ne(null),qe(!1);try{const D=await fetch(`/suggestions/files/content?path=${encodeURIComponent(o)}`,{headers:it(b)});if(!D.ok)throw new Error(r("preview.files.contentFailed"));const me=await D.json();z()&&(Pe(me.content||""),qe(!!me.truncated))}catch(D){z()&&Ne(Ze(D,r("preview.files.contentFailed")))}finally{z()&&Be(!1)}},ur=o=>{if(o.key==="ArrowDown"||o.key==="ArrowUp"){o.preventDefault(),B(b=>fs(b,le.length,o.key==="ArrowDown"?1:-1));return}if(o.key==="Enter"){const b=le[G];if(!b)return;o.preventDefault(),Qe(b);return}o.key==="Escape"&&(o.preventDefault(),X(""))},at=(o,b)=>{const T={...Se.current,[o]:b};Se.current=T,L(T)},gt=async o=>{const b=(ve.current[o]??0)+1;ve.current[o]=b,at(o,{status:"loading"});const T=ct();if(!T)return;const C=fe.current,z=()=>ve.current[o]===b&&ne.current[o]===!0&&He(T,C);try{const D=await ht(T,o);if(z()){const me={...$e.current,[o]:D};$e.current=me,ae(me),at(o,{status:"loaded"})}}catch(D){z()&&at(o,{status:"error",message:Ze(D,r("preview.files.treeFailed"))})}},fr=o=>{const b=!ne.current[o],T={...ne.current,[o]:b};if(ne.current=T,V(T),!b){ve.current[o]=(ve.current[o]??0)+1;return}$e.current[o]||gt(o)},hr=o=>{if(!ne.current[o]){const b={...ne.current,[o]:!0};ne.current=b,V(b)}gt(o)},pr=o=>{o.preventDefault(),o.currentTarget.setPointerCapture(o.pointerId),R.current=a,be(!0),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},mr=o=>{if(!O)return;const b=_t(window.innerWidth-o.clientX);R.current=b,N(b)},kt=o=>{O&&(o.currentTarget.hasPointerCapture(o.pointerId)&&o.currentTarget.releasePointerCapture(o.pointerId),be(!1),N(null),l(R.current),document.body.style.cursor="",document.body.style.userSelect="")};i.useEffect(()=>()=>{document.body.style.cursor="",document.body.style.userSelect=""},[]);const ot=_t(y??a);return e.jsxs("div",{ref:h,"data-testid":"file-preview",role:I?"dialog":"complementary","aria-modal":I||void 0,"aria-label":r("preview.title"),onKeyDown:Ce,style:n?{width:"100%",maxWidth:"none"}:{width:ot,maxWidth:"72vw"},className:$("relative flex h-full flex-col bg-[hsl(var(--deck-canvas))] max-lg:fixed max-lg:inset-0 max-lg:z-[60] max-lg:!h-dvh max-lg:!w-full max-lg:!max-w-full max-lg:min-w-0 max-lg:border-l-0",n?"absolute inset-0 z-20 min-w-0 border-l-0 shadow-none":"border-l shadow-xl min-w-[360px] shrink-0 border-[hsl(var(--deck-border))]"),children:[!n&&e.jsx("div",{role:"separator","aria-label":r("preview.action.resize"),"aria-orientation":"vertical","aria-valuemin":tr,"aria-valuemax":ut,"aria-valuenow":ot,"aria-hidden":I||void 0,tabIndex:I?-1:0,onPointerDown:pr,onPointerMove:mr,onPointerUp:kt,onPointerCancel:kt,onDoubleClick:()=>l(vs),onKeyDown:o=>{o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),l(ot+(o.key==="ArrowLeft"?24:-24)))},className:$("absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize touch-none outline-none max-lg:hidden","after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-transparent after:transition-colors","hover:after:bg-[hsl(var(--deck-accent)/0.6)] focus-visible:after:bg-[hsl(var(--deck-accent))]",O&&"after:bg-[hsl(var(--deck-accent))]")}),e.jsxs(qr,{value:v,onValueChange:o=>{const b=o;P(b),f(b)},className:"flex flex-col flex-1 min-h-0",children:[e.jsxs("div",{"data-preview-toolbar":!0,className:"flex shrink-0 items-center gap-2 border-b border-[hsl(var(--deck-border))] px-3 py-3",children:[e.jsxs(Or,{className:"grid h-9 min-w-0 flex-1 grid-cols-4 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-1",children:[e.jsx(Xe,{value:"diff",className:"px-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] data-[state=active]:bg-[hsl(var(--deck-canvas-veil))] data-[state=active]:text-[hsl(var(--deck-ink))]",children:r("preview.tab.diff")}),e.jsx(Xe,{value:"files",className:"px-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] data-[state=active]:bg-[hsl(var(--deck-canvas-veil))] data-[state=active]:text-[hsl(var(--deck-ink))]",children:r("preview.tab.files")}),e.jsx(Xe,{value:"logs",className:"px-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] data-[state=active]:bg-[hsl(var(--deck-canvas-veil))] data-[state=active]:text-[hsl(var(--deck-ink))]",children:r("preview.tab.logs")}),e.jsx(Xe,{value:"browser",className:"px-2 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))] data-[state=active]:bg-[hsl(var(--deck-canvas-veil))] data-[state=active]:text-[hsl(var(--deck-ink))]",children:r("preview.tab.browser")})]}),I&&e.jsx(q,{ref:x,variant:"ghost",size:"icon",onClick:s,"aria-label":r("preview.action.close"),title:r("preview.action.close"),className:"h-9 w-9 shrink-0 rounded-md text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:e.jsx(Cr,{className:"w-4 h-4"})})]}),e.jsx(Ye,{value:"diff",className:"overflow-hidden flex-1 mt-0",children:e.jsx("div",{className:"overflow-y-auto px-4 py-4 space-y-3 h-full",children:nt?e.jsx(Te,{title:r("preview.diff.discardedTitle"),subtitle:r("preview.diff.discardedHint"),role:"status"}):ar&&Ee.length===0?e.jsx(Te,{title:r("preview.diff.loadingTitle"),subtitle:r("preview.diff.loadingHint")}):mt&&Ee.length===0?e.jsx(Te,{title:r("preview.diff.failedTitle"),subtitle:mt,actionLabel:r("preview.action.retry"),onAction:()=>ir(o=>o+1),role:"alert"}):Ee.length===0?e.jsx(Te,{title:r("preview.diff.emptyTitle"),subtitle:r("preview.diff.emptyHint")}):e.jsx(hs,{diffs:Ee,expanded:ue,targetPath:p,onToggle:cr,onSetAllExpanded:dr})})}),e.jsx(Ye,{value:"files",className:"overflow-hidden flex-1 mt-0",children:e.jsxs("div",{className:"px-4 py-4 h-full",children:[W&&e.jsx(Te,{title:r("preview.files.loadingTitle"),subtitle:r("preview.files.loadingHint")}),!W&&F&&e.jsx(Te,{title:r("preview.files.failedTitle"),subtitle:F,actionLabel:r("preview.action.retry"),onAction:()=>M(o=>o+1),role:"alert"}),!W&&!F&&we.length===0&&e.jsx(Te,{title:r("preview.files.emptyTitle"),subtitle:r("preview.files.emptyHint")}),!W&&!F&&we.length>0&&e.jsxs("div",{className:"grid h-full min-h-0 grid-cols-[minmax(170px,220px)_minmax(0,1fr)] gap-3 max-sm:grid-cols-1 max-sm:grid-rows-[180px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"flex min-h-0 flex-col overflow-hidden rounded-lg border border-[hsl(var(--deck-border))]",children:[e.jsx("div",{className:"border-b border-[hsl(var(--deck-border))] p-2",children:e.jsxs("div",{className:"flex h-8 items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2 focus-within:border-[hsl(var(--deck-accent)/0.6)]",children:[e.jsx(ft,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{type:"search","aria-label":r("preview.files.searchAria"),placeholder:r("preview.files.searchPlaceholder"),value:A,onChange:o=>X(o.target.value),onKeyDown:ur,className:"min-w-0 flex-1 bg-transparent font-mono text-[11px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))]"}),re&&e.jsx(ze,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"})]})}),e.jsx("div",{role:A?"listbox":void 0,"aria-label":A?r("preview.files.searchResultsAria"):void 0,className:"overflow-y-auto flex-1 p-2 min-h-0",children:A?ye?e.jsxs("div",{role:"alert",className:"px-2 py-5 text-center font-mono text-[10.5px] text-red-700 dark:text-red-300",children:[e.jsx("div",{children:r("preview.files.searchFailed")}),e.jsx("button",{type:"button",onClick:()=>U(o=>o+1),className:"mt-1 underline underline-offset-2",children:r("preview.action.retry")})]}):le.length>0?le.map((o,b)=>e.jsxs("button",{type:"button",role:"option","aria-selected":b===G,"data-preview-file-result":b,onMouseEnter:()=>B(b),onClick:()=>void Qe(o),className:$("mb-0.5 flex w-full min-w-0 flex-col rounded-md px-2 py-1.5 text-left font-mono transition-colors",b===G?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))]"),children:[e.jsx("span",{className:"truncate text-[11.5px]",children:Zt(o)}),e.jsx("span",{className:"truncate text-[9px] text-[hsl(var(--deck-ink-faint))]",children:o})]},o)):!re&&e.jsx("div",{className:"px-2 py-5 text-center font-mono text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:r("preview.files.noMatches")}):e.jsx(ms,{nodes:we,expandedDirs:Le,childrenCache:Re,directoryStates:oe,selectedPath:K,onToggleDir:fr,onRetryDir:hr,onSelectFile:Qe})})]}),e.jsxs("div",{className:"border border-[hsl(var(--deck-border))] rounded-lg overflow-hidden flex flex-col min-h-0",children:[e.jsxs("div",{className:"px-3 py-2 bg-[hsl(var(--deck-surface-2))] border-b border-[hsl(var(--deck-border))] text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono flex items-center justify-between",children:[e.jsx("span",{className:"min-w-0 truncate",children:K||r("preview.files.selectTitle")}),K&&e.jsx("span",{className:"ml-2 shrink-0 text-[11px] text-[hsl(var(--deck-ink-faint))] font-mono",children:r(Ue?"preview.files.status.loading":Ke?"preview.files.status.truncated":"preview.files.status.ready")})]}),Ke&&!Ue&&e.jsx("div",{className:"px-3 py-2 bg-[#FEF3C7] dark:bg-[#111113] border-b border-[hsl(var(--deck-border))] text-[11px] text-[#b45309] dark:text-[#facc15] font-mono",children:r("preview.files.truncatedNotice")}),e.jsxs("div",{className:"flex-1 min-h-0",children:[!K&&e.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:r("preview.files.pickHint")}),K&&Ie&&e.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2 px-4 text-center font-mono text-[12px] text-[#DC2626] dark:text-[#fca5a5]",children:[e.jsx("span",{children:Ie}),e.jsx("button",{type:"button",onClick:()=>void Qe(K),className:"underline underline-offset-2",children:r("preview.action.retry")})]}),K&&!Ie&&e.jsx("div",{className:"h-full",children:Ue?e.jsx(qt,{}):e.jsx(i.Suspense,{fallback:e.jsx(qt,{}),children:e.jsx(ys,{content:se,filename:K})})})]})]})]})]})}),e.jsx(Ye,{value:"logs",className:"overflow-hidden flex-1 mt-0",children:e.jsx(xs,{logs:lr})}),e.jsx(Ye,{value:"browser",forceMount:!0,className:"overflow-hidden flex-1 min-h-0",children:e.jsx(cs,{sessionRef:u,onElementAdded:()=>{I&&s()}})})]})]})}function Te({title:t,subtitle:n,actionLabel:r,onAction:s,role:a}){return e.jsxs("div",{role:a,className:"border border-dashed border-[hsl(var(--deck-border))] rounded-lg p-6 text-center",children:[e.jsx("div",{className:"text-[13px] text-[hsl(var(--deck-ink))] font-mono",children:t}),e.jsx("div",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono mt-1",children:n}),r&&s&&e.jsx("button",{type:"button",onClick:s,className:"mt-3 rounded-md border border-[hsl(var(--deck-border))] px-2.5 py-1 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))] transition-colors hover:bg-[hsl(var(--deck-surface))] hover:text-[hsl(var(--deck-ink))]",children:r})]})}function ks(t){return t.flatMap(n=>{var a,l,d;const r=[];if((a=n.agentContent)!=null&&a.toolCalls)for(const f of n.agentContent.toolCalls){const p=Bt(f.arguments),g=f.output,w=g?(l=We(g))!=null&&l.diff?Ut(g):g:void 0;r.push({id:`${n.id}-${f.toolCallId}`,title:f.toolName||"Tool",subtitle:f.summary,status:f.status==="success"?"success":f.status==="error"?"error":"running",content:w||(p?`Arguments:
64
- ${p}`:void 0),timestamp:n.timestamp})}const s=n.metadata;if(s){if(s.kind==="tool_call"){const f=s.toolName||"Tool",p=Bt(s.arguments);r.push({id:n.id,title:`Tool Call · ${f}`,subtitle:s.toolKind?String(s.toolKind):void 0,status:s.status==="success"?"success":s.status==="error"?"error":"running",content:p?`Arguments:
65
- ${p}`:void 0,timestamp:n.timestamp})}if(s.kind==="tool_result"){const f=s.toolName||"Tool",p=s.success,g=s.summary,w=s.output,u=w?(d=We(w))!=null&&d.diff?Ut(w):w:void 0;r.push({id:n.id,title:`Tool Result · ${f}`,subtitle:g,status:p===void 0?"running":p?"success":"error",content:u,timestamp:n.timestamp})}}return r})}function ws(t){var s;const n=[],r=new Set;for(let a=t.length-1;a>=0;a-=1){const l=t[a];if((s=l.agentContent)!=null&&s.toolCalls)for(let w=l.agentContent.toolCalls.length-1;w>=0;w-=1){const u=l.agentContent.toolCalls[w],k=u.metadata;if((k==null?void 0:k.kind)==="patch"&&Array.isArray(k.changes)){zt(n,r,k.changes,u.summary);continue}const _=u.output||"",m=We(_)||We((k==null?void 0:k.diff_snippet)||"");if(m!=null&&m.diff){const j=(k==null?void 0:k.file_path)||u.toolName||"unknown";if(!r.has(j)){r.add(j);const v=typeof(k==null?void 0:k.oldContent)=="string"?k.oldContent:void 0,P=typeof(k==null?void 0:k.newContent)=="string"?k.newContent:void 0;n.push({diff:m.diff,filePath:j,summary:u.summary,oldContent:v,newContent:P})}}}const d=l.metadata;if(!d||d.kind!=="tool_result")continue;const f=d.metadata;if((f==null?void 0:f.kind)==="patch"&&Array.isArray(f.changes)){zt(n,r,f.changes,d.summary);continue}const p=d.output||(typeof l.content=="string"?l.content:"")||"",g=We(p)||We((f==null?void 0:f.diff_snippet)||"");if(g!=null&&g.diff){const w=(f==null?void 0:f.file_path)||d.toolName||"unknown";if(!r.has(w)){r.add(w);const u=typeof(f==null?void 0:f.oldContent)=="string"?f.oldContent:void 0,k=typeof(f==null?void 0:f.newContent)=="string"?f.newContent:void 0;n.push({diff:g.diff,filePath:w,summary:d.summary,oldContent:u,newContent:k})}}}return n.reverse()}function zt(t,n,r,s){for(let a=r.length-1;a>=0;a--){const l=r[a];!l||typeof l!="object"||!("path"in l)||typeof l.path!="string"||!("diff"in l)||typeof l.diff!="string"||n.has(l.path)||(n.add(l.path),t.push({diff:{patch:l.diff,startLine:1,matchLine:1},filePath:l.path,summary:s,oldContent:"oldContent"in l&&typeof l.oldContent=="string"?l.oldContent:void 0,newContent:"newContent"in l&&typeof l.newContent=="string"?l.newContent:void 0}))}}function We(t){if(!t)return null;const n=/<<<DIFF>>>\s*([\s\S]*?)\s*<<<\/DIFF>>>/m,r=t.match(n);if(!r)return null;try{return{diff:JSON.parse(r[1])}}catch{return null}}function Ut(t){return t?t.replace(/<<<DIFF>>>[\s\S]*?<<<\/DIFF>>>/m,"").trim():""}function Bt(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)}function qt(){const t=ke();return e.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:t("preview.files.editorLoading")})}function ys({content:t,filename:n}){const{codeTheme:r}=Er(),s=i.useRef(null),[a,l]=i.useState("vs-dark"),d=js(n),f=p=>{s.current=p;const g=Rt(p,r);l(g)};return i.useEffect(()=>{if(s.current){const p=Rt(s.current,r);l(p)}},[r]),e.jsx(gs,{value:t,language:d,theme:a,height:"100%",beforeMount:f,options:{readOnly:!0,minimap:{enabled:!1},fontSize:12,lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0}},n)}function js(t){var s;const n=((s=t.split(".").pop())==null?void 0:s.toLowerCase())||"";return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",md:"markdown",css:"css",scss:"scss",html:"html",yml:"yaml",yaml:"yaml",go:"go",rs:"rust",py:"python",java:"java",c:"c",cpp:"cpp",h:"cpp",hpp:"cpp",sh:"shell",zsh:"shell",toml:"toml",xml:"xml"}[n]||"plaintext"}export{Ds as FilePreview,Is as PreviewControls};
@@ -1,16 +0,0 @@
1
- import{j as e,r as p}from"./vendor-react-DofNRwfy.js";import{c as G,u as U,b as g,d as q,I as re,J as be,j as P,L as E,R as fe,K as ve,v as ge,M as je,N as Ne,O as ye,t as we,A as Se,D as Pe,e as Te,f as Ce,g as De,h as Ie,Q as se,i as Ae,U as ae,a as o,V as _e,Y as Ke,Z as Ee,$ as Me,a0 as Fe,W as Re,y as Le,a1 as Oe}from"./index-DaiT-mmo.js";import{l as Q}from"./session-events-CWzF04l4.js";import{C as ce}from"./calendar-clock-8W4ostX1.js";import{C as qe}from"./clock-3-aXgeptZP.js";import{P as ze}from"./play-DsdF5dji.js";import{P as Be}from"./pause-DVIT6IIr.js";import"./vendor-radix-Bc1_Q9tz.js";/**
2
- * @license lucide-react v0.300.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ve=G("FileDiff",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/**
7
- * @license lucide-react v0.300.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Qe=G("MessageSquareWarning",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v2",key:"stiyo7"}],["path",{d:"M12 13h.01",key:"y0uutt"}]]);/**
12
- * @license lucide-react v0.300.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Ue=G("Tag",[["path",{d:"M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z",key:"14b2ls"}],["path",{d:"M7 7h.01",key:"7u93v4"}]]),Z=["waiting","active","blocked","review"],te={high:0,medium:1,low:2};function Ye(t){return t.taskIsolation!==void 0||t.taskPromptSummary!==void 0||t.taskRetryAvailable===!0}function ne(t){return t.taskSourceProjectPath||t.projectPath}function He(t){return t.pendingInteraction?"blocked":t.taskStatus==="queued"?"waiting":t.taskStatus==="running"?"active":t.taskStatus==="completed"?"review":"blocked"}function We(t,r){if(t.pendingInteraction!==r.pendingInteraction)return t.pendingInteraction?-1:1;const i=te[t.taskPriority??"medium"]-te[r.taskPriority??"medium"];if(i!==0)return i;const u=t.taskDueAt?Date.parse(t.taskDueAt):Number.POSITIVE_INFINITY,n=r.taskDueAt?Date.parse(r.taskDueAt):Number.POSITIVE_INFINITY;if(u!==n)return u-n;if(t.taskStatus==="queued"&&r.taskStatus==="queued"){const m=(t.taskQueuePosition??Number.POSITIVE_INFINITY)-(r.taskQueuePosition??Number.POSITIVE_INFINITY);if(m!==0)return m}return r.lastMessageTime.localeCompare(t.lastMessageTime)}function $e(t){const r={waiting:[],active:[],blocked:[],review:[]};for(const i of t)Ye(i)&&r[He(i)].push(i);for(const i of Z)r[i].sort(We);return r}function Ze(t){return`TASK-${t.replace(/^task-?/,"").slice(0,6).toUpperCase()}`}const Ge={high:{label:"kanban.priority.high",className:"border-red-200 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300"},medium:{label:"kanban.priority.medium",className:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/70 dark:bg-amber-950/35 dark:text-amber-300"},low:{label:"kanban.priority.low",className:"border-zinc-200 bg-zinc-50 text-zinc-600 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-400"}},Je={feature:"kanban.kind.feature",bug:"kanban.kind.bug",maintenance:"kanban.kind.maintenance",research:"kanban.kind.research"};function Xe(t){const r=new Date(t);return Number.isNaN(r.getTime())?"":new Intl.DateTimeFormat(ye()==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(r)}function K({label:t,onClick:r,disabled:i,tone:u="neutral",children:n}){return e.jsx("button",{type:"button","aria-label":t,title:t,disabled:i,onClick:r,className:P("flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:cursor-wait disabled:opacity-45",u==="danger"?"text-red-500 hover:bg-red-500/10 focus-visible:ring-red-500":u==="accent"?"text-[hsl(var(--deck-accent))] hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:ring-[hsl(var(--deck-accent))]":"text-[hsl(var(--deck-ink-faint))] hover:bg-[hsl(var(--deck-surface-2))] hover:text-[hsl(var(--deck-ink))] focus-visible:ring-[hsl(var(--deck-accent))]"),children:n})}function ea({session:t,unread:r,cancelling:i,retrying:u,updating:n,onOpen:m,onInspect:T,onEdit:C,onCancel:y,onRetry:c,onArchive:h}){const l=U(),w=g(t),f=q(w),b=re(t,l),v=Ge[t.taskPriority??"medium"],k=t.taskKind??"feature",x=be(t,l),D=t.taskSourceProjectPath||t.projectPath,I=D.split("/").filter(Boolean).at(-1)||D,M=t.taskStatus==="queued"||t.taskStatus==="running",N=!!t.taskRetryAvailable&&["failed","interrupted","cancelled"].includes(t.taskStatus),A=!!t.pendingInteraction,S=t.taskStatus==="completed";return e.jsxs("article",{"data-kanban-task":f,className:P("group rounded-md border bg-[hsl(var(--deck-surface))] px-3 py-3 shadow-[0_1px_2px_hsl(var(--deck-ink)/0.04)] transition-[border-color,box-shadow,transform]","border-[hsl(var(--deck-border))] hover:-translate-y-px hover:border-[hsl(var(--deck-border-strong))] hover:shadow-[0_8px_24px_-16px_hsl(var(--deck-ink)/0.35)]",r&&"border-[hsl(var(--deck-accent)/0.55)]"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"font-mono text-[9.5px] uppercase text-[hsl(var(--deck-ink-faint))]",children:Ze(t.sessionId)}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[r&&e.jsx("span",{"aria-label":l("kanban.card.unread"),title:l("kanban.card.unread"),className:"h-1.5 w-1.5 rounded-full bg-[hsl(var(--deck-accent))] shadow-[0_0_6px_hsl(var(--deck-accent-glow)/0.8)]"}),e.jsx("span",{className:"truncate font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:I})]})]}),e.jsx("button",{type:"button",onClick:m,className:"mt-2 block w-full text-left text-[13px] font-medium leading-[1.45] text-[hsl(var(--deck-ink))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))]",children:b}),x&&e.jsx("p",{title:x,className:P("mt-1.5 line-clamp-2 text-[10.5px] leading-[1.45]",A||t.taskStatus==="failed"?"text-red-600 dark:text-red-400":"text-[hsl(var(--deck-ink-faint))]"),children:x}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1",children:[e.jsx("span",{className:P("rounded-sm border px-1.5 py-0.5 font-mono text-[9px] font-medium",v.className),children:l(v.label)}),e.jsx("span",{className:"rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-1.5 py-0.5 font-mono text-[9px] text-[hsl(var(--deck-ink-muted))]",children:l(Je[k])}),t.taskDueAt&&e.jsxs("span",{className:P("inline-flex items-center gap-1 rounded-sm border px-1.5 py-0.5 font-mono text-[9px]",Date.parse(t.taskDueAt)<Date.now()&&!S?"border-red-200 bg-red-50 text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300":"border-[hsl(var(--deck-border))] text-[hsl(var(--deck-ink-faint))]"),children:[e.jsx(ce,{className:"h-2.5 w-2.5"}),Xe(t.taskDueAt)]})]}),t.taskStatus==="queued"&&t.taskQueuePosition&&e.jsx("div",{className:"mt-2 font-mono text-[9.5px] text-amber-700 dark:text-amber-400",children:l("kanban.card.queuePosition",{position:t.taskQueuePosition,depth:t.taskQueueDepth??t.taskQueuePosition})}),t.taskDiffStat&&e.jsx("div",{className:"mt-2 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:l("kanban.card.diff",{files:t.taskDiffStat.changedFiles,additions:t.taskDiffStat.additions,deletions:t.taskDiffStat.deletions})}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-0.5 border-t border-[hsl(var(--deck-hairline))] pt-2",children:[A&&e.jsx(K,{label:l("kanban.action.respond"),onClick:m,tone:"danger",children:e.jsx(Qe,{className:"h-3.5 w-3.5"})}),S&&e.jsx(K,{label:l("kanban.action.inspect"),onClick:T,tone:"accent",children:e.jsx(Ve,{className:"h-3.5 w-3.5"})}),N&&e.jsx(K,{label:l("kanban.action.retry"),onClick:c,disabled:u,tone:"accent",children:u?e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(fe,{className:"h-3.5 w-3.5"})}),M&&e.jsx(K,{label:l("kanban.action.cancel"),onClick:y,disabled:i,tone:"danger",children:i?e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ve,{className:"h-3.5 w-3.5"})}),e.jsx(K,{label:l("kanban.action.edit"),onClick:C,disabled:n,children:n?e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(ge,{className:"h-3.5 w-3.5"})}),S&&e.jsx(K,{label:l("kanban.action.archive"),onClick:h,children:e.jsx(je,{className:"h-3.5 w-3.5"})}),e.jsx(K,{label:l("kanban.action.open"),onClick:m,children:e.jsx(Ne,{className:"h-3.5 w-3.5"})})]})]})}const aa={waiting:{title:"kanban.column.waiting",description:"kanban.column.waitingDescription",icon:qe,accent:"bg-amber-400",iconStyle:"text-amber-700 dark:text-amber-400"},active:{title:"kanban.column.active",description:"kanban.column.activeDescription",icon:E,accent:"bg-blue-500",iconStyle:"text-blue-700 dark:text-blue-400"},blocked:{title:"kanban.column.blocked",description:"kanban.column.blockedDescription",icon:Se,accent:"bg-red-500",iconStyle:"text-red-700 dark:text-red-400"},review:{title:"kanban.column.review",description:"kanban.column.reviewDescription",icon:we,accent:"bg-[hsl(var(--deck-accent))]",iconStyle:"text-[hsl(var(--deck-accent))]"}};function ta({id:t,sessions:r,unreadTaskKeys:i,cancellingTaskKeys:u,retryingTaskKeys:n,updatingTaskKeys:m,taskKey:T,onOpen:C,onInspect:y,onEdit:c,onCancel:h,onRetry:l,onArchive:w}){const f=U(),b=aa[t],v=b.icon;return e.jsxs("section",{"data-kanban-column":t,"aria-labelledby":`kanban-column-${t}`,className:"flex min-h-[180px] min-w-0 flex-col border-t-2 border-[hsl(var(--deck-hairline))] pt-3 md:min-h-[360px]",children:[e.jsxs("header",{className:"mb-3 flex min-h-12 items-start gap-2 px-0.5",children:[e.jsx(v,{className:P("mt-0.5 h-3.5 w-3.5 shrink-0",b.iconStyle,t==="active"&&"animate-spin")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{id:`kanban-column-${t}`,className:"font-mono text-[11px] font-semibold uppercase text-[hsl(var(--deck-ink))]",children:f(b.title)}),e.jsx("span",{className:"min-w-5 rounded-sm bg-[hsl(var(--deck-surface-2))] px-1.5 py-0.5 text-center font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:r.length})]}),e.jsx("p",{className:"mt-0.5 text-[10px] leading-4 text-[hsl(var(--deck-ink-faint))]",children:f(b.description)})]}),e.jsx("span",{className:P("mt-1 h-1.5 w-1.5 shrink-0 rounded-full",b.accent)})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-2.5",children:[r.map(k=>{const x=T(k);return e.jsx(ea,{session:k,unread:i.includes(x),cancelling:u.includes(x),retrying:n.includes(x),updating:m.includes(x),onOpen:()=>C(k),onInspect:()=>y(k),onEdit:()=>c(k),onCancel:()=>h(k),onRetry:()=>l(k),onArchive:()=>w(k)},x)}),r.length===0&&e.jsx("div",{className:"flex min-h-28 items-center justify-center rounded-md border border-dashed border-[hsl(var(--deck-border))] px-4 text-center font-mono text-[10px] leading-4 text-[hsl(var(--deck-ink-faint))]",children:f("kanban.column.empty")})]})]})}function na(t){if(!t)return"";const r=new Date(t);return Number.isNaN(r.getTime())?"":new Date(r.getTime()-r.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function ra({open:t,onOpenChange:r,projects:i,defaultProjectPath:u,session:n,submitting:m,canCreate:T,onCreate:C,onUpdate:y}){const c=U(),h=!!n,[l,w]=p.useState(""),[f,b]=p.useState(""),[v,k]=p.useState(u??""),[x,D]=p.useState("medium"),[I,M]=p.useState("feature"),[N,A]=p.useState(""),[S,F]=p.useState(null);p.useEffect(()=>{var s;t&&(w((n==null?void 0:n.title)??""),b((n==null?void 0:n.taskPromptSummary)??""),k((n==null?void 0:n.taskSourceProjectPath)??(n==null?void 0:n.projectPath)??u??((s=i.find(j=>j.available))==null?void 0:s.path)??""),D((n==null?void 0:n.taskPriority)??"medium"),M((n==null?void 0:n.taskKind)??"feature"),A(na(n==null?void 0:n.taskDueAt)),F(null))},[u,t,i,n]);const z=async s=>{s.preventDefault();const j=l.trim(),B=f.trim();if(!(!h&&(!B||!v))){F(null);try{h?await y({...j?{title:j}:{},taskPriority:x,taskKind:I,taskDueAt:N?new Date(N).toISOString():null}):await C({...j?{title:j}:{},prompt:B,projectPath:v,taskPriority:x,taskKind:I,...N?{taskDueAt:new Date(N).toISOString()}:{}}),r(!1)}catch(R){F(R instanceof Error?R.message:c("kanban.dialog.submitFailed"))}}};return e.jsx(Pe,{open:t,onOpenChange:r,children:e.jsxs(Te,{className:"max-w-[560px] gap-0 overflow-hidden border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-0",children:[e.jsxs(Ce,{className:"border-b border-[hsl(var(--deck-hairline))] px-5 py-4",children:[e.jsx(De,{className:"font-mono text-[15px] text-[hsl(var(--deck-ink))]",children:c(h?"kanban.dialog.editTitle":"kanban.dialog.createTitle")}),e.jsx(Ie,{className:"text-[11.5px] text-[hsl(var(--deck-ink-faint))]",children:c(h?"kanban.dialog.editDescription":"kanban.dialog.createDescription")})]}),e.jsxs("form",{onSubmit:z,children:[e.jsxs("div",{className:"grid gap-4 px-5 py-5",children:[e.jsxs("label",{className:"grid gap-1.5",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:c("kanban.field.title")}),e.jsx("input",{value:l,onChange:s=>w(s.target.value),maxLength:200,className:"field",placeholder:c("kanban.field.titlePlaceholder")})]}),!h&&e.jsxs("label",{className:"grid gap-1.5",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:c("kanban.field.prompt")}),e.jsx("textarea",{required:!0,value:f,onChange:s=>b(s.target.value),maxLength:32e3,rows:6,className:"min-h-32 w-full resize-y rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-3 py-2.5 text-[13px] leading-5 text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.6)] focus:ring-1 focus:ring-[hsl(var(--deck-accent)/0.35)]",placeholder:c("kanban.field.promptPlaceholder")})]}),!h&&e.jsxs("label",{className:"grid gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(se,{className:"h-3 w-3"}),c("kanban.field.project")]}),e.jsx("select",{required:!0,value:v,onChange:s=>k(s.target.value),className:"field",children:i.filter(s=>s.available).map(s=>e.jsx("option",{value:s.path,children:s.name},s.path))})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsxs("label",{className:"grid gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(Ue,{className:"h-3 w-3"}),c("kanban.field.kind")]}),e.jsxs("select",{value:I,onChange:s=>M(s.target.value),className:"field",children:[e.jsx("option",{value:"feature",children:c("kanban.kind.feature")}),e.jsx("option",{value:"bug",children:c("kanban.kind.bug")}),e.jsx("option",{value:"maintenance",children:c("kanban.kind.maintenance")}),e.jsx("option",{value:"research",children:c("kanban.kind.research")})]})]}),e.jsxs("label",{className:"grid gap-1.5",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:c("kanban.field.priority")}),e.jsxs("select",{value:x,onChange:s=>D(s.target.value),className:"field",children:[e.jsx("option",{value:"high",children:c("kanban.priority.high")}),e.jsx("option",{value:"medium",children:c("kanban.priority.medium")}),e.jsx("option",{value:"low",children:c("kanban.priority.low")})]})]}),e.jsxs("label",{className:"grid gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[10px] uppercase text-[hsl(var(--deck-ink-muted))]",children:[e.jsx(ce,{className:"h-3 w-3"}),c("kanban.field.dueAt")]}),e.jsx("input",{type:"datetime-local",value:N,onChange:s=>A(s.target.value),className:"field min-w-0"})]})]}),!h&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface-2))] px-3 py-2 font-mono text-[10px] text-[hsl(var(--deck-ink-muted))]",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[hsl(var(--deck-accent))]"}),c("kanban.dialog.localExecution")]}),S&&e.jsx("div",{role:"alert",className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-[11px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:S})]}),e.jsxs(Ae,{className:"border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-surface-2))]/60 px-5 py-3",children:[e.jsx(ae,{type:"button",variant:"ghost",onClick:()=>r(!1),disabled:m,children:c("kanban.dialog.cancel")}),e.jsxs(ae,{type:"submit",disabled:m||!h&&(!T||!f.trim()||!v),className:"gap-2",children:[m&&e.jsx(E,{className:"h-3.5 w-3.5 animate-spin"}),c(h?"kanban.dialog.save":"kanban.dialog.dispatch")]})]})]})]})})}function ha(){var ee;const t=U(),r=o(a=>a.sessions),i=o(a=>a.boundProjects),u=o(a=>a.selectedProjectPath),n=o(a=>a.taskWorkspaceInfo),m=o(a=>a.catalogLoadState),T=o(a=>a.taskEventConnectionState),C=o(a=>a.isDispatchingTask),y=o(a=>a.isUpdatingTaskAdmission),c=o(a=>a.cancellingTaskKeys),h=o(a=>a.retryingTaskKeys),l=o(a=>a.updatingTaskKeys),w=o(a=>a.unreadTaskKeys),f=o(a=>a.error),b=o(a=>a.selectProject),v=o(a=>a.selectSession),k=o(a=>a.dispatchTask),x=o(a=>a.updateTask),D=o(a=>a.cancelTask),I=o(a=>a.retryTask),M=o(a=>a.archiveSession),N=o(a=>a.setTaskAdmissionPaused),A=o(a=>a.reconnectTaskEvents),S=o(a=>a.clearError),F=_e(a=>a.currentMode),z=Q(a=>a.setMainView),s=Q(a=>a.boardProjectPath),j=Q(a=>a.setBoardProjectPath),B=Q(a=>a.openFilePreview),[R,ie]=p.useState(""),[le,Y]=p.useState(!1),[oe,H]=p.useState(null),[de,W]=p.useState(!1);p.useEffect(()=>{s&&!i.some(a=>a.path===s&&a.available)&&j(null)},[s,i,j]);const L=r.find(a=>q(g(a))===oe)??null,$=R.trim().toLowerCase(),J=p.useMemo(()=>r.filter(a=>s&&ne(a)!==s?!1:$?[a.sessionId,re(a,t),a.taskPromptSummary,ne(a),a.taskPriority,a.taskKind].filter(Boolean).join(" ").toLowerCase().includes($):!0),[s,$,r,t]),X=p.useMemo(()=>$e(J),[J]),ue=Z.reduce((a,d)=>a+X[d].length,0),_=n==null?void 0:n.taskAdmission,O=_?!_.paused:!0,V=i.filter(a=>a.available),me=s??u??((ee=V[0])==null?void 0:ee.path)??null,he=L?l.includes(q(g(L))):C,ke=async a=>{z("workspace"),await v(g(a))},xe=async a=>{z("workspace"),await v(g(a)),B({tab:"diff"})},pe=async a=>{b(a.projectPath),await k({...a,isolation:"local",permissionMode:F},{selectSession:!1})};return e.jsxs("main",{"data-kanban-board":!0,className:"flex h-full min-w-0 flex-col overflow-hidden bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))]",children:[e.jsxs("div",{className:"border-b border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas))] px-4 py-3 sm:px-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"font-mono text-[15px] font-semibold",children:t("kanban.title")}),e.jsx("span",{className:"rounded-sm border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-1.5 py-0.5 font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:t("kanban.taskCount",{count:ue})})]}),e.jsx("p",{className:"mt-0.5 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:t("kanban.subtitle")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[_&&e.jsx("div",{className:"hidden rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-2.5 py-1.5 lg:block",children:e.jsx(Ke,{inFlight:_.inFlight,queued:_.queued,maxConcurrent:_.maxConcurrent,compact:!0})}),e.jsxs("button",{type:"button",role:"switch","aria-checked":O,disabled:!_||y,onClick:()=>{N(O).catch(()=>{})},className:P("inline-flex h-8 items-center gap-2 rounded-md border px-2.5 font-mono text-[10.5px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:opacity-45",O?"border-[hsl(var(--deck-accent)/0.45)] bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-accent))]":"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-muted))]"),children:[y?e.jsx(E,{className:"h-3 w-3 animate-spin"}):O?e.jsx(ze,{className:"h-3 w-3 fill-current"}):e.jsx(Be,{className:"h-3 w-3"}),t(O?"kanban.autoClaim.running":"kanban.autoClaim.paused")]}),e.jsxs("button",{type:"button",onClick:()=>{if(V.length===0){W(!0);return}H(null),Y(!0)},className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-[hsl(var(--deck-ink))] px-3 font-mono text-[10.5px] font-medium text-[hsl(var(--deck-canvas))] transition-opacity hover:opacity-85 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--deck-accent))]",children:[e.jsx(Ee,{className:"h-3.5 w-3.5"}),t("kanban.action.newTask")]})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsxs("label",{className:"relative min-w-[180px] flex-1 sm:max-w-[320px]",children:[e.jsx(Me,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[hsl(var(--deck-ink-faint))]"}),e.jsx("input",{type:"search",value:R,onChange:a=>ie(a.target.value),"aria-label":t("kanban.searchAria"),placeholder:t("kanban.searchPlaceholder"),className:"h-8 w-full rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] pl-8 pr-3 font-mono text-[10.5px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))] focus:border-[hsl(var(--deck-accent)/0.55)] focus:ring-1 focus:ring-[hsl(var(--deck-accent)/0.25)]"})]}),e.jsxs("label",{className:"relative",children:[e.jsx(se,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[hsl(var(--deck-accent))]"}),e.jsxs("select",{value:s??"__all__",onChange:a=>{const d=a.target.value;j(d==="__all__"?null:d),d!=="__all__"&&b(d)},"aria-label":t("kanban.projectFilterAria"),className:"h-8 min-w-[160px] appearance-none rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] pl-8 pr-7 font-mono text-[10.5px] text-[hsl(var(--deck-ink-muted))] outline-none focus:border-[hsl(var(--deck-accent)/0.55)]",children:[e.jsx("option",{value:"__all__",children:t("kanban.projectAll")}),V.map(a=>e.jsx("option",{value:a.path,children:a.name},a.path))]})]}),e.jsx("button",{type:"button",onClick:()=>W(!0),"aria-label":t("projects.bind.action"),title:t("projects.bind.action"),className:"flex h-8 w-8 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-accent))]",children:e.jsx(Fe,{className:"h-3.5 w-3.5"})}),m==="loading"||m==="hydrating"?e.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[e.jsx(E,{className:"h-3 w-3 animate-spin"}),t("sidebar.catalog.syncing")]}):null]})]}),T==="offline"&&e.jsxs("div",{role:"alert",className:"flex items-center gap-2 border-b border-amber-300/60 bg-amber-50/80 px-4 py-2 text-[10.5px] text-amber-800 dark:border-amber-900/70 dark:bg-amber-950/30 dark:text-amber-300 sm:px-6",children:[e.jsx(Re,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"flex-1",children:t("kanban.feed.offline")}),e.jsxs("button",{type:"button",onClick:()=>void A().catch(()=>{}),className:"inline-flex h-7 items-center gap-1 rounded-md px-2 font-mono hover:bg-amber-100 dark:hover:bg-amber-900/40",children:[e.jsx(Le,{className:"h-3 w-3"}),t("taskHome.feed.retry")]})]}),f&&e.jsxs("div",{role:"alert",className:"flex items-center gap-3 border-b border-red-200 bg-red-50 px-4 py-2 text-[10.5px] text-red-700 dark:border-red-900/70 dark:bg-red-950/30 dark:text-red-300 sm:px-6",children:[e.jsx("span",{className:"flex-1",children:f}),e.jsx("button",{type:"button",onClick:S,className:"font-mono underline",children:t("taskHome.error.dismiss")})]}),e.jsx("div",{className:"flex-1 overflow-auto px-4 py-4 sm:px-6",children:e.jsx("div",{className:"grid min-w-0 grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4",children:Z.map(a=>e.jsx(ta,{id:a,sessions:X[a],unreadTaskKeys:w,cancellingTaskKeys:c,retryingTaskKeys:h,updatingTaskKeys:l,taskKey:d=>q(g(d)),onOpen:d=>{ke(d).catch(()=>{})},onInspect:d=>{xe(d).catch(()=>{})},onEdit:d=>{H(q(g(d))),Y(!0)},onCancel:d=>{D(g(d)).catch(()=>{})},onRetry:d=>{I(g(d)).catch(()=>{})},onArchive:d=>{M(g(d))}},a))})}),e.jsx(ra,{open:le,onOpenChange:a=>{Y(a),a||H(null)},projects:i,defaultProjectPath:me,session:L,submitting:he,canCreate:V.length>0,onCreate:pe,onUpdate:async a=>{L&&await x(g(L),a)}}),e.jsx(Oe,{open:de,onOpenChange:W})]})}export{ha as KanbanBoard};
@@ -1,26 +0,0 @@
1
- import{j as n,r as d}from"./vendor-react-DofNRwfy.js";import{c as D,j as N,ac as Me,d as _,b as R,I as De,ad as q,ae as Z,af as Ae,u as Ie,a as o,ag as P,Z as Le,ah as Pe,ai as Fe,aj as Re,ak as qe,E as Ee,D as Be,e as Ke,al as $e,g as Oe,h as ze,$ as G,s as We,A as he,t as Qe,G as He,L as F,K as Ue,R as Ve}from"./index-DaiT-mmo.js";import{l as h}from"./session-events-CWzF04l4.js";import{A as ue,F as Ge}from"./folder-BOCc5dv2.js";import{C as _e}from"./clock-3-aXgeptZP.js";import"./vendor-radix-Bc1_Q9tz.js";/**
2
- * @license lucide-react v0.300.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ze=D("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
7
- * @license lucide-react v0.300.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Je=D("Cpu",[["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"9",y:"9",width:"6",height:"6",key:"o3kz5p"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
12
- * @license lucide-react v0.300.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Xe=D("Keyboard",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",ry:"2",key:"15u882"}],["path",{d:"M6 8h.001",key:"1ej0i3"}],["path",{d:"M10 8h.001",key:"1x2st2"}],["path",{d:"M14 8h.001",key:"1vkmyp"}],["path",{d:"M18 8h.001",key:"kfsenl"}],["path",{d:"M8 12h.001",key:"1sjpby"}],["path",{d:"M12 12h.001",key:"al75ts"}],["path",{d:"M16 12h.001",key:"931bgk"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
17
- * @license lucide-react v0.300.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const Ye=D("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"9",x2:"9",y1:"3",y2:"21",key:"13tij5"}]]);/**
22
- * @license lucide-react v0.300.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const et=D("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function tt(t,r){const s=r.trim().toLocaleLowerCase();return s?t.filter(i=>`${i.label} ${i.description} ${i.keywords}`.toLocaleLowerCase().includes(s)):t}function nt({actions:t,selectedIndex:r,onSelect:s,onRun:i}){return t.map((c,p)=>{const k=p===r,m=c.icon;return n.jsx("div",{id:`command-center-result-${p}`,"data-task-result-index":p,role:"option","aria-selected":k,onMouseEnter:()=>s(p),className:N("group flex min-h-[58px] w-full items-center rounded-lg border border-transparent text-left transition-colors",k?"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]":"hover:bg-[hsl(var(--deck-surface))]/60"),children:n.jsxs("button",{type:"button",onClick:()=>i(c),className:"flex min-h-[58px] min-w-0 flex-1 items-center gap-3 px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))]",children:[n.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-accent))]",children:n.jsx(m,{className:"h-3.5 w-3.5"})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate font-mono text-[12.5px] font-medium text-[hsl(var(--deck-ink))]",children:c.label}),n.jsx("span",{className:"mt-0.5 block truncate text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:c.description})]}),c.shortcut&&n.jsx("span",{className:"shrink-0 rounded border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] px-1.5 py-0.5 font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:c.shortcut}),n.jsx(ue,{className:N("h-3.5 w-3.5 shrink-0 transition-all",k?"translate-x-0 text-[hsl(var(--deck-accent))] opacity-100":"-translate-x-1 text-[hsl(var(--deck-ink-faint))] opacity-0")})]})},c.id)})}const st={running:"running active 进行中 运行中",queued:"queued waiting 排队中 等待中",interrupted:"interrupted paused 已暂停 已中断",failed:"failed error 已失败 错误",cancelled:"cancelled canceled 已取消",completed:"completed done finished 已完成 完成"};function J(t){return De(t,Ae)}function at(t){const r=t.lastMessageTime||t.firstMessageTime;if(!r)return"";const s=new Date(r);return Number.isNaN(s.getTime())?"":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(s)}function E(t){return t.normalize("NFKC").toLocaleLowerCase().trim()}function rt(t,r){var i,c;const s=q(t,r);return E([J(t),Z(s),s,t.projectPath,t.gitBranch,t.taskWorktreeBranch,t.taskStatus,st[t.taskStatus],((i=t.pendingInteraction)==null?void 0:i.type)==="question"?"needs answer question attention 等待回答 需要回答":((c=t.pendingInteraction)==null?void 0:c.type)==="elicitation"?"mcp input elicitation attention MCP 输入 等待输入":t.pendingInteraction?"needs approval permission attention 等待审批 需要授权":"",t.sessionId].filter(Boolean).join(" "))}function pe(t,r,s){if(!r)return 0;const i=E(J(t)),c=E(Z(q(t,s)));return i===r?500:i.startsWith(r)?400:i.includes(r)?300:c===r?250:c.startsWith(r)?200:100}function it(t,r,s,i=50){const c=E(r),p=c.split(/\s+/).filter(Boolean),k=new Set;return t.filter(m=>{if(p.length===0)return!0;const u=rt(m,s);return p.every(g=>u.includes(g))}).sort((m,u)=>{const g=+!!u.pendingInteraction-+!!m.pendingInteraction;return g!==0?g:pe(u,c,s)-pe(m,c,s)||Me(m,u)}).filter(m=>{const u=_(R(m));return k.has(u)?!1:(k.add(u),!0)}).slice(0,i)}const ct={running:"sidebar.group.running",queued:"sidebar.group.queued",interrupted:"sidebar.group.interrupted",failed:"sidebar.group.failed",cancelled:"sidebar.group.cancelled",completed:"sidebar.group.done"};function ut(){const t=Ie(),r=h(e=>e.isTaskSwitcherOpen),s=h(e=>e.taskSwitcherMode),i=h(e=>e.setTaskSwitcherOpen),c=h(e=>e.setTaskSwitcherMode),p=h(e=>e.setMainView),k=h(e=>e.toggleSidebar),m=h(e=>e.isFilePreviewOpen),u=h(e=>e.setFilePreviewOpen),g=h(e=>e.openFilePreview),B=h(e=>e.toggleTerminal),w=h(e=>e.openSettings),b=o(e=>e.sessions),ke=o(e=>e.isLoading),C=o(e=>e.catalogLoadState),K=C==="loading"||C==="hydrating",$=o(e=>e.currentSessionRef),X=o(e=>e.isTemporarySession),Y=o(e=>e.startTemporarySession),O=o(e=>e.unreadTaskKeys),xe=o(e=>e.boundProjects),A=o(e=>{var a;return e.selectedProjectPath??((a=e.taskWorkspaceInfo)==null?void 0:a.cwd)??null}),fe=o(e=>e.selectProject),ge=o(e=>e.selectSession),be=o(e=>e.cancelTask),ye=o(e=>e.retryTask),ve=o(e=>e.cancellingTaskKeys),we=o(e=>e.retryingTaskKeys),[y,ee]=d.useState(""),[f,j]=d.useState(0),[je,z]=d.useState(null),[te,I]=d.useState(null),ne=d.useRef(null),se=d.useRef(null),ae=d.useMemo(()=>[{id:"new-task",label:t("commandCenter.action.newTask"),description:t("commandCenter.action.newTaskDescription"),keywords:"create compose session",icon:Le,shortcut:P("newTask"),run:()=>{p("workspace"),Y(),requestAnimationFrame(()=>Ee())}},{id:"toggle-preview",label:t("commandCenter.action.preview"),description:t("commandCenter.action.previewDescription"),keywords:"diff files logs artifact review",icon:Pe,run:()=>{m?u(!1):g((!$||X)&&h.getState().previewRequestId===0?{tab:"files"}:void 0)}},{id:"toggle-terminal",label:t("commandCenter.action.terminal"),description:t("commandCenter.action.terminalDescription"),keywords:"shell console command line",icon:Fe,run:B},{id:"open-settings",label:t("commandCenter.action.settings"),description:t("commandCenter.action.settingsDescription"),keywords:"preferences general",icon:Re,run:()=>w("general")},{id:"open-models",label:t("commandCenter.action.models"),description:t("commandCenter.action.modelsDescription"),keywords:"provider llm api configuration",icon:Je,run:()=>w("models")},{id:"open-shortcuts",label:t("commandCenter.action.shortcuts"),description:t("commandCenter.action.shortcutsDescription"),keywords:"keyboard hotkey key binding",icon:Xe,shortcut:P("openCommands"),run:()=>w("shortcuts")},{id:"open-skills",label:t("commandCenter.action.skills"),description:t("commandCenter.action.skillsDescription"),keywords:"capabilities workflow",icon:qe,run:()=>w("skills")},{id:"open-mcp",label:t("commandCenter.action.mcp"),description:t("commandCenter.action.mcpDescription"),keywords:"server tools protocol integration",icon:et,run:()=>w("mcp")},{id:"toggle-sidebar",label:t("commandCenter.action.sidebar"),description:t("commandCenter.action.sidebarDescription"),keywords:"navigation layout panel projects",icon:Ye,shortcut:P("toggleSidebar"),run:k}],[$,m,X,g,w,u,p,Y,t,k,B]),v=d.useMemo(()=>it(b,y,A),[A,y,b]),T=d.useMemo(()=>tt(ae,y),[ae,y]),M=s==="tasks"?v.length:T.length,re=d.useMemo(()=>b.filter(e=>!!e.pendingInteraction).length,[b]),W=s==="tasks"?v[f]??null:null,Q=s==="commands"?T[f]??null:null;d.useEffect(()=>{r&&(ee(""),j(0),z(null),I(null))},[s,r]),d.useEffect(()=>{j(0)},[y]),d.useEffect(()=>{var a,l;const e=(a=se.current)==null?void 0:a.querySelector(`[data-task-result-index="${f}"]`);(l=e==null?void 0:e.scrollIntoView)==null||l.call(e,{block:"nearest"})},[f]);const ie=async e=>{const a=R(e),l=_(a),x=q(e,A);z(l),xe.some(S=>S.path===x)&&fe(x);try{p("workspace"),await ge(a),i(!1)}catch(S){I(S instanceof Error?S.message:t("taskSwitcher.action.failed"))}finally{z(null)}},ce=async(e,a)=>{I(null);try{const l=R(a);e==="cancel"?await be(l):(await ye(l),i(!1))}catch(l){I(l instanceof Error?l.message:t("taskSwitcher.action.failed"))}},oe=e=>{i(!1),requestAnimationFrame(e.run)},Se=e=>{e.key==="ArrowDown"?(e.preventDefault(),j(a=>M===0?0:(a+1)%M)):e.key==="ArrowUp"?(e.preventDefault(),j(a=>M===0?0:(a-1+M)%M)):e.key==="Enter"&&W?(e.preventDefault(),ie(W)):e.key==="Enter"&&Q?(e.preventDefault(),oe(Q)):e.key==="Escape"&&(e.preventDefault(),i(!1))};return n.jsx(Be,{open:r,onOpenChange:i,children:n.jsxs(Ke,{hideCloseButton:!0,onCloseAutoFocus:$e,className:"top-3 w-[min(680px,calc(100vw-32px))] max-w-none translate-y-0 gap-0 overflow-hidden rounded-xl border-[hsl(var(--deck-border-strong))] bg-[hsl(var(--deck-canvas))] p-0 shadow-2xl sm:top-[18%]",children:[n.jsx(Oe,{className:"sr-only",children:t("commandCenter.title")}),n.jsx(ze,{className:"sr-only",children:t("commandCenter.description")}),n.jsxs("div",{className:"flex h-14 items-center gap-3 border-b border-[hsl(var(--deck-hairline))] px-4",children:[n.jsx(G,{className:"h-4 w-4 shrink-0 text-[hsl(var(--deck-accent))]"}),n.jsx("input",{ref:ne,autoFocus:!0,role:"combobox","aria-expanded":"true","aria-controls":"task-switcher-results","aria-activedescendant":W?`task-switcher-result-${f}`:Q?`command-center-result-${f}`:void 0,"aria-label":t(s==="tasks"?"taskSwitcher.searchAria":"commandCenter.searchAria"),placeholder:t(s==="tasks"?"taskSwitcher.placeholder":"commandCenter.placeholder"),value:y,onChange:e=>ee(e.target.value),onKeyDown:Se,className:"h-full min-w-0 flex-1 bg-transparent font-mono text-[14px] text-[hsl(var(--deck-ink))] outline-none placeholder:text-[hsl(var(--deck-ink-faint))]"}),n.jsx("span",{className:"rounded border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] px-1.5 py-0.5 font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:"ESC"})]}),n.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 pb-2 pt-3",children:[n.jsx("div",{role:"tablist","aria-label":t("commandCenter.modeAria"),className:"flex items-center gap-0.5 rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))] p-0.5",children:["tasks","commands"].map(e=>n.jsx("button",{type:"button",role:"tab","aria-selected":s===e,onClick:()=>{c(e),requestAnimationFrame(()=>{var a;return(a=ne.current)==null?void 0:a.focus()})},className:N("rounded-[5px] px-2.5 py-1 font-mono text-[9.5px] uppercase tracking-[0.1em] transition-colors",s===e?"bg-[hsl(var(--deck-canvas))] text-[hsl(var(--deck-ink))] shadow-sm":"text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-ink-muted))]"),children:t(e==="tasks"?"commandCenter.mode.tasks":"commandCenter.mode.commands")},e))}),n.jsx("span",{children:n.jsx("span",{className:"font-mono text-[9.5px] uppercase tracking-[0.14em] text-[hsl(var(--deck-ink-faint))]",children:s==="commands"?t("commandCenter.actions",{count:T.length}):y?t("taskSwitcher.results",{count:v.length}):K?b.length===0?t("taskSwitcher.indexing"):t("taskSwitcher.indexingLoaded",{count:b.length}):C==="error"?t("sidebar.catalog.incomplete"):re>0?t("taskSwitcher.needsAction",{count:re}):O.length>0?t("taskSwitcher.unread",{count:O.length}):t("taskSwitcher.scope",{count:b.length})})})]}),te&&n.jsx("div",{role:"alert",className:"mx-4 mb-2 rounded-md border border-red-300/70 bg-red-50 px-3 py-2 font-mono text-[10.5px] text-red-700 dark:border-red-900/70 dark:bg-red-950/35 dark:text-red-300",children:te}),n.jsxs("div",{id:"task-switcher-results",ref:se,role:"listbox","aria-label":t(s==="tasks"?"taskSwitcher.resultsAria":"commandCenter.resultsAria"),className:"max-h-[min(460px,60vh)] overflow-y-auto px-2 pb-2",children:[s==="commands"&&n.jsx(nt,{actions:T,selectedIndex:f,onSelect:j,onRun:oe}),s==="tasks"&&v.map((e,a)=>{const l=R(e),x=_(l),S=q(e,A),Ne=Z(S),le=We(l,$),H=a===f,Ce=je===x,Te=O.includes(x),L=J(e),de=e.taskStatus==="running"||e.taskStatus==="queued",me=!!e.taskRetryAvailable&&(e.taskStatus==="failed"||e.taskStatus==="interrupted"||e.taskStatus==="cancelled"),U=ve.includes(x),V=we.includes(x);return n.jsxs("div",{id:`task-switcher-result-${a}`,"data-task-result-index":a,"data-session-ref":x,role:"option","aria-selected":H,onMouseEnter:()=>j(a),className:N("group flex min-h-[68px] w-full items-center rounded-lg border border-transparent text-left transition-colors",H?"border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]":"hover:bg-[hsl(var(--deck-surface))]/60"),children:[n.jsxs("button",{type:"button",onClick:()=>void ie(e),"aria-label":t("session.action.select",{title:L}),className:"flex min-h-[68px] min-w-0 flex-1 items-center gap-3 px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[hsl(var(--deck-accent))]",children:[n.jsx("span",{className:N("flex h-8 w-8 shrink-0 items-center justify-center rounded-md border bg-[hsl(var(--deck-canvas))]",le?"border-[hsl(var(--deck-accent)/0.5)] text-[hsl(var(--deck-accent))]":"border-[hsl(var(--deck-border))] text-[hsl(var(--deck-ink-faint))]"),children:e.pendingInteraction?n.jsx(he,{className:"h-3.5 w-3.5 animate-pulse text-amber-600 dark:text-amber-400"}):e.taskStatus==="running"?n.jsx(Ze,{className:"h-3.5 w-3.5 animate-pulse"}):n.jsx(Qe,{className:"h-3.5 w-3.5"})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate font-mono text-[12.5px] font-medium text-[hsl(var(--deck-ink))]",children:L}),le&&n.jsx("span",{className:"shrink-0 rounded bg-[hsl(var(--deck-accent-soft))] px-1.5 py-0.5 font-mono text-[8.5px] uppercase tracking-[0.1em] text-[hsl(var(--deck-accent))]",children:t("taskSwitcher.current")}),Te&&n.jsx("span",{className:"shrink-0 rounded bg-[hsl(var(--deck-accent-soft))] px-1.5 py-0.5 font-mono text-[8.5px] uppercase tracking-[0.1em] text-[hsl(var(--deck-accent))]",children:t("taskSwitcher.new")}),e.pendingInteraction&&n.jsx("span",{className:"shrink-0 rounded bg-amber-100 px-1.5 py-0.5 font-mono text-[8.5px] uppercase tracking-[0.08em] text-amber-800 dark:bg-amber-950/60 dark:text-amber-300",children:t(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission")}),e.taskRetriedFrom&&n.jsx("span",{title:`${t("session.retriedFrom")} ${e.taskRetriedFrom.sessionId.slice(0,6)}`,className:"shrink-0 rounded bg-[hsl(var(--deck-accent-soft))] px-1.5 py-0.5 font-mono text-[8.5px] text-[hsl(var(--deck-accent))]",children:t("session.retryShort")})]}),n.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-2 font-mono text-[9.5px] text-[hsl(var(--deck-ink-faint))]",children:[n.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",children:[n.jsx(Ge,{className:"h-2.5 w-2.5 shrink-0"}),n.jsx("span",{className:"truncate",children:Ne})]}),(e.taskWorktreeBranch||e.gitBranch)&&n.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",children:[n.jsx(He,{className:"h-2.5 w-2.5 shrink-0"}),n.jsx("span",{className:"truncate",children:e.taskWorktreeBranch||e.gitBranch})]}),n.jsx("span",{className:"shrink-0",children:e.taskStatus==="queued"&&e.taskQueuePosition!==void 0&&e.taskQueueDepth!==void 0?t("session.queued",{position:e.taskQueuePosition,depth:e.taskQueueDepth}):e.pendingInteraction?t(e.pendingInteraction.type==="question"?"interaction.badge.question":e.pendingInteraction.type==="elicitation"?"interaction.badge.elicitation":"interaction.badge.permission"):t(ct[e.taskStatus])}),n.jsxs("span",{className:"ml-auto inline-flex shrink-0 items-center gap-1",children:[n.jsx(_e,{className:"h-2.5 w-2.5"}),at(e)]})]})]}),Ce?n.jsx(F,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}):n.jsx(ue,{className:N("h-3.5 w-3.5 shrink-0 transition-all",H?"translate-x-0 text-[hsl(var(--deck-accent))] opacity-100":"-translate-x-1 text-[hsl(var(--deck-ink-faint))] opacity-0")})]}),(de||me)&&n.jsxs("div",{className:"flex shrink-0 items-center pr-2",children:[de&&n.jsx("button",{type:"button","aria-label":t(U?"session.action.stopping":"session.action.stop",{title:L}),disabled:U,onClick:()=>void ce("cancel",e),className:"flex h-8 w-8 items-center justify-center rounded-md text-red-500 transition-colors hover:bg-red-500/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-red-500 disabled:cursor-wait disabled:opacity-60",children:U?n.jsx(F,{className:"h-3.5 w-3.5 animate-spin"}):n.jsx(Ue,{className:"h-3.5 w-3.5"})}),me&&n.jsx("button",{type:"button","aria-label":t(V?"session.action.retrying":"session.action.retry",{title:L}),disabled:V,onClick:()=>void ce("retry",e),className:"flex h-8 w-8 items-center justify-center rounded-md text-[hsl(var(--deck-accent))] transition-colors hover:bg-[hsl(var(--deck-accent-soft))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--deck-accent))] disabled:cursor-wait disabled:opacity-60",children:V?n.jsx(F,{className:"h-3.5 w-3.5 animate-spin"}):n.jsx(Ve,{className:"h-3.5 w-3.5"})})]})]},x)}),s==="tasks"&&v.length===0&&K&&n.jsxs("div",{className:"flex min-h-36 items-center justify-center gap-2 font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:[n.jsx(F,{className:"h-3.5 w-3.5 animate-spin text-[hsl(var(--deck-accent))]"}),t("taskSwitcher.indexing")]}),s==="tasks"&&v.length===0&&!K&&C!=="error"&&!ke&&n.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center px-6 text-center",children:[n.jsx(G,{className:"mb-3 h-5 w-5 text-[hsl(var(--deck-ink-faint))]"}),n.jsx("p",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:t("taskSwitcher.empty")}),n.jsx("p",{className:"mt-1 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:t("taskSwitcher.emptyHint")})]}),s==="tasks"&&v.length===0&&C==="error"&&n.jsxs("div",{role:"alert",className:"flex min-h-36 flex-col items-center justify-center px-6 text-center",children:[n.jsx(he,{className:"mb-3 h-5 w-5 text-amber-500"}),n.jsx("p",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:t("sidebar.catalog.incomplete")})]}),s==="commands"&&T.length===0&&n.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center px-6 text-center",children:[n.jsx(G,{className:"mb-3 h-5 w-5 text-[hsl(var(--deck-ink-faint))]"}),n.jsx("p",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:t("commandCenter.empty")}),n.jsx("p",{className:"mt-1 text-[10.5px] text-[hsl(var(--deck-ink-faint))]",children:t("commandCenter.emptyHint")})]})]}),n.jsxs("div",{className:"flex items-center gap-4 border-t border-[hsl(var(--deck-hairline))] bg-[hsl(var(--deck-canvas-veil))] px-4 py-2 font-mono text-[9px] text-[hsl(var(--deck-ink-faint))]",children:[n.jsxs("span",{children:["↑↓ ",t("taskSwitcher.hint.navigate")]}),n.jsxs("span",{children:["↵ ",t("taskSwitcher.hint.open")]}),n.jsxs("span",{className:"ml-auto",children:[P(s==="tasks"?"openCommands":"searchTasks")," ",t(s==="tasks"?"commandCenter.mode.commands":"commandCenter.mode.tasks")]})]})]})})}export{ut as TaskSwitcher};
@@ -1,6 +0,0 @@
1
- import{r as t,j as a}from"./vendor-react-DofNRwfy.js";import{D as A,o as R,L as j}from"./vendor-xterm-DuYZoU4T.js";import{c as C,u as N,as as M,j as x,ai as F,X as S}from"./index-DaiT-mmo.js";import{l as T}from"./session-events-CWzF04l4.js";import"./vendor-radix-Bc1_Q9tz.js";/**
2
- * @license lucide-react v0.300.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const W=C("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),$=({workspacePath:b})=>{const c=N(),{isTerminalOpen:l,toggleTerminal:v}=T(),[s,z]=t.useState(!1),[p,u]=t.useState(!1),g=M(),h=t.useRef(null),i=t.useRef(null),m=t.useRef(null),o=t.useRef(null),E=t.useRef(null),y=t.useCallback(()=>{var d;if(((d=o.current)==null?void 0:d.readyState)===WebSocket.OPEN)return;const r=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/terminal/ws`,e=b?`${r}?cwd=${encodeURIComponent(b)}`:r,n=new WebSocket(e);o.current=n,n.onopen=()=>{u(!0)},n.onmessage=w=>{var f;(f=i.current)==null||f.write(w.data)},n.onclose=()=>{u(!1)},n.onerror=()=>{u(!1)}},[b]),k=t.useCallback(()=>{o.current&&(o.current.close(),o.current=null),u(!1)},[]),B=t.useCallback(r=>{var e;((e=o.current)==null?void 0:e.readyState)===WebSocket.OPEN&&o.current.send(r)},[]);return t.useEffect(()=>(E.current=document.activeElement instanceof HTMLElement?document.activeElement:null,()=>{var r;return(r=E.current)==null?void 0:r.focus({preventScroll:!0})}),[]),t.useEffect(()=>{if(!l||!h.current||i.current)return;const r={background:"#ffffff",foreground:"#111827",cursor:"#111827",cursorAccent:"#ffffff",selectionBackground:"#E5E7EB",black:"#111827",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#7c3aed",cyan:"#0891b2",white:"#111827",brightBlack:"#6b7280",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#a855f7",brightCyan:"#22d3ee",brightWhite:"#111827"},e=new A({cursorBlink:!0,cursorStyle:"bar",fontSize:14,fontFamily:"JetBrains Mono, Menlo, Monaco, Consolas, monospace",allowTransparency:!0,scrollback:1e4,theme:g?{background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#0a0a0a",selectionBackground:"#3f3f46",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"}:r}),n=new R,d=new j;e.loadAddon(n),e.loadAddon(d),e.open(h.current),n.fit();const w=requestAnimationFrame(()=>e.focus());return e.onData(f=>{B(f)}),i.current=e,m.current=n,y(),()=>{cancelAnimationFrame(w),k(),e.dispose(),i.current=null,m.current=null}},[l,y,k,B]),t.useEffect(()=>{i.current&&(i.current.options.theme=g?{background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#0a0a0a",selectionBackground:"#3f3f46",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"}:{background:"#ffffff",foreground:"#111827",cursor:"#111827",cursorAccent:"#ffffff",selectionBackground:"#E5E7EB",black:"#111827",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#7c3aed",cyan:"#0891b2",white:"#111827",brightBlack:"#6b7280",brightRed:"#ef4444",brightGreen:"#22c55e",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#a855f7",brightCyan:"#22d3ee",brightWhite:"#111827"})},[g]),t.useEffect(()=>{if(!l||s)return;const r=()=>{var n;(n=m.current)==null||n.fit()};window.addEventListener("resize",r);const e=setTimeout(r,100);return()=>{window.removeEventListener("resize",r),clearTimeout(e)}},[l,s]),l?a.jsxs("div",{role:"region","aria-label":c("terminal.title"),className:x("fixed bottom-0 left-0 right-0 z-40 bg-white dark:bg-[#0a0a0a] border-t border-[#E5E7EB] dark:border-zinc-800 transition-all duration-200",s?"h-10":"h-[min(18rem,45dvh)]"),children:[a.jsxs("div",{className:"flex items-center justify-between h-10 px-3 border-b border-[#E5E7EB] dark:border-zinc-800 bg-[#F9FAFB] dark:bg-zinc-900/50",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(F,{className:"h-4 w-4 text-[#9CA3AF] dark:text-zinc-400"}),a.jsx("span",{className:"text-sm text-[#6B7280] dark:text-zinc-400",children:c("terminal.title")}),a.jsx("span",{role:"status","aria-label":c(p?"terminal.status.connected":"terminal.status.disconnected"),className:x("w-2 h-2 rounded-full",p?"bg-green-500":"bg-zinc-600")})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>z(!s),"aria-label":c(s?"terminal.action.restore":"terminal.action.minimize"),className:"p-1.5 rounded hover:bg-[#E5E7EB] text-[#9CA3AF] hover:text-[#111827] dark:hover:bg-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200 transition-colors",children:a.jsx(W,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:()=>{k(),v()},"aria-label":c("terminal.action.close"),className:"p-1.5 rounded hover:bg-[#E5E7EB] text-[#9CA3AF] hover:text-[#111827] dark:hover:bg-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200 transition-colors",children:a.jsx(S,{className:"h-4 w-4"})})]})]}),a.jsx("div",{ref:h,className:x("h-[calc(100%-40px)] p-2",s&&"hidden")})]}):null};export{$ as TerminalPanel};