blade-code 0.10.24 → 0.10.26
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-01n8k1jj.js +1 -0
- package/dist/{chunk-1gkpjhts.js → chunk-0q4jbbm5.js} +1 -1
- package/dist/{chunk-9c3jjbgd.js → chunk-1g5h4zv6.js} +1 -1
- package/dist/{chunk-xzdpdwhz.js → chunk-1hzj6s0f.js} +2 -2
- package/dist/chunk-1mh2285d.js +200 -0
- package/dist/{chunk-26zhy301.js → chunk-20kg90zt.js} +2 -2
- package/dist/{chunk-18n15nn8.js → chunk-35d5gdgw.js} +1 -1
- package/dist/{chunk-f8zz4se0.js → chunk-46yg6dfr.js} +2 -2
- package/dist/{chunk-f4ksxskk.js → chunk-4aem0m2n.js} +1 -1
- package/dist/chunk-58tpe6nx.js +44 -0
- package/dist/{chunk-phzy5kqq.js → chunk-58yqrbey.js} +1 -1
- package/dist/{chunk-5xph8r1k.js → chunk-5mtryjjc.js} +1 -1
- package/dist/chunk-5yr2c8gz.js +25 -0
- package/dist/chunk-6axhk4r7.js +2 -0
- package/dist/chunk-6k74z0eb.js +2 -0
- package/dist/{chunk-yac1ga9w.js → chunk-6srz3q5d.js} +1 -1
- package/dist/{chunk-d2kzet1k.js → chunk-7jv8thn1.js} +2 -2
- package/dist/{chunk-3fkj59nv.js → chunk-89gswfb2.js} +1 -1
- package/dist/{chunk-w56y2pvk.js → chunk-8htfb5zn.js} +2 -2
- package/dist/{chunk-hpmxmkzc.js → chunk-9ka0bdry.js} +1 -1
- package/dist/{chunk-m13jrgp9.js → chunk-a4cyec1y.js} +2 -2
- package/dist/chunk-aa28p37g.js +2 -0
- package/dist/chunk-acf5v2fv.js +2 -0
- package/dist/chunk-b5fegjt7.js +6 -0
- package/dist/chunk-bbjtt28z.js +1 -0
- package/dist/{chunk-6vfe3409.js → chunk-ct2x59pr.js} +1 -1
- package/dist/chunk-d9jz1edf.js +100 -0
- package/dist/chunk-dxgzyy09.js +1 -0
- package/dist/{chunk-j8ggq1z4.js → chunk-ebffhjma.js} +2 -2
- package/dist/{chunk-bp886b8j.js → chunk-edyxa2jw.js} +1 -1
- package/dist/{chunk-k2b95m2p.js → chunk-eqa706gn.js} +2 -2
- package/dist/chunk-f88wkyfm.js +1 -0
- package/dist/{chunk-aw8s1sej.js → chunk-fbc5zfq7.js} +1 -1
- package/dist/chunk-fkwqgqsw.js +1 -0
- package/dist/{chunk-m27w377p.js → chunk-fnt1z0y8.js} +1 -1
- package/dist/chunk-gahvpbbs.js +1 -0
- package/dist/{chunk-57q5wn4g.js → chunk-gn37wxwg.js} +1 -1
- package/dist/chunk-h2npwqz9.js +10 -0
- package/dist/{chunk-c674mmtj.js → chunk-jt55ct49.js} +2 -2
- package/dist/{chunk-xjqcc0nt.js → chunk-k99rbzqw.js} +1 -1
- package/dist/{chunk-wjqctwyr.js → chunk-kskg7crs.js} +26 -41
- package/dist/{chunk-p1dp2xgq.js → chunk-kvd5nexw.js} +1 -1
- package/dist/chunk-kwe0a3xw.js +1 -0
- package/dist/chunk-m7x4ya6m.js +1 -0
- package/dist/chunk-mqsxghqb.js +1 -0
- package/dist/chunk-nar8qz5t.js +1 -0
- package/dist/{chunk-5sw8j9ae.js → chunk-nt6xmzk0.js} +1 -1
- package/dist/chunk-p6nhdbdw.js +116 -0
- package/dist/{chunk-67ekta7b.js → chunk-pja0tttq.js} +1 -1
- package/dist/{chunk-my2jwz6y.js → chunk-px3t1rxa.js} +2 -2
- package/dist/chunk-pyfag66h.js +1 -0
- package/dist/chunk-q1papzdc.js +1 -0
- package/dist/{chunk-pccn8ndq.js → chunk-r46ws0q8.js} +2 -2
- package/dist/{chunk-bw7vknjr.js → chunk-rgafk34p.js} +1 -1
- package/dist/chunk-rth3jfdq.js +2 -0
- package/dist/{chunk-nqpcwa0k.js → chunk-rtktz9v1.js} +233 -231
- package/dist/{chunk-s14wmzm3.js → chunk-s1khjfye.js} +2 -2
- package/dist/{chunk-vns8g2rv.js → chunk-sprjrvn6.js} +1 -1
- package/dist/chunk-ss449b56.js +1 -0
- package/dist/{chunk-yaxapgbm.js → chunk-tg1mf1tf.js} +1 -1
- package/dist/{chunk-x6tns9d8.js → chunk-tnrrnzzv.js} +1 -1
- package/dist/chunk-v508x7cg.js +0 -0
- package/dist/chunk-vc2c8wkx.js +2 -0
- package/dist/chunk-vp50e95n.js +3 -0
- package/dist/chunk-wg8p9g0z.js +1 -0
- package/dist/chunk-xkb48pvz.js +1 -0
- package/dist/{chunk-t327cwnb.js → chunk-xp44jtsd.js} +1 -1
- package/dist/chunk-y2en7qvs.js +6 -0
- package/dist/{chunk-86zsjamb.js → chunk-zs9mwd17.js} +3 -3
- package/dist/web/assets/{ChatView-CCxjYDmJ.js → ChatView-Crna6-ID.js} +2 -2
- package/dist/web/assets/{CodeBlockHighlighter-D9MqsrZP.js → CodeBlockHighlighter-coWjWCyT.js} +1 -1
- package/dist/web/assets/{FilePreview-Cn5HOlPw.js → FilePreview-BKcCbpvz.js} +2 -2
- package/dist/web/assets/{MarkdownRenderer-ALTOCdfi.js → MarkdownRenderer-BqV1nvf1.js} +3 -3
- package/dist/web/assets/{SettingsModal-Dk69F1bS.js → SettingsModal-BOMswk9P.js} +2 -2
- package/dist/web/assets/{TaskSwitcher-DRZZocE1.js → TaskSwitcher-BEW2DhW3.js} +1 -1
- package/dist/web/assets/{TerminalPanel-ByAqKZ47.js → TerminalPanel-BXzypTz6.js} +1 -1
- package/dist/web/assets/index-DqXKkjcp.js +11 -0
- package/dist/web/index.html +1 -1
- package/package.json +2 -1
- package/dist/chunk-014rwj5b.js +0 -1
- package/dist/chunk-0568ndm9.js +0 -200
- package/dist/chunk-1pkca2km.js +0 -3
- package/dist/chunk-2wpnzjme.js +0 -1
- package/dist/chunk-3ak60ndt.js +0 -1
- package/dist/chunk-3qmwt188.js +0 -100
- package/dist/chunk-4a02yjg9.js +0 -2
- package/dist/chunk-6pb6zs96.js +0 -2
- package/dist/chunk-7dqc10sc.js +0 -1
- package/dist/chunk-ag07wwer.js +0 -2
- package/dist/chunk-bpz0g8ej.js +0 -2
- package/dist/chunk-bvwq5wth.js +0 -6
- package/dist/chunk-c29y2s8g.js +0 -2
- package/dist/chunk-d70mtcp4.js +0 -1
- package/dist/chunk-e71qm105.js +0 -1
- package/dist/chunk-edqtngzr.js +0 -44
- package/dist/chunk-f0mt91sr.js +0 -1
- package/dist/chunk-gwe547ww.js +0 -1
- package/dist/chunk-m486vmtn.js +0 -1
- package/dist/chunk-n00mknme.js +0 -25
- package/dist/chunk-n54tp9wr.js +0 -1
- package/dist/chunk-pq7tk058.js +0 -6
- package/dist/chunk-q5sewfn5.js +0 -1
- package/dist/chunk-qg87zezq.js +0 -1
- package/dist/chunk-r14bz8va.js +0 -1
- package/dist/chunk-rtkhyp1g.js +0 -1
- package/dist/chunk-s4mqw4wa.js +0 -116
- package/dist/chunk-sgnjekfb.js +0 -1
- package/dist/chunk-tetxqw28.js +0 -1
- package/dist/chunk-vmzf4nvh.js +0 -2
- package/dist/chunk-zm3zn23k.js +0 -10
- package/dist/web/assets/index-CRCirUK7.js +0 -11
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DI8ZWdWH.js","assets/vendor-react-DG5dkZ_t.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as T,u as P,b as et,a as B,s as V,I as Te,k as Xt,J as Yt,w as Zt,_ as er}from"./index-CRCirUK7.js";import{r as o,j as t}from"./vendor-react-DG5dkZ_t.js";import{k as Pe,a4 as tr,am as rr,y as bt,m as vt,s as kt,L as gt,d as nr,ak as sr,R as ar,X as or}from"./vendor-icons-ICv1v-tf.js";import"./vendor-radix-DXRuAJHH.js";import"./session-events-K_9Lexp8.js";const yt=o.createContext(null);function wt(e){const r=o.useContext(yt);if(!r)throw new Error(`${e} must be used within <Tabs>`);return r}function ir({value:e,onValueChange:r,className:s,children:a}){const c=o.useMemo(()=>({value:e,setValue:r}),[e,r]);return t.jsx(yt.Provider,{value:c,children:t.jsx("div",{className:s,children:a})})}function cr({className:e,children:r}){return t.jsx("div",{role:"tablist",className:T("inline-flex items-center",e),children:r})}function Fe({value:e,className:r,children:s}){const{value:a,setValue:c}=wt("TabsTrigger"),i=a===e;return t.jsx("button",{type:"button",role:"tab","aria-selected":i,"data-state":i?"active":"inactive",onClick:()=>c(e),className:T("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))]",r),children:s})}function Le({value:e,className:r,children:s}){const{value:a}=wt("TabsContent");return a!==e?null:t.jsx("div",{role:"tabpanel",className:r,children:s})}const lr={"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 dr(e){const r=e.replace("#",""),s=parseInt(r.substring(0,2),16),a=parseInt(r.substring(2,4),16),c=parseInt(r.substring(4,6),16);return(.299*s+.587*a+.114*c)/255<.5}function ur(e){return{base:dr(e.background.primary)?"vs-dark":"vs",inherit:!0,rules:[{token:"",foreground:e.text.primary.replace("#",""),background:e.background.primary.replace("#","")},{token:"comment",foreground:e.syntax.comment.replace("#",""),fontStyle:"italic"},{token:"string",foreground:e.syntax.string.replace("#","")},{token:"number",foreground:e.syntax.number.replace("#","")},{token:"keyword",foreground:e.syntax.keyword.replace("#","")},{token:"type",foreground:e.syntax.type.replace("#","")},{token:"identifier",foreground:e.syntax.variable.replace("#","")},{token:"function",foreground:e.syntax.function.replace("#","")},{token:"variable",foreground:e.syntax.variable.replace("#","")},{token:"operator",foreground:e.syntax.operator.replace("#","")},{token:"delimiter",foreground:e.syntax.operator.replace("#","")},{token:"tag",foreground:e.syntax.tag.replace("#","")},{token:"attribute.name",foreground:e.syntax.attr.replace("#","")},{token:"attribute.value",foreground:e.syntax.string.replace("#","")}],colors:{"editor.background":e.background.primary,"editor.foreground":e.text.primary,"editor.lineHighlightBackground":e.background.secondary,"editor.selectionBackground":`${e.syntax.function}40`,"editorLineNumber.foreground":e.text.muted,"editorLineNumber.activeForeground":e.text.secondary,"editorCursor.foreground":e.text.primary,"editorIndentGuide.background":e.border.light,"editorWidget.background":e.background.secondary,"editorWidget.border":e.border.light,"scrollbarSlider.background":`${e.text.muted}40`,"scrollbarSlider.hoverBackground":`${e.text.muted}60`}}}const tt=new Set;function rt(e,r){const s=r.toLowerCase().replace(/\s+/g,"-"),a=lr[s];if(!a)return"vs-dark";if(!tt.has(s)){const c=ur(a);e.editor.defineTheme(s,c),tt.add(s)}return s}function oe(e){return e.normalize("NFKC").toLocaleLowerCase().trim()}function fr(e,r,s){const a=oe(r).split(/\s+/).filter(Boolean);return e.filter(c=>{if(s!=="all"&&c.status!==s)return!1;if(a.length===0)return!0;const i=oe([c.title,c.subtitle,c.content].filter(Boolean).join(" "));return a.every(g=>i.includes(g))})}function jt(e){return e.replace(/\/+$/,"").split("/").filter(Boolean).at(-1)||e}function hr(e,r){const s=oe(r).split(/\s+/).filter(Boolean);return s.length===0?e:e.filter(a=>{const c=oe([a.filePath,a.summary].filter(Boolean).join(" "));return s.every(i=>c.includes(i))})}function pr(e,r,s){return r===0?0:(e+s+r)%r}const nt=20,st=20,at=160,ot=240;function it(e,r){const s=i=>i.replace(/\\/g,"/").replace(/^\.?\//,"").replace(/\/+/g,"/"),a=s(e),c=s(r);return a===c||a.endsWith(`/${c}`)||c.endsWith(`/${a}`)}function mr({diffs:e,expanded:r,targetPath:s,onToggle:a,onSetAllExpanded:c}){var d,N;const i=P(),[g,u]=o.useState(""),b=`${g}\0${e.length}\0${((d=e[0])==null?void 0:d.filePath)??""}\0${((N=e.at(-1))==null?void 0:N.filePath)??""}`,[f,h]=o.useState({key:b,count:nt}),x=f.key===b?f.count:nt,m=o.useMemo(()=>hr(e,g),[e,g]),k=o.useMemo(()=>{const p=m.slice(0,x);if(!s)return p;const j=m.find(S=>S.filePath&&it(S.filePath,s));return j&&!p.includes(j)?[...p,j]:p},[m,s,x]);return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"sticky top-0 z-10 space-y-2 bg-[hsl(var(--deck-canvas))] pb-1",children:[t.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:[t.jsx(Pe,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),t.jsx("input",{type:"search","aria-label":i("preview.diff.searchAria"),placeholder:i("preview.diff.searchPlaceholder"),value:g,onChange:p=>u(p.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))]"}),t.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-[hsl(var(--deck-ink-faint))]",children:[m.length,"/",e.length]})]}),t.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[t.jsx("span",{children:i("preview.diff.changedFiles",{count:e.length})}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsxs("button",{type:"button",onClick:()=>c(!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:[t.jsx(tr,{className:"h-3 w-3"}),i("preview.diff.expandAll")]}),t.jsxs("button",{type:"button",onClick:()=>c(!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:[t.jsx(rr,{className:"h-3 w-3"}),i("preview.diff.collapseAll")]})]})]})]}),m.length===0?t.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:i("preview.diff.noMatches")}):k.map(p=>{const j=p.filePath||"unknown",S=e.indexOf(p),E=r[j]??S===0,A=!!(s&&it(j,s));return t.jsxs("div",{"data-preview-diff-path":p.filePath,className:T("overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] transition-colors",A&&"border-[hsl(var(--deck-accent)/0.7)] bg-[hsl(var(--deck-accent-soft))] ring-1 ring-[hsl(var(--deck-accent)/0.2)]"),children:[t.jsxs("button",{type:"button","aria-expanded":E,onClick:()=>a(j),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:[E?t.jsx(bt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}):t.jsx(vt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),t.jsx(kt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-left font-mono text-[13px] text-[hsl(var(--deck-ink))]",children:jt(j)}),p.summary&&t.jsx("span",{className:"shrink-0 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:p.summary})]}),E&&t.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))]",children:[t.jsx("div",{className:"truncate px-3 py-1 font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:p.filePath}),t.jsx(xr,{diff:p.diff})]})]},j)}),x<m.length&&t.jsx("div",{className:"flex justify-center pt-1",children:t.jsx("button",{type:"button",onClick:()=>h({key:b,count:Math.min(m.length,x+st)}),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:i("preview.diff.showMoreFiles",{count:Math.min(st,m.length-x)})})})]})}function xr({diff:e}){const r=P(),s=o.useMemo(()=>e.patch.split(`
|
|
2
|
+
import{j as T,u as P,b as et,a as B,s as V,I as Te,k as Xt,J as Yt,w as Zt,_ as er}from"./index-DqXKkjcp.js";import{r as o,j as t}from"./vendor-react-DG5dkZ_t.js";import{k as Pe,a4 as tr,am as rr,y as bt,m as vt,s as kt,L as gt,d as nr,ak as sr,R as ar,X as or}from"./vendor-icons-ICv1v-tf.js";import"./vendor-radix-DXRuAJHH.js";import"./session-events-K_9Lexp8.js";const yt=o.createContext(null);function wt(e){const r=o.useContext(yt);if(!r)throw new Error(`${e} must be used within <Tabs>`);return r}function ir({value:e,onValueChange:r,className:s,children:a}){const c=o.useMemo(()=>({value:e,setValue:r}),[e,r]);return t.jsx(yt.Provider,{value:c,children:t.jsx("div",{className:s,children:a})})}function cr({className:e,children:r}){return t.jsx("div",{role:"tablist",className:T("inline-flex items-center",e),children:r})}function Fe({value:e,className:r,children:s}){const{value:a,setValue:c}=wt("TabsTrigger"),i=a===e;return t.jsx("button",{type:"button",role:"tab","aria-selected":i,"data-state":i?"active":"inactive",onClick:()=>c(e),className:T("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))]",r),children:s})}function Le({value:e,className:r,children:s}){const{value:a}=wt("TabsContent");return a!==e?null:t.jsx("div",{role:"tabpanel",className:r,children:s})}const lr={"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 dr(e){const r=e.replace("#",""),s=parseInt(r.substring(0,2),16),a=parseInt(r.substring(2,4),16),c=parseInt(r.substring(4,6),16);return(.299*s+.587*a+.114*c)/255<.5}function ur(e){return{base:dr(e.background.primary)?"vs-dark":"vs",inherit:!0,rules:[{token:"",foreground:e.text.primary.replace("#",""),background:e.background.primary.replace("#","")},{token:"comment",foreground:e.syntax.comment.replace("#",""),fontStyle:"italic"},{token:"string",foreground:e.syntax.string.replace("#","")},{token:"number",foreground:e.syntax.number.replace("#","")},{token:"keyword",foreground:e.syntax.keyword.replace("#","")},{token:"type",foreground:e.syntax.type.replace("#","")},{token:"identifier",foreground:e.syntax.variable.replace("#","")},{token:"function",foreground:e.syntax.function.replace("#","")},{token:"variable",foreground:e.syntax.variable.replace("#","")},{token:"operator",foreground:e.syntax.operator.replace("#","")},{token:"delimiter",foreground:e.syntax.operator.replace("#","")},{token:"tag",foreground:e.syntax.tag.replace("#","")},{token:"attribute.name",foreground:e.syntax.attr.replace("#","")},{token:"attribute.value",foreground:e.syntax.string.replace("#","")}],colors:{"editor.background":e.background.primary,"editor.foreground":e.text.primary,"editor.lineHighlightBackground":e.background.secondary,"editor.selectionBackground":`${e.syntax.function}40`,"editorLineNumber.foreground":e.text.muted,"editorLineNumber.activeForeground":e.text.secondary,"editorCursor.foreground":e.text.primary,"editorIndentGuide.background":e.border.light,"editorWidget.background":e.background.secondary,"editorWidget.border":e.border.light,"scrollbarSlider.background":`${e.text.muted}40`,"scrollbarSlider.hoverBackground":`${e.text.muted}60`}}}const tt=new Set;function rt(e,r){const s=r.toLowerCase().replace(/\s+/g,"-"),a=lr[s];if(!a)return"vs-dark";if(!tt.has(s)){const c=ur(a);e.editor.defineTheme(s,c),tt.add(s)}return s}function oe(e){return e.normalize("NFKC").toLocaleLowerCase().trim()}function fr(e,r,s){const a=oe(r).split(/\s+/).filter(Boolean);return e.filter(c=>{if(s!=="all"&&c.status!==s)return!1;if(a.length===0)return!0;const i=oe([c.title,c.subtitle,c.content].filter(Boolean).join(" "));return a.every(g=>i.includes(g))})}function jt(e){return e.replace(/\/+$/,"").split("/").filter(Boolean).at(-1)||e}function hr(e,r){const s=oe(r).split(/\s+/).filter(Boolean);return s.length===0?e:e.filter(a=>{const c=oe([a.filePath,a.summary].filter(Boolean).join(" "));return s.every(i=>c.includes(i))})}function pr(e,r,s){return r===0?0:(e+s+r)%r}const nt=20,st=20,at=160,ot=240;function it(e,r){const s=i=>i.replace(/\\/g,"/").replace(/^\.?\//,"").replace(/\/+/g,"/"),a=s(e),c=s(r);return a===c||a.endsWith(`/${c}`)||c.endsWith(`/${a}`)}function mr({diffs:e,expanded:r,targetPath:s,onToggle:a,onSetAllExpanded:c}){var d,N;const i=P(),[g,u]=o.useState(""),b=`${g}\0${e.length}\0${((d=e[0])==null?void 0:d.filePath)??""}\0${((N=e.at(-1))==null?void 0:N.filePath)??""}`,[f,h]=o.useState({key:b,count:nt}),x=f.key===b?f.count:nt,m=o.useMemo(()=>hr(e,g),[e,g]),k=o.useMemo(()=>{const p=m.slice(0,x);if(!s)return p;const j=m.find(S=>S.filePath&&it(S.filePath,s));return j&&!p.includes(j)?[...p,j]:p},[m,s,x]);return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"sticky top-0 z-10 space-y-2 bg-[hsl(var(--deck-canvas))] pb-1",children:[t.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:[t.jsx(Pe,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),t.jsx("input",{type:"search","aria-label":i("preview.diff.searchAria"),placeholder:i("preview.diff.searchPlaceholder"),value:g,onChange:p=>u(p.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))]"}),t.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-[hsl(var(--deck-ink-faint))]",children:[m.length,"/",e.length]})]}),t.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:[t.jsx("span",{children:i("preview.diff.changedFiles",{count:e.length})}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsxs("button",{type:"button",onClick:()=>c(!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:[t.jsx(tr,{className:"h-3 w-3"}),i("preview.diff.expandAll")]}),t.jsxs("button",{type:"button",onClick:()=>c(!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:[t.jsx(rr,{className:"h-3 w-3"}),i("preview.diff.collapseAll")]})]})]})]}),m.length===0?t.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:i("preview.diff.noMatches")}):k.map(p=>{const j=p.filePath||"unknown",S=e.indexOf(p),E=r[j]??S===0,A=!!(s&&it(j,s));return t.jsxs("div",{"data-preview-diff-path":p.filePath,className:T("overflow-hidden rounded-lg border border-[hsl(var(--deck-border))] transition-colors",A&&"border-[hsl(var(--deck-accent)/0.7)] bg-[hsl(var(--deck-accent-soft))] ring-1 ring-[hsl(var(--deck-accent)/0.2)]"),children:[t.jsxs("button",{type:"button","aria-expanded":E,onClick:()=>a(j),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:[E?t.jsx(bt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}):t.jsx(vt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),t.jsx(kt,{className:"h-4 w-4 text-[hsl(var(--deck-ink-muted))]"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-left font-mono text-[13px] text-[hsl(var(--deck-ink))]",children:jt(j)}),p.summary&&t.jsx("span",{className:"shrink-0 font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:p.summary})]}),E&&t.jsxs("div",{className:"border-t border-[hsl(var(--deck-border))]",children:[t.jsx("div",{className:"truncate px-3 py-1 font-mono text-[11px] text-[hsl(var(--deck-ink-faint))]",children:p.filePath}),t.jsx(xr,{diff:p.diff})]})]},j)}),x<m.length&&t.jsx("div",{className:"flex justify-center pt-1",children:t.jsx("button",{type:"button",onClick:()=>h({key:b,count:Math.min(m.length,x+st)}),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:i("preview.diff.showMoreFiles",{count:Math.min(st,m.length-x)})})})]})}function xr({diff:e}){const r=P(),s=o.useMemo(()=>e.patch.split(`
|
|
3
3
|
`),[e.patch]),[a,c]=o.useState({patch:e.patch,count:at}),i=a.patch===e.patch?a.count:at,g=s.slice(0,i);let u=0,b=0;return t.jsxs("div",{className:"overflow-hidden rounded-md border border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-surface))]",children:[t.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:[t.jsx("span",{children:r("preview.diff.patch")}),e.matchLine&&t.jsx("span",{children:r("preview.diff.line",{line:e.matchLine})})]}),t.jsx("div",{className:"overflow-x-auto font-mono text-[12px]",children:g.map((f,h)=>{if(f.startsWith("@@")){const x=/@@ -(?<old>\d+),?(?<oldCount>\d*) \+(?<new>\d+),?(?<newCount>\d*) @@/.exec(f);return x!=null&&x.groups&&(u=Number.parseInt(x.groups.old,10),b=Number.parseInt(x.groups.new,10)),t.jsx(z,{line:f},`${f}-${h}`)}if(f.startsWith("---")||f.startsWith("+++")||f.startsWith("Index:")||f.startsWith("==="))return t.jsx(z,{line:f},`${f}-${h}`);if(f.startsWith("+")){const x=b++;return t.jsx(z,{line:f,oldLine:null,newLine:x},`${f}-${h}`)}if(f.startsWith("-")){const x=u++;return t.jsx(z,{line:f,oldLine:x,newLine:null},`${f}-${h}`)}return f.startsWith(" ")?t.jsx(z,{line:f,oldLine:u++,newLine:b++},`${f}-${h}`):t.jsx(z,{line:f},`${f}-${h}`)})}),i<s.length&&t.jsx("div",{className:"flex justify-center border-t border-[hsl(var(--deck-border))] p-2",children:t.jsx("button",{type:"button",onClick:()=>c({patch:e.patch,count:Math.min(s.length,i+ot)}),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:r("preview.diff.showMoreLines",{count:Math.min(ot,s.length-i)})})})]})}function z({line:e,oldLine:r,newLine:s}){const a=e.startsWith("---")||e.startsWith("+++")||e.startsWith("Index:")||e.startsWith("==="),c=e.startsWith("@@"),i=e[0],g=a||c?e:e.slice(1),u=a?"text-[hsl(var(--deck-ink-muted))]":i==="+"?"bg-[#22C55E]/10 text-[#166534] dark:bg-[#22C55E]/10 dark:text-[#86efac]":i==="-"?"bg-[#EF4444]/10 text-[#b91c1c] dark:bg-[#EF4444]/10 dark:text-[#fca5a5]":c?"bg-[#DBEAFE] text-[#1d4ed8] dark:bg-[#1e3a8a]/30 dark:text-[#93c5fd]":"text-[hsl(var(--deck-ink))]";return t.jsxs("div",{"data-preview-diff-line":!0,className:T("grid min-w-max grid-cols-[40px_40px_1fr] gap-2 px-3 py-0.5",u),children:[t.jsx("span",{className:"text-right text-[hsl(var(--deck-ink-faint))]",children:r?String(r).padStart(2," "):""}),t.jsx("span",{className:"text-right text-[hsl(var(--deck-ink-faint))]",children:s?String(s).padStart(2," "):""}),t.jsx("span",{className:"whitespace-pre",children:g})]})}function br({nodes:e,expandedDirs:r,childrenCache:s,directoryStates:a,selectedPath:c,onToggleDir:i,onRetryDir:g,onSelectFile:u}){return t.jsx(t.Fragment,{children:e.map(b=>t.jsx(Nt,{node:b,depth:0,expandedDirs:r,childrenCache:s,directoryStates:a,selectedPath:c,onToggleDir:i,onRetryDir:g,onSelectFile:u},b.path))})}function Nt({node:e,depth:r,expandedDirs:s,childrenCache:a,directoryStates:c,selectedPath:i,onToggleDir:g,onRetryDir:u,onSelectFile:b}){const f=P(),h=e.type==="dir",x=!!s[e.path],m=!h&&i===e.path,k=a[e.path]??[],d=c[e.path],N=r*14+24;return t.jsxs("div",{children:[t.jsxs("button",{type:"button","aria-expanded":h?x:void 0,"aria-busy":h&&(d==null?void 0:d.status)==="loading",onClick:()=>h?g(e.path):b(e.path),className:T("flex w-full items-center gap-2 rounded-md px-2 py-1 text-left font-mono text-[12px] transition-colors",m?"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))]",h&&"cursor-pointer"),style:{paddingLeft:r*14+8},children:[h?(d==null?void 0:d.status)==="loading"?t.jsx(gt,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"}):x?t.jsx(nr,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink))]"}):t.jsx(sr,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-muted))]"}):t.jsx(kt,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),t.jsx("span",{className:"truncate text-[hsl(var(--deck-ink))]",children:e.name})]}),h&&x&&t.jsxs("div",{children:[(d==null?void 0:d.status)==="loading"&&t.jsx("div",{role:"status",style:{paddingLeft:N},className:"py-1 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:f("preview.files.directoryLoading")}),(d==null?void 0:d.status)==="error"&&t.jsxs("div",{role:"alert",style:{marginLeft:N},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:[t.jsx("div",{className:"truncate",title:d.message,children:d.message}),t.jsxs("button",{type:"button",onClick:()=>u(e.path),className:"mt-1 inline-flex items-center gap-1 font-medium underline-offset-2 hover:underline",children:[t.jsx(ar,{className:"h-2.5 w-2.5"}),f("preview.action.retry")]})]}),(d==null?void 0:d.status)==="loaded"&&k.length===0&&t.jsx("div",{style:{paddingLeft:N},className:"py-1 font-mono text-[10px] text-[hsl(var(--deck-ink-faint))]",children:f("preview.files.directoryEmpty")}),k.map(p=>t.jsx(Nt,{node:p,depth:r+1,expandedDirs:s,childrenCache:a,directoryStates:c,selectedPath:i,onToggleDir:g,onRetryDir:u,onSelectFile:b},p.path))]})]})}const ct=80,lt=80;function vr({logs:e}){var d,N;const r=P(),[s,a]=o.useState(""),[c,i]=o.useState("all"),[g,u]=o.useState({}),b=`${c}\0${s}\0${e.length}\0${((d=e[0])==null?void 0:d.id)??""}\0${((N=e.at(-1))==null?void 0:N.id)??""}`,[f,h]=o.useState({key:b,count:ct}),x=o.useMemo(()=>fr(e,s,c),[c,e,s]),m=f.key===b?f.count:ct,k=x.slice(0,m);return t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"space-y-2 border-b border-[hsl(var(--deck-border))] px-4 py-3",children:[t.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:[t.jsx(Pe,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),t.jsx("input",{type:"search","aria-label":r("preview.logs.searchAria"),placeholder:r("preview.logs.searchPlaceholder"),value:s,onChange:p=>a(p.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))]"}),t.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-[hsl(var(--deck-ink-faint))]",children:[x.length,"/",e.length]})]}),t.jsx("div",{className:"flex items-center gap-1","aria-label":r("preview.logs.filterAria"),children:["all","running","error","success"].map(p=>t.jsx("button",{type:"button","aria-pressed":c===p,onClick:()=>i(p),className:T("rounded-md border px-2 py-1 font-mono text-[9.5px] transition-colors",c===p?"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:r(`preview.logs.filter.${p}`)},p))})]}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-4",children:[e.length===0?t.jsx(dt,{title:r("preview.logs.emptyTitle"),subtitle:r("preview.logs.emptyHint")}):x.length===0?t.jsx(dt,{title:r("preview.logs.noMatches"),subtitle:r("preview.logs.noMatchesHint")}):k.map(p=>{var W;const j=g[p.id],S=(p.content||"").split(`
|
|
4
4
|
`),E=S.length>10||(((W=p.content)==null?void 0:W.length)||0)>800,A=j||!E?S:S.slice(0,8);return t.jsxs("div",{"data-preview-log-id":p.id,className:"overflow-hidden rounded-lg border border-[hsl(var(--deck-border))]",children:[t.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:[t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("div",{className:"font-mono text-[12px] text-[hsl(var(--deck-ink))]",children:p.title}),p.subtitle&&t.jsx("div",{className:"font-mono text-[11px] text-[hsl(var(--deck-ink-muted))]",children:p.subtitle})]}),t.jsx(kr,{status:p.status})]}),p.content&&t.jsxs("div",{className:"space-y-2 px-3 py-3",children:[t.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:[A.join(`
|
|
5
5
|
`),!j&&E&&`
|
|
6
6
|
…`]}),E&&t.jsxs("button",{type:"button",onClick:()=>u(H=>({...H,[p.id]:!H[p.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:[j?t.jsx(bt,{className:"h-3 w-3"}):t.jsx(vt,{className:"h-3 w-3"}),r(j?"preview.logs.collapse":"preview.logs.expand")]})]})]},p.id)}),m<x.length&&t.jsx("div",{className:"flex justify-center",children:t.jsx("button",{type:"button",onClick:()=>h({key:b,count:Math.min(x.length,m+lt)}),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:r("preview.logs.showMore",{count:Math.min(lt,x.length-m)})})})]})]})}function dt({title:e,subtitle:r}){return t.jsxs("div",{className:"rounded-lg border border-dashed border-[hsl(var(--deck-border))] p-6 text-center",children:[t.jsx("div",{className:"font-mono text-[13px] text-[hsl(var(--deck-ink))]",children:e}),t.jsx("div",{className:"mt-1 font-mono text-[12px] text-[hsl(var(--deck-ink-muted))]",children:r})]})}function kr({status:e}){const r=P(),s=r(e==="success"?"preview.logs.status.success":e==="error"?"preview.logs.status.error":"preview.logs.status.running"),a=e==="success"?"bg-[#22C55E] text-white":e==="error"?"bg-[#FEE2E2] text-[#b91c1c] dark:bg-[#EF4444]/20 dark:text-[#fca5a5]":"bg-[hsl(var(--deck-surface))] text-[hsl(var(--deck-ink-muted))]";return t.jsx("span",{className:T("rounded-full px-2 py-0.5 font-mono text-[11px]",a),children:s})}const gr=640,Ct=360,Re=960;function ut(e){const r=typeof window>"u"?Re:Math.max(280,Math.floor(window.innerWidth*.72));return Math.min(Re,r,Math.max(Ct,Math.round(e)))}function St(e,r,s){var a;if(e){const c=(a=s==null?void 0:s.taskDelivery)==null?void 0:a.status;return(s==null?void 0:s.taskIsolation)==="worktree"&&s.taskSourceProjectPath&&(c==="applied"||c==="discarded")?{sessionId:e.sessionId,projectPath:s.taskSourceProjectPath}:e}return r?{sessionId:`project:${r}`,projectPath:r}:null}function Ie(){const e=B.getState(),r=e.sessions.find(s=>V({sessionId:s.sessionId,projectPath:s.projectPath},e.currentSessionRef));return St(e.currentSessionRef,e.selectedProjectPath,r)}function ft(e,r){const s=i=>i.replace(/\\/g,"/").replace(/^\.?\//,"").replace(/\/+/g,"/"),a=s(e),c=s(r);return a===c||a.endsWith(`/${c}`)||c.endsWith(`/${a}`)}const yr=o.lazy(async()=>({default:(await er(()=>import("./index-DI8ZWdWH.js"),__vite__mapDeps([0,1]))).Editor}));function ae(e,r){return e instanceof Error?e.message:r}function Lr({returnFocusElement:e}={}){var Ye,Ze;const r=P(),{toggleFilePreview:s,previewWidth:a,setPreviewWidth:c,previewTab:i,setPreviewTab:g,previewTargetPath:u,previewRequestId:b}=et(),f=B(n=>n.messages),h=B(n=>n.currentSessionRef),x=B(n=>n.sessions),m=B(n=>n.selectedProjectPath),k=o.useMemo(()=>x.find(n=>V({sessionId:n.sessionId,projectPath:n.projectPath},h)),[h,x]),d=o.useMemo(()=>St(h,m,k),[k,h,m]),[N,p]=o.useState(i),[j,S]=o.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 1023px)").matches),[E,A]=o.useState(null),[W,H]=o.useState(!1),[ie,ce]=o.useState([]),[Et,Ae]=o.useState({}),[Dt,We]=o.useState({}),[Tt,Ft]=o.useState(0),[K,le]=o.useState(!1),[U,de]=o.useState(null),[$,ue]=o.useState(""),[J,Q]=o.useState([]),[$e,X]=o.useState(!1),[Lt,Y]=o.useState(!1),[It,Rt]=o.useState(0),[fe,Z]=o.useState(0),[Pt,he]=o.useState({}),[At,ee]=o.useState({}),[F,_e]=o.useState(null),[Wt,pe]=o.useState(""),[me,xe]=o.useState(!1),[be,ve]=o.useState(null),[qe,ke]=o.useState(!1),Me=o.useRef(d),_=o.useRef(0),te=o.useRef(0),q=o.useRef({}),ge=o.useRef(0),re=o.useRef(0),M=o.useRef(0),L=o.useRef({}),ne=o.useRef({}),ye=o.useRef({}),we=o.useRef(null),je=o.useRef(null),ze=o.useRef(null),Be=o.useRef(null),Ne=o.useRef(a),Ge=o.useRef(h);o.useLayoutEffect(()=>{V(Me.current,d)||(_.current+=1),Me.current=d},[d]),o.useEffect(()=>{if(typeof window.matchMedia!="function")return;const n=window.matchMedia("(max-width: 1023px)"),l=()=>S(n.matches);return l(),n.addEventListener("change",l),()=>n.removeEventListener("change",l)},[]),o.useEffect(()=>(Be.current=e??(document.activeElement instanceof HTMLElement?document.activeElement:null),()=>{const n=Be.current;requestAnimationFrame(()=>{n!=null&&n.isConnected&&n.focus({preventScroll:!0})})}),[e]),o.useEffect(()=>{var n;j&&((n=ze.current)==null||n.focus({preventScroll:!0}))},[j]);const $t=n=>{var C;if(!j)return;if(n.key==="Escape"){n.preventDefault(),s();return}if(n.key!=="Tab")return;const l=Array.from(((C=je.current)==null?void 0:C.querySelectorAll('button:not([disabled]), input:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))??[]).filter(w=>!w.hasAttribute("hidden"));if(l.length===0)return;const y=l[0],v=l[l.length-1];n.shiftKey&&document.activeElement===y?(n.preventDefault(),v==null||v.focus()):!n.shiftKey&&document.activeElement===v&&(n.preventDefault(),y==null||y.focus())},O=(n,l)=>l===_.current&&V(Ie(),n),He=async(n,l="")=>{const y=l?`/suggestions/files/tree?path=${encodeURIComponent(l)}`:"/suggestions/files/tree",v=await fetch(y,{headers:Te(n)});if(!v.ok)throw new Error(r("preview.files.treeFailed"));return(await v.json()).map(w=>({...w,children:w.type==="dir"?[]:void 0}))};o.useEffect(()=>{const n=++te.current;return(async()=>{if(!d){ce([]),le(!1),de(null);return}const y={...d},v=_.current,C=()=>n===te.current&&O(y,v);if(C()){ce([]),le(!0),de(null);try{const w=await He(y);C()&&ce(w)}catch(w){C()&&de(ae(w,r("preview.files.treeFailed")))}finally{C()&&le(!1)}}})(),()=>{te.current===n&&(te.current+=1)}},[Tt,d==null?void 0:d.projectPath,d==null?void 0:d.sessionId]),o.useEffect(()=>{we.current=null,L.current={},ne.current={},ye.current={},q.current={},ge.current+=1,_e(null),pe(""),xe(!1),ve(null),ke(!1),he({}),Ae({}),We({}),ue(""),Q([]),X(!1),Y(!1),Z(0),ee({})},[d==null?void 0:d.projectPath,d==null?void 0:d.sessionId]);const _t=o.useMemo(()=>jr(f),[f]),[qt,Oe]=o.useState(null),[Mt,Ce]=o.useState(!1),[Ve,Ke]=o.useState(null),[zt,Bt]=o.useState(0),Se=(k==null?void 0:k.taskIsolation)==="worktree"&&((Ye=k.taskDelivery)==null?void 0:Ye.status)==="discarded",Ue=(k==null?void 0:k.taskIsolation)==="worktree"&&!!k.taskDiffStat&&!Se,Je=Ue&&!!(k!=null&&k.taskDiffStat&&k.taskDiffStat.changedFiles>0),I=Se?[]:Ue?qt??[]:_t,Gt=o.useMemo(()=>wr(f),[f]);o.useEffect(()=>{const n=$.trim(),l=++re.current;if(Z(0),Y(!1),!n||N!=="files"||!d){Q([]),X(!1);return}const y={...d},v=_.current;X(!0);const C=window.setTimeout(()=>{fetch(`/suggestions/files?q=${encodeURIComponent(n)}&limit=100&type=file`,{headers:Te(y)}).then(async w=>{if(!w.ok)throw new Error(r("preview.files.searchFailed"));return await w.json()}).then(w=>{l===re.current&&O(y,v)&&(Q(w.filter(D=>!D.endsWith("/"))),Y(!1))}).catch(()=>{l===re.current&&O(y,v)&&(Q([]),Y(!0))}).finally(()=>{l===re.current&&X(!1)})},160);return()=>window.clearTimeout(C)},[N,$,It,d==null?void 0:d.projectPath,d==null?void 0:d.sessionId]),o.useEffect(()=>{p(et.getState().previewTab)},[b]),o.useEffect(()=>{const n=Ge.current;Ge.current=h,!h&&m&&(n||N!=="files")&&(p("files"),g("files"))},[N,h==null?void 0:h.projectPath,h==null?void 0:h.sessionId,m,g]),o.useEffect(()=>{var y;if(!u||N!=="diff")return;const n=(y=I.find(v=>v.filePath&&ft(v.filePath,u)))==null?void 0:y.filePath;if(!n)return;ee(v=>({...v,[n]:!0}));const l=requestAnimationFrame(()=>{var C,w;const v=Array.from(((C=je.current)==null?void 0:C.querySelectorAll("[data-preview-diff-path]"))??[]).find(D=>ft(D.dataset.previewDiffPath??"",u));typeof(v==null?void 0:v.scrollIntoView)=="function"&&v.scrollIntoView({block:"nearest",behavior:"smooth"}),(w=v==null?void 0:v.querySelector("button"))==null||w.focus({preventScroll:!0})});return()=>cancelAnimationFrame(l)},[N,I,b,u]),o.useEffect(()=>{const n=++M.current;if(Oe(null),Ke(null),Ce(!1),!h||!Je)return;const l={...h};return Ce(!0),Xt.getTaskDiff(l).then(y=>{n!==M.current||!V(B.getState().currentSessionRef,l)||Oe(y.files.map(v=>({filePath:v.path,diff:{patch:v.patch},summary:v.binary?"binary":`+${v.additions} -${v.deletions}${v.truncated?" (truncated)":""}`})))}).catch(y=>{n===M.current&&Ke(ae(y,r("preview.diff.failedTitle")))}).finally(()=>{n===M.current&&Ce(!1)}),()=>{M.current===n&&(M.current+=1)}},[k==null?void 0:k.taskCompletedAt,(Ze=k==null?void 0:k.taskDelivery)==null?void 0:Ze.status,k==null?void 0:k.taskDiffStat,k==null?void 0:k.taskIsolation,h,Je,zt]);const Ht=n=>{ee(l=>({...l,[n]:!l[n]}))},Ot=n=>{ee(Object.fromEntries(I.map(l=>[l.filePath||"unknown",n])))},se=async n=>{const l=Ie();if(!l)return;const y=_.current,v=++ge.current,C=()=>v===ge.current&&we.current===n&&O(l,y);we.current=n,_e(n),pe(""),xe(!0),ve(null),ke(!1);try{const w=await fetch(`/suggestions/files/content?path=${encodeURIComponent(n)}`,{headers:Te(l)});if(!w.ok)throw new Error(r("preview.files.contentFailed"));const D=await w.json();C()&&(pe(D.content||""),ke(!!D.truncated))}catch(w){C()&&ve(ae(w,r("preview.files.contentFailed")))}finally{C()&&xe(!1)}},Vt=n=>{if(n.key==="ArrowDown"||n.key==="ArrowUp"){n.preventDefault(),Z(l=>pr(l,J.length,n.key==="ArrowDown"?1:-1));return}if(n.key==="Enter"){const l=J[fe];if(!l)return;n.preventDefault(),se(l);return}n.key==="Escape"&&(n.preventDefault(),ue(""))},Ee=(n,l)=>{const y={...ye.current,[n]:l};ye.current=y,We(y)},Qe=async n=>{const l=(q.current[n]??0)+1;q.current[n]=l,Ee(n,{status:"loading"});const y=Ie();if(!y)return;const v=_.current,C=()=>q.current[n]===l&&L.current[n]===!0&&O(y,v);try{const w=await He(y,n);if(C()){const D={...ne.current,[n]:w};ne.current=D,Ae(D),Ee(n,{status:"loaded"})}}catch(w){C()&&Ee(n,{status:"error",message:ae(w,r("preview.files.treeFailed"))})}},Kt=n=>{const l=!L.current[n],y={...L.current,[n]:l};if(L.current=y,he(y),!l){q.current[n]=(q.current[n]??0)+1;return}ne.current[n]||Qe(n)},Ut=n=>{if(!L.current[n]){const l={...L.current,[n]:!0};L.current=l,he(l)}Qe(n)},Jt=n=>{n.preventDefault(),n.currentTarget.setPointerCapture(n.pointerId),Ne.current=a,H(!0),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},Qt=n=>{if(!W)return;const l=ut(window.innerWidth-n.clientX);Ne.current=l,A(l)},Xe=n=>{W&&(n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),H(!1),A(null),c(Ne.current),document.body.style.cursor="",document.body.style.userSelect="")};o.useEffect(()=>()=>{document.body.style.cursor="",document.body.style.userSelect=""},[]);const De=ut(E??a);return t.jsxs("div",{ref:je,"data-testid":"file-preview",role:j?"dialog":"complementary","aria-modal":j||void 0,"aria-label":r("preview.title"),onKeyDown:$t,style:{width:De,maxWidth:"72vw"},className:"relative flex h-full min-w-[360px] shrink-0 flex-col border-l border-[hsl(var(--deck-border))] bg-[hsl(var(--deck-canvas))] shadow-xl 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",children:[t.jsx("div",{role:"separator","aria-label":r("preview.action.resize"),"aria-orientation":"vertical","aria-valuemin":Ct,"aria-valuemax":Re,"aria-valuenow":De,"aria-hidden":j||void 0,tabIndex:j?-1:0,onPointerDown:Jt,onPointerMove:Qt,onPointerUp:Xe,onPointerCancel:Xe,onDoubleClick:()=>c(gr),onKeyDown:n=>{n.key!=="ArrowLeft"&&n.key!=="ArrowRight"||(n.preventDefault(),c(De+(n.key==="ArrowLeft"?24:-24)))},className:T("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))]",W&&"after:bg-[hsl(var(--deck-accent))]")}),t.jsxs("div",{className:"flex items-center justify-between px-4 h-12 border-b border-[hsl(var(--deck-border))] shrink-0",children:[t.jsx("span",{className:"font-normal text-[13px] text-[hsl(var(--deck-ink-muted))] font-mono",children:r("preview.title")}),t.jsx(Yt,{ref:ze,variant:"ghost",size:"icon",onClick:s,"aria-label":r("preview.action.close"),title:r("preview.action.close"),className:"h-8 w-8 text-[hsl(var(--deck-ink-faint))] hover:text-[hsl(var(--deck-ink))] hover:bg-[hsl(var(--deck-surface))]",children:t.jsx(or,{className:"w-4 h-4"})})]}),t.jsxs(ir,{value:N,onValueChange:n=>{const l=n;p(l),g(l)},className:"flex flex-col flex-1 min-h-0",children:[t.jsx("div",{className:"px-4 py-3 border-b border-[hsl(var(--deck-border))]",children:t.jsxs(cr,{className:"bg-[hsl(var(--deck-surface))] border border-[hsl(var(--deck-border))] h-9 p-1 rounded-md w-full justify-start",children:[t.jsx(Fe,{value:"diff",className:"text-[12px] font-mono px-3 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")}),t.jsx(Fe,{value:"files",className:"text-[12px] font-mono px-3 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")}),t.jsx(Fe,{value:"logs",className:"text-[12px] font-mono px-3 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")})]})}),t.jsx(Le,{value:"diff",className:"overflow-hidden flex-1 mt-0",children:t.jsx("div",{className:"overflow-y-auto px-4 py-4 space-y-3 h-full",children:Se?t.jsx(R,{title:r("preview.diff.discardedTitle"),subtitle:r("preview.diff.discardedHint"),role:"status"}):Mt&&I.length===0?t.jsx(R,{title:r("preview.diff.loadingTitle"),subtitle:r("preview.diff.loadingHint")}):Ve&&I.length===0?t.jsx(R,{title:r("preview.diff.failedTitle"),subtitle:Ve,actionLabel:r("preview.action.retry"),onAction:()=>Bt(n=>n+1),role:"alert"}):I.length===0?t.jsx(R,{title:r("preview.diff.emptyTitle"),subtitle:r("preview.diff.emptyHint")}):t.jsx(mr,{diffs:I,expanded:At,targetPath:u,onToggle:Ht,onSetAllExpanded:Ot})})}),t.jsx(Le,{value:"files",className:"overflow-hidden flex-1 mt-0",children:t.jsxs("div",{className:"px-4 py-4 h-full",children:[K&&t.jsx(R,{title:r("preview.files.loadingTitle"),subtitle:r("preview.files.loadingHint")}),!K&&U&&t.jsx(R,{title:r("preview.files.failedTitle"),subtitle:U,actionLabel:r("preview.action.retry"),onAction:()=>Ft(n=>n+1),role:"alert"}),!K&&!U&&ie.length===0&&t.jsx(R,{title:r("preview.files.emptyTitle"),subtitle:r("preview.files.emptyHint")}),!K&&!U&&ie.length>0&&t.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:[t.jsxs("div",{className:"flex min-h-0 flex-col overflow-hidden rounded-lg border border-[hsl(var(--deck-border))]",children:[t.jsx("div",{className:"border-b border-[hsl(var(--deck-border))] p-2",children:t.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:[t.jsx(Pe,{className:"h-3.5 w-3.5 shrink-0 text-[hsl(var(--deck-ink-faint))]"}),t.jsx("input",{type:"search","aria-label":r("preview.files.searchAria"),placeholder:r("preview.files.searchPlaceholder"),value:$,onChange:n=>ue(n.target.value),onKeyDown:Vt,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&&t.jsx(gt,{className:"h-3 w-3 shrink-0 animate-spin text-[hsl(var(--deck-accent))]"})]})}),t.jsx("div",{role:$?"listbox":void 0,"aria-label":$?r("preview.files.searchResultsAria"):void 0,className:"min-h-0 flex-1 overflow-y-auto p-2",children:$?Lt?t.jsxs("div",{role:"alert",className:"px-2 py-5 text-center font-mono text-[10.5px] text-red-700 dark:text-red-300",children:[t.jsx("div",{children:r("preview.files.searchFailed")}),t.jsx("button",{type:"button",onClick:()=>Rt(n=>n+1),className:"mt-1 underline underline-offset-2",children:r("preview.action.retry")})]}):J.length>0?J.map((n,l)=>t.jsxs("button",{type:"button",role:"option","aria-selected":l===fe,"data-preview-file-result":l,onMouseEnter:()=>Z(l),onClick:()=>void se(n),className:T("mb-0.5 flex w-full min-w-0 flex-col rounded-md px-2 py-1.5 text-left font-mono transition-colors",l===fe?"bg-[hsl(var(--deck-accent-soft))] text-[hsl(var(--deck-ink))]":"text-[hsl(var(--deck-ink-muted))] hover:bg-[hsl(var(--deck-surface))]"),children:[t.jsx("span",{className:"truncate text-[11.5px]",children:jt(n)}),t.jsx("span",{className:"truncate text-[9px] text-[hsl(var(--deck-ink-faint))]",children:n})]},n)):!$e&&t.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")}):t.jsx(br,{nodes:ie,expandedDirs:Pt,childrenCache:Et,directoryStates:Dt,selectedPath:F,onToggleDir:Kt,onRetryDir:Ut,onSelectFile:se})})]}),t.jsxs("div",{className:"border border-[hsl(var(--deck-border))] rounded-lg overflow-hidden flex flex-col min-h-0",children:[t.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:[t.jsx("span",{className:"min-w-0 truncate",children:F||r("preview.files.selectTitle")}),F&&t.jsx("span",{className:"ml-2 shrink-0 text-[11px] text-[hsl(var(--deck-ink-faint))] font-mono",children:r(me?"preview.files.status.loading":qe?"preview.files.status.truncated":"preview.files.status.ready")})]}),qe&&!me&&t.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")}),t.jsxs("div",{className:"flex-1 min-h-0",children:[!F&&t.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")}),F&&be&&t.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:[t.jsx("span",{children:be}),t.jsx("button",{type:"button",onClick:()=>void se(F),className:"underline underline-offset-2",children:r("preview.action.retry")})]}),F&&!be&&t.jsx("div",{className:"h-full",children:me?t.jsx(xt,{}):t.jsx(o.Suspense,{fallback:t.jsx(xt,{}),children:t.jsx(Nr,{content:Wt,filename:F})})})]})]})]})]})}),t.jsx(Le,{value:"logs",className:"overflow-hidden flex-1 mt-0",children:t.jsx(vr,{logs:Gt})})]})]})}function R({title:e,subtitle:r,actionLabel:s,onAction:a,role:c}){return t.jsxs("div",{role:c,className:"border border-dashed border-[hsl(var(--deck-border))] rounded-lg p-6 text-center",children:[t.jsx("div",{className:"text-[13px] text-[hsl(var(--deck-ink))] font-mono",children:e}),t.jsx("div",{className:"text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono mt-1",children:r}),s&&a&&t.jsx("button",{type:"button",onClick:a,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:s})]})}function wr(e){return e.flatMap(r=>{var c,i,g;const s=[];if((c=r.agentContent)!=null&&c.toolCalls)for(const u of r.agentContent.toolCalls){const b=mt(u.arguments),f=u.output,h=f?(i=G(f))!=null&&i.diff?pt(f):f:void 0;s.push({id:`${r.id}-${u.toolCallId}`,title:u.toolName||"Tool",subtitle:u.summary,status:u.status==="success"?"success":u.status==="error"?"error":"running",content:h||(b?`Arguments:
|
|
7
7
|
${b}`:void 0),timestamp:r.timestamp})}const a=r.metadata;if(a){if(a.kind==="tool_call"){const u=a.toolName||"Tool",b=mt(a.arguments);s.push({id:r.id,title:`Tool Call · ${u}`,subtitle:a.toolKind?String(a.toolKind):void 0,status:a.status==="success"?"success":a.status==="error"?"error":"running",content:b?`Arguments:
|
|
8
|
-
${b}`:void 0,timestamp:r.timestamp})}if(a.kind==="tool_result"){const u=a.toolName||"Tool",b=a.success,f=a.summary,h=a.output,x=h?(g=G(h))!=null&&g.diff?pt(h):h:void 0;s.push({id:r.id,title:`Tool Result · ${u}`,subtitle:f,status:b===void 0?"running":b?"success":"error",content:x,timestamp:r.timestamp})}}return s})}function jr(e){var a;const r=[],s=new Set;for(let c=e.length-1;c>=0;c-=1){const i=e[c];if((a=i.agentContent)!=null&&a.toolCalls)for(let h=i.agentContent.toolCalls.length-1;h>=0;h-=1){const x=i.agentContent.toolCalls[h],m=x.metadata;if((m==null?void 0:m.kind)==="patch"&&Array.isArray(m.changes)){ht(r,s,m.changes,x.summary);continue}const k=x.output||"",d=G(k)||G((m==null?void 0:m.diff_snippet)||"");if(d!=null&&d.diff){const N=(m==null?void 0:m.file_path)||x.toolName||"unknown";if(!s.has(N)){s.add(N);const p=typeof(m==null?void 0:m.oldContent)=="string"?m.oldContent:void 0,j=typeof(m==null?void 0:m.newContent)=="string"?m.newContent:void 0;r.push({diff:d.diff,filePath:N,summary:x.summary,oldContent:p,newContent:j})}}}const g=i.metadata;if(!g||g.kind!=="tool_result")continue;const u=g.metadata;if((u==null?void 0:u.kind)==="patch"&&Array.isArray(u.changes)){ht(r,s,u.changes,g.summary);continue}const b=g.output||(typeof i.content=="string"?i.content:"")||"",f=G(b)||G((u==null?void 0:u.diff_snippet)||"");if(f!=null&&f.diff){const h=(u==null?void 0:u.file_path)||g.toolName||"unknown";if(!s.has(h)){s.add(h);const x=typeof(u==null?void 0:u.oldContent)=="string"?u.oldContent:void 0,m=typeof(u==null?void 0:u.newContent)=="string"?u.newContent:void 0;r.push({diff:f.diff,filePath:h,summary:g.summary,oldContent:x,newContent:m})}}}return r.reverse()}function ht(e,r,s,a){for(let c=s.length-1;c>=0;c--){const i=s[c];!i||typeof i!="object"||!("path"in i)||typeof i.path!="string"||!("diff"in i)||typeof i.diff!="string"||r.has(i.path)||(r.add(i.path),e.push({diff:{patch:i.diff,startLine:1,matchLine:1},filePath:i.path,summary:a,oldContent:"oldContent"in i&&typeof i.oldContent=="string"?i.oldContent:void 0,newContent:"newContent"in i&&typeof i.newContent=="string"?i.newContent:void 0}))}}function G(e){if(!e)return null;const r=/<<<DIFF>>>\s*([\s\S]*?)\s*<<<\/DIFF>>>/m,s=e.match(r);if(!s)return null;try{return{diff:JSON.parse(s[1])}}catch{return null}}function pt(e){return e?e.replace(/<<<DIFF>>>[\s\S]*?<<<\/DIFF>>>/m,"").trim():""}function mt(e){if(!e)return"";if(typeof e=="string")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return JSON.stringify(e,null,2)}function xt(){const e=P();return t.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:e("preview.files.editorLoading")})}function Nr({content:e,filename:r}){const{
|
|
8
|
+
${b}`:void 0,timestamp:r.timestamp})}if(a.kind==="tool_result"){const u=a.toolName||"Tool",b=a.success,f=a.summary,h=a.output,x=h?(g=G(h))!=null&&g.diff?pt(h):h:void 0;s.push({id:r.id,title:`Tool Result · ${u}`,subtitle:f,status:b===void 0?"running":b?"success":"error",content:x,timestamp:r.timestamp})}}return s})}function jr(e){var a;const r=[],s=new Set;for(let c=e.length-1;c>=0;c-=1){const i=e[c];if((a=i.agentContent)!=null&&a.toolCalls)for(let h=i.agentContent.toolCalls.length-1;h>=0;h-=1){const x=i.agentContent.toolCalls[h],m=x.metadata;if((m==null?void 0:m.kind)==="patch"&&Array.isArray(m.changes)){ht(r,s,m.changes,x.summary);continue}const k=x.output||"",d=G(k)||G((m==null?void 0:m.diff_snippet)||"");if(d!=null&&d.diff){const N=(m==null?void 0:m.file_path)||x.toolName||"unknown";if(!s.has(N)){s.add(N);const p=typeof(m==null?void 0:m.oldContent)=="string"?m.oldContent:void 0,j=typeof(m==null?void 0:m.newContent)=="string"?m.newContent:void 0;r.push({diff:d.diff,filePath:N,summary:x.summary,oldContent:p,newContent:j})}}}const g=i.metadata;if(!g||g.kind!=="tool_result")continue;const u=g.metadata;if((u==null?void 0:u.kind)==="patch"&&Array.isArray(u.changes)){ht(r,s,u.changes,g.summary);continue}const b=g.output||(typeof i.content=="string"?i.content:"")||"",f=G(b)||G((u==null?void 0:u.diff_snippet)||"");if(f!=null&&f.diff){const h=(u==null?void 0:u.file_path)||g.toolName||"unknown";if(!s.has(h)){s.add(h);const x=typeof(u==null?void 0:u.oldContent)=="string"?u.oldContent:void 0,m=typeof(u==null?void 0:u.newContent)=="string"?u.newContent:void 0;r.push({diff:f.diff,filePath:h,summary:g.summary,oldContent:x,newContent:m})}}}return r.reverse()}function ht(e,r,s,a){for(let c=s.length-1;c>=0;c--){const i=s[c];!i||typeof i!="object"||!("path"in i)||typeof i.path!="string"||!("diff"in i)||typeof i.diff!="string"||r.has(i.path)||(r.add(i.path),e.push({diff:{patch:i.diff,startLine:1,matchLine:1},filePath:i.path,summary:a,oldContent:"oldContent"in i&&typeof i.oldContent=="string"?i.oldContent:void 0,newContent:"newContent"in i&&typeof i.newContent=="string"?i.newContent:void 0}))}}function G(e){if(!e)return null;const r=/<<<DIFF>>>\s*([\s\S]*?)\s*<<<\/DIFF>>>/m,s=e.match(r);if(!s)return null;try{return{diff:JSON.parse(s[1])}}catch{return null}}function pt(e){return e?e.replace(/<<<DIFF>>>[\s\S]*?<<<\/DIFF>>>/m,"").trim():""}function mt(e){if(!e)return"";if(typeof e=="string")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return JSON.stringify(e,null,2)}function xt(){const e=P();return t.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[hsl(var(--deck-ink-muted))] font-mono",children:e("preview.files.editorLoading")})}function Nr({content:e,filename:r}){const{codeTheme:s}=Zt(),a=o.useRef(null),[c,i]=o.useState("vs-dark"),g=Cr(r),u=b=>{a.current=b;const f=rt(b,s);i(f)};return o.useEffect(()=>{if(a.current){const b=rt(a.current,s);i(b)}},[s]),t.jsx(yr,{value:e,language:g,theme:c,height:"100%",beforeMount:u,options:{readOnly:!0,minimap:{enabled:!1},fontSize:12,lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0}},r)}function Cr(e){var a;const r=((a=e.split(".").pop())==null?void 0:a.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"}[r]||"plaintext"}export{Lr as FilePreview};
|