blade-code 0.10.98 → 0.10.99
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.
- package/dist/blade.js +2 -2
- package/dist/{chunk-q74f1pj9.js → chunk-0zhdjaen.js} +1 -1
- package/dist/{chunk-b4ahgdtn.js → chunk-10taec1j.js} +2 -2
- package/dist/{chunk-7wgtj7w4.js → chunk-12vzyc3x.js} +2 -2
- package/dist/{chunk-my7nr1sx.js → chunk-1gjn9bp7.js} +2 -2
- package/dist/{chunk-p47hbq3a.js → chunk-1pscfw5q.js} +2 -2
- package/dist/{chunk-4004spc1.js → chunk-2hb222re.js} +1 -1
- package/dist/{chunk-e99cqtmv.js → chunk-2jffgzdf.js} +2 -2
- package/dist/{chunk-j9cnp8ms.js → chunk-2va6ex5v.js} +1 -1
- package/dist/{chunk-mf2s05b7.js → chunk-39qzk9nm.js} +1 -1
- package/dist/chunk-3awjdsef.js +5 -0
- package/dist/{chunk-drqezf1p.js → chunk-3ghvdscg.js} +1 -1
- package/dist/{chunk-krhr8xbg.js → chunk-425p4nwx.js} +2 -2
- package/dist/{chunk-azcca8bk.js → chunk-45sgvghd.js} +1 -1
- package/dist/{chunk-hdhxzmw7.js → chunk-4fmtv329.js} +1 -1
- package/dist/{chunk-wzgdm617.js → chunk-53xtssbf.js} +2 -2
- package/dist/chunk-5dkzqgxa.js +1 -0
- package/dist/{chunk-szccdrah.js → chunk-5tq3s9h5.js} +1 -1
- package/dist/{chunk-1j3mmdbt.js → chunk-6vcy0nq7.js} +1 -1
- package/dist/{chunk-7kbtqzy0.js → chunk-6yz49rz2.js} +3 -3
- package/dist/{chunk-8jtwm19d.js → chunk-70hwyc2w.js} +1 -1
- package/dist/{chunk-7yn3d4cf.js → chunk-71jnx206.js} +1 -1
- package/dist/{chunk-8v8frtnd.js → chunk-9hsbjy6a.js} +1 -1
- package/dist/{chunk-j0ndrqv6.js → chunk-9sx3vsyj.js} +1 -1
- package/dist/chunk-9z0yx0bn.js +1 -0
- package/dist/{chunk-0bsn86gg.js → chunk-a42rvwg4.js} +1 -1
- package/dist/chunk-akfez2cs.js +1 -0
- package/dist/{chunk-hy9tkb5x.js → chunk-ap8539bw.js} +419 -414
- package/dist/{chunk-9qqhkwbw.js → chunk-b4d43ap3.js} +1 -1
- package/dist/{chunk-qdf2a3vf.js → chunk-bdbyy2ah.js} +1 -1
- package/dist/chunk-c2s9rgyj.js +1 -0
- package/dist/{chunk-h1wvtdh4.js → chunk-c6tq09mt.js} +1 -1
- package/dist/{chunk-7k38nj7a.js → chunk-cc3d4nne.js} +1 -1
- package/dist/{chunk-fra0nwzj.js → chunk-cp7xsjj2.js} +2 -2
- package/dist/{chunk-nvypaz88.js → chunk-czcxx8tb.js} +1 -1
- package/dist/{chunk-3wjb3bhw.js → chunk-d7j7z8hy.js} +2 -2
- package/dist/{chunk-54syvhtz.js → chunk-d8wzc602.js} +2 -2
- package/dist/{chunk-ef5b0ysc.js → chunk-dg0d3303.js} +1 -1
- package/dist/chunk-et6pvc3y.js +1 -0
- package/dist/{chunk-4ytvrkks.js → chunk-f9asjkfz.js} +1 -1
- package/dist/{chunk-4crf8nvz.js → chunk-fqwq3626.js} +2 -2
- package/dist/{chunk-17ck16tq.js → chunk-fvfc95g3.js} +1 -1
- package/dist/{chunk-gcy8nczq.js → chunk-ga15nptz.js} +1 -1
- package/dist/chunk-gmnv1jme.js +1 -0
- package/dist/chunk-gwj637ey.js +1 -0
- package/dist/{chunk-wzx5s1dm.js → chunk-h8qjkxee.js} +2 -2
- package/dist/chunk-hcz98dbj.js +1 -0
- package/dist/chunk-hyk4fw18.js +10 -0
- package/dist/{chunk-qb1wev32.js → chunk-hz5rsfxv.js} +1 -1
- package/dist/{chunk-e6wgta3m.js → chunk-j00px1es.js} +1 -1
- package/dist/{chunk-63wahkkf.js → chunk-k7vv9vne.js} +1 -1
- package/dist/chunk-kvdk0pfk.js +1 -0
- package/dist/chunk-maebpz1j.js +2 -0
- package/dist/{chunk-tae9c030.js → chunk-mhfwp1f0.js} +2 -2
- package/dist/{chunk-hphdt9ph.js → chunk-mq4x8zhq.js} +36 -36
- package/dist/chunk-n4cw6vt1.js +1 -0
- package/dist/{chunk-rzcm8hw3.js → chunk-p0rvgzpx.js} +1 -1
- package/dist/chunk-p7t010gq.js +1 -0
- package/dist/chunk-p7zvg7e3.js +1 -0
- package/dist/{chunk-ks3f9h9n.js → chunk-pmb5kr86.js} +2 -2
- package/dist/{chunk-s6n0cgg5.js → chunk-q3vza5gt.js} +2 -2
- package/dist/{chunk-gaj6kkb6.js → chunk-qcy79mva.js} +1 -1
- package/dist/{chunk-v2p30pe1.js → chunk-qdgwprcv.js} +1 -1
- package/dist/{chunk-wkfhpjkf.js → chunk-qwjfxvda.js} +1 -1
- package/dist/{chunk-dp9xbrjy.js → chunk-r22mdmtr.js} +2 -2
- package/dist/{chunk-ps9vc0m3.js → chunk-rej5bbbs.js} +2 -2
- package/dist/chunk-s0tq8gyx.js +2 -0
- package/dist/{chunk-rmkw6dpm.js → chunk-spdrxj5e.js} +1 -1
- package/dist/chunk-vd6kmnc7.js +1 -0
- package/dist/{chunk-d2f41jxt.js → chunk-w9xfks7f.js} +1 -1
- package/dist/{chunk-hmgxkjbx.js → chunk-x5j6nexe.js} +39 -39
- package/dist/chunk-xg959k9w.js +1 -0
- package/dist/chunk-xz5ar75z.js +8 -0
- package/dist/{chunk-vw2j0avq.js → chunk-ykkqywtq.js} +1 -1
- package/dist/web/assets/{ChatView-DRfyX8iK.js → ChatView-Cwc3fRAC.js} +4 -4
- package/dist/web/assets/{CodeBlockHighlighter-DAFduwex.js → CodeBlockHighlighter-IGDocZUy.js} +1 -1
- package/dist/web/assets/FilePreview-EWE-k9VN.js +65 -0
- package/dist/web/assets/{KanbanBoard-CWMPGJNx.js → KanbanBoard-FiiVQgTQ.js} +1 -1
- package/dist/web/assets/{MarkdownRenderer-Dp8ahj7G.js → MarkdownRenderer-DjhWmikM.js} +3 -3
- package/dist/web/assets/{SettingsModal-BR_98FMD.js → SettingsModal-bHPx0fVG.js} +1 -1
- package/dist/web/assets/{TaskSwitcher-D5WijUhR.js → TaskSwitcher-CclOfJEl.js} +1 -1
- package/dist/web/assets/{TerminalPanel-CE33pxwb.js → TerminalPanel-Bnep8jE2.js} +1 -1
- package/dist/web/assets/{arrow-left-Cv-KDeEq.js → arrow-left-CiX0E9Mt.js} +1 -1
- package/dist/web/assets/{calendar-clock-Cv_w0wjo.js → calendar-clock-Bgfr-twh.js} +1 -1
- package/dist/web/assets/{chevrons-up-down-BAdiQ6sx.js → chevrons-up-down-B4T5fHUs.js} +1 -1
- package/dist/web/assets/{clock-3-wrrODhWr.js → clock-3-CGIhJjon.js} +1 -1
- package/dist/web/assets/{external-link-CBEu1rS8.js → external-link-DnQv1VYE.js} +1 -1
- package/dist/web/assets/{folder-aphP4iXp.js → folder-C5f8TpGj.js} +1 -1
- package/dist/web/assets/index-DGf6Z2kM.css +1 -0
- package/dist/web/assets/{index-rQ1P5u3I.js → index-DNoVz0u1.js} +61 -57
- package/dist/web/assets/{pause-Bp8TFDGG.js → pause-Cb0ijwnO.js} +1 -1
- package/dist/web/assets/{play-CuOkQMyB.js → play-Dsw1qmpk.js} +1 -1
- package/dist/web/assets/{session-events-C95VE6d2.js → session-events-B4Cq2TwN.js} +1 -1
- package/dist/web/assets/{teamService-BXTinwSE.js → teamService-C69fFhny.js} +1 -1
- package/dist/web/index.html +3 -3
- package/package.json +1 -1
- package/dist/chunk-4n7zxjk0.js +0 -1
- package/dist/chunk-6b232wd7.js +0 -1
- package/dist/chunk-78bmtbzh.js +0 -1
- package/dist/chunk-8dtggj9c.js +0 -2
- package/dist/chunk-a7hz8scf.js +0 -8
- package/dist/chunk-a9ek5zt1.js +0 -5
- package/dist/chunk-d1je4wzc.js +0 -2
- package/dist/chunk-d3z12cgn.js +0 -1
- package/dist/chunk-d62jkv36.js +0 -1
- package/dist/chunk-dc3k9999.js +0 -1
- package/dist/chunk-hdrap16m.js +0 -1
- package/dist/chunk-hvz0wk1j.js +0 -1
- package/dist/chunk-kv6w817v.js +0 -10
- package/dist/chunk-m4bg4jp9.js +0 -1
- package/dist/chunk-mpm2kdf6.js +0 -1
- package/dist/chunk-rztsp1jj.js +0 -1
- package/dist/chunk-wq8zryfj.js +0 -1
- package/dist/chunk-ysckkpw0.js +0 -1
- package/dist/chunk-zppdqh51.js +0 -1
- package/dist/web/assets/FilePreview-DP5FG_5E.js +0 -59
- package/dist/web/assets/index-zY4JU9fd.css +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
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-DNoVz0u1.js";import{r as i,j as e}from"./vendor-react-DofNRwfy.js";import{o as jt,l as Nt}from"./session-events-B4Cq2TwN.js";import{A as Rr,C as Lr}from"./chevrons-up-down-B4T5fHUs.js";import{A as Pr,E as St}from"./external-link-DnQv1VYE.js";import{A as Ir}from"./arrow-left-CiX0E9Mt.js";import{A as Dr,F as Fr}from"./folder-C5f8TpGj.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,4 +1,4 @@
|
|
|
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-
|
|
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-DNoVz0u1.js";import{l as Q}from"./session-events-B4Cq2TwN.js";import{C as ce}from"./calendar-clock-Bgfr-twh.js";import{C as qe}from"./clock-3-CGIhJjon.js";import{P as ze}from"./play-Dsw1qmpk.js";import{P as Be}from"./pause-Cb0ijwnO.js";import"./vendor-radix-Bc1_Q9tz.js";/**
|
|
2
2
|
* @license lucide-react v0.300.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|